home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
phasevdbob.tcl
< prev
next >
Wrap
Text File
|
1997-11-26
|
16KB
|
571 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)phasevdbob.tcl /main/titanic/19
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)phasevdbob.tcl /main/titanic/19 26 Nov 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
require "browsdbobj.tcl"
require "versionobj.tcl"
Class PhaseVDbObj : {BrowsDbObj VersionObj PhaseVersion} {
method destructor
constructor
method promoter
method addDocumentVersion
method addSystemVersion
method allowsDrop
method browserType
method changeLinks
method compareWithPrevPhase
method copy
method copyVersion
method deselectObjects
method importFromPrevPhase
method importObject
method initializeInfo
method linkStatus
method makeUpToDate
method name
method newObjects
method phase
method prevPhaseExists
method removeObjects
method removeVersion
method selectObject
method systemVersions
method systemOnlyVersions
method canBeDragged
attribute prevPhaseV
}
method PhaseVDbObj::destructor {this} {
# Start destructor user section
# End destructor user section
$this BrowsDbObj::destructor
$this VersionObj::destructor
}
constructor PhaseVDbObj {class this name} {
set this [PhaseVersion::constructor $class $this $name]
set this [BrowsDbObj::constructor $class $this $name]
set this [VersionObj::constructor $class $this $name]
return $this
}
selfPromoter PhaseVersion {this} {
PhaseVDbObj promote $this
}
method PhaseVDbObj::promoter {this} {
$this BrowsDbObj::promoter
set customFileVersionSet $this.${CustFVUiObj::uiClass}:0
if {! [isCommand $customFileVersionSet]} {
CustFVUiObj new $customFileVersionSet -parent $this
}
$this customFileVersionSet $customFileVersionSet
module_promoter PhaseVDbObj $this
}
method PhaseVDbObj::addDocumentVersion {this} {
# redefined in docwriter module
}
method PhaseVDbObj::addSystemVersion {this} {
require "newobjentr.tcl"
if {! [isCommand $wmttoolObj.newSystemV]} {
NewObjEntryDlg new $wmttoolObj.newSystemV \
-title "New System Version" \
-message "System Name:" \
-okPressed {
set sysName [%this entry]
set sysType [lindex ${BrowserProcs::systemTypes} 0]
set configV [[%this dbObj] getParent ConfigVersion]
set script "[%this dbObj] createSystemVersion \
[list $sysName] cl [list $sysType] $configV"
$wmttoolObj startCommand tcl \
"$script" "" \
"Creating $sysType version '$sysName'..." \
{1 0} 1
}
}
$wmttoolObj.newSystemV dbObj $this
$wmttoolObj.newSystemV popUp
}
method PhaseVDbObj::allowsDrop {this uiClass} {
if {"$uiClass" != "SystemVersion"} {
return 0
}
return 1
}
proc PhaseVDbObj::associations {} {
return {systemVersions customFileVersionSet}
}
method PhaseVDbObj::browserType {this} {
return [[$this phase] type]
}
method PhaseVDbObj::changeLinks {this} {
ClassMaker::extend TemplateDialog ChangeLinksTemplateDialog dbObj
ChangeLinksTemplateDialog new $wmttoolObj.changeLink \
-modal yes \
-title "Change Link Status" \
-dbObj $this \
-helpPressed {.main helpOnName changeLink} \
-cancelPressed {%this delete} \
-okPressed {
set status [%this.top.status selected]
set script ""
foreach obj [$wmttoolObj selectedObjSet] {
set found 0
foreach link [$obj phaseVersionLinks] {
if {"[$link phaseVersion]" == "[%this dbObj]"} {
set found 1
break
}
}
if {! $found} {
wmtkerror "link to [$obj getInfo Type] \
'[$obj getInfo Name]' not found"
continue
}
if {"$script" != ""} {
append script " ;"
}
append script " $link status $status"
}
if {"$script" != ""} {
$wmttoolObj startCommand tcl "$script" "" "" {1 0} 1
}
%this delete
}
interface DlgColumn $wmttoolObj.changeLink.top {
Label messageLab {
text "Link Status:"
}
VerRadioGroup status {
entrySet {fixed dynamicFrozen}
}
}
if {[llength [$wmttoolObj selectedObjSet]] == 1} {
$wmttoolObj.changeLink.top.status selected \
[[lindex [$wmttoolObj selectedObjSet] 0] getInfo Link]
} else {
$wmttoolObj.changeLink.top.status selected fixed
}
$wmttoolObj.changeLink popUp
}
proc PhaseVDbObj::childTypes {assoc} {
if {[lsearch -exact "[PhaseVDbObj::associations]" "$assoc"] == -1} {
return ""
}
set childTypes [BrowserProcs::childTypes $assoc]
if {"$childTypes" == "SystemVersion"} {
set childTypes ""
foreach systemType ${BrowserProcs::systemTypes} {
set firstChar [string toupper [string range $systemType 0 0]]
set type "${firstChar}[string range $systemType 1 end]"
lappend childTypes [format "%sVersion" $type]
}
}
return $childTypes
}
method PhaseVDbObj::compareWithPrevPhase {this} {
require "comparepha.tcl"
ComparePhaseDlg new $wmttoolObj.compareWithPrevPhase \
-dbObj $this \
-title "Compare With Previous Phase" \
-helpPressed {.main helpOnName compareWithPrevPhase}
$wmttoolObj.compareWithPrevPhase popUp
}
proc PhaseVDbObj::controlledLists {} {
return {
"[[$this phase] customFileList]"
"[$this customFileVersionLinkList]"
"[[$this phase] phaseVersionList]"
"[[$this phase] systemList]"
"[$this systemVersionLinkList]"
}
}
method PhaseVDbObj::copy {this args} {
set newSysv ""
set argc [llength $args]
set flag [lindex $args 0]
case "$flag" in {
{-systemVersion} {
if {$argc <= 3} {
set copyCmd "$this PhaseVersion::copy $args"
set newSysV [eval $copyCmd]
return $newSysV
}
set sysV [lindex $args 1]
set editPasteCmdBusy [lindex $args [expr $argc -1]]
set sys [$sysV system]
set sysName [$sys name]
set sysType [$sys type]
set oldSysV [$this findSystemVersion $sysName $sysType]
if {! [$oldSysV isNil]} {
$this deselectVersion $oldSysV
if $editPasteCmdBusy {
[.main undoCommand] addDeselected $oldSysV
}
}
set newSysV [eval \
$this PhaseVersion::copy [lrange $args 0 [expr $argc -3]]]
if {$editPasteCmdBusy && (! [$newSysV isNil])} {
[.main undoCommand] addObject $newSysV
}
}
{default} {
set copyCmd "$this PhaseVersion::copy $args"
set newSysV [eval $copyCmd]
}
}
return $newSysV
}
method PhaseVDbObj::copyVersion {this} {
set versionList ""
set myName [$this name]
foreach version [[$this phase] phaseVersions] {
if {"$version" == "$this"} continue
lappend versionList [list $version "$myName"]
}
BrowserProcs::copyVersion $this $versionList
}
method PhaseVDbObj::deselectObjects {this} {
set script ""
foreach obj [$wmttoolObj selectedObjSet] {
if {"$script" != ""} {
append script " ;"
}
append script " $this deselectVersion $obj"
}
$wmttoolObj startCommand tcl "$script" "" "" {1 0} 1
}
method PhaseVDbObj::importFromPrevPhase {this mode} {
foreach sysV [$this getChildSet systemVersions] {
set sys [$sysV system]
if {"[$sys type]" != "system"} continue
set currentList([$sys name]) 1
}
set prevSysList ""
foreach sysV [[$this prevPhaseV] systemVersions] {
set sys [$sysV system]
if {"[$sys type]" != "system"} continue
if [info exists currentList([$sys name])] continue
lappend prevSysList $sys
}
if [lempty $prevSysList] {
wmtkinfo "There are no new systems in the previous Phase Version"
return
}
case "$mode" in {
{specific} {
set typeSpec [getObjectSpec [$wmttoolObj objectHdlr] \
SystemVersion SystemVersion \
]
if {"$typeSpec" != ""} {
set icon [$typeSpec smallIcon]
} else {
set icon ""
}
set headerSpecList {{Name 25 ascii {increasing 1}}}
set objectSpecList ""
foreach sys $prevSysList {
lappend objectSpecList [list $icon [$sys name]]
}
require "browsviewd.tcl"
set box $wmttoolObj.importSystems
ClassMaker::extend BrowsViewDialog ImpSysBrowsViewDialog dbObj
ImpSysBrowsViewDialog new $box \
-title "Import Systems" \
-headerSpecList $headerSpecList \
-objectSpecList $objectSpecList \
-objectList $prevSysList \
-dbObj $this \
-cancelPressed {%this delete} \
-okPressed {
set importSysList ""
foreach object [[%this view] selectedSet] {
lappend importSysList "[[$object object] identity]"
}
BrowserProcs::importSystems $importSysList
%this delete
}
$box popUp
}
{new} {
BrowserProcs::importSystems ""
}
}
}
method PhaseVDbObj::importObject {this context node} {
set phaseVId [lindex $context 2]
if {$phaseVId == [$this getInfo Identity]} {
wmtkmessage "Can not import object into its own parent"
if [isCommand [.main undoCommand]] {
[.main undoCommand] delete
}
return 0
}
set phaseV [BrowserProcs::id2obj $phaseVId PhaseVersion $node]
set dstType [$this getInfo Type]
set srcType [$phaseV getInfo Type]
if {"$srcType" != "$dstType" &&
("$srcType" == "Implementation" || "$dstType" == "Implementation")} {
wmtkmessage "Can not import from '$srcType' to '$dstType'"
if [isCommand [.main undoCommand]] {
[.main undoCommand] delete
}
return 0
}
# Make sure SystemVersion exists
set sysVId [lindex $context 3]
if {[catch {set sysV [BrowserProcs::id2obj $sysVId SystemVersion $node]}] ||
[catch {$sysV system}]} {
wmtkinfo "Can not import [lindex $context 4] because it is removed"
if [isCommand [.main undoCommand]] {
[.main undoCommand] delete
}
return 1
}
set myConfV [$node getParent ConfigVersion]
set editPasteCmdBusy [.main undoCommandBusy EditPasteCmd]
if {"$srcType" == "Implementation"} {
# The ClientContext must be set to the source
# system in order to determine the file's path
set clientContext [ClientContext::global]
set currentSysV [$clientContext currentSystem]
if {([llength $context] >= 6) && ([$currentSysV isNil] ||
[$currentSysV getInfo Identity] != $sysVId)} {
set levelIds [$clientContext currentLevelIdString]
while {! [[$clientContext currentProject] isNil]} {
$clientContext upLevel
}
$clientContext downLevelId \
[BrowserProcs::id2obj [lindex $context 0] Project $node]
$clientContext downLevelId \
[BrowserProcs::id2obj [lindex $context 1] ConfigVersion $node]
$clientContext downLevelId $phaseV
$clientContext downLevelId $sysV
} else {
set levelIds ""
}
}
# Remove imported object in case of a cut operation
if {[.main undoCommandBusy EditPasteCmd] &&
"[[.main undoCommand] operation]" == "cut"} {
$phaseV cutVersion $sysV
}
set script \
"$this copy -systemVersion $sysV $myConfV $node $editPasteCmdBusy"
if {$this == [[.main currentObj] browsUiObj]} {
set update 1
} else {
set update 0
}
$wmttoolObj startCommand tcl \
"$script" "" \
"Copying [$sysV getInfo Text]" \
[list $update 0] 1
if {"$srcType" == "Implementation" && "$levelIds" != ""} {
$clientContext setLevelIds $levelIds
}
return 1
}
proc PhaseVDbObj::infoProperties {} {
return [concat \
[BrowserProcs::infoProperties] \
{Status Link Version Comments Created Updated Frozen \
"Controlled Actions" "Created By" "Updated By"} \
]
}
method PhaseVDbObj::initializeInfo {this dummy} {
set oldLink [[$this info] set ConfigPhaseLink]
[$this info] contents ""
$this setInfo ConfigPhaseLink $oldLink
}
method PhaseVDbObj::linkStatus {this} {
return [[[$this info] set ConfigPhaseLink] status]
}
method PhaseVDbObj::makeUpToDate {this} {
$this VersionObj::makeUpToDate
}
method PhaseVDbObj::name {this} {
return "[[$this phase] name]"
}
method PhaseVDbObj::newObjects {this} {
set script ""
set confV [$this getParent ConfigVersion]
foreach obj [$wmttoolObj selectedObjSet] {
if {"$script" != ""} {
append script " ;"
}
append script " $this derive -systemVersion $obj $confV"
}
$wmttoolObj startCommand tcl "$script" "" "" {1 0} 1
}
method PhaseVDbObj::phase {this} {
if {[catch {set phase [[[$this info] set ConfigPhaseLink] phase]}] ||
[$phase isNil]} {
global errorInfo
set errorInfo ""
global errorCode
set errorCode ""
return [$this PhaseVersion::phase]
}
return $phase
}
method PhaseVDbObj::prevPhaseExists {this} {
set confV [$this getParent ConfigVersion]
set prevPhaseV [$this previous $confV]
if {! [$prevPhaseV isA PhaseVersion]} {
return 0
}
$this prevPhaseV $prevPhaseV
return 1
}
method PhaseVDbObj::removeObjects {this} {
set box $wmttoolObj.removeWarning
ClassMaker::extend YesNoWarningDialog RemoveObjectsWarningDialog dbObj
RemoveObjectsWarningDialog new $box \
-title "Confirm System Version Delete" \
-message [BrowserProcs::removeMessage] \
-dbObj $this \
-noPressed {%this delete} \
-yesPressed {
set dbObj [%this dbObj]
set script ""
foreach obj [$wmttoolObj selectedObjSet] {
if {"$script" != ""} {
append script " ;"
}
append script " $dbObj removeObject $obj"
}
$wmttoolObj startCommand tcl "$script" "" "" {1 0} 1
%this delete
}
$box delCancelButton
$box popUp
}
method PhaseVDbObj::removeVersion {this} {
set versionList ""
foreach version [[$this phase] phaseVersions] {
if [$version isLeaf] {
lappend versionList $version
}
}
BrowserProcs::removeVersion \
"[$this getParent ConfigVersion]" "[$this phase]" "$versionList"
}
method PhaseVDbObj::selectObject {this mode} {
busy {
set versionList ""
foreach sysV [$this systemVersions] {
set workingList([$sysV system]) $sysV
}
case "$mode" in {
{new} {
set sysList ""
foreach sys [[$this phase] systems] {
if [info exists workingList($sys)] continue
lappend sysList $sys
}
}
{default} {
set sysList ""
foreach obj [$wmttoolObj selectedObjSet] {
lappend sysList [$obj system]
}
}
}
foreach sys $sysList {
set sysName [$sys name]
if [info exists workingList($sys)] {
set working $workingList($sys)
} else {
set working [ORB::nil]
}
foreach version [$sys systemVersions] {
if [$version isSame $working] continue
if {"[$version status]" == "working"} continue
lappend versionList [list $version "$sysName"]
}
}
BrowserProcs::selectObject $this $versionList $mode
}
}
method PhaseVDbObj::systemVersions {this} {
set systemVersions ""
foreach link [$this systemVersionLinks] {
set sysV [$link systemVersion]
$sysV setInfo PhaseSystemLink $link
lappend systemVersions $sysV
}
return $systemVersions
}
method PhaseVDbObj::systemOnlyVersions {this} {
set sysOnlyV {}
foreach sysV [$this systemVersions] {
if {[[$sysV system] type] != "system"} continue
lappend sysOnlyV $sysV
}
return $sysOnlyV
}
method PhaseVDbObj::canBeDragged {this} {
return 1
}
# Do not delete this line -- regeneration end marker