home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
cbbinaryas.tcl
< prev
next >
Wrap
Text File
|
1996-06-11
|
6KB
|
217 lines
#---------------------------------------------------------------------------
#
# (c) Cadre Technologies Inc. 1996
#
# File: @(#)cbbinaryas.tcl /main/2
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)cbbinaryas.tcl /main/2 11 Jun 1996 Copyright 1996 Cadre Technologies Inc.
# Start user added include file section
require "cbpropname.tcl"
require "cbpropcomp.tcl"
require "cbproplabe.tcl"
require "cbpropitem.tcl"
# End user added include file section
require "cadbinarya.tcl"
require "cbassociat.tcl"
Class CBBinaryAssoc : {CBAssociation CADBinaryAssoc} {
method destructor
constructor
method collectClasses
method collectWorkItems
method collectPropComps
method format
attribute isInComing
attribute inComingFormattedText
attribute outGoingFormattedText
}
method CBBinaryAssoc::destructor {this} {
# Start destructor user section
# End destructor user section
$this CBAssociation::destructor
$this CADBinaryAssoc::destructor
}
constructor CBBinaryAssoc {class this inModel} {
set this [CADBinaryAssoc::constructor $class $this $inModel]
set this [CBAssociation::constructor $class $this $this]
$this isInComing 0
$this inComingFormattedText ""
$this outGoingFormattedText ""
return $this
}
method CBBinaryAssoc::collectClasses {this classList} {
if {[$this isInComing]} {
set oppositeClass [$this fromClass]
set thisClass [$this toClass]
} else {
set oppositeClass [$this toClass]
set thisClass [$this fromClass]
}
if {[[$this getClassBrowser] isInFlatViewMode]} {
$classList append $thisClass
}
$classList append $oppositeClass
}
method CBBinaryAssoc::collectWorkItems {this workItemList} {
if {[$this isInComing]} {
set oppositeClass [$this fromClass]
set thisClass [$this toClass]
} else {
set oppositeClass [$this toClass]
set thisClass [$this fromClass]
}
if {[[$this getClassBrowser] isInFlatViewMode]} {
$thisClass collectWorkItems $workItemList
}
if {![$this isInComing]} {
set workItem [$this getQualifierWorkItem]
if {![$workItem isNil]} {
$workItemList append $workItem
}
}
set workItem [$this getNameWorkItem]
if {![$workItem isNil]} {
$workItemList append $workItem
}
if {[$this isInComing]} {
set workItem [$this getFromRoleWorkItem]
} else {
set workItem [$this getToRoleWorkItem]
}
if {![$workItem isNil]} {
$workItemList append $workItem
}
$oppositeClass collectWorkItems $workItemList
}
method CBBinaryAssoc::collectPropComps {this propCompList} {
if {[$this isInComing]} {
set oppositeClass [$this fromClass]
set thisClass [$this toClass]
} else {
set oppositeClass [$this toClass]
set thisClass [$this fromClass]
}
if {[[$this getClassBrowser] isInFlatViewMode]} {
$thisClass collectPropComps $propCompList
}
set cbPropComp [CBPropComponent new [lindex [$this getComponents] 0]]
$propCompList addPropComponent $cbPropComp
# Qualifier part
if {![$this isInComing]} {
$cbPropComp addLabel [$this getQualifierLabel] \
[$this getQualifierItem] [$this getQualifierWorkItem]
}
# Name part
$cbPropComp addLabel [$this getNameLabel] [$this getNameItem] \
[$this getNameWorkItem]
# Opposite class role part
if {[$this isInComing]} {
$cbPropComp addLabel [$this getFromRoleLabel] \
[$this getFromRoleItem] [$this getFromRoleWorkItem]
} else {
$cbPropComp addLabel [$this getToRoleLabel] \
[$this getToRoleItem] [$this getToRoleWorkItem]
}
# Opposite class name
$oppositeClass collectPropComps $propCompList
}
method CBBinaryAssoc::format {this} {
set prefix ""
if {[[$this getClassBrowser] isInFlatViewMode]} {
if {[$this isInComing]} {
set prefix "[[$this toClass] name]: "
} else {
set prefix "[[$this fromClass] name]: "
}
}
if {[$this isInComing]} {
if {[$this inComingFormattedText] != ""} {
$this formattedText [$this inComingFormattedText]
return $prefix[$this formattedText]
}
} else {
if {[$this outGoingFormattedText] != ""} {
$this formattedText [$this outGoingFormattedText]
return $prefix[$this formattedText]
}
}
set result ""
# Qualifier part
if {![$this isInComing]} {
set qualifier [$this qualifier]
if {$qualifier != ""} {
set result "\[$qualifier\]"
}
}
set result "${result}---"
# Name part
set isDerived [$this getPropertyValue $COMP_DERIVED_ATTR]
if {$isDerived == "1"} {
set result "${result}/"
}
set result "${result}[$this name]"
set result "${result}---"
# Opposite class role part
if {[$this isInComing]} {
set role [$this fromRole]
} else {
set role [$this toRole]
}
if {$role != ""} {
set result "${result}<$role>"
}
set result "${result}--"
if {[$this isInComing]} {
set propertyId $COMP_START_MULT_KIND
} else {
set propertyId $COMP_END_MULT_KIND
}
set propVal [$this getPropertyValue $propertyId]
set result "${result}[CBAssociation::multKindToString $propVal]"
#Opposite class name
if {[$this isInComing]} {
set oppositeClass [$this fromClass]
} else {
set oppositeClass [$this toClass]
}
set result "${result} [$oppositeClass format]"
if {[$this isInComing]} {
$this inComingFormattedText $result
} else {
$this outGoingFormattedText $result
}
$this formattedText $result
return $prefix$result
}
# Do not delete this line -- regeneration end marker