home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1997
- #
- # File: @(#)brokerlogd.tcl /main/titanic/7
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)brokerlogd.tcl /main/titanic/7 17 Oct 1997 Copyright 1997 Cayenne Software Inc.
-
- # Start user added include file section
- # End user added include file section
-
-
- # A dialog that displays the log
- # of a Cayenne broker. The broker
- # must have been started with the
- # @tt{-l} option.
-
- Class BrokerLogDialog : {TemplateDialog} {
- constructor
- method destructor
- method refresh
- method print
- method save
- attribute text
-
- # The host on which the broker runs
- # for which this dialog shows the log.
- #
- attribute host
- attribute file
-
- # The script that is evaluated by the
- # @meth{refresh} method.
- #
- attribute refreshScript
- }
-
- constructor BrokerLogDialog {class this name} {
- set this [TemplateDialog::constructor $class $this $name]
- # Start constructor user section
-
- $this modal $win95
- $this delCancelButton
- $this delHelpButton
-
- interface DlgColumn $this.c {
- MultiLineText text {
- editable 0
- rowCount 20
- columnCount 120
- }
- }
-
- set log $this.c.text
- $this text $log
-
- if $win95 {
- $log font "Courier New-normal-10-0"
- } else {
- $log font "courier-normal-10-0"
- }
-
- set logFont [m4_var get M4_font -context brokerlog]
- if {$logFont != ""} {
- $log font $logFont
- }
-
- PushButton new $this.refresh \
- -label "Refresh" \
- -default 1 \
- -activated "$this refresh"
-
- PushButton new $this.save \
- -label "Save..." \
- -default 0 \
- -activated "$this save"
-
- PushButton new $this.print \
- -label "Print" \
- -default 0 \
- -activated "$this print"
-
- # End constructor user section
- return $this
- }
-
- method BrokerLogDialog::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
-
- # Refreshes the display by evaluating
- # the value of the @meth{refreshScript}
- # attribute.
- #
- method BrokerLogDialog::refresh {this} {
- set log [$this text]
- eval "$log [$this refreshScript]"
- $log cursorIndex [string length [$log text]]
- }
-
-
- # Prints the log.
- #
- method BrokerLogDialog::print {this} {
- set log [$this text]
- set printer [m4_var get M4_a_printer]
- set printfile [args_file [list [$log text]]]
- .main startCommand extern \
- "$printer $printfile" [list BasicFS::removeFile $printfile] \
- "Sending output to $printer..." \
- {0 0} 0
- }
-
-
- # Pops up a @type{FileChooser} dialog
- # which allows the log to be saved.
- #
- method BrokerLogDialog::save {this} {
- set log [$this text]
- set dlg .main.savelogdlg-[$this host]
- if ![isCommand $dlg] {
- FileChooser new $dlg \
- -selectionPolicy BROWSE \
- -title "Save Broker Log" \
- -selectedSet [list brokerlog-[$this host].log]
- $dlg okPressed "
- set logFile \[lindex \[%this selectedSet] 0]
- if \[catch {set fid \[open \$logFile w]} msg] {
- set dlg .main.savelogerrdlg
- ErrorDialog new \$dlg \
- -message \$msg \
- -title \"Save Broker Log Error\" \
- -okPressed \"\$dlg delete\"
- \$dlg delHelpButton
- \$dlg popUp
- return
- }
- puts \$fid \"\[$log text]\"
- close \$fid
- "
- $dlg delHelpButton
- }
- $dlg popUp
- }
-
- # Do not delete this line -- regeneration end marker
-
-