home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
propsecdlg.tcl
< prev
next >
Wrap
Text File
|
1996-06-12
|
8KB
|
308 lines
#---------------------------------------------------------------------------
#
# (c) Cadre Technologies Inc. 1996
#
# File: @(#)propsecdlg.tcl /main/3
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)propsecdlg.tcl /main/3 12 Jun 1996 Copyright 1996 Cadre Technologies Inc.
# Start user added include file section
require "browsfile.tcl"
require "browsitem.tcl"
require "browspropd.tcl"
require "docstructp.tcl"
require "docgenerat.tcl"
# End user added include file section
Class PropSecDlg : {TemplateDialog} {
method destructor
constructor
method popUp
method handleOk
method handleCancel
method fileSelectionChanged
method itemSelectionChanged
method propSelectionChanged
method sectionNameChanged
method addPropDef
attribute dbObj
attribute sectionName
attribute propKnowledgeDB
}
method PropSecDlg::destructor {this} {
# Start destructor user section
[$this propKnowledgeDB] delete
# End destructor user section
}
constructor PropSecDlg {class this name dbObj sectionName} {
set this [TemplateDialog::constructor $class $this $name]
$this dbObj $dbObj
$this sectionName $sectionName
# Start constructor user section
interface DlgColumn $this.if {
DlgColumn name {
verStretchFactor 0
}
DlgRow row {
DlgColumn files {
Label label {
text Files
}
BrowsView bv {
mode DETAIL
rowCount 10
columnCount 20
selectionPolicy BROWSE
BrowsHeader name {
label Name
width 25
}
BrowsHeader type {
label Type
width 4
}
}
}
DlgColumn items {
Label label {
text Items
}
BrowsView bv {
mode DETAIL
rowCount 10
columnCount 30
selectionPolicy BROWSE
BrowsHeader name {
label Name
width 25
}
BrowsHeader type {
label Type
width 4
}
}
}
DlgColumn props {
Label label {
text Properties
}
BrowsView bv {
mode DETAIL
rowCount 10
columnCount 20
BrowsHeader name {
label Name
width 30
}
}
}
}
}
$this.if.row.files.bv selectionChanged "$this fileSelectionChanged"
$this.if.row.items.bv selectionChanged "$this itemSelectionChanged"
$this.if.row.props.bv selectionChanged "$this propSelectionChanged"
if {$sectionName == ""} {
Label new $this.if.name.label -text "Property Section Name:"
SingleLineText new $this.if.name.name \
-textModified "$this sectionNameChanged"
}
$this config \
-modal yes \
-title "Property Section" \
-okPressed "$this handleOk" \
-cancelPressed "$this handleCancel" \
-helpPressed {.main helpOnName propertySection} \
-propKnowledgeDB [PropKnowledgeDB new $this.propKnowledgeDB]
set context "/[[$dbObj documentedSystem] identity]"
set obj [$dbObj getParent CustomLevelVersion]
set obj [$obj getParent CustomLevelVersion]
while {$obj != ""} {
set context "/[$obj identity]$context"
set obj [$obj getParent CustomLevelVersion]
}
if [catch {[$this propKnowledgeDB] context $context} msg] {
wmtkerror $msg
}
# End constructor user section
return $this
}
method PropSecDlg::popUp {this} {
set nr 0
set dbObj [$this dbObj]
set objHdlr [$wmttoolObj objectHdlr]
set configV [$dbObj getParent ConfigVersion]
foreach file [[[$dbObj documentedSystem] system] files] {
set fileVersions [$file fileVersions]
if {[lempty $fileVersions] ||
[[$file selectedVersion $configV] isNil]} continue
set fileType [$file type]
set objSpec [getObjectSpec $objHdlr \
[[lindex $fileVersions 0] uiClass] $fileType \
]
if {"$objSpec" == ""} continue
BrowsFile new $this.if.row.files.bv.$nr \
-fileVersion [$file selectedVersion $configV] \
-smallIcon [$objSpec smallIcon] \
-label [$file qualifiedName :] \
-details $fileType
lappend [$this.if.row.files.bv objectSet] \
$this.if.row.files.bv.$nr
incr nr
}
$this.if.row.files.bv sort -column "$this.if.row.files.bv.type" \
-column "$this.if.row.files.bv.name"
$this propSelectionChanged
$this TemplateDialog::popUp
}
method PropSecDlg::handleOk {this} {
DocStructPart new .docStrucPart -documentVersion [$this dbObj] \
-sectionName [$this sectionName]
if [lempty [$this.if.row.items.bv selectedSet]] {
set selObj [lindex [$this.if.row.files.bv selectedSet] 0]
.docStrucPart config \
-sectionType "Fileprop" \
-sectionClass "Fileprop" \
-fileVersion [$selObj fileVersion]
} else {
set selObj [lindex [$this.if.row.items.bv selectedSet] 0]
.docStrucPart config \
-sectionType "Itemprop" \
-sectionClass "Itemprop" \
-workItem [$selObj item]
}
set propertyNames ""
foreach propObj [$this.if.row.props.bv selectedSet] {
lappend propertyNames [[$propObj propDef] name]
}
.docStrucPart propertyNames $propertyNames
DocGenerator::createSection .docStrucPart
wmtkmessage ""
$wmttoolObj updateView
.docStrucPart delete
$this delete
}
method PropSecDlg::handleCancel {this} {
$this delete
}
method PropSecDlg::fileSelectionChanged {this} {
foreach prop [$this.if.row.props.bv objectSet] {
$prop delete
}
$this propSelectionChanged
foreach item [$this.if.row.items.bv objectSet] {
$item delete
}
if [lempty [$this.if.row.files.bv selectedSet]] {
return
}
set dbObj [$this dbObj]
set fileV [[lindex [$this.if.row.files.bv selectedSet] 0] fileVersion]
PropLocation new .propLocation \
-containerKind [$fileV ORB_class] \
-containerType [[$fileV file] type] \
-phaseType [[[$dbObj getParent PhaseVersion] phase] type]
set propDefs [[$this propKnowledgeDB] definitions .propLocation]
set nr 0
foreach propDef $propDefs {
$this addPropDef $propDef $nr
incr nr
}
$this.if.row.props.bv sort -column "$this.if.row.props.bv.name"
.propLocation delete
if [$fileV isA Diagram] {
set nr 0
set configV [$dbObj getParent ConfigVersion]
foreach item [$fileV definedItemRefs $configV] {
BrowsItem new $this.if.row.items.bv.$nr \
-label [$item qualifiedName :] \
-details [$item type] \
-item $item
lappend [$this.if.row.items.bv objectSet] \
$this.if.row.items.bv.$nr
incr nr
}
}
$this.if.row.items.bv sort -column "$this.if.row.items.bv.type" \
-column "$this.if.row.items.bv.name"
}
method PropSecDlg::itemSelectionChanged {this} {
if [lempty [$this.if.row.items.bv selectedSet]] {
$this fileSelectionChanged
return
}
foreach prop [$this.if.row.props.bv objectSet] {
$prop delete
}
set dbObj [$this dbObj]
set fileV [[lindex [$this.if.row.files.bv selectedSet] 0] fileVersion]
set item [[lindex [$this.if.row.items.bv selectedSet] 0] item]
PropLocation new .propLocation \
-containerKind Item \
-containerType [$item type] \
-phaseType [[[$dbObj getParent PhaseVersion] phase] type] \
-diagramType [[$fileV file] type]
if {[.propLocation diagramType] == "cdm"} {
.propLocation diagramType "cad"
}
set propDefs [[$this propKnowledgeDB] definitions .propLocation]
set nr 0
foreach propDef $propDefs {
$this addPropDef $propDef $nr
incr nr
}
$this.if.row.props.bv sort -column "$this.if.row.props.bv.name"
$this propSelectionChanged
.propLocation delete
}
method PropSecDlg::propSelectionChanged {this} {
set selected 1
if {[rmWhiteSpace [$this sectionName]] == "" ||
[lempty [$this.if.row.props.bv selectedSet]]} {
set selected 0
}
$this okSensitive $selected
$this okDefault $selected
$this cancelDefault [expr 1 - $selected]
}
method PropSecDlg::sectionNameChanged {this} {
set prevSectionName [$this sectionName]
set sectionName [$this.if.name.name text]
$this sectionName $sectionName
if {"[rmWhiteSpace $prevSectionName]" == "" ||
"[rmWhiteSpace $sectionName]" == ""} {
$this propSelectionChanged
}
}
method PropSecDlg::addPropDef {this def id} {
set nr 0
foreach member [$def memberSet] {
$this addPropDef $member ${id}_$nr
incr nr
}
if {$nr == 0} {
BrowsPropDef new $this.if.row.props.bv.$id \
-label [$def longName] \
-propDef $def
lappend [$this.if.row.props.bv objectSet] \
$this.if.row.props.bv.$id
}
}
# Do not delete this line -- regeneration end marker