home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
cbassoctex.tcl
< prev
next >
Wrap
Text File
|
1996-06-11
|
5KB
|
179 lines
#---------------------------------------------------------------------------
#
# (c) Cadre Technologies Inc. 1996
#
# File: @(#)cbassoctex.tcl /main/2
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)cbassoctex.tcl /main/2 11 Jun 1996 Copyright 1996 Cadre Technologies Inc.
# Start user added include file section
# End user added include file section
require "cbclassinf.tcl"
Class CBAssocTextList : {CBClassInfoTextList} {
constructor
method destructor
method updateView
method collectAssociations
method collectInheritedAssociations
method getSelTextListEntry
method fillEntries
method browser
method addBinaryAssocIn
method removeBinaryAssocIn
method addBinaryAssocOut
method removeBinaryAssocOut
method addNAssocConn
method removeNAssocConn
attribute _browser
attribute binaryAssocInSet
attribute binaryAssocOutSet
attribute nAssocConnSet
}
constructor CBAssocTextList {class this name} {
set this [CBClassInfoTextList::constructor $class $this $name]
$this binaryAssocInSet [List new]
$this binaryAssocOutSet [List new]
$this nAssocConnSet [List new]
# Start constructor user section
# End constructor user section
return $this
}
method CBAssocTextList::destructor {this} {
set ref [$this _browser]
if {$ref != ""} {
$ref _assocTL ""
}
# Start destructor user section
# End destructor user section
$this CBClassInfoTextList::destructor
}
method CBAssocTextList::updateView {this currentClass} {
$this removeTextListEntries
$this removeEntries
[$this binaryAssocInSet] contents ""
[$this binaryAssocOutSet] contents ""
[$this nAssocConnSet] contents ""
if {[[$this browser] isInFlatViewMode]} {
set inFlatViewList [List new]
$inFlatViewList insert $currentClass
$this collectInheritedAssociations $currentClass $inFlatViewList
}
$this collectAssociations $currentClass
[$this textListEntrySet] contents \
[concat [[$this binaryAssocInSet] contents] \
[[$this binaryAssocOutSet] contents] \
[[$this nAssocConnSet] contents]]
$this fillEntries
$this deselectEntries
}
method CBAssocTextList::collectAssociations {this aClass} {
[$aClass binaryAssocInSet] foreach assoc {
[$this binaryAssocInSet] append $assoc
}
[$aClass binaryAssocOutSet] foreach assoc {
[$this binaryAssocOutSet] append $assoc
}
[$aClass nAssocConnSet] foreach nassocconn {
[$this nAssocConnSet] append $nassocconn
}
}
method CBAssocTextList::collectInheritedAssociations {this aClass inFlatViewList} {
foreach superClass [$aClass getSuperClasses] {
if {[lsearch [$inFlatViewList contents] $superClass] != -1} {
continue
}
$inFlatViewList insert $superClass
$this collectInheritedAssociations $superClass $inFlatViewList
$this collectAssociations $superClass
}
}
method CBAssocTextList::getSelTextListEntry {this} {
set idx [$this selectedIndexSet]
if {[llength $idx] == 0} {
return ""
}
set index [lindex $idx 0]
set assoc [[$this textListEntrySet] index $index]
set nrOfBinaryAssocIn [llength [[$this binaryAssocInSet] contents]]
set nrOfBinaryAssocOut [llength [[$this binaryAssocOutSet] contents]]
if {$index < $nrOfBinaryAssocIn} {
$assoc isInComing 1
} elseif {$index < [expr $nrOfBinaryAssocIn + $nrOfBinaryAssocOut]} {
$assoc isInComing 0
}
return $assoc
}
method CBAssocTextList::fillEntries {this} {
set lst ""
[$this binaryAssocInSet] foreach assoc {
$assoc isInComing 1
lappend lst [$assoc format]
}
[$this binaryAssocOutSet] foreach assoc {
$assoc isInComing 0
lappend lst [$assoc format]
}
[$this nAssocConnSet] foreach nassocconn {
lappend lst [$nassocconn format]
}
$this entrySet $lst
}
# Do not delete this line -- regeneration end marker
method CBAssocTextList::browser {this args} {
if {$args == ""} {
return [$this _browser]
}
set ref [$this _browser]
if {$ref != ""} {
$ref _assocTL ""
}
set obj [lindex $args 0]
if {$obj != ""} {
$obj _assocTL $this
}
$this _browser $obj
}
method CBAssocTextList::addBinaryAssocIn {this newBinaryAssocIn} {
[$this binaryAssocInSet] append $newBinaryAssocIn
}
method CBAssocTextList::removeBinaryAssocIn {this oldBinaryAssocIn} {
[$this binaryAssocInSet] removeValue $oldBinaryAssocIn
}
method CBAssocTextList::addBinaryAssocOut {this newBinaryAssocOut} {
[$this binaryAssocOutSet] append $newBinaryAssocOut
}
method CBAssocTextList::removeBinaryAssocOut {this oldBinaryAssocOut} {
[$this binaryAssocOutSet] removeValue $oldBinaryAssocOut
}
method CBAssocTextList::addNAssocConn {this newNAssocConn} {
[$this nAssocConnSet] append $newNAssocConn
}
method CBAssocTextList::removeNAssocConn {this oldNAssocConn} {
[$this nAssocConnSet] removeValue $oldNAssocConn
}