home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / viewobject.tcl < prev    next >
Encoding:
Text File  |  1996-06-12  |  2.7 KB  |  116 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cadre Technologies Inc.    1996
  4. #
  5. #      File:           @(#)viewobject.tcl    /main/3
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)viewobject.tcl    /main/3   12 Jun 1996 Copyright 1996 Cadre Technologies Inc.
  10.  
  11. # Start user added include file section
  12. require "custsort.tcl"
  13. # End user added include file section
  14.  
  15. require "custbrowso.tcl"
  16.  
  17. Class ViewObject : {CustBrowsObject BrowsObject} {
  18.     method destructor
  19.     constructor
  20.     method updateView
  21.     method infoList
  22.     method validEnvironment
  23.     method open
  24.     attribute repositoryType
  25.     attribute browserType
  26.     attribute redefined
  27. }
  28.  
  29. method ViewObject::destructor {this} {
  30.     # Start destructor user section
  31.     # End destructor user section
  32.     $this CustBrowsObject::destructor
  33. }
  34.  
  35. constructor ViewObject {class this name specification} {
  36.     set this [BrowsObject::constructor $class $this $name]
  37.     set this [CustBrowsObject::constructor $class $this $name]
  38.  
  39.     $this smallIcon folder_16
  40.     $this largeIcon folder_32
  41.     $this activated {%this open}
  42.  
  43.     while {![lempty $specification]} {
  44.         set key [lvarpop specification]
  45.         $this $key [lvarpop specification]
  46.     }
  47.  
  48.     set specification [$this objSpec]
  49.     #give the name of the object the name of the view
  50.     $this displayName [$this name]
  51.     #type is always ViewObject
  52.     $this type ViewObject
  53.  
  54.     return $this
  55. }
  56.  
  57. method ViewObject::updateView {this} {
  58.  
  59.     if [$this editable] {
  60.         set level "[$this specLevel] *"
  61.     } else {
  62.         set level [$this specLevel]
  63.     }
  64.  
  65.     $this label [$this repositoryType]
  66.     $this details  "\"[$this browserType]\"
  67.               \"[$this _displayName]\"
  68.             \"$level\"
  69.                 \"[$this scope]\""
  70. }
  71.  
  72. method ViewObject::infoList {this} {
  73.  
  74.     set list [$this CustBrowsObject::infoList]
  75.     set list [concat $list repositoryType]
  76.         set list [concat $list [$this repositoryType]]
  77.     set list [concat $list browserType]
  78.         set list [concat $list [$this browserType]]
  79.  
  80.     return $list
  81. }
  82.  
  83. method ViewObject::validEnvironment {this curPath} {
  84.  
  85.     set objScope [$this scope]
  86.  
  87.     # extract corporate 
  88.     set curPathLen [expr {[llength $curPath]-1}]
  89.  
  90.     if {$curPathLen != [llength $objScope]} {
  91.         return 0
  92.     }
  93.  
  94.     return [$this validScope $curPath]
  95. }
  96.  
  97. method ViewObject::open {this} {
  98.  
  99.     if {![$this editable]} {
  100.         return
  101.     }
  102.  
  103.     .main busy TRUE
  104.     set definer [[.main editorArea] viewDefiner]
  105.  
  106.     if {[catch {$definer load $this}]} {
  107.         set definer [ViewDefineDialog new .main.viewDefiner]
  108.         [.main editorArea] viewDefiner $definer
  109.         $definer load $this
  110.     }
  111.     .main busy FALSE
  112. }
  113.  
  114. # Do not delete this line -- regeneration end marker
  115.  
  116.