home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
repoptimdi.tcl
< prev
next >
Wrap
Text File
|
1997-11-28
|
8KB
|
309 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1996
#
# File: @(#)repoptimdi.tcl /main/titanic/12
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)repoptimdi.tcl /main/titanic/12 28 Nov 1997 Copyright 1996 Cayenne Software Inc.
# Start user added include file section
require "repository.tcl"
# End user added include file section
require "repdbdialo.tcl"
Class RepOptimDialog : {RepDbDialog} {
constructor
method destructor
method popUp
method checkOk
method ok
method optimizeFinished
attribute projects
attribute allProjects
attribute models
attribute allModels
}
constructor RepOptimDialog {class this name view} {
set this [RepDbDialog::constructor $class $this $name $view]
# Start constructor user section
$this autoPopDown 0
set rep [[$this view] rep]
set corp [$rep currentCorporate]
set name [$rep currentName]
$this config \
-title "Optimize Repository '$name'" \
-okPressed { %this ok } \
-helpPressed { [%this view] helpOnName optimizeRepository }
interface DlgColumn $this.gui {
verStretchFactor 0
NamedGroup options {
label "Options"
DlgRow r {
DlgColumn l {
verStretchFactor 0
CheckButton corp {
label "Corporate"
state 1
}
}
DlgColumn r {
verStretchFactor 0
CheckButton drop {
label "Drop Indices"
state 0
}
CheckButton create {
label "Create Indices"
state 0
}
CheckButton template {
label "Template Optimizations"
state 1
}
}
}
}
DlgColumn list {
verStretchFactor 0
}
CheckButton shut {
label "Shutdown dbservers before optimizing."
state 1
}
NamedGroup db {
label "Database"
DlgColumn attr {
verStretchFactor 0
}
}
}
if [$view projectsEnabled] {
$this allProjects $this.gui.options.r.l.allprojects
interface CheckButton [$this allProjects] {
label "All Projects"
state 1
}
set projects $this.gui.list.projects
$this projects $projects.list
interface NamedGroup $projects {
label "Projects"
TextList list {
verStretchFactor 100
selectionPolicy EXTENDED
rowCount 5
}
}
if ![$corp isNil] {
[$this projects] entrySet \
[lsort [query -s name [$corp projects]]]
}
[$this projects] selectionChanged "
set count \[llength \[[$this projects] selectedSet]]
if {\$count > 0} {
if [$view modelsEnabled] {
\[$this models] selectedSet {}
\[$this allModels] state 0
}
[$this allProjects] state 0
}
$this checkOk"
[$this allProjects] stateChanged "
[$this projects] selectedSet {}
if [$view modelsEnabled] {
\[$this models] selectedSet {}
if \[%this state] {
\[$this allModels] state 0
}
}
$this checkOk"
}
if [$view modelsEnabled] {
$this allModels $this.gui.options.r.l.allmodels
interface CheckButton [$this allModels] {
label "All Models"
state 1
}
if [$view projectsEnabled] {
[$this allModels] state 0
}
set models $this.gui.list.models
$this models $models.list
interface NamedGroup $models {
label "Models"
TextList list {
verStretchFactor 100
selectionPolicy EXTENDED
rowCount 5
}
}
if ![$corp isNil] {
set models {}
foreach m [$corp models] {
lappend models [$m name].[$m type]
}
[$this models] entrySet $models
}
[$this models] selectionChanged "
set count \[llength \[[$this models] selectedSet]]
if {\$count > 0} {
if [$view projectsEnabled] {
\[$this projects] selectedSet {}
\[$this allProjects] state 0
}
[$this allModels] state 0
}
$this checkOk"
[$this allModels] stateChanged "
[$this models] selectedSet {}
if [$view projectsEnabled] {
\[$this projects] selectedSet {}
if \[%this state] {
\[$this allProjects] state 0
}
}
$this checkOk"
}
$this.gui.options.r.l.corp stateChanged "
$this checkOk"
$this createDbInterface $this.gui.db.attr
$this setDbFields
$this setupForPassword
# End constructor user section
return $this
}
method RepOptimDialog::destructor {this} {
# Start destructor user section
# End destructor user section
$this RepDbDialog::destructor
}
method RepOptimDialog::popUp {this} {
$this checkOk
$this RepDbDialog::popUp
}
method RepOptimDialog::checkOk {this} {
if {([$this.gui.options.r.l.corp state]
||
([[$this view] projectsEnabled] &&
([[$this allProjects] state] ||
![lempty [[$this projects] selectedSet]]))
||
([[$this view] modelsEnabled] &&
([[$this allModels] state] ||
![lempty [[$this models] selectedSet]])))
&&
[$this passwordOk]} {
$this okSensitive 1
} else {
$this okSensitive 0
}
}
method RepOptimDialog::ok {this} {
$this busy 1
set view [$this view]
set rep [$view rep]
set name [$rep currentName]
if [$view projectsEnabled] {
if {[$this.gui.shut state] && ![$rep shutdownDbServers $name]} {
[$this view] message "Repository not optimized."
$this busy 0
return
}
}
if ![$this getDbFields cmdInfo] {
[$this view] message "Repository not optimized."
$this busy 0
return
}
set options ""
set projects {}
set models {}
if [$this.gui.options.r.l.corp state] {
append options " -c"
}
if [$view projectsEnabled] {
if [[$this allProjects] state] {
append options " -a"
} else {
set projects ""
foreach project [[$this projects] selectedSet] {
append projects " [quoteIf $project]"
}
}
}
if [$view modelsEnabled] {
if [[$this allModels] state] {
append options " -a -m"
} else {
set models ""
foreach model [[$this models] selectedSet] {
append models " [quoteIf $model]"
}
if ![lempty $models] {
append options " -m"
}
}
}
if [$this.gui.options.r.r.drop state] {
append options " -I"
}
if [$this.gui.options.r.r.create state] {
append options " -i"
}
if [$this.gui.options.r.r.template state] {
append options " -t"
}
if ![[[$this view] rep] optimizeRepository "$this optimizeFinished" \
cmdInfo $options [$rep currentName] "$projects $models"] {
$this busy 0
}
}
method RepOptimDialog::optimizeFinished {this exitCode} {
$this busy 0
if {$exitCode == 0} {
$this popDown
[$this view] message "Repository optimized successfully."
} else {
[$this view] message "Repository not optimized."
}
}
# Do not delete this line -- regeneration end marker