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

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cadre Technologies Inc.    1996
  4. #
  5. #      File:           @(#)setlockdia.tcl    /main/hindenburg/11
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)setlockdia.tcl    /main/hindenburg/11   18 Oct 1996 Copyright 1996 Cadre Technologies Inc.
  10.  
  11. # Start user added include file section
  12. require "lockbrtabl.tcl"
  13. # End user added include file section
  14.  
  15. require "reptooldia.tcl"
  16.  
  17. Class SetLockDialog : {RepToolDialog} {
  18.     constructor
  19.     method destructor
  20.     method setObject
  21.     method setClient
  22.     method ok
  23.     method cancel
  24. }
  25.  
  26. constructor SetLockDialog {class this name view} {
  27.     set this [RepToolDialog::constructor $class $this $name $view]
  28.     # Start constructor user section
  29.  
  30.     interface DlgColumn $this.gui {
  31.             DlgRow type {
  32.             Label l { text "Lock Type" }
  33.             OptionMenu type {
  34.                 horStretchFactor 100
  35.                 entrySet {
  36.                 writeLock
  37.                 readLock
  38.                 }
  39.             }
  40.             }
  41.             DlgRow attr {
  42.         DlgColumn attr {
  43.             DlgRow object {
  44.             Label l { text "Object Id" }
  45.             SingleLineText object {
  46.                             columnCount 35
  47.                         }
  48.             }
  49.             DlgRow host {
  50.             Label l { text "Host" }
  51.             SingleLineText host {
  52.                             columnCount 35
  53.                         }
  54.             }
  55.             DlgRow user {
  56.             Label l { text "User" }
  57.             SingleLineText user {
  58.                             columnCount 35
  59.                         }
  60.             }
  61.             DlgRow pid {
  62.             Label l { text "Process Id" }
  63.             IntField pid {
  64.                             intValue -1
  65.                             columnCount 35
  66.             }
  67.             }
  68.             DlgRow reason {
  69.             Label l { text "Reason" }
  70.             SingleLineText reason {
  71.                             columnCount 35
  72.                         }
  73.             }
  74.         }
  75.         LockBrTable dropZone {
  76.             mode ICON
  77.                     selectionPolicy BROWSE
  78.                     selectionChanged { %this selectedSet {} }
  79.  
  80.                     BrowsObject o {
  81.                         largeIcon rep_lock_32
  82.                         label "Drop\nbrowser\nor client\nobjects\nhere."
  83.                     }
  84.         }
  85.             }
  86.         }
  87.  
  88.         $this.gui.attr.dropZone view [$this view]
  89.         if $win95 {
  90.         $this.gui.attr.dropZone columnCount 15
  91.         }
  92.  
  93.         $this config \
  94.         -title "New Lock" \
  95.         -okPressed { %this ok } \
  96.         -cancelPressed { %this cancel } \
  97.         -helpPressed { [%this view] helpOnName newLock }
  98.  
  99.     # End constructor user section
  100.     return $this
  101. }
  102.  
  103. method SetLockDialog::destructor {this} {
  104.     # Start destructor user section
  105.     # End destructor user section
  106.     $this RepToolDialog::destructor
  107. }
  108.  
  109. method SetLockDialog::setObject {this objId} {
  110.     $this.gui.attr.attr.object.object text $objId
  111. }
  112.  
  113. method SetLockDialog::setClient {this context} {
  114.     $this.gui.attr.attr.host.host text [lindex $context 0]
  115.     $this.gui.attr.attr.pid.pid intValue [lindex $context 1]
  116.     $this.gui.attr.attr.user.user text [lindex $context 2]
  117. }
  118.  
  119. method SetLockDialog::ok {this} {
  120.     [$this view] setLockPoppedUp 0
  121.  
  122.     set new [LockDescription new]
  123.  
  124.     # Only set those fields of the description that have been entered in
  125.     # the dialog.  Let setLock give error if description is incomplete.
  126.     #
  127.  
  128.     set objId [$this.gui.attr.attr.object.object text]
  129.     if {$objId != "" && $objId != [[ORB::nil] identity]} {
  130.     $new setObject $objId
  131.     }
  132.  
  133.     $new addType [LockFilter::lock2descType \
  134.                     [$this.gui.type.type selected]]
  135.  
  136.     set host [$this.gui.attr.attr.host.host text]
  137.     if {$host != ""} {
  138.     $new setHost $host
  139.     }
  140.  
  141.     set user [$this.gui.attr.attr.user.user text]
  142.     if {$user != ""} {
  143.     $new setUser $user
  144.     }
  145.  
  146.     set pid [$this.gui.attr.attr.pid.pid intValue]
  147.     if {$pid != "" && $pid != -1} {
  148.     $new setPid $pid
  149.     }
  150.  
  151.     set reason [$this.gui.attr.attr.reason.reason text]
  152.     if {$reason != ""} {
  153.     $new setReason $reason
  154.     }
  155.  
  156.     [[$this view] rep] setLock $new
  157.     [$this view] update
  158. }
  159.  
  160. method SetLockDialog::cancel {this} {
  161.     [$this view] setLockPoppedUp 0
  162. }
  163.  
  164. # Do not delete this line -- regeneration end marker
  165.  
  166.