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

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cayenne Software Inc.    1997
  4. #
  5. #      File:           @(#)represtobj.tcl    /main/titanic/7
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)represtobj.tcl    /main/titanic/7   21 Nov 1997 Copyright 1997 Cayenne Software Inc.
  10.  
  11. # Start user added include file section
  12. require "repsubdirb.tcl"
  13. # End user added include file section
  14.  
  15. require "represtdia.tcl"
  16.  
  17. Class RepRestObjDialog : {RepRestDialog} {
  18.     constructor
  19.     method destructor
  20.         method checkOverwrite
  21.         method browseObjectDirectory
  22.         method setDirectory
  23.     attribute overwriteLabel
  24.     attribute overwriteField
  25.     attribute overwriteBrowse
  26. }
  27.  
  28. constructor RepRestObjDialog {class this name view} {
  29.     set this [RepRestDialog::constructor $class $this $name $view]
  30.     # Start constructor user section
  31.  
  32.         interface Label [$this extraColumn].overwriteLabel {
  33.         text "Overwrite Object"
  34.         }
  35.  
  36.         interface DlgRow [$this extraColumn].o {
  37.         spaceType NONE
  38.         DlgColumn o {
  39.         spaceType EVEN
  40.         horStretchFactor 100
  41.         SingleLineText overwrite {
  42.             columnCount 30
  43.             horStretchFactor 100
  44.                     editable 1
  45.         }
  46.         }
  47.         DlgColumn b {
  48.         spaceType EVEN
  49.         horStretchFactor 0
  50.         PushButton browse {
  51.             horStretchFactor 0
  52.             label "Browse..."
  53.         }
  54.         }
  55.     }
  56.  
  57.         [$this dirField] text ""
  58.         [$this dirField] editable 0
  59.     [$this dirBrowse] activated "$this browseObjectDirectory"
  60.  
  61.         $this overwriteLabel [$this extraColumn].overwriteLabel
  62.         $this overwriteField [$this extraColumn].o.o.overwrite
  63.     $this overwriteBrowse [$this extraColumn].o.b.browse
  64.         [$this nameField] textModified "$this checkOk; $this checkOverwrite new"
  65.         [$this overwriteField] textModified "$this checkOverwrite old"
  66.         [$this overwriteBrowse] activated "$this browseObjects"
  67.  
  68.         interface NamedGroup [$this dbColumn].g {
  69.         label "Database"
  70.             DlgColumn c {
  71.                 verStretchFactor 0
  72.             }
  73.         }
  74.  
  75.         if $win95 {
  76.         $this createDbInterface [$this dbColumn].g.c 35
  77.         } else {
  78.         $this createDbInterface [$this dbColumn].g.c 30
  79.         }
  80.  
  81.     $this setDbFields
  82.     $this setupForPassword
  83.  
  84.     # End constructor user section
  85.     return $this
  86. }
  87.  
  88. method RepRestObjDialog::destructor {this} {
  89.     # Start destructor user section
  90.     # End destructor user section
  91.     $this RepRestDialog::destructor
  92. }
  93.  
  94. method RepRestObjDialog::checkOverwrite {this what} {
  95.     if {$what == "new"} {
  96.         set new [$this nameField]
  97.         set old [$this overwriteField]
  98.     } else {
  99.         set new [$this overwriteField]
  100.         set old [$this nameField]
  101.     }
  102.  
  103.     if {[string length [$new text]] == 0} {
  104.     $old editable 1
  105.         if {$old == [$this overwriteField]} {
  106.             [$this overwriteBrowse] sensitive 1
  107.         }
  108.     } else {
  109.         $old editable 0
  110.         if {$old == [$this overwriteField]} {
  111.             [$this overwriteBrowse] sensitive 0
  112.         }
  113.     }
  114. }
  115.  
  116. method RepRestObjDialog::browseObjectDirectory {this} {
  117.     set rep [[$this view] rep]
  118.     set repDir [$rep currentRepDir]
  119.  
  120.     set dlg [$this view].browse[$this objType]dir
  121.     if ![isCommand $dlg] {
  122.     RepSubDirBrowser new $dlg \
  123.         -title "[$this objType] Directory Browser" \
  124.         -message "Select a [$this objType] directory from\
  125.               the repository directory:"
  126.  
  127.     $dlg okPressed "%this handleOk; $this setDirectory \
  128.         \[lindex \[%this selectedSet] 0]"
  129.     }
  130.  
  131.     $dlg selectedSet [list [[$this dirField] text]]
  132.     $dlg directory $repDir
  133.     $dlg popUp
  134. }
  135.  
  136. method RepRestObjDialog::setDirectory {this dir} {
  137.     $this RepRestDialog::setDirectory [file tail $dir]
  138. }
  139.  
  140. # Do not delete this line -- regeneration end marker
  141.  
  142.