home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1996
- #
- # File: @(#)csparamdia.tcl /main/hindenburg/10
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)csparamdia.tcl /main/hindenburg/10 13 May 1997 Copyright 1996 Cayenne Software Inc.
-
- # Start user added include file section
- require "csintdlgel.tcl"
- # End user added include file section
-
- require "reptooldia.tcl"
-
- Class CSParamDialog : {RepToolDialog} {
- constructor
- method destructor
- method setParameter
- method getParameter
- method setFields
- method getFields
- method ok
- method apply
- method cancel
- attribute timeoutInitial
- attribute lingerInitial
- attribute reportInitial
- attribute maxclientsInitial
- attribute maxinstancesInitial
- attribute node
- attribute objects
- attribute parameters
- attribute paramMap
- }
-
- constructor CSParamDialog {class this name view node objects parameters} {
- set this [RepToolDialog::constructor $class $this $name $view]
- $this node $node
- $this objects $objects
- $this parameters $parameters
- # Start constructor user section
-
- $this paramMap [Dictionary new]
-
- $this config \
- -title "Change ORB Parameters" \
- -modal $win95 \
- -okPressed { %this ok } \
- -cancelPressed { %this cancel } \
- -helpPressed { [%this view] helpOnName changeParameters }
-
- interface NamedGroup $this.gui {
- DlgColumn params {
- }
- }
-
- set object [lindex [eval [$this objects]] 0]
- $this.gui label "Parameters of [$object objType] '[$object name]'"
-
- foreach param $parameters {
- set guiName $this.gui.params.$param
- [$this paramMap] set $param $guiName
-
- switch -- $param {
- orb_timeout {
- interface CSIntDlgElem $guiName {
- label "ORB Request Time-out (seconds)"
- min 0
- max 600
- step 30
- }
- }
- orb_linger {
- interface CSIntDlgElem $guiName {
- label "ORB Linger Time (seconds)"
- min 0
- max 600
- step 30
- }
- }
- orb_report {
- interface CSIntDlgElem $guiName {
- label "ORB Report Time (seconds)"
- min -1
- max 600
- step 30
- }
- }
- orb_maxclients {
- interface CSIntDlgElem $guiName {
- label "Max Number of Clients"
- min -1
- max 10
- step 2
- }
- }
- orb_maxinstances {
- interface CSIntDlgElem $guiName {
- label "Max Number of Instances Per Host"
- min -1
- max 10
- step 2
- }
- }
- }
- }
-
- if !$win95 {
- PushButton new $this.apply \
- -label "Apply" \
- -activated "$this apply"
- }
-
- $this setFields 1
-
- # End constructor user section
- return $this
- }
-
- method CSParamDialog::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this RepToolDialog::destructor
- }
-
- method CSParamDialog::setParameter {this name valueScript} {
- set guiElem [[$this paramMap] set $name]
- if {$guiElem == ""} {
- return 0
- }
-
- regsub {%} $valueScript $guiElem valueScript
- set value [expr $valueScript]
-
- foreach object [eval [$this objects]] {
- if {$value != [$object getParameter $name]} {
- $object changeParameter $name $value
- }
- }
-
- return 1
- }
-
- method CSParamDialog::getParameter {this name valueScript} {
- set guiElem [[$this paramMap] set $name]
- if {$guiElem == ""} {
- return 0
- }
-
- set object [lindex [eval [$this objects]] 0]
- set value [$object getParameter $name]
- regsub {%} $valueScript $value valueScript
- set guiValue [expr $valueScript]
-
- $guiElem value $guiValue
- }
-
- method CSParamDialog::setFields {this {copyInitial 0}} {
- $this getParameter orb_timeout {% / 1000}
- $this getParameter orb_linger {%}
- $this getParameter orb_report {%}
- $this getParameter orb_maxclients {%}
- $this getParameter orb_maxinstances {%}
-
- if $copyInitial {
- set object [lindex [eval [$this objects]] 0]
- $this timeoutInitial [$object getParameter orb_timeout]
- $this lingerInitial [$object getParameter orb_linger]
- $this reportInitial [$object getParameter orb_report]
- $this maxclientsInitial [$object getParameter orb_maxclients]
- $this maxinstancesInitial [$object getParameter orb_maxinstances]
- }
- }
-
- method CSParamDialog::getFields {this} {
- if [catch {
- $this setParameter orb_timeout {[% value] * 1000}
- $this setParameter orb_linger {[% value]}
- $this setParameter orb_report {[% value]}
- $this setParameter orb_maxclients {[% value]}
- $this setParameter orb_maxinstances {[% value]}
- } error] {
- [$this view] error $error
- return 0
- }
-
- return 1
- }
-
- method CSParamDialog::ok {this} {
- $this apply
- }
-
- method CSParamDialog::apply {this} {
- if ![$this getFields] {
- return
- }
-
- [$this node] update 0
-
- set tree [[$this view] tree]
- if {[$tree selected] != [$this node]} {
- $tree selected [$this node]
- }
- [$this node] display
- [$this node] makeVisible
- }
-
- method CSParamDialog::cancel {this} {
- catch {
- $this setParameter orb_timeout {[$this timeoutInitial]}
- $this setParameter orb_linger {[$this lingerInitial]}
- $this setParameter orb_report {[$this reportInitial]}
- $this setParameter orb_maxclients {[$this maxclientsInitial]}
- $this setParameter orb_maxinstances {[$this maxinstancesInitial]}
- }
-
- [$this node] update 0
-
- # Redisplay current node because it may be a bomb.
- #
- set tree [[$this view] tree]
- set obj [$tree selected]
- if {$obj != ""} {
- $obj display
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
-