home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
repmodelbr.tcl
< prev
next >
Wrap
Text File
|
1997-11-14
|
4KB
|
152 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)repmodelbr.tcl /main/titanic/6
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)repmodelbr.tcl /main/titanic/6 14 Nov 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
require modelreser.tcl
require modelunres.tcl
# End user added include file section
require "repobjbrow.tcl"
Class RepModelBrowser : {RepObjBrowser} {
constructor
method destructor
method fillList
method selectionChanged
method changeStatus
method statusChanged
}
constructor RepModelBrowser {class this name view} {
set this [RepObjBrowser::constructor $class $this $name $view]
# Start constructor user section
$this config \
-title "Model Browser" \
-helpPressed { [%this view] helpOnName modelBrowser }
set corp [[[$this view] rep] currentCorporate]
[$this objLabel] text "Models in corporate '[$corp name]'"
[$this statusLabel] text "Reserved:"
[$this statusValue] text ""
[$this statusChange] label "Change..."
[$this statusChange] activated "busy { $this changeStatus }"
$this selectionChanged
# End constructor user section
return $this
}
method RepModelBrowser::destructor {this} {
# Start destructor user section
# End destructor user section
$this RepObjBrowser::destructor
}
proc RepModelBrowser::splitModelName {name} {
set nt [splitFileName $name]
set name [lindex $nt 0]
set type [lindex $nt 1]
if {$name == "" || $type == ""} {
error "Invalid model name '$name'; must have format <name>.<type>."
}
return $nt
}
method RepModelBrowser::fillList {this} {
set corp [[[$this view] rep] currentCorporate]
[$this objList] setHeaderLabels { Name Type Reserved By At Comments }
foreach model [$corp models] {
set name [$model name]
set type [$model type]
set nameType ${name}-${type}
regsub -all {[\. ]} $nameType {___} nameType
if [$model reserved] {
set status "Yes"
set user [$model reserveUser]
set date [clock format [$model reserveTime]]
set comments [$model reserveComments]
} else {
set status "No"
set date ""
set user ""
set comments ""
}
[$this objMap] set $nameType $model
BrowsObject new [$this objList].$nameType \
-smallIcon model_16 \
-label $name \
-details [list $type $status $user $date $comments]\
-activated "$this doubleClicked"
}
}
method RepModelBrowser::selectionChanged {this} {
set model [$this selectedObject]
if [$model isNil] {
[$this dirField] text ""
[$this statusValue] text ""
[$this statusChange] sensitive 0
} else {
[$this dirField] text [$model repositoryDirectory]
if [$model reserved] {
[$this statusValue] text "Yes"
} else {
[$this statusValue] text "No"
}
[$this statusChange] sensitive 1
}
}
method RepModelBrowser::changeStatus {this} {
set model [$this selectedObject]
if [$model isNil] {
return
}
if ![$model reserved] {
set dlg [ModelReserveDialog new [$this view].modreserve \
-model $model]
} else {
set dlg [ModelUnreserveDialog new [$this view].modunreserve \
-model $model]
}
$dlg okPressed "[$dlg okPressed]; $this statusChanged"
$dlg popUp
}
method RepModelBrowser::statusChanged {this} {
set model [$this selectedObject]
if [$model isNil] {
return
}
if [$model reserved] {
[$this statusValue] text "Yes"
} else {
[$this statusValue] text "No"
}
set currSel [[$this objList] selectedSet]
$this update
[$this objList] selectedSet $currSel
}
# Do not delete this line -- regeneration end marker