home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
genitempro.tcl
< prev
next >
Wrap
Text File
|
1996-05-29
|
3KB
|
133 lines
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} {
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]
if {![lempty $strLine]} {
if {$first == "1"} {
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} {
set indent "+"
set line ""
set lines ""
# get all the items with given componentType and itemType
if {![$fileVersion isA Diagram]} {
return $lines
}
foreach comp [$fileVersion components] {
if {[$comp type] != $componentType} continue
foreach label [$comp labels] {
if {[$label type] != $labelType} continue
set lab [rmWhiteSpace [$label value]]
# add propertieNames to get unique names
# max 2 prop names
if {$properties != "*"} {
set prCount 0
foreach prop $properties {
if {$prCount > 1} {
break
}
incr prCount
set lab "${lab}_$prop"
}
}
foreach itemRef [$label itemRefs] {
set item [$itemRef item]
if {[$item type] != $itemType} continue
set workItem [$fileVersion \
findDeclaration $item \
[[ClientContext::global] \
currentConfig]]
# skip phaseRef workItems
if {[$workItem scope] == "phaseRef"} continue
# skip when there are no properties
set prop [$workItem properties]
if {[$prop isNil] ||
[lempty [$prop properties]]} continue
if {!$first} {
set indent "="
} else {
set first 0
}
set itemKeeper [$workItem owner]
if [$itemKeeper isA SystemVersion] {
set name [[$itemKeeper system] name]
} else {
set name [[$itemKeeper file] name]
}
set line "\
p_${name}_${itemType}_$lab | $indent \
| | Itemprop | | | $fileVersion \
| $workItem | $properties | Itemprop"
set lines "$lines\n$line"
}
}
}
return $lines
}
# Do not delete this line -- regeneration end marker