home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
csnode.tcl
< prev
next >
Wrap
Text File
|
1997-11-06
|
5KB
|
207 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1996
#
# File: @(#)csnode.tcl /main/titanic/8
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)csnode.tcl /main/titanic/8 5 Nov 1997 Copyright 1996 Cayenne Software Inc.
# Start user added include file section
require "repinfosec.tcl"
# End user added include file section
Class CSNode : {BrowsNode} {
constructor
method destructor
method name
method uniqueName
method confirmShutdown
method removeChildren
method childName
method childObjects
method createChild
method beginUpdate
method doUpdate
method endUpdate
method update
method display
attribute canDelete
attribute canReload
attribute canChangeEntry
attribute canChangeParams
attribute canShowLog
attribute canLogRegistrations
attribute canLogMessage
attribute canShutdown
attribute prevSelection
attribute view
attribute info
attribute shutdownDialog
}
constructor CSNode {class this name} {
set this [BrowsNode::constructor $class $this $name]
# Start constructor user section
$this view [[$this tree] view]
$this info [RepInfoSection new [$this view]]
# Defaults, can be overridden by children.
#
$this selected { %this display }
$this hasChildren 1
$this foldState 0
$this canDelete 0
$this canReload 0
$this canChangeEntry 0
$this canChangeParams 0
$this canShowLog 0
$this canLogRegistrations 0
$this canLogMessage 0
$this canShutdown 0
# End constructor user section
return $this
}
method CSNode::destructor {this} {
# Start destructor user section
# End destructor user section
}
method CSNode::name {this} {
return [$this label]
}
method CSNode::uniqueName {this} {
return [$this name]
}
method CSNode::confirmShutdown {this title msg {help ""}} {
if {[$this shutdownDialog] == ""} {
global classCount
set dlg [$this view].shutdowndlg-[$this uniqueName]$classCount
incr classCount
$this shutdownDialog $dlg
YesNoWarningDialog new $dlg \
-title "Confirm Shutdown Of $title" \
-message $msg \
-yesPressed "$this shutdown 0"
$dlg delCancelButton
if {$help != ""} {
$dlg helpPressed "[$this view] helpOnName $help"
} else {
$dlg delHelpButton
}
}
[$this shutdownDialog] popUp
}
method CSNode::removeChildren {this} {
foreach child [$this childSet] {
$child delete
}
}
method CSNode::childName {this object} {
return $object
}
method CSNode::childObjects {this} {
return {}
}
method CSNode::createChild {this object} {
return ""
}
method CSNode::beginUpdate {this {rebuild 1}} {
[$this info] clear
$this prevSelection [[$this tree] selected]
if $rebuild {
$this removeChildren
}
$this hasChildren 1
}
method CSNode::doUpdate {this {rebuild 1}} {
if $rebuild {
foreach object [$this childObjects] {
set node [$this createChild $object]
if {$node != ""} {
$node update 1
}
}
} else {
set oldChildSet [$this childSet]
set newChildSet {}
foreach object [$this childObjects] {
set nodeName [$this childName $object]
set i [lsearch -exact $oldChildSet $this.$nodeName]
if {$i != -1} {
set node [lindex $oldChildSet $i]
$node update 0
lappend newChildSet $node
} else {
set node [$this createChild $object]
if {$node != ""} {
$node update 1
lappend newChildSet $node
}
}
}
foreach node $oldChildSet {
if {[lsearch -exact $newChildSet $node] == -1} {
$node delete
}
}
}
}
method CSNode::endUpdate {this {rebuild 1}} {
[$this info] format
if [lempty [$this childSet]] {
$this hasChildren 0
} else {
$this hasChildren 1
}
if {[info commands [$this prevSelection]] == ""} {
[$this view] selectionChanged
}
}
method CSNode::update {this {rebuild 1}} {
$this beginUpdate $rebuild
if [catch {$this doUpdate $rebuild} error] {
[$this info] clear
[$this info] addHeader "Could not access:"
foreach line [split $error \n] {
[$this info] addLine $line
}
}
$this endUpdate $rebuild
}
method CSNode::display {this} {
# Default: contents of the RepInfoSection of this node.
#
[[$this view] info] text [[$this info] contents]
}
# Do not delete this line -- regeneration end marker