home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
mtversiona.tcl
< prev
next >
Wrap
Text File
|
1997-09-12
|
5KB
|
198 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)mtversiona.tcl /main/titanic/8
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)mtversiona.tcl /main/titanic/8 12 Sep 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
require mtproperty.tcl
require mtversion.tcl
require mergeinfoo.tcl
# End user added include file section
Class MTVersionable : {BrowsNode} {
constructor
method destructor
method initialize
method open
method removeChildren
method appendChildren
method showMergeInfo
attribute sortable
attribute repObj
}
constructor MTVersionable {class this name repObj} {
set this [BrowsNode::constructor $class $this $name]
$this repObj $repObj
# Start constructor user section
$this sortable 0
# End constructor user section
return $this
}
method MTVersionable::destructor {this} {
# Start destructor user section
if {[.main currentObj] == $this} {
.main currentObj ""
}
# End destructor user section
}
method MTVersionable::initialize {this} {
[$this repObj] initializeInfo
set fromVersion [[$this repObj] fromRepObj]
set name [$fromVersion getInfo Name]
if [$fromVersion isA ConfigVersion] {
set toVersion [[$this repObj] toRepObj]
set name "$name -> [$toVersion getInfo Name]"
}
if [$fromVersion isA PhaseVersion] {
if [.main import] {
set toVersion [[$this repObj] toRepObj]
set name "$name -> [$toVersion getInfo Name]"
}
}
if [$fromVersion typeInLabel] {
append name ".[$fromVersion getInfo Type]"
}
$this config -label $name -hasChildren [$fromVersion hasChildren]
# Set icons and default foldState
set uiType "[$fromVersion getInfo Type]"
set objType "[$fromVersion uiClass]"
set typeSpec [getObjectSpec [.main objectHdlr] "$objType" "$uiType" 0]
if {"$typeSpec" != ""} {
set icon [$typeSpec normalIcon]
set activeIcon [$typeSpec activeIcon]
} else {
set icon ""
set activeIcon ""
}
$this config \
-icon $icon \
-activeIcon $activeIcon \
-foldState 0 \
-activeState 0 \
-selectState 0 \
-hasChildren 1 \
-activated {%this open} \
-selected {%this open}
# Append children if current one is unfolded,
if {! [$this foldState]} {
busy {
$this appendChildren
}
}
}
method MTVersionable::open {this} {
if {[.main currentObj] == $this} {
return
}
busy {
.main currentObj $this
set view [.main infoView]
# show all the version information of this object
# in the information view
$this config -activeState 1 -selectState 1
foreach obj [[.main infoView] objectSet] {
$obj delete
}
.main setCurrentContextVars
$this showMergeInfo
.main selectionChanged
}
}
method MTVersionable::removeChildren {this} {
busy {
# remove current childSet
foreach child [$this childSet] {
$child delete
}
}
}
method MTVersionable::appendChildren {this} {
# remove previous set
$this removeChildren
set rep [$this repObj]
# create a tree element for those element that has
# mergeable components of it's own
# do not show leaf objects (non conflicting objects)
if {![.main showAll] || [.main import]} {
if {![$rep hasConflict] && ![.main import]} {
# do not delete if it's the root object
if {[$this parent] != ""} {
$this delete
return
}
}
}
# do not show leaf objects
if [[$rep childSet] empty] {
$this delete
return
}
[$rep childSet] foreach child {
if ![[$child fromRepObj] isA Version] {
continue
}
global classCount
set node $this.MTVersionable$classCount
incr classCount
# now create the merge tree element
MTVersionable new $node $child
# make this stuff compatible
# with browser TreeNode
[$child fromRepObj] parent [$rep fromRepObj]
$node initialize
}
}
method MTVersionable::showMergeInfo {this} {
global classCount
set path [.main infoView]
# create a info object element for every mergeobject
[[$this repObj] childSet] foreach child {
MergeInfoObject new $path.MergeInfoObject$classCount $child
incr classCount
}
$path sort -column [.main infoView].conflict -column \
[.main infoView].type -column [.main infoView].name
}
# Do not delete this line -- regeneration end marker