home *** CD-ROM | disk | FTP | other *** search
- Class GenItemProp : {Object} {
- method destructor
- constructor
- method getDocStructure
- method getStructureLines
- method match
- attribute document
- }
-
- method GenItemProp::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- constructor GenItemProp {class this name document} {
- set this [Object::constructor $class $this $name]
- $this document $document
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method GenItemProp::getDocStructure {this fileTypes itemType componentType labelType properties {prefix ""}} {
-
- set structure ""
- set first 1
-
- set sv [[$this document] documentedSystem]
-
- if [$sv isNil] {
- wmtkerror "Invalid documented system"
- return $structure
- }
-
- foreach fv [$sv localFileVersions] {
- if [$this match $fileTypes $fv] {
- set strLine [$this getStructureLines $fv $itemType \
- $componentType $labelType $properties $first $prefix]
- if {! [lempty $strLine]} {
- if $first {
- set structure $strLine
- } else {
- set structure "$structure\n$strLine"
- }
- set first 0
- }
- }
- }
-
- return $structure
- }
-
- method GenItemProp::match {this fileTypes fileVersion} {
-
- if {[lsearch $fileTypes [[$fileVersion file] type]] == -1} {
- return 0
- }
- return 1
- }
-
- method GenItemProp::getStructureLines {this fileVersion itemType componentType labelType properties first {prefix ""}} {
-
- set indent "+"
- set line ""
- set lines ""
-
- # get all the items with given componentType and itemType
-
- if {![$fileVersion isA Diagram]} {
- return $lines
- }
-
- set confV [[$this document] configVersion]
- foreach comp [$fileVersion components] {
- if {[$comp type] != $componentType} continue
-
- set lbls [$comp labels]
- if [$comp isA Connector] {
- # special: for connectors look at segments
- foreach segm [$comp segments] {
- set lbls [concat $lbls [$segm labels]]
- }
- }
-
- foreach label $lbls {
- if {[$label type] != $labelType} continue
-
- foreach itemRef [$label itemRefs] {
- set item [$itemRef item]
- if {[$item type] != $itemType} continue
-
- set workItem [$fileVersion findDeclaration $item $confV]
- set name [$workItem qualifiedName :]
-
- # add propertieNames to get unique names
- # max 2 prop names
- if {$properties != "*"} {
- set prCount 0
- foreach prop $properties {
- if {$prCount > 1} {
- break
- }
- incr prCount
- append name "_$prop"
- }
- }
-
- # skip phaseRef workItems
- if {[$workItem scope] == "scopePhaseRef"} continue
-
- # skip when there are no properties
- set prop [$workItem properties]
- if {[$prop isNil] || [lempty [$prop properties]]} continue
- if $first {
- set first 0
- } else {
- set indent "="
- }
- set itemKeeper [$workItem owner]
- if [$itemKeeper isA SystemVersion] {
- set keeper [[$itemKeeper system] name]
- } else {
- set keeper [[$itemKeeper file] name]
- }
- set line "${keeper}_${itemType}_$name | $indent | | Itemprop \
- | | | $fileVersion | $workItem | $properties | Itemprop"
- if {$prefix != ""} {
- set line "${prefix}_$line"
- }
- set lines "$lines\n$line"
- }
- }
- }
-
- return $lines
- }
-
- # Do not delete this line -- regeneration end marker
-
-