home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cadre Technologies Inc. 1995
- #
- # File: @(#)components.tcl /main/titanic/2
- # Author: Harm Leijendeckers
- # Description: Report on Components and properties
- # Usage in: SystemVersion and FileVersion
- #
- #---------------------------------------------------------------------------
- # SccsId = @(#)components.tcl /main/titanic/2 27 Aug 1997 Copyright 1996 Cadre Technologies Inc.
-
-
- Class ReportCompObject : {GCObject} {
- constructor
-
- attribute component
- attribute name
- }
-
-
- constructor ReportCompObject {class this component name} {
- set this [GCObject::constructor $class $this]
- $this component $component
- $this name $name
- return $this
- }
-
-
- Class ReportComponents : {ReportBase} {
- constructor
-
- attribute printProps
-
- method systemReport
- method fileReport
-
- method doReport
- method getName
- }
-
-
- constructor ReportComponents {class this} {
- set this [ReportBase::constructor $class $this]
- if { [lsearch $Options "properties"] != -1 } {
- $this printProps 1
- } else {
- $this printProps 0
- }
- $this reportName "Components"
- return $this
- }
-
-
- method ReportComponents::systemReport {this} {
- GCControl collectInterval 9999
- if { [[[$this phaseV] phase] type] == "Implementation" } return
-
- set components [query -s components "file.type != cdm" \
- [[$this systemV] localFileVersions]]
- return [$this doReport components 1]
- }
-
-
- method ReportComponents::fileReport {this} {
- set components [[$this fileV] components]
- return [$this doReport components 0]
- }
-
-
- method ReportComponents::doReport {this v_components onSystemLevel} {
- upvar $v_components components
- if [lempty $components] { return 0 }
-
- foreach comp $components {
- lappend compobjects [ReportCompObject new $comp [$this getName $comp]]
- }
-
- set report [$this report]
-
- $report header {
- [$this report] print Component 46
- [$this report] print Type 22
- if $onSystemLevel {
- [$this report] print Diagram
- }
- [$this report] line
- [$this report] line
- }
-
- # Sorting order can be changed here (component.type <-> name).
- foreach compobj [osort component.type name $compobjects] {
- set comp [$compobj component]
- $report print [$compobj name] 45
- $report space
- $report print [$comp type] 21
- if $onSystemLevel {
- $report space
- $report print [[$comp diagram] text]
- }
- $report line
-
- # print properties
- if [$this printProps] {
- $this showProperties $comp
- } else {
- # elseif ![lempty $Options] to show no props with no options
- $this showProperties $comp "$Options"
- }
- }
-
- $report page
- $report remove header
-
- return 0
- }
-
-
- method ReportComponents::getName {this comp} {
- set queryConstraint "type in {name name_type event}"
- case [$comp objType] in {
- Node
- { return [query -s value $queryConstraint $comp.labels] }
-
- ConnectedNode
- {
- set from [$comp from]
- if {[$from isA Segment] &&
- "[[$from connector] type]" == "nary_link_conn"} {
- set name [query -s value $queryConstraint \
- $from.connector.from.labels]
- } else {
- set name [query -s value $queryConstraint $from.labels]
- set value [query -s value $queryConstraint $comp.labels]
- }
- return "($name) $value"
- }
-
- Connector
- {
- set name [query -s value $queryConstraint $comp.labels]
- if {"$name" != ""} {
- return $name
- }
- if [[$comp from] isA Segment] {
- set from [query -s value $queryConstraint \
- $comp.from.connector.labels]
- } else {
- set from [query -s value $queryConstraint \
- $comp.from.labels]
- }
- if [[$comp to] isA Segment] {
- set to [query -s value $queryConstraint \
- $comp.to.connector.labels]
- } else {
- set to [query -s value $queryConstraint \
- $comp.to.labels]
- }
- return "($from - $to)"
- }
-
- { Segment Row Cell }
- {
- # should not occur
- return ""
- }
- }
- }
-
- set executeMe [ReportComponents new]
-