home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cadre Technologies Inc. 1996
- #
- # File: @(#)cbpropview.tcl 1.12
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)cbpropview.tcl 1.12 04 Apr 1996 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} {
- set systemLevelIds [$classBrowser phaseLevelpathIds]
- set currentClass [$classBrowser currentOpenedClass]
- if {$currentClass != ""} {
- set systemV [$currentClass getDefiningSystemVersion]
- if {![$systemV isNil]} {
- set systemLevelIds [join [concat $systemLevelIds \
- [$systemV identity]] /]
- }
- }
- [$this propKnowledgeDB] context $systemLevelIds
-
- $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 "$compLongName($compType)\
- $labLongName($labType)"
- } else {
- set objType $compLongName($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 $compLongName($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
- }
-
-