home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
csnode.tcl
< prev
next >
Wrap
Text File
|
1996-11-11
|
5KB
|
197 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1996
#
# File: @(#)csnode.tcl /main/hindenburg/8
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)csnode.tcl /main/hindenburg/8 11 Nov 1996 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 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 activated { %this update; %this display }
$this hasChildren 1
$this foldState 0
$this canDelete 0
$this canReload 0
$this canChangeEntry 0
$this canChangeParams 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] == ""} {
$this shutdownDialog [WarningDialog new \
[$this view].shutdowndlg-[$this uniqueName] \
-title $title \
-message $msg \
-okPressed "$this shutdown 0"]
if {$help != ""} {
[$this shutdownDialog] helpPressed "[$this view] helpOnName $help"
} else {
[$this shutdownDialog] 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