home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
fastviewha.tcl
< prev
next >
Wrap
Text File
|
1997-06-03
|
4KB
|
137 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)fastviewha.tcl /main/titanic/1
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)fastviewha.tcl /main/titanic/1 3 Jun 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
require fastviewob.tcl
# End user added include file section
Class FastViewHandler : {Object} {
constructor
method destructor
method registerObject
method checkView
method saveObjects
method getViewSpec
method getViewObject
method setViewObject
method removeViewObject
attribute viewSetChanged
attribute viewObject
}
constructor FastViewHandler {class this name} {
set this [Object::constructor $class $this $name]
$this viewSetChanged 0
$this viewObject [Dictionary new]
# Start constructor user section
eval "proc registerObject {spec} {$this registerObject \$spec}"
set path [path_name concat ~ icase]
set path [path_name concat $path desk.vie]
if [file exists $path] {
source $path
}
# End constructor user section
return $this
}
method FastViewHandler::destructor {this} {
# Start destructor user section
# End destructor user section
}
method FastViewHandler::registerObject {this spec} {
set view [FastViewObject new $this.FastViewObject$classCount $spec]
set key "[$view repositoryType]:[$view browserType]:[$view viewName]"
$this setViewObject $key $view
}
method FastViewHandler::checkView {this infoView} {
set curSpec [$infoView currentSpec]
if {$curSpec == ""} {
return
}
# check if this spec is changed when displayed
set props [$curSpec properties]
set changed 0
set index 0
set headerSet [[$infoView area] headerSet]
foreach prop $props {
set header [lindex $headerSet $index]
if {$header == ""} {
break;
}
incr index
if {[lindex $prop 1] != [$header width]} {
set changed 1
}
set newProp ""
lappend newProp "[$header label]"
lappend newProp "[$header width]"
lappend newProp "[$header type]"
set sortProp [$header sortPolicy]
lappend sortProp "[$header sortIndex]"
lappend newProp "$sortProp"
lappend newProps "$newProp"
}
if {$changed == 1} {
$curSpec properties $newProps
global classCount
incr classCount
set newSpec [FastViewObject new $this.FVO.$classCount ""]
foreach method [CustViewSpec info methods] {
$newSpec $method [$curSpec $method]
}
# set in dictionary when changed
set key "[$newSpec repositoryType]:[$newSpec browserType]:[$newSpec viewName]"
$this setViewObject $key $newSpec
$this viewSetChanged 1
}
}
method FastViewHandler::saveObjects {this} {
if [$this viewSetChanged] {
set path [path_name concat ~ icase]
set fid [open [path_name concat $path desk.vie] w]
foreach view [[$this viewObject] values] {
$view writeObject $fid
}
close $fid
$this viewSetChanged 0
}
}
method FastViewHandler::getViewSpec {this repositoryType browserType viewName} {
set key "$repositoryType:$browserType:$viewName"
set spec [$this getViewObject $key]
if {$spec != ""} {
return $spec
}
set key "$repositoryType::$viewName"
return [$this getViewObject $key]
}
# Do not delete this line -- regeneration end marker
method FastViewHandler::getViewObject {this key} {
return [[$this viewObject] set $key]
}
method FastViewHandler::setViewObject {this key newViewObject} {
[$this viewObject] set $key $newViewObject
}
method FastViewHandler::removeViewObject {this key} {
[$this viewObject] unset $key
}