--- a/DataSetBuilder.st Wed May 13 22:14:42 1998 +0200
+++ b/DataSetBuilder.st Wed May 13 22:24:26 1998 +0200
@@ -1,5 +1,5 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
+ COPYRIGHT (c) 1997 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
@@ -15,8 +15,8 @@
ResourceSpecEditor subclass:#DataSetBuilder
- instanceVariableNames:'rowClass rowSuperClass hasChanged columnView columns
- selectedColumnIndex tabSelectionIndex'
+ instanceVariableNames:'rowClass rowSuperClass columnView columns selectedColumnIndex
+ modalOpened'
classVariableNames:''
poolDictionaries:''
category:'Interface-UIPainter'
@@ -26,7 +26,7 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
+ COPYRIGHT (c) 1997 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
@@ -58,19 +58,55 @@
! !
-!DataSetBuilder class methodsFor:'instance creation'!
-
-openOnClass:aClass andSelector:aSelector
-
- ^ self new openOnClass:aClass andSelector:aSelector
-! !
-
-!DataSetBuilder class methodsFor:'constants'!
+!DataSetBuilder class methodsFor:'accessing'!
resourceType
"get the type of resource of the method generated by the MenuEditor"
- ^#dataset
+ ^#tableColumns
+
+
+! !
+
+!DataSetBuilder class methodsFor:'aspects'!
+
+aspects
+ "get the aspects for the attributes of the table columns"
+
+ ^#(
+ label
+ canSelect
+ choices
+ editorType
+ formatString
+ labelIsImage
+ size
+ type
+ width
+ minWidth
+ height
+ menu
+ foregroundSelector
+ backgroundSelector
+ doubleClickedSelector
+ selectSelector
+ printSelector
+ readSelector
+ writeSelector
+ rendererType
+ showColSeparator
+ showRowSeparator
+ backgroundColor
+ foregroundColor
+ labelForegroundColor
+ labelBackgroundColor
+ labelFont
+ labelActionSelector
+ labelActionArgument
+ labelAlignment
+ columnAlignment
+ )
+
! !
@@ -357,10 +393,11 @@
!
colorsEditSpec
- "this window spec was automatically generated by the ST/X UIPainter"
+ "This resource specification was automatically generated
+ by the UIPainter of ST/X."
- "do not manually edit this - the painter/builder may not be able to
- handle the specification if its corrupted."
+ "Do not manually edit this!! If it is corrupted,
+ the UIPainter may not be able to read the specification."
"
UIPainter new openOnClass:DataSetBuilder andSelector:#colorsEditSpec
@@ -375,11 +412,11 @@
#window:
#(#WindowSpec
#name: 'DataSet Misc'
- #layout: #(#LayoutFrame 383 0 282 0 751 0 581 0)
+ #layout: #(#LayoutFrame 518 0 351 0 886 0 650 0)
#label: 'DataSet Misc'
#min: #(#Point 10 10)
#max: #(#Point 1280 1024)
- #bounds: #(#Rectangle 383 282 752 582)
+ #bounds: #(#Rectangle 518 351 887 651)
#usePreferredExtent: false
)
#component:
@@ -502,10 +539,11 @@
!
defineClassNameSpec
- "this window spec was automatically generated by the ST/X UIPainter"
+ "This resource specification was automatically generated
+ by the UIPainter of ST/X."
- "do not manually edit this - the painter/builder may not be able to
- handle the specification if its corrupted."
+ "Do not manually edit this!! If it is corrupted,
+ the UIPainter may not be able to read the specification."
"
UIPainter new openOnClass:DataSetBuilder andSelector:#defineClassNameSpec
@@ -520,11 +558,11 @@
#window:
#(#WindowSpec
#name: 'Data Set Builder'
- #layout: #(#LayoutFrame 425 0 253 0 751 0 388 0)
+ #layout: #(#LayoutFrame 414 0 336 0 740 0 471 0)
#label: 'Data Set Builder'
#min: #(#Point 10 10)
#max: #(#Point 1152 900)
- #bounds: #(#Rectangle 425 253 752 389)
+ #bounds: #(#Rectangle 414 336 741 472)
#usePreferredExtent: false
)
#component:
@@ -575,10 +613,11 @@
!
formatEditSpec
- "this window spec was automatically generated by the ST/X UIPainter"
+ "This resource specification was automatically generated
+ by the UIPainter of ST/X."
- "do not manually edit this - the painter/builder may not be able to
- handle the specification if its corrupted."
+ "Do not manually edit this!! If it is corrupted,
+ the UIPainter may not be able to read the specification."
"
UIPainter new openOnClass:DataSetBuilder andSelector:#formatEditSpec
@@ -593,11 +632,11 @@
#window:
#(#WindowSpec
#name: 'DataSet Details'
- #layout: #(#LayoutFrame 415 0 266 0 802 0 557 0)
+ #layout: #(#LayoutFrame 329 0 353 0 716 0 644 0)
#label: 'DataSet Details'
#min: #(#Point 10 10)
#max: #(#Point 1280 1024)
- #bounds: #(#Rectangle 415 266 803 558)
+ #bounds: #(#Rectangle 329 353 717 645)
#usePreferredExtent: false
)
#component:
@@ -668,10 +707,11 @@
!
frameEditSpec
- "this window spec was automatically generated by the ST/X UIPainter"
+ "This resource specification was automatically generated
+ by the UIPainter of ST/X."
- "do not manually edit this - the painter/builder may not be able to
- handle the specification if its corrupted."
+ "Do not manually edit this!! If it is corrupted,
+ the UIPainter may not be able to read the specification."
"
UIPainter new openOnClass:DataSetBuilder andSelector:#frameEditSpec
@@ -686,11 +726,11 @@
#window:
#(#WindowSpec
#name: 'DataSet Dimension'
- #layout: #(#LayoutFrame 354 0 262 0 644 0 475 0)
+ #layout: #(#LayoutFrame 512 0 370 0 802 0 583 0)
#label: 'DataSet Dimension'
#min: #(#Point 10 10)
#max: #(#Point 1280 1024)
- #bounds: #(#Rectangle 354 262 645 476)
+ #bounds: #(#Rectangle 512 370 803 584)
#usePreferredExtent: false
)
#component:
@@ -788,10 +828,11 @@
!
selectionEditSpec
- "this window spec was automatically generated by the ST/X UIPainter"
+ "This resource specification was automatically generated
+ by the UIPainter of ST/X."
- "do not manually edit this - the painter/builder may not be able to
- handle the specification if its corrupted."
+ "Do not manually edit this!! If it is corrupted,
+ the UIPainter may not be able to read the specification."
"
UIPainter new openOnClass:DataSetBuilder andSelector:#selectionEditSpec
@@ -806,11 +847,11 @@
#window:
#(#WindowSpec
#name: 'DataSet Basic'
- #layout: #(#LayoutFrame 411 0 287 0 699 0 542 0)
+ #layout: #(#LayoutFrame 533 0 372 0 821 0 627 0)
#label: 'DataSet Basic'
#min: #(#Point 10 10)
#max: #(#Point 1280 1024)
- #bounds: #(#Rectangle 411 287 700 543)
+ #bounds: #(#Rectangle 533 372 822 628)
#usePreferredExtent: false
)
#component:
@@ -938,10 +979,11 @@
!
valuesEditSpec
- "this window spec was automatically generated by the ST/X UIPainter"
+ "This resource specification was automatically generated
+ by the UIPainter of ST/X."
- "do not manually edit this - the painter/builder may not be able to
- handle the specification if its corrupted."
+ "Do not manually edit this!! If it is corrupted,
+ the UIPainter may not be able to read the specification."
"
UIPainter new openOnClass:DataSetBuilder andSelector:#valuesEditSpec
@@ -956,11 +998,11 @@
#window:
#(#WindowSpec
#name: 'DataSet Basic'
- #layout: #(#LayoutFrame 385 0 286 0 680 0 591 0)
+ #layout: #(#LayoutFrame 501 0 386 0 796 0 691 0)
#label: 'DataSet Basic'
#min: #(#Point 10 10)
#max: #(#Point 1280 1024)
- #bounds: #(#Rectangle 385 286 681 592)
+ #bounds: #(#Rectangle 501 386 797 692)
#usePreferredExtent: false
)
#component:
@@ -1105,11 +1147,11 @@
#window:
#(#WindowSpec
#name: 'Data Set Builder'
- #layout: #(#LayoutFrame 487 0 189 0 1031 0 690 0)
+ #layout: #(#LayoutFrame 314 0 309 0 853 0 808 0)
#label: 'Data Set Builder'
#min: #(#Point 10 10)
#max: #(#Point 1152 900)
- #bounds: #(#Rectangle 487 189 1032 691)
+ #bounds: #(#Rectangle 314 309 854 809)
#menu: #menu
#usePreferredExtent: false
)
@@ -1117,21 +1159,41 @@
#(#SpecCollection
#collection:
#(
- #(#ViewSpec
- #name: 'Box1'
- #layout: #(#LayoutFrame 0 0.0 100 0.0 0 1.0 0 1.0)
+ #(#MenuPanelSpec
+ #name: 'menuToolbarView'
+ #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 32 0)
+ #menu: #menuToolbar
+ )
+ #(#VariableVerticalPanelSpec
+ #name: 'VariableVerticalPanel1'
+ #layout: #(#LayoutFrame 0 0.0 38 0.0 0 1.0 -26 1.0)
#component:
#(#SpecCollection
#collection:
#(
- #(#MenuPanelSpec
- #name: 'menuToolbarView'
- #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 32 0)
- #menu: #menuToolbar
+ #(#FramedBoxSpec
+ #name: 'FramedBox'
+ #component:
+ #(#SpecCollection
+ #collection:
+ #(
+ #(#DataSetSpec
+ #name: 'columnView'
+ #layout: #(#LayoutFrame 15 0.0 16 0.0 15 1.0 16 1.0)
+ #hasHorizontalScrollBar: true
+ #hasVerticalScrollBar: false
+ #miniScrollerHorizontal: true
+ #rowClassName: 'CodingExamples_GUI::GUIDemoDataSetView::Row'
+ #useIndex: false
+ #has3Dsepartors: true
+ )
+ )
+ )
+ #label: 'Table Columns'
+ #labelPosition: #topLeft
)
#(#VariableHorizontalPanelSpec
#name: 'VariablePanel'
- #layout: #(#LayoutFrame 0 0.0 34 0.0 0 1.0 -26 1.0)
#component:
#(#SpecCollection
#collection:
@@ -1186,38 +1248,18 @@
)
)
)
- #handles: #(#Any 0.346072 1.0)
- )
- #(#UISubSpecification
- #name: 'infoBarSubSpec'
- #layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0)
- #majorKey: #ToolApplicationModel
- #minorKey: #windowSpecForInfoBar
+ #level: -1
+ #handles: #(#Any 0.311111 1.0)
)
)
)
+ #handles: #(#Any 0.25 1.0)
)
- #(#FramedBoxSpec
- #name: 'ColumnFrame'
- #layout: #(#LayoutFrame 0 0.0 5 0.0 0 1.0 100 0)
- #component:
- #(#SpecCollection
- #collection:
- #(
- #(#DataSetSpec
- #name: 'columnView'
- #layout: #(#LayoutFrame 14 0.0 18 0.0 14 1.0 14 1.0)
- #hasHorizontalScrollBar: true
- #hasVerticalScrollBar: false
- #miniScrollerHorizontal: true
- #rowClassName: 'CodingExamples_GUI::GUIDemoDataSetView::Row'
- #useIndex: false
- #has3Dsepartors: true
- )
- )
- )
- #label: 'Table Columns'
- #labelPosition: #topLeft
+ #(#UISubSpecification
+ #name: 'infoBarSubSpec'
+ #layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0)
+ #majorKey: #ToolApplicationModel
+ #minorKey: #windowSpecForInfoBar
)
)
)
@@ -1363,6 +1405,20 @@
)
)
#(#MenuItem
+ #label: 'Settings'
+ #submenu:
+ #(#Menu
+
+ #(
+ #(#MenuItem
+ #label: 'Fonts'
+ #submenuChannel: #menuFont
+ )
+ ) nil
+ nil
+ )
+ )
+ #(#MenuItem
#label: 'History'
#activeHelpKey: #history
#submenuChannel: #menuHistory
@@ -1370,36 +1426,7 @@
#(#MenuItem
#label: 'Help'
#startGroup: #right
- #submenu:
- #(#Menu
-
- #(
- #(#MenuItem
- #label: 'Documentation'
- #value: #openHTMLDocument:
- #activeHelpKey: #helpTutorial
- #argument: 'tools/uipainter/DataSetBuilder.html'
- )
- #(#MenuItem
- #label: '-'
- )
- #(#MenuItem
- #label: 'Help Tool'
- #value: #openHTMLDocument:
- #activeHelpKey: #helpHelpTool
- #argument: 'tools/uipainter/HelpTool.html'
- )
- #(#MenuItem
- #label: '-'
- )
- #(#MenuItem
- #label: 'Show Help Texts'
- #activeHelpKey: #helpShowHelp
- #indication: #showHelp:
- )
- ) nil
- nil
- )
+ #submenuChannel: #menuHelp
)
) nil
nil
@@ -1407,10 +1434,11 @@
!
menuEdit
- "this window spec was automatically generated by the ST/X MenuEditor"
+ "This resource specification was automatically generated
+ by the MenuEditor of ST/X."
- "do not manually edit this - the builder may not be able to
- handle the specification if its corrupted."
+ "Do not manually edit this!! If it is corrupted,
+ the MenuEditor may not be able to read the specification."
"
MenuEditor new openOnClass:DataSetBuilder andSelector:#menuEdit
@@ -1425,41 +1453,47 @@
#(
#(#MenuItem
- #'label:' 'Cut'
- #'value:' #doCutColumn
- #'activeHelpKey:' #editCut
- #'enabled:' #isColumnSelected
+ #label: 'Cut'
+ #value: #doCut
+ #activeHelpKey: #editCut
+ #enabled: #isColumnSelected
)
#(#MenuItem
- #'label:' 'Copy'
- #'value:' #doCopyColumn
- #'activeHelpKey:' #editCopy
- #'enabled:' #isColumnSelected
+ #label: 'Copy'
+ #value: #doCopy
+ #activeHelpKey: #editCopy
+ #enabled: #isColumnSelected
)
#(#MenuItem
- #'label:' 'Paste'
- #'value:' #doPasteColumn
- #'activeHelpKey:' #editPaste
- #'enabled:' #valueOfHavingClipboard
+ #label: 'Paste'
+ #value: #doPaste
+ #activeHelpKey: #editPaste
+ #enabled: #valueOfHavingClipboard
)
#(#MenuItem
- #'label:' '-'
+ #label: 'Delete'
+ #value: #doDelete
+ #activeHelpKey: #editPaste
+ #enabled: #valueOfHavingClipboard
+ )
+ #(#MenuItem
+ #label: '-'
)
#(#MenuItem
- #'label:' 'Move Up'
- #'value:' #'doMoveColumn:'
- #'activeHelpKey:' #editMoveUp
- #'enabled:' #isColumnSelected
- #'argument:' #up
- #'labelImage:' #(#ResourceRetriever #DataSetBuilder #upIcon 'Move Up')
+ #label: 'Move Up'
+ #value: #doMoveColumn:
+ #activeHelpKey: #editMoveUp
+ #enabled: #isColumnSelected
+ #argument: #up
+ #labelImage: #(#ResourceRetriever #DataSetBuilder #upIcon 'Move Up')
)
#(#MenuItem
- #'label:' 'Move Down'
- #'value:' #'doMoveColumn:'
- #'activeHelpKey:' #editMoveDown
- #'enabled:' #isColumnSelected
- #'argument:' #down
- #'labelImage:' #(#ResourceRetriever #DataSetBuilder #downIcon 'Move Down')
+ #label: 'Move Down'
+ #value: #doMoveColumn:
+ #activeHelpKey: #editMoveDown
+ #enabled: #isColumnSelected
+ #argument: #down
+ #labelImage: #(#ResourceRetriever #DataSetBuilder #downIcon 'Move Down')
)
) nil
nil
@@ -1467,10 +1501,11 @@
!
menuToolbar
- "this window spec was automatically generated by the ST/X MenuEditor"
+ "This resource specification was automatically generated
+ by the MenuEditor of ST/X."
- "do not manually edit this - the builder may not be able to
- handle the specification if its corrupted."
+ "Do not manually edit this!! If it is corrupted,
+ the MenuEditor may not be able to read the specification."
"
MenuEditor new openOnClass:DataSetBuilder andSelector:#menuToolbar
@@ -1485,33 +1520,92 @@
#(
#(#MenuItem
- #'label:' 'Add Column'
- #'isButton:' true
- #'value:' #doCreateColumn
- #'activeHelpKey:' #addColumn
- #'enabled:' #columnIsNotEditing
- #'labelImage:' #(#ResourceRetriever nil #newColumnIcon)
+ #label: 'New'
+ #isButton: true
+ #value: #doNew
+ #activeHelpKey: #fileNew
+ #labelImage: #(#ResourceRetriever nil #newIcon)
+ )
+ #(#MenuItem
+ #label: 'Load'
+ #isButton: true
+ #value: #doLoad
+ #activeHelpKey: #fileLoad
+ #labelImage: #(#ResourceRetriever nil #loadIcon)
)
#(#MenuItem
- #'label:' ''
+ #label: 'Save'
+ #isButton: true
+ #value: #doSave
+ #activeHelpKey: #fileSave
+ #labelImage: #(#ResourceRetriever nil #saveIcon)
+ )
+ #(#MenuItem
+ #label: ''
+ )
+ #(#MenuItem
+ #label: 'Cut'
+ #isButton: true
+ #value: #doCut
+ #activeHelpKey: #editCut
+ #enabled: #isColumnSelected
+ #labelImage: #(#ResourceRetriever nil #cutIcon)
+ )
+ #(#MenuItem
+ #label: 'Copy'
+ #isButton: true
+ #value: #doCopy
+ #activeHelpKey: #editCopy
+ #enabled: #isColumnSelected
+ #labelImage: #(#ResourceRetriever nil #copyIcon)
)
#(#MenuItem
- #'label:' 'Move Up'
- #'isButton:' true
- #'value:' #'doMoveColumn:'
- #'activeHelpKey:' #editMoveUp
- #'enabled:' #isColumnSelected
- #'argument:' #up
- #'labelImage:' #(#ResourceRetriever nil #upIcon)
+ #label: 'Paste'
+ #isButton: true
+ #value: #doPaste
+ #activeHelpKey: #editPaste
+ #enabled: #valueOfCanPaste
+ #labelImage: #(#ResourceRetriever nil #pasteIcon)
+ )
+ #(#MenuItem
+ #label: 'Delete'
+ #isButton: true
+ #value: #doDelete
+ #activeHelpKey: #editDelete
+ #enabled: #isColumnSelected
+ #labelImage: #(#ResourceRetriever nil #deleteIcon)
+ )
+ #(#MenuItem
+ #label: ''
)
#(#MenuItem
- #'label:' 'Move Down'
- #'isButton:' true
- #'value:' #'doMoveColumn:'
- #'activeHelpKey:' #editMoveDown
- #'enabled:' #isColumnSelected
- #'argument:' #down
- #'labelImage:' #(#ResourceRetriever nil #downIcon)
+ #label: 'Add Column'
+ #isButton: true
+ #value: #doCreateColumn
+ #activeHelpKey: #addColumn
+ #enabled: #columnIsNotEditing
+ #labelImage: #(#ResourceRetriever nil #newColumnIcon)
+ )
+ #(#MenuItem
+ #label: ''
+ )
+ #(#MenuItem
+ #label: 'Move Up'
+ #isButton: true
+ #value: #doMoveColumn:
+ #activeHelpKey: #editMoveUp
+ #enabled: #isColumnSelected
+ #argument: #up
+ #labelImage: #(#ResourceRetriever nil #upIcon)
+ )
+ #(#MenuItem
+ #label: 'Move Down'
+ #isButton: true
+ #value: #doMoveColumn:
+ #activeHelpKey: #editMoveDown
+ #enabled: #isColumnSelected
+ #argument: #down
+ #labelImage: #(#ResourceRetriever nil #downIcon)
)
) nil
nil
@@ -1521,16 +1615,22 @@
!DataSetBuilder class methodsFor:'resources'!
newColumnIcon
- "Generated by the Image Editor"
+ "This resource specification was automatically generated
+ by the ImageEditor of ST/X."
+
+ "Do not manually edit this!! If it is corrupted,
+ the ImageEditor may not be able to read the specification."
+
"
- ImageEditor openOnClass:self andSelector:#newColumnIcon
+ self newColumnIcon inspect
+ ImageEditor openOnClass:self andSelector:#newColumnIcon
"
<resource: #image>
^Icon
constantNamed:#'DataSetBuilder newColumnIcon'
- ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UT@@@@UPUTUUUXUPUTZ**,UPUTZB",UPUTX*H,UYUTX*H,UPUTZB",UPQTZ**,UPUTX*H,UPUTX*H,UPUTX*H,UPUTXB@,UPUTZ**,UPUTZ**,UPUTX"H,UYUTXB@,UPUTX"@,UPUTX"H,UPUTZ**,UPUTZ**,UPUT/??<UPUT@@@@UP'); colorMap:(((Array new:4) at:1 put:((Color black)); at:2 put:((Color white)); at:3 put:((Color grey:66.9978)); at:4 put:((Color grey:49.9962)); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A??@A??@A??@A??@A??@A??@A??@A??@A??CA??@A??@A??@A??@A??CA??AA??@A??CA??@A??CA??@A??@A??A'); yourself); yourself]! !
+ ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UT@@@@UPUTUUUXUPUTZ**,UPUTZB",UPUTX*H,UYUTX*H,UPUTZB",UPQTZ**,UPUTX*H,UPUTX*H,UPUTX*H,UPUTXB@,UPUTZ**,UPUTZ**,UPUTX"H,UYUTXB@,UPUTX"@,UPUTX"H,UPUTZ**,UPUTZ**,UPUT/??<UPUT@@@@UP') ; colorMapFromArray:#[0 0 0 255 255 255 170 170 170 127 127 127]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A??@A??@A??@A??@A??@A??@A??@A??@A??CA??@A??@A??@A??@A??CA??AA??@A??CA??@A??CA??@A??@A??A') ; yourself); yourself]! !
!DataSetBuilder methodsFor:'accessing'!
@@ -1547,7 +1647,6 @@
columns := OrderedCollection new.
list := self seqList.
- hasChanged := false.
list removeAll.
@@ -1559,7 +1658,7 @@
column := aColumn copy
].
columns add:column.
- list add:(self labelFromColumn:column).
+ list add:(self labelFromColumn:column).
]
].
self updateColumnView.
@@ -1578,7 +1677,7 @@
rowSuperClass := nil.
(rowClass := aClassName) notNil ifTrue:[
- (cls := self resolveRowClassNamed) notNil
+ (cls := self resolveClassNamed) notNil
ifTrue: [rowSuperClass := cls superclass name asString]
ifFalse:[rowSuperClass := 'Object']
]
@@ -1587,14 +1686,6 @@
!DataSetBuilder methodsFor:'aspects'!
-aspectFor:aKey
- "returns aspect for a key or nil"
-
- ^aspects at:aKey ifAbsent:[super aspectFor:aKey]
-
-
-!
-
columnIsNotEditing
"returns a boolean value holder which is set to true if column is not editing"
@@ -1633,16 +1724,6 @@
!
-modifiedChannel
- "returns a boolean value holder which is set to true if something is modified
- and not accepted"
-
- ^builder booleanValueAspectFor:#modifiedChannel
-
-
-
-!
-
rendererTypeList
"generate list of supported renderer types"
@@ -1703,24 +1784,43 @@
^self class slices collect:[:aSlice|aSlice first]
-!
-
-tabModel
- "returns a value holder which keeps the index of the current selected tab or 0"
-
- |holder|
-
- (holder := builder bindingAt:#tabModel) isNil ifTrue:[
- holder := AspectAdaptor new subject:self; forAspect:#tabSelectionIndex.
- builder aspectAt:#tabModel put:holder.
- ].
- ^ holder
! !
!DataSetBuilder methodsFor:'building'!
buildFromClass:aClass andSelector:aSelector
- |cls list|
+
+ |updateBlock cls list|
+
+ selectedColumnIndex := 0.
+
+ updateBlock := [
+ columns notEmpty ifTrue: [
+ self tabModel value: 0.
+ self tabModel value: 1.
+ self selectedColumnModel value: nil.
+ self selectedColumnModel value: 1.
+ self updateColumnView.
+ self updateInputFields.
+ self updateInfoLabel.
+ self updateHistory
+ ]
+ ].
+
+ "if opened on table columns"
+
+ aClass isNil ifTrue: [
+ self tabModel value: 0.
+ self columns removeAll.
+ self seqList removeAll.
+ self updateColumnView.
+ self updateInfoLabel.
+ self specChannel value:nil.
+ self isColumnSelected value: false.
+ ^self
+ ].
+
+ specSelector isNil ifTrue: [updateBlock value. ^self].
list := nil.
@@ -1736,12 +1836,23 @@
] ifFalse:[
list := columns
].
- self columns:list
+ self columns:list.
+ updateBlock value
+
!
buildFromResourceSpec:aResourceSpec
- self columns:aResourceSpec
+ self columns:aResourceSpec.
+
+ columns notEmpty ifTrue: [
+ self tabModel value: 1.
+ self selectedColumnModel value: nil.
+ self selectedColumnModel value: 1.
+ self updateInputFields.
+ self updateInfoLabel.
+ self updateHistory
+ ]
! !
!DataSetBuilder methodsFor:'change & update'!
@@ -1749,7 +1860,8 @@
update:something with:aParameter from:someObject
"one of my aspects has changed; update modified channel"
- self valueOfEnablingCommitButtons value: true.
+ super update:something with:aParameter from:someObject.
+
self columnIsNotEditing value: false
! !
@@ -2024,93 +2136,74 @@
!DataSetBuilder methodsFor:'initialization'!
initialize
- "setup aspects used by column description specifications"
-
- |holder|
+ "initializes"
super initialize.
- selectedColumnIndex := 0.
- tabSelectionIndex := 0.
- columns := OrderedCollection new.
- hasChanged := false.
- #(
- label
- canSelect
- choices
- editorType
- formatString
- labelIsImage
- size
- type
- width
- minWidth
- height
- menu
- foregroundSelector
- backgroundSelector
- doubleClickedSelector
- selectSelector
- printSelector
- readSelector
- writeSelector
- rendererType
- showColSeparator
- showRowSeparator
- backgroundColor
- foregroundColor
- labelForegroundColor
- labelBackgroundColor
- labelFont
- labelActionSelector
- labelActionArgument
- labelAlignment
- columnAlignment
- ) do:[:aKey|
- aspects at:aKey put:(holder := ValueHolder new).
- holder addDependent:self
- ]
+ selectedColumnIndex := 0.
+ columns := OrderedCollection new.
+ modalOpened := false
+
! !
!DataSetBuilder methodsFor:'private'!
-checkMenuItemModified
- "check column modification"
+askForListModification
+ "asks for resource modification"
- self valueOfEnablingCommitButtons value
- ifTrue:
+ modalOpened
+ ifFalse:
[
- ((YesNoBox title:'Column was modified!!\Save it?\' withCRs)
- noText:'No';
- yesText:'Yes';
- showAtPointer;
- accepted) ifFalse: [self valueOfEnablingCommitButtons value: false. ^true].
- self accept
+ ^super askForListModification
].
^true
!
labelFromColumn:aColumn
- ^ aColumn rendererType == #rowSelector ifFalse:[aColumn label]
- ifTrue:['Row Selector'].
-!
-resolveRowClassNamed
- "returns current class or nil"
-
- ^Smalltalk resolveName:rowClass inClass:self class.
-
+ ^ aColumn rendererType == #rowSelector
+ ifFalse:[aColumn label]
+ ifTrue: ['Row Selector'].
!
updateColumnView
- "update column view from column descriptions"
- columnView notNil ifTrue:[columnView columnDescriptors:columns]
+ "updates column view from column descriptions"
+
+ columnView notNil ifTrue:[
+ |previewColumns columnItems columnList|
+ columnList := List new.
+ previewColumns := columns deepCopy.
+ columns notEmpty
+ ifTrue:
+ [
+ previewColumns do:
+ [:column|
+ column readSelector: #at:.
+ column writeSelector: #at:put:.
+ column backgroundSelector:nil.
+ column foregroundSelector:nil.
+ column selectSelector: nil.
+ column doubleClickedSelector: nil.
+ column printSelector: nil.
+ column menu: nil
+ ].
+ #('1' '2' '...' 'x') do:
+ [:suffix|
+ columnItems := Array new: previewColumns size.
+ 1 to: previewColumns size do: [:i| columnItems at: i put: (previewColumns at: i) label ? 'Cell', suffix].
+ columnList add: columnItems.
+ ]
+ ].
+ columnView list: #().
+ columnView columnDescriptors: previewColumns.
+ columnView list: columnList.
+ ]
!
updateInputFields
- "reload item value into input fields"
+ "reloads item value into input fields"
|column|
@@ -2122,25 +2215,17 @@
ifFalse:
[
aspects keysAndValuesDo:[:aKey :aModel|aModel value:(column perform:aKey) withoutNotifying: self].
- tabSelectionIndex == 0 ifTrue:[self tabModel value:1]
+ tabSelection == 0 ifTrue:[self tabModel value:1]
]
! !
-!DataSetBuilder methodsFor:'queries'!
-
-hasChanged
- "returns true if changes are done to the original column description"
-
- ^hasChanged
-! !
-
!DataSetBuilder methodsFor:'selection'!
selectedColumn
"returns selected column or nil"
^selectedColumnIndex == 0
- ifFalse:[columns at:selectedColumnIndex]
+ ifFalse:[columns at:selectedColumnIndex ifAbsent: nil]
ifTrue: [nil]
!
@@ -2151,7 +2236,7 @@
!
selectedColumnIndex:something
- "change selected column and update specifications"
+ "changes selected column and update specifications"
something == selectedColumnIndex
ifFalse:
@@ -2162,40 +2247,39 @@
!
-tabSelectionIndex
- "returns selected tab index or 0"
-
- ^tabSelectionIndex
-!
-
-tabSelectionIndex:something
- "change selected tab and set corresponding specification"
+tabSelection:something
+ "changes selected tab and set corresponding specification"
|specSelector|
- something == tabSelectionIndex ifTrue:[^self].
+ something == tabSelection ifTrue:[^self].
self selectedColumn isNil
ifTrue:
[
- tabSelectionIndex == 0 ifTrue:[^self].
- tabSelectionIndex := 0
+ tabSelection == 0 ifTrue:[^self].
+ tabSelection := 0
]
ifFalse:
[
- (tabSelectionIndex := something) ~~ 0
- ifTrue: [specSelector := (self class slices at:tabSelectionIndex) last]
+ (tabSelection := something) ~~ 0
+ ifTrue: [specSelector := (self class slices at:tabSelection) last]
].
- self specChannel value:specSelector
-
+ self specChannel value:specSelector.
+ (self window notNil and: [self window shown]) ifTrue: [self updateFonts]
! !
!DataSetBuilder methodsFor:'startup / release'!
-closeRequest
- "close request"
+openModalOnResourceSpec: aListSpec
+ "sets the modalOpened flag, so later,
+ there is no need to ask for saving into a class"
- self checkMenuItemModified ifTrue: [super closeRequest]
+ modalOpened := true.
+
+ super openModalOnResourceSpec: aListSpec
+
+
!
postBuildWith:builder
@@ -2206,11 +2290,12 @@
super postBuildWith:builder.
(builder componentAt: #labelAndColumns)
- selectConditionBlock: [:i|self checkMenuItemModified];
+ selectConditionBlock: [:i|self askForItemModification];
action: [:i|self cancel];
selection: 1.
+
! !
!DataSetBuilder methodsFor:'user actions'!
@@ -2220,8 +2305,7 @@
|column type|
- self valueOfEnablingCommitButtons value == false ifTrue: [^self].
- hasChanged := true.
+ super accept.
(column := self selectedColumn) isNil ifTrue: [^self cancel].
@@ -2237,7 +2321,9 @@
aspects keysAndValuesDo:[:aKey :aModel| column perform:(aKey , ':') asSymbol with: aModel value].
self seqList at:selectedColumnIndex put:(self labelFromColumn:column).
self updateColumnView.
- self cancel
+ self cancel.
+ modified := true.
+
!
cancel
@@ -2253,7 +2339,7 @@
|cls|
- (cls := self resolveRowClassNamed) notNil
+ (cls := self resolveClassNamed) notNil
ifTrue: [SystemBrowser openInClass:cls]
ifFalse:[self information:'No class defined!!']
@@ -2261,7 +2347,7 @@
!
-doCopyColumn
+doCopy
"copy selected column to the clipboard"
|idx|
@@ -2282,19 +2368,19 @@
label := 'Column ', (list size + 1) printString.
columns add:(DataSetColumnSpec label:label selector:nil) afterIndex:selectedColumnIndex.
self seqList add:label afterIndex:selectedColumnIndex.
- hasChanged := true.
self valueOfEnablingCommitButtons value ifFalse:[self selectedColumnModel value:selectedColumnIndex + 1].
self cancel.
- self updateColumnView
+ self updateColumnView.
+ modified := true.
!
-doCutColumn
+doCut
"remove selected column and put it to the clipboard"
|idx|
- ((idx := selectedColumnIndex) ~~ 0 and: [self checkMenuItemModified])
+ ((idx := selectedColumnIndex) ~~ 0 and: [self askForItemModification])
ifTrue:
[
self selectedColumnModel value:0.
@@ -2306,7 +2392,7 @@
self updateInputFields.
columns isEmpty ifTrue: [self isColumnSelected value: false].
self cancel.
- hasChanged := true.
+ modified := true.
]
!
@@ -2325,7 +2411,7 @@
rowClass notNil
ifTrue:
[
- (cls := self resolveRowClassNamed) notNil
+ (cls := self resolveClassNamed) notNil
ifTrue:
[
rowSuperClass := cls superclass name asString
@@ -2359,7 +2445,7 @@
]
ifFalse:
[
- cls := self resolveRowClassNamed.
+ cls := self resolveClassNamed.
cls notNil ifTrue:[cls := cls superclass name asString].
@@ -2375,7 +2461,7 @@
]
ifFalse:
[
- (cls isNil or:[rowSuperClass = cls]) ifTrue:[hasChanged := true. ^self].
+ (cls isNil or:[rowSuperClass = cls]) ifTrue:[^self].
self information:('A global named ' , rowClass , ' exists,\' ,
'but is not a subclass of ' , rowSuperClass, '.\\' ,
'Check and try again if that is not what you want.') withCRs.
@@ -2386,13 +2472,33 @@
]
!
+doDelete
+ "remove selected column and put it to the clipboard"
+
+ |idx|
+
+ ((idx := selectedColumnIndex) ~~ 0 and: [self askForItemModification])
+ ifTrue:
+ [
+ self selectedColumnModel value:0.
+ columns removeIndex:idx.
+ self seqList removeIndex:idx.
+ columns size > 0 ifTrue: [self selectedColumnModel value: ((idx - 1) max: 1)].
+ self updateColumnView.
+ self updateInputFields.
+ columns isEmpty ifTrue: [self isColumnSelected value: false].
+ self cancel.
+ modified := true.
+ ]
+!
+
doGenerateCode
"generate code for column values"
|cls superclass|
rowClass isNil ifTrue:[^self information:'No class defined!!'].
- cls := self resolveRowClassNamed.
+ cls := self resolveClassNamed.
cls isNil
ifTrue:
@@ -2429,7 +2535,6 @@
size := list size.
size == 1 ifTrue:[^self].
- hasChanged := true.
selectedColumnIndex := 0.
label := list at:idx.
col := columns at:idx.
@@ -2453,24 +2558,25 @@
self updateColumnView.
!
-doPasteColumn
+doPaste
"paste clipboard copy column after selected column or at left (nothing selected)"
|col lbl|
- self checkMenuItemModified ifFalse: [^nil].
+ self askForItemModification ifFalse: [^nil].
col := self class clipboard deepCopy.
lbl := self labelFromColumn:col.
columns add:col afterIndex:selectedColumnIndex.
self seqList add:lbl afterIndex:selectedColumnIndex.
- hasChanged := true.
self valueOfEnablingCommitButtons value ifFalse:[
self selectedColumnModel value:selectedColumnIndex + 1
].
self updateColumnView.
self updateInputFields.
+ modified := true.
+
!
doPickColumns