home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
cbpropview.tcl
< prev
next >
Wrap
Text File
|
1997-08-29
|
6KB
|
188 lines
#---------------------------------------------------------------------------
#
# (c) Cadre Technologies Inc. 1996
#
# File: @(#)cbpropview.tcl /main/titanic/2
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)cbpropview.tcl /main/titanic/2 29 Aug 1997 Copyright 1996 Cadre Technologies Inc.
# Start user added include file section
require "cbpropcmpl.tcl"
require "cbpropcomp.tcl"
require "cbproplabe.tcl"
require "cbpropitem.tcl"
require "cbpropcont.tcl"
require "propstruct.tcl"
require "propertydi.tcl"
require "labelpartn.tcl"
require "cblongname.tcl"
# End user added include file section
Class CBPropViewer : {Object} {
constructor
method destructor
method showProperties
method createPropContainers
method indent
method releasePropContainers
method addPropContainer
method removePropContainer
attribute propContainerSet
attribute propKnowledgeDB
}
constructor CBPropViewer {class this name propKnowledgeDB} {
set this [Object::constructor $class $this $name]
$this propKnowledgeDB $propKnowledgeDB
$this propContainerSet [List new]
# Start constructor user section
# End constructor user section
return $this
}
method CBPropViewer::destructor {this} {
# Start destructor user section
# End destructor user section
}
method CBPropViewer::showProperties {this entry} {
$classBrowser updateClientContext [$entry getCBClass]
$this createPropContainers $entry
# Don't reuse a PropertyDialog:
# the initial size does not change to fit new contents.
PropertyDialog new $classBrowser.showProperties $this \
-editable 0 \
-helpPressed "$classBrowser helpOnName showProperties"
$classBrowser.showProperties popUp
}
method CBPropViewer::createPropContainers {this entry} {
set cbPropCompList [CBPropCmpList new]
$entry collectPropComps $cbPropCompList
set propStructList [List new]
set phaseV [[ClientContext::global] currentPhase]
PropLocation new .propLocation \
-phaseType [[$phaseV phase] type] \
-diagramType $CAD_TYPE
set maxNameLength 0
[$cbPropCompList propComponentSet] foreach propComp {
set count 0
set compType [[$propComp component] type]
.propLocation componentType $compType
set indent [$this indent $compType]
[$propComp propLabelSet] foreach propLabel {
set labType [[$propLabel label] type]
.propLocation labelType $labType
[$propLabel propItemSet] foreach propItem {
set itemType [[$propItem item] type]
.propLocation containerKind Component
.propLocation containerType $compType
set compPropDefs [[$this propKnowledgeDB] \
definitions .propLocation]
.propLocation containerKind Item
.propLocation containerType $itemType
set itemPropDefs [[$this propKnowledgeDB] \
definitions .propLocation]
if {"$compPropDefs$itemPropDefs" == ""} {
continue
}
set objName $indent[[$propItem item] name]
set objNameLength [string length $objName]
if {$objNameLength > $maxNameLength} {
set maxNameLength $objNameLength
}
set labIdx ${compType},${labType},${itemType}
if [info exists labelPartName($labIdx)] {
set objType $labelPartName($labIdx)
} else {
if {[info exists multiLabelComp($compType)]} {
set objType \
"[ShortLongName::longName $compType]\
[ShortLongName::longName $labType]"
} else {
set objType [ShortLongName::longName $compType]
}
}
# Note: attribute itemRef is used to store the workItem!
$propStructList append [PropStruct new \
-name $objName \
-type $objType \
-compPropDefs $compPropDefs \
-containerKey [.propLocation asString] \
-component [$propComp component] \
-itemRef [$propItem workItem] \
-itemPropDefs $itemPropDefs]
incr count
}
}
if {$count == 0} {
.propLocation containerKind Component
.propLocation containerType $compType
.propLocation labelType ""
set compPropDefs [[$this propKnowledgeDB] \
definitions .propLocation]
if {[llength $compPropDefs] > 0} {
$propStructList append [PropStruct new \
-type [ShortLongName::longName $compType] \
-compPropDefs $compPropDefs \
-containerKey [.propLocation asString] \
-component [$propComp component]]
}
}
}
.propLocation delete
set formatString "%-*.*s %s"
set cntList [List new]
$propStructList foreach propStruct {
set pres [format $formatString $maxNameLength $maxNameLength \
[$propStruct name] [$propStruct type]]
# Note: attribute itemRef was used to store the workItem!
set wrkItem [$propStruct itemRef]
if {$wrkItem == "" || [$wrkItem isNil]} {
set itemProperties [ORB::nil]
} else {
set itemProperties [$wrkItem properties]
}
set cnt [CBPropContainer new -editable 0 \
-propertyKey [$propStruct containerKey] \
-propertyPresentation $pres \
-holderComp [$propStruct component] \
-holderItemProperties $itemProperties]
foreach propDef [$propStruct compPropDefs] {
$cnt addSpecificPropDef $propDef holderComp
}
foreach propDef [$propStruct itemPropDefs] {
$cnt addSpecificPropDef $propDef holderItemProperties
}
$cntList append $cnt
}
$this propContainerSet $cntList
}
method CBPropViewer::indent {this compType} {
if {$compType == $CDM_PARAM} {
return " "
}
return ""
}
method CBPropViewer::releasePropContainers {this} {
# Not applicable !!
}
# Do not delete this line -- regeneration end marker
method CBPropViewer::addPropContainer {this newPropContainer} {
[$this propContainerSet] append $newPropContainer
}
method CBPropViewer::removePropContainer {this oldPropContainer} {
[$this propContainerSet] removeValue $oldPropContainer
}