# HG changeset patch # User Claus Gittinger # Date 906735567 -7200 # Node ID b7bfaa2d6ecdc88e527aae0dc54159b0c0f6dae3 # Parent 7880fc48f0bb950439d1486f7b5c86586391c568 fix code generation diff -r 7880fc48f0bb -r b7bfaa2d6ecd DataSetBuilder.st --- a/DataSetBuilder.st Fri Sep 25 00:33:09 1998 +0200 +++ b/DataSetBuilder.st Fri Sep 25 16:59:27 1998 +0200 @@ -22,6 +22,13 @@ category:'Interface-UIPainter' ! +Array subclass:#Row + instanceVariableNames:'' + classVariableNames:'' + poolDictionaries:'' + privateIn:DataSetBuilder +! + !DataSetBuilder class methodsFor:'documentation'! copyright @@ -138,16 +145,22 @@ 'Default widget type or a selector returning an instance of a user defined widget opened in the cell.' #basicsFont -'Sets the font of the label text.' +'Sets the font of the labeled text.' #basicsJustification -'Aligns the label text to the left, right, or centered in the cell.' +'Aligns the label to the left, right, or center in the cell.' #basicsLabel -'The label of the column or a selector returning a string or an image.' +'The label of the column (String or StringCollection) or a selector returning the label.' + +#basicsLabelId +'Unique identifier of the column (optional).' #basicsLabelIsImage -'Turns on/off image behavior of the label string; i.e. it is used as selector returning an image.' +'Label is actually the selector if a message providing an image-label.' + +#basicsLabelTranslate +'Translate the label via the resource mechanism to a national language string.' #basicsRenderer 'Specifies displaying cell as Text, CheckToggle, ComboBox, ComboList or as a RowSelector.' @@ -228,34 +241,34 @@ 'A selector called if cell was double clicked.' #selectionCellSelector -'An optional selector, which is used to test whether the cell in the column is selectable; the ''Is Selectable'' flag must be enabled.' +'Name of the message sent to the row to validate a selection.' #selectionIsSelectable 'Turns on/off selection behavior of a column.' #selectionLabelClickSelector -'A selector called if label cell was clicked.' +'A selector called if a cell was clicked.' #selectionLabelSelectorArgument -'An argument passed to label selection selector.' +'An argument passed to the label selection selector.' #showSelectionHighLighted 'Show selected cell highligthened (change fg/bg color).' #valuesChoiceSelector -'A selector returning a collection of choices for a cell having a ComboBox or a ComboList widget.' +'Selector to get a collection of choices for a cell having a ComboBox or a ComboList widget.' #valuesMenuSelector -'A selector returning a middle button menu.' +'Selector to retrive the middle button menu.' #valuesPrintSelector -'A key selector used to register images on a DSVColumnView (the arg). For more detailed info see #register... methods in DSVColumnView.' +'Selector used to register images on a DSVColumnView (the arg). For more detailed info see #register... methods in DSVColumnView.' #valuesReadSelector -'A selector used to get (string or a bitmap) or set (if the write selector is undefined) the contents of a cell.' +'Selector returning the label to be displayed(string, bitmap or a collection).' #valuesWriteSelector -'A selector used to set the value of a cell.' +'Selector used to set the value derived from the editor.' ) @@ -304,11 +317,11 @@ #window: #(#WindowSpec #name: 'DataSet Basic' - #layout: #(#LayoutFrame 216 0 173 0 538 0 499 0) + #layout: #(#LayoutFrame 85 0 154 0 407 0 480 0) #label: 'DataSet Basic' #min: #(#Point 10 10) #max: #(#Point 1280 1024) - #bounds: #(#Rectangle 216 173 539 500) + #bounds: #(#Rectangle 85 154 408 481) #usePreferredExtent: false ) #component: @@ -334,6 +347,9 @@ #activeHelpKey: #basicsLabel #tabable: true #model: #label + #type: #smalltalkObject + #immediateAccept: false + #acceptOnLeave: true ) #(#LabelSpec #name: 'LabelFont' @@ -378,7 +394,7 @@ #(#CheckBoxSpec #name: 'CheckBox2' #layout: #(#LayoutOrigin 142 0 110 0) - #activeHelpKey: #basicsLabelIsImage + #activeHelpKey: #basicsLabelTranslate #tabable: true #model: #translateLabel #label: 'Translate Label' @@ -392,7 +408,7 @@ #(#InputFieldSpec #name: 'idField' #layout: #(#LayoutFrame 97 0 0 0 2 1.0 22 0) - #activeHelpKey: #basicsLabel + #activeHelpKey: #basicsLabelId #tabable: true #model: #id ) @@ -466,8 +482,6 @@ ) ) ) - - "Modified: / 13.8.1998 / 19:53:18 / cg" ! colorsEditSpec @@ -2136,22 +2150,32 @@ |sel catg code| catg := 'accessing' asSymbol. - code := 'aGC\' + code := '\' , ' "automatically generated by DataSetBuilder ..."\' , '\' , ' "get drawable image or text on a gc"\' , '\' - , ' ^nil' + , ' ^ ' . - columns do: - [:aColumn| - (aColumn rendererType ~~ #rowSelector - and:[(sel := aColumn printSelector) notNil - and:[(aClass implements:sel) not]]) - ifTrue: - [ - self compile:(sel asString, code) forClass:aClass inCategory:catg + columns do:[:aColumn| + ( aColumn rendererType ~~ #rowSelector + and:[(sel := aColumn printSelector) notNil + and:[(aClass implements:sel) not]] + ) ifTrue:[ + |args bcode keys| + bcode := sel asString. + args := sel numArgs. + + args ~~ 0 ifTrue:[ + args == 1 ifTrue:[ + bcode := bcode, 'aGC' + ] ifFalse:[ + keys := sel keywords. + bcode := (keys at:1), 'aGC ', (keys at:2), 'aColNr'. + ] + ]. + self compile:(bcode, code, '''', bcode, '''') forClass:aClass inCategory:catg ] ] ! @@ -2179,11 +2203,14 @@ (aColumn printSelector isNil or:[aColumn canSelect]) ifTrue: [ + |selName| + selName := sel asString. + sel numArgs == 0 - ifTrue: [bCode := sel asString, code] - ifFalse:[bCode := sel asString, 'anIndex\', code]. + ifTrue: [bCode := selName, code] + ifFalse:[bCode := selName, 'anIndex\', code]. aColumn rendererType == #CheckToggle - ifFalse:[bCode := bCode, ' ^nil'] + ifFalse:[bCode := bCode, ' ^ ''', selName, ''''] ifTrue: [bCode := bCode, ' ^true']. self compile:bCode forClass:aClass inCategory:catg ] @@ -2302,10 +2329,8 @@ askForListModification "asks for resource modification" - modalOpened - ifFalse: - [ - ^super askForListModification + modalOpened ifFalse:[ + ^ super askForListModification ]. ^true @@ -2313,23 +2338,27 @@ labelFromColumn:aColumn - ^ aColumn rendererType == #rowSelector - ifFalse:[aColumn label] - ifTrue: ['Row Selector']. + ^ aColumn rendererType == #rowSelector ifFalse:[aColumn label] + ifTrue: ['Row Selector']. +! + +labelInPreviewPressed:anIndex + (builder componentAt:#labelAndColumns) selection:anIndex ! updateColumnView - "updates column view from column descriptions" + "updates column view from column descriptions + " + |size| columnView notNil ifTrue:[ |previewColumns columnItems columnList| columnList := List new. previewColumns := columns deepCopy. - columns notEmpty - ifTrue: - [ - previewColumns do: - [:column| + size := previewColumns size. + + size ~~ 0 ifTrue:[ + previewColumns keysAndValuesDo:[:anIndex :column| column readSelector: #at:; writeSelector: #at:put:; backgroundSelector:nil; @@ -2339,12 +2368,13 @@ doubleClickedSelector: nil; printSelector: nil; menu: nil; - choices: nil + labelActionSelector:#labelInPreviewPressed:; + labelActionArgument:anIndex; + choices:#choices ]. - #('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]. + #(' 1' ' 2' ' x') do:[:suffix| + columnItems := Row new:size. + 1 to:size do:[:i| columnItems at: i put: ('Cell', suffix)]. columnList add: columnItems. ] ]. @@ -2359,13 +2389,9 @@ |column| - (column := self selectedColumn) isNil - ifTrue: - [ + (column := self selectedColumn) isNil ifTrue:[ self tabModel value:0. - ] - ifFalse: - [ + ] ifFalse:[ aspects keysAndValuesDo:[:aKey :aModel|aModel value:(column perform:aKey) withoutNotifying: self]. tabSelection == 0 ifTrue:[self tabModel value:1] ] @@ -2390,9 +2416,7 @@ selectedColumnIndex:something "changes selected column and update specifications" - something == selectedColumnIndex - ifFalse: - [ + something == selectedColumnIndex ifFalse:[ selectedColumnIndex := something ? 0. self isColumnSelected value: true ] @@ -2405,16 +2429,14 @@ |specSelector| something == tabSelection ifTrue:[^self]. - self selectedColumn isNil - ifTrue: - [ + + self selectedColumn isNil ifTrue:[ tabSelection == 0 ifTrue:[^self]. tabSelection := 0 - ] - ifFalse: - [ - (tabSelection := something) ~~ 0 - ifTrue: [specSelector := (self class slices at:tabSelection) last] + ] ifFalse:[ + (tabSelection := something) ~~ 0 ifTrue:[ + specSelector := (self class slices at:tabSelection) last + ] ]. self specChannel value:specSelector. (self window notNil and: [self window shown]) ifTrue: [self updateFonts] @@ -2448,7 +2470,7 @@ postBuildWith:builder columnView := self builder componentAt:#columnView. - columnView labelView enabled:false. + "/ columnView labelView enabled:false. super postBuildWith:builder. @@ -2816,6 +2838,23 @@ ! ! +!DataSetBuilder::Row methodsFor:'accessing'! + +choices + ^ #( 'foo' 'bar' 'baz' ) + + +! ! + +!DataSetBuilder::Row methodsFor:'message handling'! + +doesNotUnderstand:aMessage + "does not understand message; delegate to column view + " + ^ nil + +! ! + !DataSetBuilder class methodsFor:'documentation'! version