home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / opendefeda.tcl < prev    next >
Text File  |  1996-08-29  |  5KB  |  187 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cadre Technologies Inc.    1996
  4. #
  5. #      File:           @(#)opendefeda.tcl    /main/hindenburg/1
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)opendefeda.tcl    /main/hindenburg/1   29 Aug 1996 Copyright 1996 Cadre Technologies Inc.
  10.  
  11. # Start user added include file section
  12.  
  13. require "searchstgd.tcl"
  14. require "crfilestgd.tcl"
  15. require "crsysstgde.tcl"
  16. require "userstgdef.tcl"
  17. require "groupstgde.tcl"
  18.  
  19. global stgAbbr
  20.  
  21. set stgAbbr(search)            Search
  22. set stgAbbr(createFile)            CrFile
  23. set stgAbbr(createSystemAndFile)    CrSys
  24. set stgAbbr(userDefined)        User
  25. set stgAbbr(group)            Group
  26.  
  27. # End user added include file section
  28.  
  29. require "custdefsar.tcl"
  30.  
  31. Class OpenDefEdArea : {CustDefsArea} {
  32.     constructor
  33.     method destructor
  34.     method read
  35.     method deleteObjects
  36.     method newObject
  37.     method createSearch
  38.     method createCrFile
  39.     method createCrSys
  40.     method createUser
  41.     method createGroup
  42.     method createObject
  43.     method clearArea
  44.     method getStrategy
  45.     method setStrategy
  46.     method removeStrategy
  47.     attribute searchDefiner
  48.     attribute crFileDefiner
  49.     attribute crSysDefiner
  50.     attribute userDefiner
  51.     attribute groupDefiner
  52.     attribute strategy
  53. }
  54.  
  55. constructor OpenDefEdArea {class this name} {
  56.     set this [CustDefsArea::constructor $class $this $name]
  57.     $this strategy [Dictionary new]
  58.     # Start constructor user section
  59.     $this rowCount 12
  60.     $this columnCount 65
  61.     $this font "[m4_var get M4_font -context uce]"
  62.     $this destinationSet "OPENSTGDEF dropEvent"
  63.     $this mode DETAIL
  64.     BrowsHeader new $this.name  -label Strategy -width 25
  65.     BrowsHeader new $this.type  -label Type     -width 20
  66.     BrowsHeader new $this.level -label Level    -width 15
  67.     # End constructor user section
  68.     return $this
  69. }
  70.  
  71. method OpenDefEdArea::destructor {this} {
  72.     # Start destructor user section
  73.     # End destructor user section
  74.     $this CustDefsArea::destructor
  75. }
  76.  
  77. method OpenDefEdArea::read {this object type} {
  78.     global stgAbbr
  79.     set defFileName [$this _curName]
  80.     set defFileType [$this _curType]
  81.     foreach defLine [$this readConfig $object $defFileName $defFileType] {
  82.         $this create$stgAbbr([lindex $defLine 1]) $defLine $type
  83.     }
  84. }
  85.  
  86. method OpenDefEdArea::deleteObjects {this objs} {
  87.     foreach stg $objs {
  88.         $this removeStrategy [$stg name]
  89.     }
  90.     $this CustDefsArea::deleteObjects $objs
  91. }
  92.  
  93. method OpenDefEdArea::newObject {this type name {edit 0}} {
  94.     $this isChanged 1
  95.  
  96.     set obj [$this createObject "name    \"$name\"
  97.                 type    \"$type\"
  98.                 specLevel    \"[$this _level]\"" \
  99.                 $type [$this _level]]
  100.  
  101.     $this sortArea
  102.  
  103.     if $edit {
  104.         $obj open
  105.     }
  106. }
  107.  
  108. method OpenDefEdArea::createSearch {this defs level} {
  109.     $this createObject "name    \"[lindex $defs 0]\"
  110.                 type    \"[lindex $defs 1]\"
  111.                 flags    \"[lindex $defs 2]\"
  112.                 fileTypes    \"[lindex $defs 3]\"" \
  113.                 [lindex $defs 1] $level
  114. }
  115.  
  116. method OpenDefEdArea::createCrFile {this defs level} {
  117.     $this createObject "name      \"[lindex $defs 0]\"
  118.                 type      \"[lindex $defs 1]\"
  119.                 fileQualifier \"[lindex $defs 2]\"
  120.                 fileName      \"[lindex $defs 3]\"
  121.                 fileType      \"[lindex $defs 4]\"" \
  122.                 [lindex $defs 1] $level
  123. }
  124.  
  125. method OpenDefEdArea::createCrSys {this defs level} {
  126.     $this createObject "name      \"[lindex $defs 0]\"
  127.                 type      \"[lindex $defs 1]\"
  128.                 systemName      \"[lindex $defs 2]\"
  129.                 fileQualifier \"[lindex $defs 3]\"
  130.                 fileName      \"[lindex $defs 4]\"
  131.                 fileType      \"[lindex $defs 5]\"" \
  132.                 [lindex $defs 1] $level
  133. }
  134.  
  135. method OpenDefEdArea::createUser {this defs level} {
  136.     $this createObject "name    \"[lindex $defs 0]\"
  137.                 type    \"[lindex $defs 1]\"
  138.                 procedure    \"[lindex $defs 2]\"" \
  139.                 [lindex $defs 1] $level
  140. }
  141.  
  142. method OpenDefEdArea::createGroup {this defs level} {
  143.     $this createObject "name    \"[lindex $defs 0]\"
  144.                 type    \"[lindex $defs 1]\"
  145.                 members    \"[lindex $defs 2]\"" \
  146.                 [lindex $defs 1] $level
  147. }
  148.  
  149. method OpenDefEdArea::createObject {this objSpec type level} {
  150.     global stgAbbr
  151.     global classCount
  152.     set newIndex [llength [$this objectSet]]
  153.     set object [$stgAbbr($type)StgDef new $this.Object$classCount $objSpec]
  154.     $this setStrategy [$object name] $object
  155.     $object index $newIndex
  156.     incr classCount
  157.  
  158.     $this adjustCreatedObject $object $level
  159.  
  160.     # update the object-details in the view
  161.     $object updateView
  162.  
  163.     return $object
  164. }
  165.  
  166. method OpenDefEdArea::clearArea {this} {
  167.     $this CustDefsArea::clearArea
  168.     foreach stg [[$this strategy] names] {
  169.         $this removeStrategy $stg
  170.     }
  171. }
  172.  
  173. # Do not delete this line -- regeneration end marker
  174.  
  175. method OpenDefEdArea::getStrategy {this name} {
  176.     return [[$this strategy] set $name]
  177. }
  178.  
  179. method OpenDefEdArea::setStrategy {this name newStrategy} {
  180.     [$this strategy] set $name $newStrategy
  181. }
  182.  
  183. method OpenDefEdArea::removeStrategy {this name} {
  184.     [$this strategy] unset $name
  185. }
  186.  
  187.