home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1996
- #
- # File: @(#)repoptimdi.tcl /main/hindenburg/7
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)repoptimdi.tcl /main/hindenburg/7 8 Jan 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
- }
-
- constructor RepOptimDialog {class this name view} {
- set this [RepDbDialog::constructor $class $this $name $view]
- # Start constructor user section
-
- set rep [[$this view] rep]
- set corp [$rep currentCorporate]
- set name [$rep currentName]
-
- $this config \
- -title "Optimize Repository '$name'" \
- -okPressed { busy { %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
- }
- CheckButton all {
- label "All Projects"
- 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
- }
- }
- }
- }
- NamedGroup projects {
- label "Projects"
- TextList list {
- verStretchFactor 100
- selectionPolicy EXTENDED
- rowCount 5
- }
- }
- NamedGroup db {
- label "Database"
- DlgColumn attr {
- verStretchFactor 0
- }
- }
- }
-
- $this projects $this.gui.projects.list
-
- if ![$corp isNil] {
- [$this projects] entrySet [lsort [query -s name [$corp projects]]]
- }
-
- [$this projects] selectionChanged "
- $this.gui.options.r.l.all state 0
- $this checkOk"
-
- $this.gui.options.r.l.corp stateChanged "
- $this checkOk"
-
- $this.gui.options.r.l.all stateChanged "
- [$this projects] selectedSet {}
- $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.gui.options.r.l.all state] ||
- ![lempty [[$this projects] selectedSet]]) &&
- [$this passwordOk]} {
-
- $this okSensitive 1
- } else {
- $this okSensitive 0
- }
- }
-
- method RepOptimDialog::ok {this} {
- set rep [[$this view] rep]
-
- if ![$this getDbFields cmdInfo] {
- [$this view] message "Repository not optimized."
- return
- }
-
- set options ""
- set projects {}
-
- if [$this.gui.options.r.l.corp state] {
- append options " -c"
- }
- if [$this.gui.options.r.l.all state] {
- append options " -a"
- } else {
- set projects [[$this projects] selectedSet]
- }
-
- 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"
- }
-
- [[$this view] rep] optimizeRepository "$this optimizeFinished" cmdInfo \
- $options [$rep currentName] $projects
- }
-
- method RepOptimDialog::optimizeFinished {this exitCode} {
- if {$exitCode == 0} {
- [$this view] message "Repository optimized successfully."
- } else {
- [$this view] message "Repository not optimized."
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
-