home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / custfvdbob.tcl < prev    next >
Text File  |  1996-11-07  |  7KB  |  266 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cadre Technologies Inc.    1996
  4. #
  5. #      File:           @(#)custfvdbob.tcl    /main/hindenburg/3
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)custfvdbob.tcl    /main/hindenburg/3   7 Nov 1996 Copyright 1996 Cadre Technologies Inc.
  10.  
  11. # Start user added include file section
  12. # End user added include file section
  13.  
  14. require "browsdbobj.tcl"
  15. require "versionobj.tcl"
  16.  
  17. Class CustFVDbObj : {BrowsDbObj CustomFileVersion VersionObj} {
  18.     method destructor
  19.     constructor
  20.     method promoter
  21.     method browserType
  22.     method compareVersion
  23.     method compareVersionAllowed
  24.     method copyVersion
  25.     method editFile
  26.     method hasChildren
  27.     method name
  28.     method openFile
  29.     method removeVersion
  30.     method showFile
  31.     method typeInLabel
  32. }
  33.  
  34. method CustFVDbObj::destructor {this} {
  35.     # Start destructor user section
  36.  
  37.     [$this controlledListSet] delete
  38.  
  39.     # End destructor user section
  40.     $this BrowsDbObj::destructor
  41.     $this VersionObj::destructor
  42. }
  43.  
  44. constructor CustFVDbObj {class this name} {
  45.     set this [CustomFileVersion::constructor $class $this $name]
  46.     set this [BrowsDbObj::constructor $class $this $name]
  47.     set this [VersionObj::constructor $class $this $name]
  48.     return $this
  49. }
  50.  
  51. selfPromoter CustomFileVersion {this} {
  52.     CustFVDbObj promote $this
  53. }
  54.  
  55. method CustFVDbObj::promoter {this} {
  56.     $this BrowsDbObj::promoter
  57.  
  58.     set controlledListSet $this.${CListUiObj::uiClass}:0
  59.     if {! [isCommand $controlledListSet]} {
  60.     CListUiObj new $controlledListSet -parent $this
  61.     }
  62.     $this controlledListSet $controlledListSet
  63. }
  64.  
  65. proc CustFVDbObj::associations {} {
  66.     return {controlledListSet accessRuleSet}
  67. }
  68.  
  69. method CustFVDbObj::browserType {this} {
  70.     return "[[$this customFile] type]"
  71. }
  72.  
  73. proc CustFVDbObj::childTypes {assoc} {
  74.     if {[lsearch -exact "[CustFVDbObj::associations]" "$assoc"] == -1} {
  75.     return ""
  76.     }
  77.     return "[BrowserProcs::childTypes $assoc]"
  78. }
  79.  
  80. method CustFVDbObj::compareVersion {this} {
  81.     set versionList ""
  82.     foreach version [[$this customFile] customFileVersions] {
  83.     if {"$version" == "$this"} continue
  84.     lappend versionList $version
  85.     }
  86.     BrowserProcs::compareVersion $this [$this customFile] $versionList
  87. }
  88.  
  89. method CustFVDbObj::compareVersionAllowed {this} {
  90.     return 1
  91. }
  92.  
  93. proc CustFVDbObj::controlledLists {} {
  94.     return {"[[$this customFile] customFileVersionList]"}
  95. }
  96.  
  97. method CustFVDbObj::copyVersion {this} {
  98.     set versionList ""
  99.     set myType [$this browserType]
  100.     set myName [$this name]
  101.     foreach custf [[[$this customFile] customLevel] customFiles] {
  102.     if {"[$custf name]" != "$myName"} continue
  103.     if {"[$custf type]" != "$myType"} continue
  104.     foreach version [$custf customFileVersions] {
  105.         if {"$version" == "$this"} continue
  106.         lappend versionList [list $version "$myName.$myType"]
  107.     }
  108.     }
  109.     BrowserProcs::copyVersion $this $versionList
  110. }
  111.  
  112. method CustFVDbObj::editFile {this} {
  113.     if {"[$this getInfo Status]" != "working"} {
  114.     $this showFile
  115.     return
  116.     }
  117.     case "[$this browserType]" in {
  118.     {mnu vie objtype opendefs openlocs propdefs proplocs} {
  119.         set script "SystemUtilities::fork otk uce \
  120.         -c [list [get_comm_name]] \
  121.         -id [$this getInfo Identity]"
  122.         $wmttoolObj startCommand tcl \
  123.         "$script" "" \
  124.         "Starting uce for '[$this name].[$this browserType]'" \
  125.         {0 0} 1
  126.     }
  127.     {pnl} {
  128.         require "ctrlpnldia.tcl"
  129.         global classCount
  130.         incr classCount
  131.         set dlgName .main.ctrlPnlDialog$classCount
  132.         CtrlPnlDialog new $dlgName \
  133.         -helpPressed ".main helpOnName ctrlPnlDialog" \
  134.         -lvlObj [$this getParent CustomLevelVersion] \
  135.         -fileName [$this name] \
  136.         -fileType [$this browserType] \
  137.         -editable 1
  138.         $dlgName popUp
  139.     }
  140.     {default} {
  141.         case "[$this name]" in {
  142.         {checkconfig} {
  143.             require "custcheckd.tcl"
  144.             global classCount
  145.             incr classCount
  146.             set dlgName .main.custCheckDialog$classCount
  147.             CustCheckDialog new $dlgName
  148.             $dlgName edit [$this getParent CustomLevelVersion]
  149.         }
  150.         {default} {
  151.             $this edit
  152.             set tmpFile [args_file {}]
  153.             $this downLoad $tmpFile
  154.             set cmd [list $this upLoad $tmpFile]
  155.             append cmd " ;"
  156.             append cmd " $this quit"
  157.             append cmd " ;"
  158.             append cmd [list BasicFS::removeFile $tmpFile]
  159.             $wmttoolObj startM4Command \
  160.             editor $tmpFile "$cmd" "[$this name]"
  161.             }
  162.         }
  163.     }
  164.     }
  165. }
  166.  
  167. method CustFVDbObj::hasChildren {this} {
  168.     return 1
  169. }
  170.  
  171. proc CustFVDbObj::infoProperties {} {
  172.     return [concat \
  173.     [BrowserProcs::infoProperties] \
  174.     {Status Version Comments Created Updated Frozen "Controlled Actions"
  175.      "Created By"} \
  176.     ]
  177. }
  178.  
  179. method CustFVDbObj::name {this} {
  180.     return "[[$this customFile] name]"
  181. }
  182.  
  183. method CustFVDbObj::openFile {this} {
  184.     case [$this getInfo Status] in {
  185.     backGround {
  186.         set treeNode [$this treeNode]
  187.         if {"$treeNode" != ""} {
  188.         $treeNode open
  189.         } else {
  190.         [$this infoObject] open
  191.         }
  192.     }
  193.     working {
  194.         $this editFile
  195.     }
  196.     default {
  197.         $this showFile
  198.     }
  199.     } 
  200. }
  201.  
  202. method CustFVDbObj::removeVersion {this} {
  203.     set versionList ""
  204.     foreach version [[$this customFile] customFileVersions] {
  205.     if [$version isLeaf] {
  206.         lappend versionList $version
  207.     }
  208.     }
  209.     BrowserProcs::removeVersion \
  210.     "[$this getParent CustomLevelVersion]" \
  211.     "[$this customFile]" "$versionList"
  212. }
  213.  
  214. method CustFVDbObj::showFile {this} {
  215.     case "[$this browserType]" in {
  216.     {mnu vie objtype opendefs openlocs propdefs proplocs} {
  217.         set script "SystemUtilities::fork otk uce -r \
  218.         -c [list [get_comm_name]] \
  219.         -id [$this getInfo Identity]"
  220.         $wmttoolObj startCommand tcl \
  221.         "$script" "" \
  222.         "Starting uce for '[$this name].[$this browserType]'" \
  223.         {0 0} 1
  224.     }
  225.     {pnl} {
  226.         require "ctrlpnldia.tcl"
  227.         global classCount
  228.         incr classCount
  229.         set dlgName .main.ctrlPnlDialog$classCount
  230.         CtrlPnlDialog new $dlgName \
  231.         -helpPressed ".main helpOnName ctrlPnlDialog" \
  232.         -lvlObj [$this getParent CustomLevelVersion] \
  233.         -fileName [$this name] \
  234.         -fileType [$this browserType] \
  235.         -editable 0
  236.         $dlgName popUp
  237.     }
  238.     {default} {
  239.         case "[$this name]" in {
  240.         {checkconfig} {
  241.             require "custcheckd.tcl"
  242.             global classCount
  243.             incr classCount
  244.             set dlgName .main.custCheckDialog$classCount
  245.             CustCheckDialog new $dlgName
  246.             $dlgName show [$this getParent CustomLevelVersion]
  247.         }
  248.         {default} {
  249.             set tmpFile [args_file {}]
  250.             $this downLoad $tmpFile
  251.             set cmd [list BasicFS::removeFile $tmpFile]
  252.             $wmttoolObj startM4Command \
  253.             viewer $tmpFile "$cmd" "[$this name]"
  254.         }
  255.         }
  256.     }
  257.     }
  258. }
  259.  
  260. method CustFVDbObj::typeInLabel {this} {
  261.     return 1
  262. }
  263.  
  264. # Do not delete this line -- regeneration end marker
  265.  
  266.