home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cadre Technologies Inc. 1996
- #
- # File: @(#)edpropcont.tcl /main/hindenburg/1
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)edpropcont.tcl /main/hindenburg/1 12 Sep 1996 Copyright 1996 Cadre Technologies Inc.
-
- # Start user added include file section
- require "itempropin.tcl"
- # End user added include file section
-
- require "propcontai.tcl"
-
- Class EdPropContainer : {PropContainer} {
- constructor
- method destructor
- method existPropertyHolder
- method createPropertyHolder
- method loadProperties
- method editProperties
- method saveProperties
- method quitProperties
- method changeProperty
- method getPropertyValue
- method isPropertyEditable
- method removeProperties
- method removeProperty
- method addSpecificPropDef
- method fillPropInfoMethod
- method getPropInfoMethods
- method storePropInfoMethods
- method startLabel
- method endLabel
- method getPropInfoMethod
- method setPropInfoMethod
- method removePropInfoMethod
- attribute holderComp
- attribute itemRef
- attribute workItem
- attribute itemProperties
- attribute itemPropInfo
- attribute diagPropInfo
- attribute propInfoMethod
- }
-
- global EdPropContainer::propInfoMethodDicts
- set EdPropContainer::propInfoMethodDicts [Dictionary new]
-
-
- constructor EdPropContainer {class this} {
- set this [PropContainer::constructor $class $this]
- $this propInfoMethod [Dictionary new]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method EdPropContainer::destructor {this} {
- # Start destructor user section
- set info [$this itemPropInfo]
- if [isCommand $info] {
- $info delete
- }
- # End destructor user section
- $this PropContainer::destructor
- }
-
- method EdPropContainer::existPropertyHolder {this} {
- if {[$this itemPropInfo] != "" || [$this itemRef] == ""} {
- return 1
- }
- set workItem [[$this itemRef] workItem \
- [[ClientContext::global] currentConfig]]
- $this workItem $workItem
- if [$workItem isNil] {
- return 0
- }
- set itemProperties [$workItem properties]
- if [$itemProperties isNil] {
- return 0
- }
- $this itemPropInfo [ItemPropInfo::getPropInfo $itemProperties]
- $this itemProperties $itemProperties
- return 1
- }
-
- method EdPropContainer::createPropertyHolder {this} {
- set workItem [$this workItem]
- if {$workItem == ""} {
- return
- }
- [[ClientContext::global] currentSystem] \
- declareItem [$workItem item] scopePhaseDef
- $this itemProperties [$workItem properties]
- $this itemPropInfo [ItemPropInfo::getPropInfo [$this itemProperties]]
- }
-
- method EdPropContainer::loadProperties {this} {
- set info [$this itemPropInfo]
- if {$info != ""} {
- $info load
- }
- }
-
- method EdPropContainer::editProperties {this} {
- set info [$this itemPropInfo]
- if {$info != ""} {
- $info edit
- }
- }
-
- method EdPropContainer::saveProperties {this} {
- set info [$this itemPropInfo]
- if [isCommand $info] {
- $info save
- }
- set info [$this diagPropInfo]
- if [isCommand $info] {
- $info save
- }
- }
-
- method EdPropContainer::quitProperties {this} {
- set info [$this itemPropInfo]
- if [isCommand $info] {
- $info quit
- }
- }
-
- method EdPropContainer::changeProperty {this name value defVal} {
- set info [$this [$this getPropInfoMethod $name]]
- if {$info != ""} {
- if [string compare $value $defVal] {
- $info changeProperty $name $value
- } else {
- $info removeProperty $name
- }
- }
- }
-
- method EdPropContainer::getPropertyValue {this name} {
- set info [$this [$this getPropInfoMethod $name]]
- if {$info != ""} {
- return [$info getProperty $name]
- }
- return ""
- }
-
- method EdPropContainer::isPropertyEditable {this name} {
- if {[$this [$this getPropInfoMethod $name]] != ""} {
- return [$this editable]
- }
- return 0
- }
-
- method EdPropContainer::removeProperties {this} {
- set info ""
- if [$this existPropertyHolder] {
- set info [$this itemPropInfo]
- }
- if {$info != ""} {
- $info edit
- }
- [$this propDefinitionSet] foreach propDef {
- $this removeProperty $propDef
- }
- if {$info != ""} {
- $info save
- $info quit
- }
- }
-
- method EdPropContainer::removeProperty {this def} {
- set info [$this [$this getPropInfoMethod [$def name]]]
- if {$info != ""} {
- $info removeProperty [$def name]
- }
- foreach member [$def memberSet] {
- $this removeProperty $member
- }
- }
-
- method EdPropContainer::addSpecificPropDef {this def propInfoMethod} {
- $this addPropDefinition $def
- $this fillPropInfoMethod $def $propInfoMethod
- }
-
- method EdPropContainer::fillPropInfoMethod {this def propInfoMethod} {
- $this setPropInfoMethod [$def name] $propInfoMethod
- foreach member [$def memberSet] {
- $this fillPropInfoMethod $member $propInfoMethod
- }
- }
-
- method EdPropContainer::getPropInfoMethods {this} {
- global EdPropContainer::propInfoMethodDicts
- set infoMethods [${EdPropContainer::propInfoMethodDicts} set \
- [$this propertyKey]]
- if {$infoMethods == ""} {
- return 0
- }
- $this propInfoMethod $infoMethods
- return 1
- }
-
- method EdPropContainer::storePropInfoMethods {this} {
- global EdPropContainer::propInfoMethodDicts
- ${EdPropContainer::propInfoMethodDicts} set [$this propertyKey] \
- [$this propInfoMethod]
- }
-
- method EdPropContainer::startLabel {this} {
- set holderComp [$this holderComp]
- if {![$holderComp isA EditorConnector]} {
- return Start
- }
- set startComp [$holderComp compAtStart]
- set startItem [$startComp nameItem]
- if {$startItem != ""} {
- return [$startItem name]
- }
- return [$startComp longName]
- }
-
- method EdPropContainer::endLabel {this} {
- set holderComp [$this holderComp]
- if {![$holderComp isA EditorConnector]} {
- return End
- }
- set endComp [$holderComp compAtEnd]
- set endItem [$endComp nameItem]
- if {$endItem != ""} {
- return [$endItem name]
- }
- return [$endComp longName]
- }
-
- # Do not delete this line -- regeneration end marker
-
- method EdPropContainer::getPropInfoMethod {this name} {
- return [[$this propInfoMethod] set $name]
- }
-
- method EdPropContainer::setPropInfoMethod {this name newPropInfoMethod} {
- [$this propInfoMethod] set $name $newPropInfoMethod
- }
-
- method EdPropContainer::removePropInfoMethod {this name} {
- [$this propInfoMethod] unset $name
- }
-
-