home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Westmount Technology 1994
- #
- # File: @(#)browsviewd.tcl 1.6
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)browsviewd.tcl 1.6 11 Jan 1996 Copyright 1994 Westmount Technology
-
- # Start user added include file section
- require "dlgbrowsob.tcl"
- require "wmt_util.tcl"
- # End user added include file section
-
-
- Class BrowsViewDialog : {TemplateDialog} {
- constructor
- method destructor
- method display
- method handleHelp
- method handleSelectionChanged
- method popUp
- method sort
- method view
- attribute objectSpecList
- attribute headerSpecList
- attribute objectList
- attribute message
- }
-
- constructor BrowsViewDialog {class this name} {
- set this [TemplateDialog::constructor $class $this $name]
- # Start constructor user section
-
- interface DlgColumn $this.top {
- Label message {}
- BrowsView view {
- rowCount 5
- mode DETAIL
- selectionPolicy EXTENDED
- }
- }
- $this config \
- -modal yes \
- -helpPressed "$this handleHelp"
- [$this view] selectionChanged "$this handleSelectionChanged"
-
- # End constructor user section
- return $this
- }
-
- method BrowsViewDialog::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method BrowsViewDialog::display {this} {
- $this.top.message text [$this message]
-
- # clear the view
- foreach object [[$this view] objectSet] {
- $object delete
- }
- foreach header [[$this view] headerSet] {
- $header delete
- }
-
- # create headers
- set count 0
- set columnCount 0
- foreach headerSpec [$this headerSpecList] {
- BrowsHeader new [$this view].header$count \
- -label "[lindex $headerSpec 0]" \
- -width [lindex $headerSpec 1]
- if {$count < 2} {
- incr columnCount [lindex $headerSpec 1]
- }
- incr count 1
- }
- [$this view] columnCount $columnCount
-
- #create objects
- set count 0
- foreach objectSpec [$this objectSpecList] {
- set dlgBrowsObject [$this view].object$count
- DlgBrowsObject new $dlgBrowsObject \
- -object [lindex [$this objectList] $count] \
- -label [lindex $objectSpec 1] \
- -details [lrange $objectSpec 2 end] \
- -activated "$this popDown; eval \[$this okPressed\]"
- if {"[lindex $objectSpec 0]" != ""} {
- $dlgBrowsObject smallIcon [lindex $objectSpec 0]
- }
- incr count 1
- }
-
- $this sort
- }
-
- method BrowsViewDialog::handleHelp {this} {
- [getParent $this] helpOnName [nt_get_type $this]
- }
-
- method BrowsViewDialog::handleSelectionChanged {this} {
- if {[llength [[$this view] selectedSet]] == 0} {
- set selected 0
- } else {
- set selected 1
- }
- $this okSensitive $selected
- $this okDefault $selected
- $this cancelDefault [expr 1 - $selected]
- }
-
- method BrowsViewDialog::popUp {this} {
- $this display
-
- $this handleSelectionChanged
- $this TemplateDialog::popUp
- }
-
- method BrowsViewDialog::sort {this} {
- if [lempty [[$this view] objectSet]] {
- return
- }
-
- set count -1
- foreach headerSpec [$this headerSpecList] {
- incr count 1
- if {[llength $headerSpec] < 4} continue
- set type [lindex $headerSpec 2]
- set sortPolicy [lindex [lindex $headerSpec 3] 0]
- if {"$sortPolicy" == "" || "$sortPolicy" == "none"} continue
- set index [lindex [lindex $headerSpec 3] 1]
- if {"$index" == "" || $index < 1} continue
- set sortSpec($index) \
- "-column {[$this view].header$count $type $sortPolicy}"
- }
-
- set sortSpecList ""
- if {! [catch {set indices [lsort -integer [array names sortSpec]]}]} {
- foreach index $indices {
- append sortSpecList " $sortSpec($index)"
- }
- }
-
- if [lempty $sortSpecList] {
- return
- }
-
- eval [$this view] sort $sortSpecList
- }
-
- method BrowsViewDialog::view {this} {
- return $this.top.view
- }
-
- # Do not delete this line -- regeneration end marker
-
-