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

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cadre Technologies Inc.    1996
  4. #
  5. #      File:           @(#)filevobj.tcl    /main/hindenburg/5
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)filevobj.tcl    /main/hindenburg/5   30 Oct 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 FileVObj : {VersionObj BrowsDbObj} {
  18.     method destructor
  19.     constructor
  20.     method promoter
  21.     method browserType
  22.     method canBeDragged
  23.     method compareVersion
  24.     method compareVersionAllowed
  25.     method copyVersion
  26.     method file
  27.     method hasChildren
  28.     method inCorporate2String
  29.     method initializeInfo
  30.     method linkStatus
  31.     method name
  32.     method openFile
  33.     method removeVersion
  34. }
  35.  
  36. method FileVObj::destructor {this} {
  37.     # Start destructor user section
  38.  
  39.     [$this controlledListSet] delete
  40.  
  41.     # End destructor user section
  42.     $this VersionObj::destructor
  43.     $this BrowsDbObj::destructor
  44. }
  45.  
  46. constructor FileVObj {class this name} {
  47.     set this [BrowsDbObj::constructor $class $this $name]
  48.     set this [VersionObj::constructor $class $this $name]
  49.     return $this
  50. }
  51.  
  52. selfPromoter FileVersion {this} {
  53.     [$this ORB_class] new [$this identity]
  54. }
  55.  
  56. method FileVObj::promoter {this} {
  57.     $this BrowsDbObj::promoter
  58.  
  59.     set controlledListSet $this.${CListUiObj::uiClass}:0
  60.     if {! [isCommand $controlledListSet]} {
  61.     CListUiObj new $controlledListSet -parent $this
  62.     }
  63.     $this controlledListSet $controlledListSet
  64. }
  65.  
  66. proc FileVObj::associations {} {
  67.     return {controlledListSet accessRuleSet}
  68. }
  69.  
  70. method FileVObj::browserType {this} {
  71.     return "[[$this file] type]"
  72. }
  73.  
  74. method FileVObj::canBeDragged {this} {
  75.     return 1
  76. }
  77.  
  78. method FileVObj::compareVersion {this} {
  79.     set versionList ""
  80.     foreach version [[$this file] fileVersions] {
  81.     if {"$version" == "$this"} continue
  82.     lappend versionList $version
  83.     }
  84.     BrowserProcs::compareVersion $this [$this file] $versionList
  85. }
  86.  
  87. method FileVObj::compareVersionAllowed {this} {
  88.     if {"[$this getParent CorpGVDbObj]" != ""} {
  89.     return 0
  90.     }
  91.     return 1
  92. }
  93.  
  94. proc FileVObj::controlledLists {} {
  95.     return {"[[$this file] fileVersionList]"}
  96. }
  97.  
  98. method FileVObj::copyVersion {this} {
  99.     set versionList ""
  100.     set myType [[$this file] type]
  101.     foreach system [[$this phase] systems] {
  102.     foreach file [$system files] {
  103.         if {"[$file type]" != "$myType"} continue
  104.         foreach version [$file fileVersions] {
  105.         if {"$version" == "$this"} continue
  106.         lappend versionList [list $version "[$file qualifiedName :]"]
  107.         }
  108.     }
  109.     }
  110.     BrowserProcs::copyVersion $this $versionList
  111. }
  112.  
  113. method FileVObj::file {this} {
  114.     if {[catch {set file [[[$this info] set SystemFileLink] file]}] ||
  115.     [$file isNil]} {
  116.     global errorInfo
  117.     set errorInfo ""
  118.     global errorCode
  119.     set errorCode ""
  120.     return [$this FileVersion::file]
  121.     }
  122.     return $file
  123. }
  124.  
  125. method FileVObj::hasChildren {this} {
  126.     return 1
  127. }
  128.  
  129. method FileVObj::inCorporate2String {this} {
  130.     if {[$this inCorporate] || "[$this getInfo Status]" == "reused"} {
  131.     return "Yes"
  132.     }
  133.     return "No"
  134. }
  135.  
  136. proc FileVObj::infoProperties {} {
  137.     return [concat \
  138.     [BrowserProcs::infoProperties] \
  139.     {Status Link Version Comments Created Updated Frozen \
  140.      "In Corporate" "Controlled Actions" "Created By"} \
  141.     ]
  142. }
  143.  
  144. method FileVObj::initializeInfo {this dummy} {
  145.     set oldLink [[$this info] set SystemFileLink]
  146.     [$this info] contents ""
  147.     $this setInfo SystemFileLink $oldLink
  148. }
  149.  
  150. method FileVObj::linkStatus {this} {
  151.     return [[[$this info] set SystemFileLink] status]
  152. }
  153.  
  154. method FileVObj::name {this {qualifier ":"}} {
  155.     case [$this getInfo Type] in {
  156.     {etd std} {
  157.         return "[[$this file] qualifiedName $qualifier]"
  158.     }
  159.     default {
  160.         return "[[$this file] name]"
  161.     }
  162.     }
  163. }
  164.  
  165. method FileVObj::openFile {this} {
  166.     if {"[$this getParent CorporateGroupVersion]" != "" ||
  167.     [$this getInfo Status] == "backGround"} {
  168.     set treeNode [$this treeNode]
  169.     if {"$treeNode" != ""} {
  170.         $treeNode open
  171.     } else {
  172.         [$this infoObject] open
  173.     }
  174.     } elseif {[$this getInfo "In Corporate"] == "Yes" ||
  175.           [$this getInfo Status] != "working"} {
  176.     $this showFile
  177.     } else {
  178.     $this editFile
  179.     }
  180. }
  181.  
  182. method FileVObj::removeVersion {this} {
  183.     set sysV [$this getParent SystemVersion]
  184.     if {"$sysV" == ""} {
  185.     wmtkerror "Cannot access corporate FileVersion(s)"
  186.     return
  187.     }
  188.     set versionList ""
  189.     foreach version [[$this file] fileVersions] {
  190.     if [$version isLeaf] {
  191.         lappend versionList $version
  192.     }
  193.     }
  194.     BrowserProcs::removeVersion "$sysV" "[$this file]" "$versionList"
  195. }
  196.  
  197. # Do not delete this line -- regeneration end marker
  198.  
  199.