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

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cadre Technologies Inc.    1996
  4. #
  5. #      File:           @(#)opencdmdlg.tcl    /main/hindenburg/3
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)opencdmdlg.tcl    /main/hindenburg/3   22 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 "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 confV
  24.     attribute phaseV
  25.     attribute sysV
  26. }
  27.  
  28. constructor OpenCdmDlg {class this name} {
  29.     set this [BrowsViewDialog::constructor $class $this $name]
  30.     # Start constructor user section
  31.  
  32.     $this config \
  33.         -message "Select CAD to open" \
  34.         -headerSpecList {
  35.         {Name 25 ascii {increasing 2}}
  36.         {System 20 ascii {increasing 1}}
  37.         {Version 20 ascii {increasing 3}}
  38.         {Status 14 ascii {increasing 4}}
  39.         } \
  40.         -cancelPressed {%this delete} \
  41.         -okPressed {
  42.         %this open [[lindex [[%this view] selectedSet] 0] object]
  43.         %this delete
  44.         }
  45.     [$this view] selectionPolicy BROWSE
  46.  
  47.     # End constructor user section
  48.     return $this
  49. }
  50.  
  51. method OpenCdmDlg::destructor {this} {
  52.     # Start destructor user section
  53.     # End destructor user section
  54.     $this BrowsViewDialog::destructor
  55. }
  56.  
  57. method OpenCdmDlg::open {this cad} {
  58.     if {[$cad getInfo "In Corporate"] == "Yes" ||
  59.     [$cad getInfo Status] != "working"} {
  60.     set action showFile
  61.     } else {
  62.     set action editFile
  63.     }
  64.     set confV [$this confV]
  65.     set phaseV [$this phaseV]
  66.     set sysV [[$cad system] selectedVersion $confV]
  67.     $cad $action $confV $phaseV $sysV
  68. }
  69.  
  70. method OpenCdmDlg::popUp {this} {
  71.     set cdm [$this cdm]
  72.     if {"[$this confV]" == ""} {
  73.     $this confV [$cdm getParent ConfigVersion]
  74.     }
  75.     if {"[$this phaseV]" == ""} {
  76.     $this phaseV [$cdm getParent PhaseVersion]
  77.     }
  78.     if {"[$this sysV]" == ""} {
  79.     $this sysV [$cdm getParent SystemVersion]
  80.     }
  81.  
  82.     set item [[$cdm file] item]
  83.     [$this sysV] getDecompositions \
  84.     $item [$this confV] decompComponents cad decompSystems decompFiles
  85.     set nrOfFiles [llength $decompFiles]
  86.  
  87.     if {$nrOfFiles == 0} {
  88.     return [list 0 "No CAD's exist in which class '[$item name]' occurs"]
  89.     }
  90.  
  91.     if {$nrOfFiles == 1} {
  92.     $this open [lindex $decompFiles 0]
  93.     return {0 ""}
  94.     }
  95.  
  96.     set typeSpec [getObjectSpec [.main objectHdlr] Graph cad]
  97.     if {"$typeSpec" != ""} {
  98.     set icon [$typeSpec smallIcon]
  99.     } else {
  100.     set icon ""
  101.     }
  102.     set objectSpecList ""
  103.     foreach decompFile $decompFiles {
  104.     lappend objectSpecList [list $icon \
  105.         [[$decompFile file] qualifiedName :] \
  106.         [[$decompFile system] name] \
  107.         [$decompFile versionName] \
  108.         [$decompFile status] \
  109.     ]
  110.     }
  111.     if [$this editable] {
  112.     set title "Edit"
  113.     } else {
  114.     set title "Show"
  115.     }
  116.     append title " CDM"
  117.     $this config \
  118.     -title $title \
  119.     -objectSpecList $objectSpecList \
  120.     -objectList $decompFiles
  121.     $this BrowsViewDialog::popUp
  122.     return 1
  123. }
  124.  
  125. # Do not delete this line -- regeneration end marker
  126.  
  127.