home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
confvdbobj.tcl
< prev
next >
Wrap
Text File
|
1997-11-26
|
12KB
|
435 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)confvdbobj.tcl /main/titanic/12
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)confvdbobj.tcl /main/titanic/12 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 ConfVDbObj : {BrowsDbObj VersionObj ConfigVersion} {
method destructor
constructor
method promoter
method addPhaseVersions
method changeLinks
method copyVersion
method deselectObjects
method makeUpToDate
method name
method newObjects
method phaseVersions
method removeObjects
method removeVersion
method selectObject
method versionInLabel
method canBeDragged
}
method ConfVDbObj::destructor {this} {
# Start destructor user section
# End destructor user section
$this BrowsDbObj::destructor
$this VersionObj::destructor
}
constructor ConfVDbObj {class this name} {
set this [ConfigVersion::constructor $class $this $name]
set this [BrowsDbObj::constructor $class $this $name]
set this [VersionObj::constructor $class $this $name]
return $this
}
selfPromoter ConfigVersion {this} {
ConfVDbObj promote $this
}
method ConfVDbObj::promoter {this} {
$this BrowsDbObj::promoter
set customFileVersionSet $this.${CustFVUiObj::uiClass}:0
if {! [isCommand $customFileVersionSet]} {
CustFVUiObj new $customFileVersionSet -parent $this
}
$this customFileVersionSet $customFileVersionSet
module_promoter ConfVDbObj $this
}
method ConfVDbObj::addPhaseVersions {this} {
set proj [$this project]
set phaseList ""
foreach phase ${BrowserProcs::phases} {
set phaseName [lindex $phase 0]
set phaseType [lindex $phase 1]
if {[[$proj findPhase "$phaseName" "$phaseType"] isNil] ||
[[$this findPhaseVersion "$phaseName" "$phaseType"] isNil]} {
lappend phaseList "$phaseName"
}
}
if [lempty $phaseList] {
wmtkinfo "A PhaseVersion already exists for each Phase"
return
}
set objectSpecList ""
foreach phaseName $phaseList {
set id [lsearch -regexp \
${BrowserProcs::phases} \
[format "%s%s" $phaseName {[ |\t|\n\]*}] \
]
set phaseType [lindex [lindex ${BrowserProcs::phases} $id] 1]
set typeSpec [getObjectSpec [$wmttoolObj objectHdlr] \
PhaseVersion $phaseType \
]
if {"$typeSpec" != ""} {
set icon [$typeSpec smallIcon]
} else {
set icon ""
}
lappend objectSpecList [list $icon $phaseName]
}
require "browsviewd.tcl"
set box $wmttoolObj.newPhaseV
ClassMaker::extend BrowsViewDialog NewPhaseVBrowsViewDialog dbObj
NewPhaseVBrowsViewDialog new $box \
-title "New Phase Version" \
-headerSpecList {{Name 20 ascii {none}}} \
-objectSpecList $objectSpecList \
-dbObj $this \
-cancelPressed {%this delete} \
-okPressed {
set proj [[%this dbObj] project]
foreach object [[%this view] selectedSet] {
set phaseName [$object label]
# get phase type
foreach phase ${BrowserProcs::phases} {
if {"[lindex $phase 0]" == "$phaseName"} {
set phaseType [lindex $phase 1]
break
}
}
# find predecessor phase
set predPhase ""
set predName $phaseName
set predType $phaseType
while {! ("$predPhase" != "" && [$predPhase isA Phase])} {
set id 0
set found 0
foreach phase ${BrowserProcs::phases} {
if {"[lindex $phase 0]" == "$predName" &&
"[lindex $phase 1]" == "$predType"} {
set found 1
break
}
incr id 1
}
if {(! $found) || ($id == 0)} {
set predName ""
break
}
set predPhase \
[lindex ${BrowserProcs::phases} [expr $id - 1]]
set predName [lindex $predPhase 0]
set predType [lindex $predPhase 1]
set predPhase [$proj findPhase "$predName" "$predType"]
}
# find successor phase
set succPhase ""
set succName $phaseName
set succType $phaseType
set len [llength ${BrowserProcs::phases}]
while {! ("$succPhase" != "" && [$succPhase isA Phase])} {
set id 0
set found 0
foreach phase ${BrowserProcs::phases} {
if {"[lindex $phase 0]" == "$succName" &&
"[lindex $phase 1]" == "$succType"} {
set found 1
break
}
incr id 1
}
if {(! $found) || ($id >= [expr $len - 1])} {
set succName ""
break
}
set succPhase \
[lindex ${BrowserProcs::phases} [expr $id + 1]]
set succName [lindex $succPhase 0]
set succType [lindex $succPhase 1]
set succPhase [$proj findPhase "$succName" "$succType"]
}
if {"$predPhase" != "" && [$predPhase isA Phase]} {
set script "[%this dbObj] createPhaseVersionBehind \
[list $phaseName] [list $phaseType] $predPhase"
} elseif {"$succPhase" != "" && [$succPhase isA Phase]} {
set script "[%this dbObj] createPhaseVersionBefore \
[list $phaseName] [list $phaseType] $succPhase"
} else {
set lastPhase [$proj lastPhase]
if [$lastPhase isNil] {
set createBehind 0
} else {
set createBehind 1
foreach phase ${BrowserProcs::phases} {
if {"[$lastPhase name]" == "[lindex $phase 0]" &&
"[$lastPhase type]" == "[lindex $phase 1]"} {
set createBehind 0
break
}
}
}
if $createBehind {
set script "[%this dbObj] createPhaseVersionBehind \
[list $phaseName] [list $phaseType] $lastPhase"
} else {
set script "[%this dbObj] createPhaseVersion \
[list $phaseName] [list $phaseType]"
}
}
$wmttoolObj startCommand tcl \
"$script" "" \
"Creating phase version '$phaseName'..." \
{1 0} 1
}
%this delete
}
$box popUp
}
proc ConfVDbObj::associations {} {
return {phaseVersions customFileVersionSet}
}
method ConfVDbObj::changeLinks {this} {
ClassMaker::extend TemplateDialog ChangeLinksTemplateDialog dbObj
ChangeLinksTemplateDialog new $wmttoolObj.changeLink \
-modal yes \
-title "Change Link(s)" \
-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 configVersionLinks] {
if {"[$link configVersion]" == "[%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 ConfVDbObj::childTypes {assoc} {
if {[lsearch -exact "[ConfVDbObj::associations]" "$assoc"] == -1} {
return ""
}
set childTypes [BrowserProcs::childTypes $assoc]
case "$childTypes" in {
{PhaseVersion} {
set childTypes ""
foreach phase ${BrowserProcs::phases} {
set phaseType [lindex $phase 1]
if {[lsearch -exact $childTypes "$phaseType"] != -1} continue
lappend childTypes "$phaseType"
}
return "$childTypes"
}
{default} {
return "$childTypes"
}
}
}
proc ConfVDbObj::controlledLists {} {
return {
"[[$this ConfigVersion::config] configVersionList]"
"[[$this ConfigVersion::config] customFileList]"
"[$this customFileVersionLinkList]"
"[$this phaseVersionLinkList]"
}
}
method ConfVDbObj::copyVersion {this} {
set versionList ""
foreach version [[$this project] configVersions] {
if {"$version" == "$this"} continue
lappend versionList [list \
$version "[[$version ConfigVersion::config] name]"
]
}
BrowserProcs::copyVersion $this $versionList
}
method ConfVDbObj::deselectObjects {this} {
set script ""
foreach obj [$wmttoolObj selectedObjSet] {
if {"$script" != ""} {
append script " ;"
}
append script " $this deselectVersion $obj"
}
$wmttoolObj startCommand tcl "$script" "" "" {1 0} 1
}
proc ConfVDbObj::infoProperties {} {
return [concat \
[BrowserProcs::infoProperties] \
{Status Version Comments Created Updated Frozen "Controlled Actions"
"Created By" "Updated By"} \
]
}
method ConfVDbObj::makeUpToDate {this} {
$this VersionObj::makeUpToDate
}
method ConfVDbObj::name {this} {
return "[[$this ConfigVersion::config] name]"
}
method ConfVDbObj::newObjects {this} {
set script ""
foreach obj [$wmttoolObj selectedObjSet] {
if {"$script" != ""} {
append script " ;"
}
append script " $this derive -phaseVersion $obj"
}
$wmttoolObj startCommand tcl "$script" "" "" {1 0} 1
}
method ConfVDbObj::phaseVersions {this} {
set phaseVersions ""
foreach link [$this phaseVersionLinks] {
set phaseV [$link phaseVersion]
$phaseV setInfo ConfigPhaseLink $link
lappend phaseVersions $phaseV
}
return $phaseVersions
}
method ConfVDbObj::removeObjects {this} {
set box $wmttoolObj.removeWarning
ClassMaker::extend YesNoWarningDialog RemoveObjectsWarningDialog dbObj
RemoveObjectsWarningDialog new $box \
-title "Confirm Phase 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 ConfVDbObj::removeVersion {this} {
BrowserProcs::removeVersion \
"[$this getParent Project]" "[$this ConfigVersion::config]" "$this"
}
method ConfVDbObj::selectObject {this mode} {
busy {
set versionList ""
foreach phaseV [$this phaseVersions] {
set workingList([$phaseV phase]) $phaseV
}
case "$mode" in {
{new} {
set phaseList ""
foreach phase [[$this project] phases] {
if [info exists workingList($phase)] continue
lappend phaseList $phase
}
}
{default} {
set phaseList ""
foreach obj [$wmttoolObj selectedObjSet] {
lappend phaseList [$obj phase]
}
}
}
foreach phase $phaseList {
set phaseName [$phase name]
if [info exists workingList($phase)] {
set working $workingList($phase)
} else {
set working [ORB::nil]
}
foreach version [$phase phaseVersions] {
if [$version isSame $working] continue
if {"[$version status]" == "working"} continue
lappend versionList [list $version "$phaseName"]
}
}
BrowserProcs::selectObject $this $versionList $mode
}
}
method ConfVDbObj::versionInLabel {this} {
return 1
}
method ConfVDbObj::canBeDragged {this} {
return 1
}
# Do not delete this line -- regeneration end marker