home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
newdiagram.tcl
< prev
next >
Wrap
Text File
|
1997-11-13
|
5KB
|
170 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)newdiagram.tcl /main/titanic/10
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)newdiagram.tcl /main/titanic/10 13 Nov 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
require illegalcha.tcl
# End user added include file section
require "newobjentr.tcl"
Class NewDiagramDlg : {NewObjEntryDlg} {
constructor
method destructor
method handleEdit
method handleOk
method handleTextModified
method verifyText
method popUp
attribute type
attribute qualified
attribute prevQual
attribute prevName
attribute illegalQualChars
attribute illegalNameChars
attribute createInterface
}
constructor NewDiagramDlg {class this name} {
set this [NewObjEntryDlg::constructor $class $this $name]
$this createInterface 1
# Start constructor user section
$this config \
-okPressed "$this handleOk"
PushButton new $this.edit \
-label Edit \
-activated "$this handleEdit"
# End constructor user section
return $this
}
method NewDiagramDlg::destructor {this} {
# Start destructor user section
# End destructor user section
$this NewObjEntryDlg::destructor
}
method NewDiagramDlg::handleEdit {this} {
$this popDown
$this handleOk
if [isCommand [$this createdObj]] {
[$this createdObj] editFile
}
}
method NewDiagramDlg::handleOk {this} {
set fileType [$this type]
set itemType [file2itemtype $fileType]
set configV [[$this dbObj] getParent ConfigVersion]
set message "Creating $fileType file version"
set script "$this createdObj \"\""
append script " ;"
if [$this qualified] {
set className [$this entry]
set fileName [$this.top.name2 text]
set message "$message '${className}:${fileName}'..."
append script " \
set sysItem [[[$this dbObj] itemKeeper] findDeclareItem \
-byName $className cl scopePhaseDef]"
append script " ;"
append script " \
set item \[\[\$sysItem item\] findCreateItem \
[list $fileName] $itemType\]"
append script " ;"
append script " \
$this createdObj \[[$this dbObj] createFileVersion \
\$item \
[fileHasScopePhase $fileType] $fileType graph $configV\]"
} else {
set fileName [$this entry]
set message "$message '$fileName'..."
append script " \
$this createdObj \[[$this dbObj] createFileVersion \
[list $fileName] $itemType \
[fileHasScopePhase $fileType] $fileType graph $configV\]"
}
$wmttoolObj startCommand tcl "$script" "" $message {1 0} 1
}
method NewDiagramDlg::handleTextModified {this} {
if [$this qualified] {
$this verifyText Qual name
$this verifyText Name name2
} else {
$this verifyText Name name
}
if {[$this qualified] && "[rmWhiteSpace [$this.top.name2 text]]" == ""} {
$this entry [$this.top.name text]
set selected 0
$this okSensitive $selected
$this.edit sensitive $selected
$this okDefault $selected
$this cancelDefault [expr 1 - $selected]
} else {
$this NewObjEntryDlg::handleTextModified
$this.edit sensitive [$this okSensitive]
}
}
method NewDiagramDlg::verifyText {this kind field} {
if { ("[$this illegal${kind}Chars]" != "") && \
[regexp [$this illegal${kind}Chars] [$this.top.$field text]]} {
set cursorIndex [$this.top.$field cursorIndex]
$this.top.$field text [$this prev${kind}]
$this.top.$field cursorIndex [expr $cursorIndex - 1]
} else {
$this prev${kind} [$this.top.$field text]
}
}
method NewDiagramDlg::popUp {this} {
global illegalCharacters
if [$this createInterface] {
$this createInterface 0
case [$this type] in {
{cod etd std} {
set message "Classifier:"
set qualified 1
}
default {
set message "Diagram Name:"
set qualified 0
}
}
set type [ShortLongName::longName [$this type]]
if {$type == ""} {
set type [$this type]
}
$this config \
-title "New $type" \
-qualified $qualified \
-illegalQualChars $illegalCharacters(cl) \
-illegalNameChars $illegalCharacters([file2itemtype [$this type]]) \
-message $message
if $qualified {
Label new $this.top.nameLab2 \
-text "Name:"
SingleLineText new $this.top.name2 \
-textModified "$this handleTextModified"
}
}
$this NewObjEntryDlg::popUp
}
# Do not delete this line -- regeneration end marker