home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1997
- #
- # File: @(#)represtdia.tcl /main/titanic/11
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)represtdia.tcl /main/titanic/11 28 Nov 1997 Copyright 1997 Cayenne Software Inc.
-
- # Start user added include file section
- # End user added include file section
-
- require "repdbdialo.tcl"
-
- Class RepRestDialog : {RepDbDialog} {
- constructor
- method destructor
- method popUp
- method checkOk
- method pressedOk
- method restoreFinished
- method browseDirectory
- method setDirectory
- method unarchivedDirectory
- attribute dirLabel
- attribute dirField
- attribute dirBrowse
- attribute nameLabel
- attribute nameField
- attribute extraColumn
- attribute checkColumn
- attribute dbColumn
- attribute shutdownButton
- attribute dirBrowser
- }
-
- constructor RepRestDialog {class this name view} {
- set this [RepDbDialog::constructor $class $this $name $view]
- # Start constructor user section
-
- $this autoPopDown 0
-
- interface DlgColumn $this.c {
- Label dirLabel { text "Directory" }
- DlgRow r {
- spaceType NONE
- DlgColumn n {
- spaceType EVEN
- horStretchFactor 100
- SingleLineText dir {
- text ""
- columnCount 30
- horStretchFactor 100
- }
- }
- DlgColumn b {
- spaceType EVEN
- horStretchFactor 0
- PushButton browse {
- horStretchFactor 0
- label "Browse..."
- }
- }
- }
- Label nameLabel { text "New Name" }
- DlgRow n {
- spaceType NONE
- DlgColumn n {
- spaceType EVEN
- horStretchFactor 100
- SingleLineText name {
- text ""
- columnCount 30
- horStretchFactor 100
- }
- }
- }
- DlgColumn extra {
- }
- DlgColumn check {
- verStretchFactor 0
- CheckButton shut {
- label "Shutdown dbservers before restoring."
- state 1
- }
- }
- DlgColumn db {
- verStretchFactor 0
- }
- }
-
- $this dirLabel $this.c.dirLabel
- $this dirField $this.c.r.n.dir
- $this dirBrowse $this.c.r.b.browse
- $this nameLabel $this.c.nameLabel
- $this nameField $this.c.n.n.name
- $this extraColumn $this.c.extra
- $this checkColumn $this.c.check
- $this dbColumn $this.c.db
- $this shutdownButton $this.c.check.shut
-
- $this okPressed "$this pressedOk"
- [$this dirField] textModified "$this checkOk"
- [$this dirField] text [pwd]
- [$this dirBrowse] activated "$this browseDirectory"
- [$this nameField] textModified "$this checkOk"
-
- # End constructor user section
- return $this
- }
-
- method RepRestDialog::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this RepDbDialog::destructor
- }
-
- method RepRestDialog::popUp {this} {
- set unarchivedDir [$this unarchivedDirectory]
- if {$unarchivedDir != ""} {
- $this setDirectory $unarchivedDir
- }
-
- $this checkOk
- $this RepDbDialog::popUp
- }
-
- method RepRestDialog::checkOk {this} {
- $this okSensitive [expr {
- [[$this dirField] text] != "" &&
- [string length [[$this dbname] text]] &&
- [$this passwordOk]
- }]
- }
-
- method RepRestDialog::pressedOk {this} {
- $this busy 1
- if ![$this getDbFields dbInfo] {
- $this restoreFinished 1
- return
- }
-
- set rep [[$this view] rep]
- if [[$this shutdownButton] state] {
- set name [$rep currentName]
- if {$name != "" && ![$rep shutdownDbServers $name]} {
- $this busy 0
- return
- }
- }
-
- if ![$this restore dbInfo] {
- $this busy 0
- }
- }
-
- method RepRestDialog::restoreFinished {this exitCode} {
- $this busy 0
- if {$exitCode == 0} {
- $this popDown
- [$this view] message "Restored [$this objDescription] successfully."
- } else {
- [$this view] message "Failed to restore [$this objDescription]."
- }
- }
-
- method RepRestDialog::browseDirectory {this} {
- if {[$this dirBrowser] == ""} {
- global classCount
- set dirbrowser [$this view].dirbrowser$classCount
- incr classCount
- $this dirBrowser [RepDirBrowser new $dirbrowser 0 1 \
- -title "Select [$this objType] Directory" \
- -okPressed "%this handleOk ; $this setDirectory \[%this selected]"]
- }
-
- [$this dirBrowser] selected [[$this dirField] text]
- [$this dirBrowser] popUp
- }
-
- method RepRestDialog::setDirectory {this dir} {
- [$this dirField] text $dir
- $this checkOk
- }
-
- method RepRestDialog::unarchivedDirectory {this} {
- set type [$this objType]
- set view [$this view]
- set unarDialog $view.RepUnar${type}Dialog
- if [isCommand $unarDialog] {
- return [$unarDialog unarchivedDirectory]
- }
- return ""
- }
-
- # Do not delete this line -- regeneration end marker
-
-