home *** CD-ROM | disk | FTP | other *** search
/ PC World 1998 October / PCWorld_1998-10_cd.bin / software / prehled / komix / DATA.Z / opencdmdlg.tcl < prev    next >
Text File  |  1997-11-27  |  4KB  |  129 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cayenne Software Inc.    1997
  4. #
  5. #      File:           @(#)opencdmdlg.tcl    /main/titanic/9
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)opencdmdlg.tcl    /main/titanic/9   27 Nov 1997 Copyright 1997 Cayenne Software Inc.
  10.  
  11. # Start user added include file section
  12. # End user added include file section
  13.  
  14. require "browsviewd.tcl"
  15.  
  16. Class OpenCdmDlg : {BrowsViewDialog} {
  17.     constructor
  18.     method destructor
  19.     method open
  20.     method popUp
  21.     attribute editable
  22.     attribute cdm
  23.     attribute levelPath
  24. }
  25.  
  26. constructor OpenCdmDlg {class this name} {
  27.     set this [BrowsViewDialog::constructor $class $this $name]
  28.     # Start constructor user section
  29.  
  30.     $this config \
  31.         -message "Select Class Diagram to open" \
  32.         -headerSpecList {
  33.         {Name 25 ascii {increasing 2}}
  34.         {System 20 ascii {increasing 1}}
  35.         {Version 20 ascii {increasing 3}}
  36.         {Status 14 ascii {increasing 4}}
  37.         } \
  38.         -cancelPressed {%this delete} \
  39.         -okPressed {
  40.         %this open [[lindex [[%this view] selectedSet] 0] object]
  41.         %this delete
  42.         }
  43.     [$this view] selectionPolicy BROWSE
  44.  
  45.     # End constructor user section
  46.     return $this
  47. }
  48.  
  49. method OpenCdmDlg::destructor {this} {
  50.     # Start destructor user section
  51.     # End destructor user section
  52.     $this BrowsViewDialog::destructor
  53. }
  54.  
  55. method OpenCdmDlg::open {this cad} {
  56.     if {[$this editable] == 0 || [$cad getInfo "In Corporate"] == "Yes" ||
  57.     [$cad getInfo Status] != "working"} {
  58.     set action showFile
  59.     } else {
  60.     set action editFile
  61.     }
  62.     set cc [ClientContext::global]
  63.     set decSys [$cad system]
  64.     set phaseV [$cc currentPhase]
  65.     set decSysV [$phaseV findSystemVersion -bySystem $decSys]
  66.  
  67.     if {[string compare [$cc currentSystem] $decSysV] == 0} {
  68.     # systems equal
  69.     $cad $action [[$this levelPath] asString]
  70.     } else {
  71.     # systems not equal
  72.     set lvlPath [LevelPath new [$cc currentLevelIdString]]
  73.     $lvlPath changeTail [$decSysV identity]
  74.     $cad $action [$lvlPath asString]
  75.     }
  76. }
  77.  
  78. method OpenCdmDlg::popUp {this} {
  79.     set cdm [$this cdm]
  80.     if {[[$this levelPath] depth] == "None"} {
  81.     set cc [ClientContext::global]
  82.         set cv [$cc currentConfig]
  83.     set sv [$cc currentSystem]
  84.     } else {
  85.         set cv [ConfigVersion new [[$this levelPath] nameAt Config]]
  86.         set sv [SystemVersion new [[$this levelPath] nameAt System]]
  87.     }
  88.  
  89.     set item [[$cdm file] item]
  90.     $sv getDecompositions \
  91.     $item $cv decompComponents cad decompSystems decompFiles
  92.     set nrOfFiles [llength $decompFiles]
  93.  
  94.     if {$nrOfFiles == 0} {
  95.     return [list 0 "No Class Diagrams's exist in which class '[$item name]' occurs"]
  96.     }
  97.  
  98.     set typeSpec [getObjectSpec [.main objectHdlr] Graph cad]
  99.     if {"$typeSpec" != ""} {
  100.     set icon [$typeSpec smallIcon]
  101.     } else {
  102.     set icon ""
  103.     }
  104.     set objectSpecList ""
  105.     foreach decompFile $decompFiles {
  106.     lappend objectSpecList [list $icon \
  107.         [[$decompFile file] qualifiedName :] \
  108.         [[$decompFile system] name] \
  109.         [$decompFile versionName] \
  110.         [$decompFile status] \
  111.     ]
  112.     }
  113.     if [$this editable] {
  114.     set title "Edit"
  115.     } else {
  116.     set title "Show"
  117.     }
  118.     append title " CDM"
  119.     $this config \
  120.     -title $title \
  121.     -objectSpecList $objectSpecList \
  122.     -objectList $decompFiles
  123.     $this BrowsViewDialog::popUp
  124.     return 1
  125. }
  126.  
  127. # Do not delete this line -- regeneration end marker
  128.  
  129.