home *** CD-ROM | disk | FTP | other *** search
- #--------------------------------------------------------------------------->"
- #
- # (c) Cayenne Software 1996
- #
- # File: @(#)stcategories.tcl /main/titanic/2
- # Description: Report on categories (for Smalltalk)
- #
- #---------------------------------------------------------------------------
- # SccsId = @(#)stcategories.tcl /main/titanic/2 9 Jan 1997 Copyright 1996 Cayenne Software
-
-
- Class ReportSTCategories : {ReportBase} {
- constructor
- method systemReport
- method fileReport
-
- method doReport
- attribute categoryToClass
- }
-
-
- constructor ReportSTCategories {class this} {
- set this [ReportBase::constructor $class $this]
- $this reportName Categories
- $this categoryToClass [Dictionary new]
- return $this
- }
-
-
- method ReportSTCategories::systemReport {this} {
- set allClassItems [query -s file.item \
- "file.type == cdm" \
- [[$this systemV] localFileVersions]]
- return [$this doReport $allClassItems]
- }
-
-
- method ReportSTCategories::fileReport {this} {
- set allClassItems [query -u -s labels.itemRefs.item \
- "type == cad_class" \
- [[$this fileV] nodes]]
- return [$this doReport $allClassItems]
- }
-
-
- method ReportSTCategories::doReport {this classItems} {
- if [lempty $classItems] { return 0 }
-
- set class_props [lvarpop Options]
- set report [$this report]
- set cv [$this configV]
- set sv [$this systemV]
- set pv [$this phaseV]
-
- # sort out default category
- set defaultCategory [m4_var get M4_st_default_category]
-
- foreach classItem [osort name $classItems] {
- set name [$classItem name]
-
- # find category
- #
- set wi [$sv findDeclaration $classItem $cv]
- set category ""
- if { ![$wi isNil] && ![[$wi properties] isNil] } {
- foreach property [[$wi properties] properties] {
- if { [$property name] == "classCategory" } {
- set category [$property value]
- }
- }
- }
-
- # use system or diagram name as default
- if { $category == "" } {
- if { $defaultCategory == "Diagram" } {
- $pv getDecompositions $classItem [$this configV] \
- {decompComponents decompParents decompLeafs} \
- "" systemVersions fileVersions
-
- if { $fileVersions != "" } {
- set category [[[lindex $fileVersions 0] file] name]
- }
- } else {
- set category [[$sv system] name]
- }
- set name "$name (by default)"
- }
-
- if { ![[$this categoryToClass] exists $category] } {
- [$this categoryToClass] set $category [List new]
- }
- [[$this categoryToClass] set $category] append $name
- }
-
- foreach category [lsort [[$this categoryToClass] names]] {
- set nameList [[$this categoryToClass] set $category]
- if { $category == "" } {
- set categoryDescription "Default Category"
- } else {
- set categoryDescription "Category $category"
- }
- $report print $categoryDescription\: line
- $report print = [string length $categoryDescription] fill line
- $report line
- $nameList foreach className {
- $report print "$className "
- $report line
- }
- $report line
- $report line
- }
-
- if { [[$executeMe report] pageno] || [[$executeMe report] lineno] } {
- $report page
- }
-
- return 0
- }
-
-
- set executeMe [ReportSTCategories new]
-