DataSetBuilder.st
author Claus Gittinger <cg@exept.de>
Wed, 29 Jun 2011 19:14:46 +0200
changeset 2847 65280fe44707
parent 2840 3fc46b951a0f
child 2903 8470507f8cd8
permissions -rw-r--r--
category of: #handleMouseIn:x:y:

"
 COPYRIGHT (c) 1997 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
"{ Package: 'stx:libtool2' }"

ResourceSpecEditor subclass:#DataSetBuilder
	instanceVariableNames:'rowClass rowSuperClass columnView columns selectedColumnIndex
		modalOpened listOfSpecViews listOfItemsView editingSpecOnly
		acceptedColumns'
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-UIPainter'
!

Array variableSubclass:#Row
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	privateIn:DataSetBuilder
!

!DataSetBuilder class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1997 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"




!

documentation
"
    create and modify or inspect dataset columns; used by UIPainter (DataSetColumnSpec)

    [see also:]
        DataSetColumnSpec
        DataSetSpec
        DataSetView
        DataSetColumn

    [author:]
        Claus Atzkern, eXept Software AG
"

! !

!DataSetBuilder class methodsFor:'accessing'!

resourceType
    "get the type of resource of the method generated by the MenuEditor"

    ^#tableColumns


! !

!DataSetBuilder class methodsFor:'aspects'!

aspects
    "get the aspects for the attributes of the table columns"

    ^#(
        id
        activeHelpKey
        activeHelpKeyForLabel
        label
        canSelect
        choices
        translatedChoices
        editorType
        formatString
        formatSelector
        labelIsImage
        labelButtonType
        translateLabel
        longStringCompression
        size
        type
        width
        minWidth
        usePreferredWidth
        isResizeable
        height
        menu
        menuFromApplication
        foregroundSelector
        backgroundSelector
        selectedForegroundSelector
        selectedBackgroundSelector
        doubleClickedSelector
        rowSeparatorSelector
        selectSelector
        converterSelector
        showComboFieldSelector
        printSelector
        readSelector
        writeSelector
        visibilitySelector
        rendererType
        showColSeparator
        showSelectionHighLighted
        showRowSeparator
        backgroundColor
        foregroundColor
        selectedBackgroundColor
        selectedForegroundColor
        labelForegroundColor
        labelBackgroundColor
        labelFont
        labelActionSelector
        labelActionArgument
        labelAlignment
        columnAlignment
        minValue
        maxValue
        isSortable
        sortSelector
        sortBlockSelector
     )

    "Modified: / 25-10-2010 / 10:31:51 / cg"
! !

!DataSetBuilder class methodsFor:'help specs'!

flyByHelpSpec
    "This resource specification was automatically generated
     by the UIHelpTool of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIHelpTool may not be able to read the specification."

    "
     UIHelpTool openOnClass:DataSetBuilder    
    "

    <resource: #help>

    ^ super flyByHelpSpec addPairsFrom:#(

#addColumn
'Add a Column'

#addNonSelectableColumn
'Add a Non-Selectable Column'

#fileLoad
'Load Column Description from Method'

#fileNew
'New Column Description'

#fileSave
'Save the Column Description'

#fileSaveMethod
'Save Column Description as Method'

#fileSaveAsMethod
'Save Column Description as Method (ask for Class/Selector)'

#editCut
'Cut Column'

#editCopy
'Copy Column'

#editPaste
'Paste Column'

)
!

helpSpec
    "This resource specification was automatically generated
     by the UIHelpTool of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIHelpTool may not be able to read the specification."

    "
     UIHelpTool openOnClass:DataSetBuilder    
    "

    <resource: #help>

    ^ super helpSpec addPairsFrom:#(

#addColumn
'Adds a new column.'

#addNonSelectableColumn
'Adds a new non-selectable column.'

#basicsEditor
'Default widget type or a selector returning an instance of a user defined widget opened in the cell.'

#basicsFont
'Sets the font of the labeled text.'

#basicsJustification
'Aligns the label to the left, right, or center in the cell.'

#basicsJustificationEditor
'Aligns the column editor to the left, right, or center in the cell.'

#basicsLabel
'The label of the column, a String or an array of Strings.'

#basicsLabelId
'Unique identifier of the column (optional).'

#basicsLabelIsImage
'Label is actually the selector of 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.'

#browseRowClass
'Open a browser on the row class'

#colorsBackgroundCellColor
'The background color of the cell.'

#colorsBackgroundLabelColor
'The background color of the label.'

#colorsBackgroundSelector
'Optional selector returning the background color for the cell (with optional row/column args).'

#colorsForegroundCellColor
'The foreground color of the cell (with optional row/column args).'

#colorsForegroundLabelColor
'The foreground color of the label.'

#colorsForegroundSelector
'Optional selector returning the foreground color for a cell.'

#converterSelector
'Selector returning a TypeConverter on the model the argument or nil.'

#fileLoad
'Specify class/selector and edit that column description'

#fileNew
'Discard changes and continue with a new, empty column description'

#fileSave
'Install the column description'

#fileSaveAs
'Specify class/selector and install the column description'

#formatFormatSelector
'Selector sent to the row to get the format string.'

#formatInputType
'A type converter symbol used by the input field.'

#formatMaxSize
'Maximum size of the string which can be typed in. 0 or nil means unlimited.'

#formatTextFormat
'Format string specifying the output format of the cell text. (printf-format - for example: %5.4f gives 0.0000).'

#frameColumnWidth
'Width (fixed or relative) of a column (optional).'

#frameMinWidth
'Minimum width of the column (optional).'

#frameRowHeight
'Height of the row (optional).'

#frameShowColumnSeparator
'Turns on/off displaying column separators.'

#frameShowRowSeparator
'Turns on/off displaying row separators.'

#frameShowRowSeparatorSelector
'Message selector to test if the bottom separator is shown.'

#generateCode
'Generate code and install in the selected class/selector.'

#isResizable
'Column can be resized by user.'

#isSortable
'Adds indicator to allow user to sort rows based on this column.'

#pickColumns
'Select an open view and readOut the column specification from it.'

#selectedBackgroundCellColor
'Optional background color of a selected cell.'

#selectedBackgroundCellColorSelector
'Optional selector returning the background color for a selected cell.'

#selectedForegroundCellColor
'Optional foreground color of a selected cell.'

#selectedForegroundCellColorSelector
'Optional selector returning the foreground color for a selected cell.'

#selectionCellClickSelector
'Message sent if cell is about to be selected - return boolean to en/disable editing'

#selectionCellDoubleClickSelector
'Message sent if cell is double clicked'

#selectionCellSelector
'Name of the message sent to the row to validate a selection.'

#selectionIsSelectable
'Turns on/off selection behavior of a column.'

#selectionLabelClickSelector
'Message sent if a columns label was clicked on'

#selectionLabelSelectorArgument
'An optional argument passed with the message above.'

#showComboFieldSelector
'Selector which returns true if the editor on the ComboBox/List has an input field.'

#showSelectionHighLighted
'Show selected cell highligthened (change fg/bg color).'

#sortBlockSelector
'Sent to the row to retrieve a selector which is sent to the application to provide a block for sorting.'

#sortSelector
'Sent to the row to extract the value used for sorting. If a block is returned, that one is used as sortBlock.'

#usePreferredWidth
'Compute width from first 10 row items.'

#valuesChoicesSelector
'Selector to get a collection of choices for a cell having a ComboBox or a ComboList widget.'

#valuesMenuFromApplication
'Fetch the menu from the application (instead of the row)'

#valuesMenuSelector
'Selector to retrieve the middle button menu.'

#valuesPrintSelector
'Selector used to register images on a DSVColumnView (the arg). For more detailed info see #register... methods in DSVColumnView.'

#valuesReadSelector
'Selector returning the label to be displayed (string, bitmap or a collection).'

#valuesVisibilitySelector
'Boolean message selector controlling the columns visibility.'

#valuesWriteSelector
'Selector used to set the value derived from the editor.'

#valuesXChoicesSelector
'Selector to get a collection of translated choices for a cell having a ComboBox or a ComboList widget.'

)

    "Modified: / 01-04-2011 / 16:23:39 / cg"
! !

!DataSetBuilder class methodsFor:'image specs'!

newColumnIcon
    "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."

    "
     self newColumnIcon inspect
     ImageEditor openOnClass:self andSelector:#newColumnIcon
     Icon flushCachedIcons
    "

    <resource: #image>

    ^Icon
        constantNamed:#'DataSetBuilder class newColumnIcon'
        ifAbsentPut:[(Depth2Image new) width: 19; height: 22; photometric:(#palette); bitsPerSample:(#[2]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
U@@@@EQTUUUXUEQ***1TUF (+EQTX*H,UEQ"("1TUF (+EQTZ**,UEQ"("1TUFJ"KEQTX*H,UEQ HB1TUF**+EQTZ**,UEQ"H"1TUF@ KEQTX"@,UEQ"H"1T
UF**+EQTZ**,UER???1TU@@@@EPb') ; colorMapFromArray:#[0 0 0 255 255 255 170 170 170 127 127 127]; mask:((Depth1Image new) width: 19; height: 22; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@') ; yourself); yourself]
!

newColumnNonSelectableIcon
    "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."

    "
     self newColumnNonSelectableIcon inspect
     ImageEditor openOnClass:self andSelector:#newColumnNonSelectableIcon
     Icon flushCachedIcons
    "

    <resource: #image>

    ^Icon
        constantNamed:#'DataSetBuilder class newColumnNonSelectableIcon'
        ifAbsentPut:[(Depth2Image new) width: 19; height: 22; photometric:(#palette); bitsPerSample:(#[2]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
U@@@@EQTUUUXUEQ***1TUF**+EQTX*(,UEQ"*"1TUFB(KEQTZJ",UEQ(HJ1TUF("+EQTZ J,UEQ*@*1TUF("+EQTZBB,UEQ(*J1TUFB(KEQTX*(,UEQ"*"1T
UF**+EQTZ**,UER???1TU@@@@EPb') ; colorMapFromArray:#[0 0 0 255 255 255 170 170 170 127 127 127]; mask:((Depth1Image new) width: 19; height: 22; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@G?<@') ; yourself); yourself]
! !

!DataSetBuilder class methodsFor:'interface specs'!

basicsEditSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:DataSetBuilder andSelector:#basicsEditSpec
     DataSetBuilder new openInterface:#basicsEditSpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: basicsEditSpec
        window: 
       (WindowSpec
          label: 'DataSet Basic'
          name: 'DataSet Basic'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 389 473)
        )
        component: 
       (SpecCollection
          collection: (
           (VerticalPanelViewSpec
              name: 'VerticalPanel1'
              layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              horizontalLayout: fit
              verticalLayout: top
              horizontalSpace: 3
              verticalSpace: 3
              component: 
             (SpecCollection
                collection: (
                 (FramedBoxSpec
                    label: 'Header:'
                    name: 'headerFrame'
                    labelPosition: topLeft
                    translateLabel: true
                    component: 
                   (SpecCollection
                      collection: (
                       (LabelSpec
                          label: 'ID:'
                          name: 'idLabel'
                          layout: (AlignmentOrigin 94 0 14 0 1 0.5)
                          translateLabel: true
                          resizeForLabel: true
                        )
                       (InputFieldSpec
                          name: 'idField'
                          layout: (LayoutFrame 97 0 0 0 2 1.0 22 0)
                          activeHelpKey: basicsLabelId
                          tabable: true
                          model: id
                          group: inputGroup
                          acceptOnLostFocus: false
                          acceptChannel: acceptChannel
                          modifiedChannel: modifiedChannel
                          acceptOnPointerLeave: false
                        )
                       (LabelSpec
                          label: 'Label:'
                          name: 'label1'
                          layout: (AlignmentOrigin 94 0 39 0 1 0.5)
                          translateLabel: true
                          resizeForLabel: true
                        )
                       (InputFieldSpec
                          name: 'labelField'
                          layout: (LayoutFrame 97 0 28 0 2 1.0 50 0)
                          activeHelpKey: basicsLabel
                          tabable: true
                          model: label
                          group: inputGroup
                          type: smalltalkObject
                          immediateAccept: false
                          acceptOnLeave: false
                          acceptOnLostFocus: false
                          acceptChannel: acceptChannel
                          modifiedChannel: modifiedChannel
                          acceptOnPointerLeave: false
                        )
                       (LabelSpec
                          label: 'Font:'
                          name: 'LabelFont'
                          layout: (AlignmentOrigin 94 0 68 0 1 0.5)
                          translateLabel: true
                          resizeForLabel: true
                          adjust: left
                        )
                       (FontMenuSpec
                          name: 'fontMenu'
                          layout: (LayoutFrame 97 0 56 0 0 1.0 78 0)
                          activeHelpKey: labelFont
                          model: style
                          allowSymbolicFonts: true
                        )
                       (LabelSpec
                          label: 'Type:'
                          name: 'Type'
                          layout: (AlignmentOrigin 52 0 100 0 1 0.5)
                          translateLabel: true
                          resizeForLabel: true
                          adjust: right
                        )
                       (ComboListSpec
                          name: 'labelButtonType'
                          layout: (LayoutFrame 57 0 91 0 158 0 111 0)
                          tabable: true
                          model: labelButtonType
                          comboList: 
                         (Array
                            None Button
                            Group
                          )
                          useIndex: false
                          hidePullDownMenuButton: false
                        )
                       (LabelSpec
                          label: 'Align:'
                          name: 'JustificationLabel'
                          layout: (AlignmentOrigin 243 0 100 0 1 0.5)
                          translateLabel: true
                          resizeForLabel: true
                          adjust: right
                        )
                       (PopUpListSpec
                          label: 'Alignment'
                          name: 'Alignment'
                          layout: (LayoutFrame 248 0 91 0 2 1.0 113 0)
                          activeHelpKey: basicsJustification
                          tabable: true
                          model: labelAlignment
                          menu: 
                         (Array
                            left right
                            center
                          )
                        )
                       (CheckBoxSpec
                          label: 'Label Is Image'
                          name: 'labelIsImage'
                          layout: (LayoutOrigin -3 0 120 0)
                          activeHelpKey: basicsLabelIsImage
                          tabable: true
                          model: labelIsImage
                          translateLabel: true
                        )
                       (CheckBoxSpec
                          label: 'Translate Label'
                          name: 'CheckBox2'
                          layout: (LayoutOrigin 200 0 120 0)
                          activeHelpKey: basicsLabelTranslate
                          tabable: true
                          model: translateLabel
                          translateLabel: true
                        )
                       )
                     
                    )
                    extent: (Point 389 176)
                  )
                 (FramedBoxSpec
                    label: 'Cell Type:'
                    name: 'typesFrame'
                    labelPosition: topLeft
                    translateLabel: true
                    component: 
                   (SpecCollection
                      collection: (
                       (LabelSpec
                          label: 'Renderer:'
                          name: 'rendererLabel'
                          layout: (AlignmentOrigin 94 0 16 0 1 0.5)
                          translateLabel: true
                          resizeForLabel: true
                        )
                       (ComboListSpec
                          name: 'rendererField'
                          layout: (LayoutFrame 97 0 5 0 2 1.0 27 0)
                          activeHelpKey: basicsRenderer
                          tabable: true
                          model: rendererType
                          comboList: rendererTypeList
                          useIndex: false
                          hidePullDownMenuButton: false
                        )
                       (LabelSpec
                          label: 'Editor:'
                          name: 'editorLabel'
                          layout: (AlignmentOrigin 94 0 42 0 1 0.5)
                          translateLabel: true
                          resizeForLabel: true
                        )
                       (ComboBoxSpec
                          name: 'editorField'
                          layout: (LayoutFrame 97 0 31 0 2 1.0 53 0)
                          activeHelpKey: basicsEditor
                          tabable: true
                          model: editorType
                          type: symbolOrNil
                          acceptOnLostFocus: false
                          acceptChannel: acceptChannel
                          modifiedChannel: modifiedChannel
                          acceptOnPointerLeave: false
                          comboList: editorTypeList
                          useIndex: false
                          isFilenameBox: false
                        )
                       (LabelSpec
                          label: 'Align:'
                          name: 'JustificationC'
                          layout: (LayoutFrame -194 1 58 0 -114 1 79 0)
                          translateLabel: true
                          resizeForLabel: true
                          adjust: right
                        )
                       (PopUpListSpec
                          label: 'Alignment'
                          name: 'AlignmentC'
                          layout: (LayoutFrame -115 1 58 0 2 1.0 80 0)
                          activeHelpKey: basicsJustificationEditor
                          tabable: true
                          model: columnAlignment
                          menu: 
                         (Array
                            left right
                            center decimal decimalRight
                          )
                        )
                       (CheckBoxSpec
                          label: 'Compress Long Strings'
                          name: 'LongStringCompressionCheckBox'
                          layout: (LayoutFrame -3 0 58 0 188 0 79 0)
                          activeHelpKey: basicsLabelTranslate
                          tabable: true
                          model: longStringCompression
                          translateLabel: true
                        )
                       )
                     
                    )
                    extent: (Point 389 114)
                  )
                 (FramedBoxSpec
                    label: 'Active Help:'
                    name: 'activeHelpFrame'
                    labelPosition: topLeft
                    translateLabel: true
                    component: 
                   (SpecCollection
                      collection: (
                       (LabelSpec
                          label: 'Key:'
                          name: 'Label1'
                          layout: (AlignmentOrigin 94 0 14 0 1 0.5)
                          translateLabel: true
                          resizeForLabel: true
                        )
                       (InputFieldSpec
                          name: 'EntryField1'
                          layout: (LayoutFrame 97 0 0 0 2 1.0 22 0)
                          activeHelpKey: basicsLabelId
                          tabable: true
                          model: activeHelpKey
                          group: inputGroup
                          acceptOnLostFocus: false
                          acceptChannel: acceptChannel
                          modifiedChannel: modifiedChannel
                          acceptOnPointerLeave: false
                        )
                       (LabelSpec
                          label: 'Key for Label:'
                          name: 'Label2'
                          layout: (AlignmentOrigin 94 0 42 0 1 0.5)
                          translateLabel: true
                          resizeForLabel: true
                        )
                       (InputFieldSpec
                          name: 'EntryField2'
                          layout: (LayoutFrame 97 0 28 0 2 1.0 50 0)
                          activeHelpKey: basicsLabelId
                          tabable: true
                          model: activeHelpKeyForLabel
                          group: inputGroup
                          acceptOnLostFocus: false
                          acceptChannel: acceptChannel
                          modifiedChannel: modifiedChannel
                          acceptOnPointerLeave: false
                        )
                       )
                     
                    )
                    extent: (Point 389 81)
                  )
                 )
               
              )
            )
           )
         
        )
      )
!

colorsEditSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "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
     DataSetBuilder new openInterface:#colorsEditSpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: colorsEditSpec
        window: 
       (WindowSpec
          label: 'DataSet Misc'
          name: 'DataSet Misc'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 369 451)
        )
        component: 
       (SpecCollection
          collection: (
           (FramedBoxSpec
              label: 'Label Colors:'
              name: 'ColorsBox'
              layout: (LayoutFrame 0 0.0 3 0 0 1.0 86 0)
              labelPosition: topLeft
              translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (LabelSpec
                    label: 'Foreground:'
                    name: 'label1'
                    layout: (AlignmentOrigin 112 0 14 0 1 0.5)
                    translateLabel: true
                    resizeForLabel: true
                    adjust: right
                  )
                 (ColorMenuSpec
                    name: 'colorMenu1'
                    layout: (LayoutFrame 115 0 2 0 -3 1.0 24 0)
                    activeHelpKey: colorsForegroundLabelColor
                    model: labelForegroundColor
                    labelsAreColored: true
                  )
                 (LabelSpec
                    label: 'Background:'
                    name: 'label2'
                    layout: (AlignmentOrigin 112 0 42 0 1 0.5)
                    translateLabel: true
                    resizeForLabel: true
                    adjust: right
                  )
                 (ColorMenuSpec
                    name: 'colorMenu2'
                    layout: (LayoutFrame 115 0 30 0 -3 1.0 52 0)
                    activeHelpKey: colorsBackgroundLabelColor
                    model: labelBackgroundColor
                    labelsAreColored: false
                  )
                 )
               
              )
            )
           (FramedBoxSpec
              label: 'Cell Colors:'
              name: 'defaultColorsBox'
              layout: (LayoutFrame 0 0.0 91 0 0 1.0 232 0)
              labelPosition: topLeft
              translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (LabelSpec
                    label: 'Foreground:'
                    name: 'fgLabel'
                    layout: (AlignmentOrigin 112 0 11 0 1 0.5)
                    translateLabel: true
                    resizeForLabel: true
                    adjust: right
                  )
                 (ColorMenuSpec
                    name: 'fgMenu'
                    layout: (LayoutFrame 115 0 -1 0 -3 1.0 21 0)
                    activeHelpKey: colorsForegroundCellColor
                    model: foregroundColor
                    labelsAreColored: true
                  )
                 (LabelSpec
                    label: 'Background:'
                    name: 'bgLabel'
                    layout: (AlignmentOrigin 112 0 39 0 1 0.5)
                    translateLabel: true
                    resizeForLabel: true
                    adjust: right
                  )
                 (ColorMenuSpec
                    name: 'bgMenu'
                    layout: (LayoutFrame 115 0 27 0 -3 1.0 49 0)
                    activeHelpKey: colorsBackgroundCellColor
                    model: backgroundColor
                    labelsAreColored: false
                  )
                 (LabelSpec
                    label: 'FG-Selector:'
                    name: 'fgSelLabel'
                    layout: (AlignmentOrigin 112 0 73 0 1 0.5)
                    translateLabel: true
                    resizeForLabel: true
                    adjust: right
                  )
                 (InputFieldSpec
                    name: 'fgSelField'
                    layout: (LayoutFrame 115 0 62 0 0 1.0 84 0)
                    activeHelpKey: colorsForegroundSelector
                    tabable: true
                    model: foregroundSelector
                    group: inputGroup
                    type: symbolOrNil
                    acceptOnLostFocus: false
                    acceptChannel: acceptChannel
                    modifiedChannel: modifiedChannel
                    acceptOnPointerLeave: false
                  )
                 (LabelSpec
                    label: 'BG-Selector:'
                    name: 'bgSelLabel'
                    layout: (AlignmentOrigin 112 0 98 0 1 0.5)
                    translateLabel: true
                    resizeForLabel: true
                    adjust: right
                  )
                 (InputFieldSpec
                    name: 'bgSelField'
                    layout: (LayoutFrame 115 0 87 0 0 1.0 109 0)
                    activeHelpKey: colorsBackgroundSelector
                    tabable: true
                    model: backgroundSelector
                    group: inputGroup
                    type: symbolOrNil
                    acceptOnLostFocus: false
                    acceptChannel: acceptChannel
                    modifiedChannel: modifiedChannel
                    acceptOnPointerLeave: false
                  )
                 )
               
              )
            )
           (FramedBoxSpec
              label: 'Selected Cell Colors:'
              name: 'selectedCellColorsBox'
              layout: (LayoutFrame 0 0.0 236 0 0 1.0 377 0)
              labelPosition: topLeft
              translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (LabelSpec
                    label: 'Foreground:'
                    name: 'selFgLabel'
                    layout: (AlignmentOrigin 112 0 11 0 1 0.5)
                    translateLabel: true
                    resizeForLabel: true
                    adjust: right
                  )
                 (ColorMenuSpec
                    name: 'selFgMenu'
                    layout: (LayoutFrame 115 0 -1 0 -3 1.0 21 0)
                    activeHelpKey: selectedForegroundCellColor
                    model: selectedForegroundColor
                    labelsAreColored: true
                  )
                 (LabelSpec
                    label: 'Background:'
                    name: 'selBgLabel'
                    layout: (AlignmentOrigin 112 0 39 0 1 0.5)
                    translateLabel: true
                    resizeForLabel: true
                    adjust: right
                  )
                 (ColorMenuSpec
                    name: 'selBgMenu'
                    layout: (LayoutFrame 115 0 27 0 -3 1.0 49 0)
                    activeHelpKey: colorsBackgroundCellColor
                    model: selectedBackgroundColor
                    labelsAreColored: false
                  )
                 (LabelSpec
                    label: 'FG-Selector:'
                    name: 'Label3'
                    layout: (AlignmentOrigin 112 0 73 0 1 0.5)
                    translateLabel: true
                    resizeForLabel: true
                    adjust: right
                  )
                 (InputFieldSpec
                    name: 'EntryField1'
                    layout: (LayoutFrame 115 0 62 0 0 1.0 84 0)
                    activeHelpKey: colorsForegroundSelector
                    tabable: true
                    model: selectedForegroundSelector
                    group: inputGroup
                    type: symbolOrNil
                    acceptOnLostFocus: false
                    acceptChannel: acceptChannel
                    modifiedChannel: modifiedChannel
                    acceptOnPointerLeave: false
                  )
                 (LabelSpec
                    label: 'BG-Selector:'
                    name: 'Label4'
                    layout: (AlignmentOrigin 112 0 98 0 1 0.5)
                    translateLabel: true
                    resizeForLabel: true
                    adjust: right
                  )
                 (InputFieldSpec
                    name: 'EntryField2'
                    layout: (LayoutFrame 115 0 87 0 0 1.0 109 0)
                    activeHelpKey: colorsBackgroundSelector
                    tabable: true
                    model: selectedBackgroundSelector
                    group: inputGroup
                    type: symbolOrNil
                    acceptOnLostFocus: false
                    acceptChannel: acceptChannel
                    modifiedChannel: modifiedChannel
                    acceptOnPointerLeave: false
                  )
                 )
               
              )
            )
           )
         
        )
      )

    "Modified: / 01-04-2011 / 16:26:37 / cg"
!

defineClassNameSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "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
     DataSetBuilder new openInterface:#defineClassNameSpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: defineClassNameSpec
        window: 
       (WindowSpec
          label: 'Data Set Builder'
          name: 'Data Set Builder'
          min: (Point 10 10)
          bounds: (Rectangle 14 46 341 182)
        )
        component: 
       (SpecCollection
          collection: (
           (FramedBoxSpec
              label: 'Class for code'
              name: 'framedBox1'
              layout: (LayoutFrame 0 0.0 3 0.0 0 1.0 -34 1.0)
              labelPosition: topLeft
              translateLabel: true
            )
           (LabelSpec
              label: 'Class:'
              name: 'classLabel'
              layout: (AlignmentOrigin 73 0.11 38 0 1 0.5)
              translateLabel: true
              resizeForLabel: true
              adjust: right
            )
           (InputFieldSpec
              name: 'classNameInputField'
              layout: (LayoutFrame 77 0.11 27 0 -16 1.0 49 0)
              tabable: true
              model: classNameChannel
              acceptOnPointerLeave: false
            )
           (LabelSpec
              label: 'Superclass:'
              name: 'superClassLabel'
              layout: (AlignmentOrigin 73 0.11 65 0 1 0.5)
              translateLabel: true
              resizeForLabel: true
              adjust: right
            )
           (InputFieldSpec
              name: 'superclassNameInputField'
              layout: (LayoutFrame 76 0.11 55 0 -16 1.0 77 0)
              tabable: true
              model: superclassNameChannel
              acceptOnPointerLeave: false
            )
           (UISubSpecification
              name: 'SubSpecification'
              layout: (LayoutFrame 0 0.0 -29 1 0 1.0 -5 1.0)
              majorKey: ToolApplicationModel
              minorKey: windowSpecForCommitWithoutChannels
            )
           )
         
        )
      )
!

formatEditSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "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
     DataSetBuilder new openInterface:#formatEditSpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: formatEditSpec
        window: 
       (WindowSpec
          label: 'DataSet Details'
          name: 'DataSet Details'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 388 149)
        )
        component: 
       (SpecCollection
          collection: (
           (FramedBoxSpec
              label: 'Column Format'
              name: 'framedBox1'
              layout: (LayoutFrame 0 0.0 3 0 0 1.0 149 0)
              labelPosition: topLeft
              translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (LabelSpec
                    label: 'Type:'
                    name: 'typeLabel'
                    layout: (AlignmentOrigin 115 0 26 0 1 0.5)
                    translateLabel: true
                    resizeForLabel: true
                    activeHelpKey: formatInputType
                  )
                 (ComboListSpec
                    name: 'typeCombo'
                    layout: (LayoutFrame 118 0 15 0 3 1.0 37 0)
                    activeHelpKey: formatInputType
                    tabable: true
                    model: type
                    comboList: possiblePrintConverterTypes
                    useIndex: false
                    hidePullDownMenuButton: false
                  )
                 (LabelSpec
                    label: 'Max Size:'
                    name: 'sizeLabel'
                    layout: (AlignmentOrigin 115 0 52 0 1 0.5)
                    translateLabel: true
                    resizeForLabel: true
                    activeHelpKey: formatMaxSize
                  )
                 (InputFieldSpec
                    name: 'sizeField'
                    layout: (LayoutFrame 118 0 41 0 3 1.0 63 0)
                    activeHelpKey: formatMaxSize
                    tabable: true
                    model: size
                    group: inputGroup
                    type: numberOrNil
                    acceptOnLostFocus: false
                    acceptChannel: acceptChannel
                    modifiedChannel: modifiedChannel
                    acceptOnPointerLeave: false
                  )
                 (LabelSpec
                    label: 'Text Format:'
                    name: 'formatLabel'
                    layout: (AlignmentOrigin 115 0 77 0 1 0.5)
                    translateLabel: true
                    resizeForLabel: true
                    activeHelpKey: formatTextFormat
                  )
                 (InputFieldSpec
                    name: 'formatField'
                    layout: (LayoutFrame 118 0 66 0 3 1.0 88 0)
                    activeHelpKey: formatTextFormat
                    tabable: true
                    model: formatString
                    group: inputGroup
                    acceptOnLostFocus: false
                    acceptChannel: acceptChannel
                    modifiedChannel: modifiedChannel
                    acceptOnPointerLeave: false
                  )
                 (LabelSpec
                    label: 'Format Selector:'
                    name: 'formatSelectorLabel'
                    layout: (AlignmentOrigin 115 0 103 0 1 0.5)
                    translateLabel: true
                    resizeForLabel: true
                    activeHelpKey: formatFormatSelector
                  )
                 (InputFieldSpec
                    name: 'formatSelector'
                    layout: (LayoutFrame 118 0 92 0 3 1.0 114 0)
                    activeHelpKey: formatFormatSelector
                    tabable: true
                    model: formatSelector
                    group: inputGroup
                    acceptOnLostFocus: false
                    acceptChannel: acceptChannel
                    modifiedChannel: modifiedChannel
                    acceptOnPointerLeave: false
                  )
                 )
               
              )
            )
           )
         
        )
      )
!

frameEditSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "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
     DataSetBuilder new openInterface:#frameEditSpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: frameEditSpec
        window: 
       (WindowSpec
          label: 'DataSet Dimension'
          name: 'DataSet Dimension'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 396 313)
        )
        component: 
       (SpecCollection
          collection: (
           (FramedBoxSpec
              label: 'Separators'
              name: 'separatorBox'
              layout: (LayoutFrame 0 0.0 3 0 0 1.0 132 0)
              labelPosition: topLeft
                    translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (CheckBoxSpec
                    label: 'Show Row-Separator'
                    name: 'showRowSeparator'
                    layout: (LayoutFrame 5 0 15 0 293 0 38 0)
                    activeHelpKey: frameShowRowSeparator
                    tabable: true
                    model: showRowSeparator
                    translateLabel: true
                  )
                 (InputFieldSpec
                    name: 'rowSeparatorSelector'
                    layout: (LayoutFrame 142 0 41 0 2 1.0 63 0)
                    activeHelpKey: frameShowRowSeparatorSelector
                    tabable: true
                    model: rowSeparatorSelector
                    group: inputGroup
                    type: symbolOrNil
                    acceptOnLostFocus: false
                    acceptChannel: acceptChannel
                    modifiedChannel: modifiedChannel
                    acceptOnPointerLeave: false
                  )
                 (CheckBoxSpec
                    label: 'Show Column-Separator'
                    name: 'showColSeparator'
                    layout: (LayoutFrame 5 0 70 0 294 0 93 0)
                    activeHelpKey: frameShowColumnSeparator
                    tabable: true
                    model: showColSeparator
                    translateLabel: true
                  )
                 (LabelSpec
                    label: 'Selector:'
                    name: 'Label1'
                    layout: (LayoutFrame 80 0.0 44 0 140 0.0 61 0)
                    resizeForLabel: true
                    adjust: right
                    translateLabel: true
                  )
                 )
               
              )
            )
           (FramedBoxSpec
              label: 'Dimensions:'
              name: 'framedBox1'
              layout: (LayoutFrame 0 0.0 133 0 0 1.0 305 0)
              labelPosition: topLeft
                    translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (LabelSpec
                    label: 'Column Width:'
                    name: 'widthLabel'
                    layout: (AlignmentOrigin 140 0.0 23 0 1 0.5)
                    resizeForLabel: true
                    adjust: right
                    translateLabel: true
                  )
                 (InputFieldSpec
                    name: 'widthField'
                    layout: (LayoutFrame 142 0 12 0 2 1.0 34 0)
                    activeHelpKey: frameColumnWidth
                    tabable: true
                    model: width
                    group: inputGroup
                    type: numberOrNil
                    acceptOnLostFocus: false
                    acceptChannel: acceptChannel
                    modifiedChannel: modifiedChannel
                    acceptOnPointerLeave: false
                  )
                 (LabelSpec
                    label: 'Min. Width:'
                    name: 'minWidthLabel'
                    layout: (AlignmentOrigin 140 0.0 51 0 1 0.5)
                    resizeForLabel: true
                    adjust: right
                    translateLabel: true
                  )
                 (InputFieldSpec
                    name: 'minWidthField'
                    layout: (LayoutFrame 142 0 40 0 2 1.0 62 0)
                    activeHelpKey: frameMinWidth
                    tabable: true
                    model: minWidth
                    group: inputGroup
                    type: numberOrNil
                    acceptOnLostFocus: false
                    acceptChannel: acceptChannel
                    modifiedChannel: modifiedChannel
                    acceptOnPointerLeave: false
                  )
                 (LabelSpec
                    label: 'Row Height:'
                    name: 'heightLabel'
                    layout: (AlignmentOrigin 140 0.0 79 0 1 0.5)
                    resizeForLabel: true
                    adjust: right
                    translateLabel: true
                  )
                 (InputFieldSpec
                    name: 'heightField'
                    layout: (LayoutFrame 142 0 68 0 2 1.0 90 0)
                    activeHelpKey: frameRowHeight
                    tabable: true
                    model: height
                    group: inputGroup
                    type: numberOrNil
                    acceptOnLostFocus: false
                    acceptChannel: acceptChannel
                    modifiedChannel: modifiedChannel
                    acceptOnPointerLeave: false
                  )
                 (CheckBoxSpec
                    label: 'Compute Width from Items'
                    name: 'usePreferredWidth'
                    layout: (LayoutFrame 5 0 96 0 -5 1 118 0)
                    activeHelpKey: usePreferredWidth
                    tabable: true
                    model: usePreferredWidth
                    translateLabel: true
                  )
                 (CheckBoxSpec
                    label: 'Is Resizeable'
                    name: 'isResizeable'
                    layout: (LayoutFrame 5 0 121 0 -5 1.0 144 0)
                    activeHelpKey: isResizeable
                    tabable: true
                    model: isResizeable
                    translateLabel: true
                  )
                 )
               
              )
            )
           )
         
        )
      )
!

selectionEditSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "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
     DataSetBuilder new openInterface:#selectionEditSpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: selectionEditSpec
        window: 
       (WindowSpec
          label: 'DataSet Basic'
          name: 'DataSet Basic'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 331 328)
        )
        component: 
       (SpecCollection
          collection: (
           (FramedBoxSpec
              label: 'Label Select Action:'
              name: 'LabelSelectAction'
              layout: (LayoutFrame 0 0.0 3 0 0 1.0 97 0)
              labelPosition: topLeft
                    translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (LabelSpec
                    label: 'Selector:'
                    name: 'ActionLabel'
                    layout: (AlignmentOrigin 95 0 20 0 1 0.5)
                    resizeForLabel: true
                    adjust: left
                    translateLabel: true
                  )
                 (InputFieldSpec
                    name: 'ActionSelector'
                    layout: (LayoutFrame 98 0 9 0 3 1.0 31 0)
                    activeHelpKey: selectionLabelClickSelector
                    tabable: true
                    model: labelActionSelector
                    group: inputGroup
                    type: symbolOrNil
                    acceptOnLostFocus: false
                    acceptChannel: acceptChannel
                    modifiedChannel: modifiedChannel
                    acceptOnPointerLeave: false
                  )
                 (LabelSpec
                    label: 'Argument:'
                    name: 'ArgumentLabel'
                    layout: (AlignmentOrigin 95 0 48 0 1 0.5)
                    resizeForLabel: true
                    adjust: left
                    translateLabel: true
                  )
                 (InputFieldSpec
                    name: 'ArgumentValue'
                    layout: (LayoutFrame 98 0 37 0 3 1.0 59 0)
                    activeHelpKey: selectionLabelSelectorArgument
                    tabable: true
                    model: labelActionArgument
                    group: inputGroup
                    type: string
                    acceptOnLostFocus: false
                    acceptChannel: acceptChannel
                    modifiedChannel: modifiedChannel
                    acceptOnPointerLeave: false
                  )
                 )
               
              )
            )
           (FramedBoxSpec
              label: 'Cell Selection:'
              name: 'CellSelection'
              layout: (LayoutFrame 0 0.0 105 0 0 1.0 215 0)
              labelPosition: topLeft
                    translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (CheckBoxSpec
                    label: 'Is Selectable'
                    name: 'canSelect'
                    layout: (Point 95 -4)
                    activeHelpKey: selectionIsSelectable
                    tabable: true
                    model: canSelect
                    translateLabel: true
                  )
                 (LabelSpec
                    label: 'Selector:'
                    name: 'selectorLabel'
                    layout: (AlignmentOrigin 95 0 37 0 1 0.5)
                    resizeForLabel: true
                    adjust: right
                    translateLabel: true
                    activeHelpKey: selectionCellClickSelector
                  )
                 (InputFieldSpec
                    name: 'selectSelector'
                    layout: (LayoutFrame 98 0 26 0 3 1.0 48 0)
                    activeHelpKey: selectionCellClickSelector
                    tabable: true
                    model: selectSelector
                    group: inputGroup
                    type: symbolOrNil
                    acceptOnLostFocus: false
                    acceptChannel: acceptChannel
                    modifiedChannel: modifiedChannel
                    acceptOnPointerLeave: false
                  )
                 (CheckBoxSpec
                    label: 'Show Selection HighLightened'
                    name: 'showSelectionHighLightened'
                    layout: (LayoutFrame 95 0 53 0 3 1.0 77 0)
                    activeHelpKey: showSelectionHighLighted
                    tabable: true
                    model: showSelectionHighLighted
                    translateLabel: true
                  )
                 )
               
              )
            )
           (FramedBoxSpec
              label: 'Cell Double Click:'
              name: 'CellDoubleClick'
              layout: (LayoutFrame 0 0.0 227 0 0 1.0 293 0)
              labelPosition: topLeft
                    translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (LabelSpec
                    label: 'Selector:'
                    name: 'doubleLabel'
                    layout: (AlignmentOrigin 95 0 19 0 1 0.5)
                    resizeForLabel: true
                    adjust: right
                    translateLabel: true
                    activeHelpKey: selectionCellDoubleClickSelector
                  )
                 (InputFieldSpec
                    name: 'doubleClicked'
                    layout: (LayoutFrame 98 0 8 0 3 1.0 30 0)
                    activeHelpKey: selectionCellDoubleClickSelector
                    tabable: true
                    model: doubleClickedSelector
                    group: inputGroup
                    type: symbolOrNil
                    acceptOnLostFocus: false
                    acceptChannel: acceptChannel
                    modifiedChannel: modifiedChannel
                    acceptOnPointerLeave: false
                  )
                 )
               
              )
            )
           )
         
        )
      )

    "Modified: / 25-10-2010 / 10:29:42 / cg"
!

slices
    ^#(
        (Basics         basicsEditSpec)
        (Values         valuesEditSpec)
        (Format         formatEditSpec)
        (Sort           sortEditSpec)
        (Selection      selectionEditSpec)
        (Frame          frameEditSpec)
        (Colors         colorsEditSpec)
    )
!

sortEditSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:DataSetBuilder andSelector:#sortEditSpec
     DataSetBuilder new openInterface:#sortEditSpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: sortEditSpec
        window: 
       (WindowSpec
          label: 'DataSet Basic'
          name: 'DataSet Basic'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 430 473)
        )
        component: 
       (SpecCollection
          collection: (
           (VerticalPanelViewSpec
              name: 'VerticalPanel1'
              layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              horizontalLayout: fit
              verticalLayout: top
              horizontalSpace: 3
              verticalSpace: 3
              component: 
             (SpecCollection
                collection: (
                 (FramedBoxSpec
                    label: 'Sorting:'
                    name: 'sortFrame'
                    labelPosition: topLeft
                    translateLabel: true
                    component: 
                   (SpecCollection
                      collection: (
                       (CheckBoxSpec
                          label: 'Sortable'
                          name: 'isSortable'
                          layout: (LayoutOrigin -3 0 0 0)
                          activeHelpKey: isSortable
                          tabable: true
                          model: isSortable
                          translateLabel: true
                        )
                       (LabelSpec
                          label: 'Sort Selector:'
                          name: 'sortSelector'
                          layout: (LayoutFrame 35 0 33 0 107 0 51 0)
                          activeHelpKey: sortSelector
                          translateLabel: true
                          resizeForLabel: true
                          adjust: right
                        )
                       (InputFieldSpec
                          name: 'EntryField3'
                          layout: (LayoutFrame 110 0 30 0 2 1 56 0)
                          activeHelpKey: sortSelector
                          enableChannel: isSortable
                          tabable: true
                          model: sortSelector
                          group: inputGroup
                          type: symbolOrNil
                          immediateAccept: false
                          acceptOnLeave: false
                          acceptOnLostFocus: false
                          acceptChannel: acceptChannel
                          modifiedChannel: modifiedChannel
                          acceptOnPointerLeave: false
                        )
                       (LabelSpec
                          label: 'Sort Block Selector:'
                          name: 'Label1'
                          layout: (LayoutFrame -5 0 66 0 107 0 84 0)
                          activeHelpKey: sortBlockSelector
                          translateLabel: true
                          resizeForLabel: true
                          adjust: right
                        )
                       (InputFieldSpec
                          name: 'EntryField4'
                          layout: (LayoutFrame 110 0 63 0 2 1 89 0)
                          activeHelpKey: sortBlockSelector
                          enableChannel: isSortable
                          tabable: true
                          model: sortBlockSelector
                          group: inputGroup
                          type: symbolOrNil
                          immediateAccept: false
                          acceptOnLeave: false
                          acceptOnLostFocus: false
                          acceptChannel: acceptChannel
                          modifiedChannel: modifiedChannel
                          acceptOnPointerLeave: false
                        )
                       )
                     
                    )
                    extent: (Point 430 122)
                  )
                 )
               
              )
            )
           )
         
        )
      )
!

valuesEditSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "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
     DataSetBuilder new openInterface:#valuesEditSpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: valuesEditSpec
        window: 
       (WindowSpec
          label: 'DataSet Basic'
          name: 'DataSet Basic'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 471 417)
        )
        component: 
       (SpecCollection
          collection: (
           (VerticalPanelViewSpec
              name: 'VerticalPanel1'
              layout: (LayoutFrame 0 0 0 0 0 1 0 1)
              horizontalLayout: fit
              verticalLayout: top
              horizontalSpace: 3
              verticalSpace: 3
              component: 
             (SpecCollection
                collection: (
                 (FramedBoxSpec
                    label: 'Value Selectors:'
                    name: 'valuesBox'
                    labelPosition: topLeft
                    translateLabel: true
                    component: 
                   (SpecCollection
                      collection: (
                       (LabelSpec
                          label: 'Read:'
                          name: 'readLabel'
                          layout: (AlignmentOrigin 94 0 15 0 1 0.5)
                          activeHelpKey: valuesReadSelector
                          translateLabel: true
                          resizeForLabel: true
                          adjust: right
                        )
                       (InputFieldSpec
                          name: 'readSelector'
                          layout: (LayoutFrame 97 0 4 0 2 1.0 26 0)
                          activeHelpKey: valuesReadSelector
                          tabable: true
                          model: readSelector
                          group: inputGroup
                          type: symbolOrNil
                          acceptOnLostFocus: false
                          acceptChannel: acceptChannel
                          modifiedChannel: modifiedChannel
                          acceptOnPointerLeave: false
                        )
                       (LabelSpec
                          label: 'Write:'
                          name: 'writeLabel'
                          layout: (AlignmentOrigin 94 0 40 0 1 0.5)
                          activeHelpKey: valuesWriteSelector
                          translateLabel: true
                          resizeForLabel: true
                          adjust: right
                        )
                       (InputFieldSpec
                          name: 'writeSelector'
                          layout: (LayoutFrame 97 0 29 0 2 1.0 51 0)
                          activeHelpKey: valuesWriteSelector
                          tabable: true
                          model: writeSelector
                          group: inputGroup
                          type: symbolOrNil
                          acceptOnLostFocus: false
                          acceptChannel: acceptChannel
                          modifiedChannel: modifiedChannel
                          acceptOnPointerLeave: false
                        )
                       (LabelSpec
                          label: 'Converter:'
                          name: 'converterLabel'
                          layout: (AlignmentOrigin 94 0 65 0 1 0.5)
                          activeHelpKey: converterSelector
                          translateLabel: true
                          resizeForLabel: true
                          adjust: right
                        )
                       (InputFieldSpec
                          name: 'converterField'
                          layout: (LayoutFrame 97 0 54 0 2 1.0 76 0)
                          activeHelpKey: converterSelector
                          tabable: true
                          model: converterSelector
                          group: inputGroup
                          type: symbolOrNil
                          acceptOnLostFocus: false
                          acceptChannel: acceptChannel
                          modifiedChannel: modifiedChannel
                          acceptOnPointerLeave: false
                        )
                       (LabelSpec
                          label: 'Print:'
                          name: 'printLabel'
                          layout: (AlignmentOrigin 94 0 90 0 1 0.5)
                          activeHelpKey: valuesPrintSelector
                          translateLabel: true
                          resizeForLabel: true
                          adjust: right
                        )
                       (InputFieldSpec
                          name: 'printSelector'
                          layout: (LayoutFrame 97 0 79 0 2 1.0 101 0)
                          activeHelpKey: valuesPrintSelector
                          tabable: true
                          model: printSelector
                          group: inputGroup
                          type: symbolOrNil
                          acceptOnLostFocus: false
                          acceptChannel: acceptChannel
                          modifiedChannel: modifiedChannel
                          acceptOnPointerLeave: false
                        )
                       (LabelSpec
                          label: 'Visibility:'
                          name: 'visibilityLabel'
                          layout: (AlignmentOrigin 94 0 115 0 1 0.5)
                          activeHelpKey: valuesVisibilitySelector
                          translateLabel: true
                          resizeForLabel: true
                          adjust: right
                        )
                       (InputFieldSpec
                          name: 'visibilitySelector'
                          layout: (LayoutFrame 97 0 104 0 2 1.0 126 0)
                          activeHelpKey: valuesVisibilitySelector
                          tabable: true
                          model: visibilitySelector
                          group: inputGroup
                          type: symbolOrNil
                          acceptOnLostFocus: false
                          acceptChannel: acceptChannel
                          modifiedChannel: modifiedChannel
                          acceptOnPointerLeave: false
                        )
                       )
                     
                    )
                    extent: (Point 471 160)
                  )
                 (FramedBoxSpec
                    label: 'Range:'
                    name: 'rangeBox'
                    labelPosition: topLeft
                    translateLabel: true
                    component: 
                   (SpecCollection
                      collection: (
                       (LabelSpec
                          label: 'Min:'
                          name: 'Label1'
                          layout: (LayoutFrame 11 0 3 0 94 0 20 0)
                          activeHelpKey: minValue
                          translateLabel: true
                          resizeForLabel: true
                          adjust: right
                        )
                       (InputFieldSpec
                          name: 'EntryField1'
                          layout: (LayoutFrame 97 0 1 0 20 0.5 23 0)
                          activeHelpKey: minValue
                          tabable: true
                          model: minValue
                          group: inputGroup
                          type: numberOrNil
                          acceptOnLeave: true
                          acceptOnLostFocus: true
                          acceptChannel: acceptChannel
                          modifiedChannel: modifiedChannel
                          acceptOnPointerLeave: true
                        )
                       (LabelSpec
                          label: 'Max:'
                          name: 'Label2'
                          layout: (LayoutFrame 21 0.5 3 0 70 0.5 20 0)
                          activeHelpKey: maxValue
                          translateLabel: true
                          resizeForLabel: true
                          adjust: right
                        )
                       (InputFieldSpec
                          name: 'EntryField2'
                          layout: (LayoutFrame 70 0.5 1 0 -2 1.0 23 0)
                          activeHelpKey: maxValue
                          tabable: true
                          model: maxValue
                          group: inputGroup
                          type: numberOrNil
                          acceptOnLeave: true
                          acceptOnLostFocus: true
                          acceptChannel: acceptChannel
                          modifiedChannel: modifiedChannel
                          acceptOnPointerLeave: true
                        )
                       )
                     
                    )
                    extent: (Point 471 56)
                  )
                 (FramedBoxSpec
                    label: 'Popup Menu:'
                    name: 'menusBox'
                    labelPosition: topLeft
                    translateLabel: true
                    component: 
                   (SpecCollection
                      collection: (
                       (LabelSpec
                          label: 'Selector:'
                          name: 'menuLabel'
                          layout: (AlignmentOrigin 94 0 12 0 1 0.5)
                          activeHelpKey: valuesMenuSelector
                          translateLabel: true
                          resizeForLabel: true
                          adjust: right
                        )
                       (InputFieldSpec
                          name: 'menuSelector'
                          layout: (LayoutFrame 97 0 1 0 2 1.0 23 0)
                          activeHelpKey: valuesMenuSelector
                          tabable: true
                          model: menu
                          group: inputGroup
                          type: symbolOrNil
                          acceptOnLostFocus: false
                          acceptChannel: acceptChannel
                          modifiedChannel: modifiedChannel
                          acceptOnPointerLeave: false
                        )
                       (CheckBoxSpec
                          label: 'Fetch Menu from Application'
                          name: 'CheckBox1'
                          layout: (LayoutFrame 93 0 28 0 375 0 50 0)
                          activeHelpKey: valuesMenuFromApplication
                          model: menuFromApplication
                          translateLabel: true
                          valueChangeSelector: setModified
                        )
                       )
                     
                    )
                    extent: (Point 471 80)
                  )
                 (FramedBoxSpec
                    label: 'Combo List/Box Selectors:'
                    name: 'comboSelectorsBox'
                    labelPosition: topLeft
                    translateLabel: true
                    component: 
                   (SpecCollection
                      collection: (
                       (LabelSpec
                          label: 'Choices:'
                          name: 'ChoicesLabel'
                          layout: (AlignmentOrigin 94 0 15 0 1 0.5)
                          activeHelpKey: valuesChoicesSelector
                          translateLabel: true
                          resizeForLabel: true
                          adjust: right
                        )
                       (InputFieldSpec
                          name: 'ChoicesField'
                          layout: (LayoutFrame 97 0 4 0 2 1.0 26 0)
                          activeHelpKey: valuesChoicesSelector
                          tabable: true
                          model: choices
                          group: inputGroup
                          type: symbolOrNil
                          acceptOnLeave: false
                          acceptOnLostFocus: false
                          acceptChannel: acceptChannel
                          modifiedChannel: modifiedChannel
                          acceptOnPointerLeave: false
                        )
                       (LabelSpec
                          label: 'Xlated Choices:'
                          name: 'XChoicesLabel'
                          layout: (AlignmentOrigin 94 0 40 0 1 0.5)
                          activeHelpKey: valuesXChoicesSelector
                          translateLabel: true
                          resizeForLabel: true
                          adjust: right
                        )
                       (InputFieldSpec
                          name: 'XChoicesField'
                          layout: (LayoutFrame 97 0 29 0 2 1.0 51 0)
                          activeHelpKey: valuesXChoicesSelector
                          tabable: true
                          model: translatedChoices
                          group: inputGroup
                          type: symbolOrNil
                          acceptOnLeave: false
                          acceptOnLostFocus: false
                          acceptChannel: acceptChannel
                          modifiedChannel: modifiedChannel
                          acceptOnPointerLeave: false
                        )
                       (LabelSpec
                          label: 'Editable:'
                          name: 'EditableLabel'
                          layout: (AlignmentOrigin 94 0 65 0 1 0.5)
                          activeHelpKey: showComboFieldSelector
                          translateLabel: true
                          resizeForLabel: true
                          adjust: right
                        )
                       (InputFieldSpec
                          name: 'EditableField'
                          layout: (LayoutFrame 97 0 54 0 2 1.0 76 0)
                          activeHelpKey: showComboFieldSelector
                          tabable: true
                          model: showComboFieldSelector
                          group: inputGroup
                          type: symbolOrNil
                          acceptOnLeave: false
                          acceptOnLostFocus: false
                          acceptChannel: acceptChannel
                          modifiedChannel: modifiedChannel
                          acceptOnPointerLeave: false
                        )
                       )
                     
                    )
                    extent: (Point 471 107)
                  )
                 )
               
              )
            )
           )
         
        )
      )
!

windowSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:DataSetBuilder andSelector:#windowSpec
     DataSetBuilder new openInterface:#windowSpec
     DataSetBuilder open
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: windowSpec
        window: 
       (WindowSpec
          label: 'Data Set Builder'
          name: 'Data Set Builder'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 633 658)
          menu: menu
        )
        component: 
       (SpecCollection
          collection: (
           (MenuPanelSpec
              name: 'menuToolbarView'
              layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 32 0)
              tabable: true
              menu: menuToolbar
            )
           (VariableVerticalPanelSpec
              name: 'mainPanel'
              layout: (LayoutFrame 0 0.0 38 0.0 0 1.0 -26 1.0)
              component: 
             (SpecCollection
                collection: (
                 (FramedBoxSpec
                    label: 'Table Columns'
                    name: 'FramedBox'
                    labelPosition: topLeft
                    translateLabel: true
                    component: 
                   (SpecCollection
                      collection: (
                       (DataSetSpec
                          name: 'columnView'
                          layout: (LayoutFrame 0 0.0 6 0.0 0 1.0 2 1.0)
                          hasHorizontalScrollBar: true
                          hasVerticalScrollBar: false
                          miniScrollerHorizontal: true
                          useIndex: false
                          has3Dseparators: true
                        )
                       )
                     
                    )
                  )
                 (VariableHorizontalPanelSpec
                    name: 'VariablePanel'
                    level: -1
                    component: 
                   (SpecCollection
                      collection: (
                       (ViewSpec
                          name: 'labelsView'
                          component: 
                         (SpecCollection
                            collection: (
                             (SequenceViewSpec
                                name: 'labelAndColumns'
                                layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
                                tabable: true
                                model: selectedColumnModel
                                menu: menuEdit
                                hasHorizontalScrollBar: true
                                hasVerticalScrollBar: true
                                miniScrollerHorizontal: true
                                isMultiSelect: true
                                useIndex: true
                                sequenceList: seqList
                              )
                             )
                           
                          )
                          postBuildCallback: postBuildListOfItemsView:
                        )
                       (ViewSpec
                          name: 'specView'
                          level: -1
                          component: 
                         (SpecCollection
                            collection: (
                             (NoteBookViewSpec
                                name: 'NoteBook'
                                layout: (LayoutFrame 1 0.0 0 0.0 0 1.0 -30 1.0)
                                tabable: true
                                model: tabModel
                                menu: tabList
                                useIndex: true
                                canvas: canvasHolder
                                keepCanvasAlive: true
                              )
                             (UISubSpecification
                                name: 'SubSpecification'
                                layout: (LayoutFrame 2 0.0 -26 1 -2 1.0 -2 1.0)
                                majorKey: ToolApplicationModel
                                minorKey: windowSpecForCommit
                              )
                             )
                           
                          )
                          postBuildCallback: postBuildSpecView:
                        )
                       )
                     
                    )
                    handles: (Any 0.235387 1.0)
                  )
                 )
               
              )
              handles: (Any 0.208748 1.0)
            )
           (UISubSpecification
              name: 'infoBarSubSpec'
              layout: (LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0)
              majorKey: ToolApplicationModel
              minorKey: windowSpecForInfoBar
            )
           )
         
        )
      )
! !

!DataSetBuilder class methodsFor:'menu specs'!

fileMenu
    "This resource specification was automatically generated
     by the MenuEditor of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the MenuEditor may not be able to read the specification."

    "
     MenuEditor new openOnClass:DataSetBuilder andSelector:#fileMenu
     (Menu new fromLiteralArrayEncoding:(DataSetBuilder fileMenu)) startUp
    "

    <resource: #menu>

    ^ 
     #(Menu
        (
         (MenuItem
            activeHelpKey: fileNew
            label: 'New'
            itemValue: doNew
            translateLabel: true
          )
         (MenuItem
            label: '-'
            isVisible: notEditingSpecOnly
          )
         (MenuItem
            activeHelpKey: fileLoad
            label: 'Load...'
            itemValue: doLoad
            translateLabel: true
            isVisible: notEditingSpecOnly
          )
         (MenuItem
            label: '-'
          )
         (MenuItem
            activeHelpKey: fileSave
            label: 'Save'
            itemValue: doSave
            translateLabel: true
            isVisible: editingSpecOnly
          )
         (MenuItem
            activeHelpKey: fileSaveMethod
            label: 'Save'
            itemValue: doSave
            translateLabel: true
            isVisible: notEditingSpecOnly
          )
         (MenuItem
            activeHelpKey: fileSaveAsMethod
            label: 'Save As...'
            itemValue: doSaveAs
            translateLabel: true
            isVisible: notEditingSpecOnly
          )
         (MenuItem
            label: '-'
          )
         (MenuItem
            activeHelpKey: pickColumns
            label: 'Pick Columns...'
            itemValue: doPickColumns
            translateLabel: true
          )
         (MenuItem
            label: '-'
            isVisible: isStandAlone
          )
         (MenuItem
            activeHelpKey: fileBrowseClass
            label: 'Browse Class'
            itemValue: doBrowseClass
            translateLabel: true
            isVisible: isStandAlone
          )
         (MenuItem
            label: '-'
            isVisible: isStandAlone
          )
         (MenuItem
            activeHelpKey: fileExit
            label: 'Exit'
            itemValue: closeRequest
            translateLabel: true
            isVisible: isStandAlone
          )
         )
        nil
        nil
      )
!

menu
    "This resource specification was automatically generated
     by the MenuEditor of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the MenuEditor may not be able to read the specification."

    "
     MenuEditor new openOnClass:DataSetBuilder andSelector:#menu
     (Menu new fromLiteralArrayEncoding:(DataSetBuilder menu)) startUp
    "

    <resource: #menu>

    ^ 
     #(Menu
        (
         (MenuItem
            label: 'File'
            translateLabel: true
            submenuChannel: fileMenu
          )
         (MenuItem
            label: 'Edit'
            translateLabel: true
            submenuChannel: menuEditWithoutAccelerators
          )
         (MenuItem
            label: 'Add'
            translateLabel: true
            submenu: 
           (Menu
              (
               (MenuItem
                  activeHelpKey: addColumn
                  enabled: columnIsNotEditing
                  label: 'Column'
                  itemValue: doCreateColumn
                  translateLabel: true
                  labelImage: (ResourceRetriever nil newColumnIcon 'Column')
                )
               (MenuItem
                  activeHelpKey: addNonSelectableColumn
                  enabled: columnIsNotEditing
                  label: 'Column (Non-Selectable)'
                  itemValue: doCreateNonSelectableColumn
                  translateLabel: true
                  labelImage: (ResourceRetriever DataSetBuilder newColumnNonSelectableIcon 'Column (Non-Selectable)')
                )
               )
              nil
              nil
            )
          )
         (MenuItem
            label: 'Generate'
            translateLabel: true
            isVisible: notEditingSpecOnly
            submenu: 
           (Menu
              (
               (MenuItem
                  activeHelpKey: fileDefineClass
                  label: 'Define Row Class...'
                  itemValue: doDefineRowClass
                  translateLabel: true
                )
               (MenuItem
                  activeHelpKey: browseRowClass
                  label: 'Browse Row Class'
                  itemValue: doBrowseRowClass
                  translateLabel: true
                )
               (MenuItem
                  label: '-'
                )
               (MenuItem
                  activeHelpKey: generateCode
                  label: 'Generate Code'
                  itemValue: doGenerateCode
                  translateLabel: true
                )
               )
              nil
              nil
            )
          )
         (MenuItem
            label: 'History'
            translateLabel: true
            isVisible: isStandAlone
            submenuChannel: menuHistory
          )
         (MenuItem
            label: 'MENU_Help'
            translateLabel: true
            startGroup: conditionalRight
            submenuChannel: menuHelp
          )
         )
        nil
        nil
      )
!

menuEdit
    "This resource specification was automatically generated
     by the MenuEditor of ST/X."

    "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
     (Menu new fromLiteralArrayEncoding:(DataSetBuilder menuEdit)) startUp
    "

    <resource: #menu>

    ^ 
     #(Menu
        (
         (MenuItem
            activeHelpKey: editCut
            enabled: isColumnSelected
            label: 'Cut'
            itemValue: doCut
            translateLabel: true
            shortcutKey: Cut
          )
         (MenuItem
            activeHelpKey: editCopy
            enabled: isColumnSelected
            label: 'Copy'
            itemValue: doCopy
            translateLabel: true
            shortcutKey: Copy
          )
         (MenuItem
            activeHelpKey: editPaste
            enabled: valueOfHavingClipboard
            label: 'Paste'
            itemValue: doPaste
            translateLabel: true
            shortcutKey: Paste
          )
         (MenuItem
            label: '-'
          )
         (MenuItem
            activeHelpKey: editMoveUp
            enabled: isColumnSelected
            label: 'Move Up'
            itemValue: doMoveColumn:
            translateLabel: true
            shortcutKey: CtrlCursorUp
            labelImage: (ResourceRetriever Icon upIcon 'Move Up')
            argument: up
          )
         (MenuItem
            activeHelpKey: editMoveDown
            enabled: isColumnSelected
            label: 'Move Down'
            itemValue: doMoveColumn:
            translateLabel: true
            shortcutKey: CtrlCursorDown
            labelImage: (ResourceRetriever Icon downIcon 'Move Down')
            argument: down
          )
         (MenuItem
            label: '-'
          )
         (MenuItem
            label: 'Separators'
            translateLabel: true
            submenu: 
           (Menu
              (
               (MenuItem
                  label: 'Label Columns'
                  translateLabel: true
                  submenu: 
                 (Menu
                    (
                     (MenuItem
                        enabled: hasSelection
                        label: 'Add Separators'
                        itemValue: addLabelColumnSeparators
                        translateLabel: true
                      )
                     (MenuItem
                        enabled: hasSelection
                        label: 'Remove Separators'
                        itemValue: removeLabelColumnSeparators
                        translateLabel: true
                      )
                     )
                    nil
                    nil
                  )
                )
               (MenuItem
                  label: 'Label Row && Columns'
                  translateLabel: true
                  submenu: 
                 (Menu
                    (
                     (MenuItem
                        enabled: hasSelection
                        label: 'Add Separators'
                        itemValue: addLabelSeparators
                        translateLabel: true
                      )
                     (MenuItem
                        enabled: hasSelection
                        label: 'Remove Separators'
                        itemValue: removeLabelSeparators
                        translateLabel: true
                      )
                     )
                    nil
                    nil
                  )
                )
               (MenuItem
                  label: '-'
                )
               (MenuItem
                  label: 'Cell Rows'
                  translateLabel: true
                  submenu: 
                 (Menu
                    (
                     (MenuItem
                        enabled: hasSelection
                        label: 'Add Separators'
                        itemValue: addRowSeparators
                        translateLabel: true
                      )
                     (MenuItem
                        enabled: hasSelection
                        label: 'Remove Separators'
                        itemValue: removeRowSeparators
                        translateLabel: true
                      )
                     )
                    nil
                    nil
                  )
                )
               (MenuItem
                  label: 'Cell Columns'
                  translateLabel: true
                  submenu: 
                 (Menu
                    (
                     (MenuItem
                        enabled: hasSelection
                        label: 'Add Separators'
                        itemValue: addLabelColumnSeparators
                        translateLabel: true
                      )
                     (MenuItem
                        enabled: hasSelection
                        label: 'Remove'
                        itemValue: removeLabelColumnSeparators
                        translateLabel: true
                      )
                     )
                    nil
                    nil
                  )
                )
               (MenuItem
                  label: 'Cell Rows && Columns'
                  translateLabel: true
                  submenu: 
                 (Menu
                    (
                     (MenuItem
                        enabled: hasSelection
                        label: 'Add Separators'
                        itemValue: addCellSeparators
                        translateLabel: true
                      )
                     (MenuItem
                        enabled: hasSelection
                        label: 'Remove Separators'
                        itemValue: removeCellSeparators
                        translateLabel: true
                      )
                     )
                    nil
                    nil
                  )
                )
               )
              nil
              nil
            )
          )
         (MenuItem
            label: 'Alignment'
            translateLabel: true
            submenu: 
           (Menu
              (
               (MenuItem
                  enabled: hasSelection
                  label: 'Make Labels Left Aligned'
                  itemValue: alignLabelsLeft
                  translateLabel: true
                )
               (MenuItem
                  enabled: hasSelection
                  label: 'Make Labels Centered'
                  itemValue: alignLabelsCentered
                  translateLabel: true
                )
               (MenuItem
                  enabled: hasSelection
                  label: 'Make Labels Right Aligned'
                  itemValue: alignLabelsRight
                  translateLabel: true
                )
               (MenuItem
                  label: '-'
                )
               (MenuItem
                  enabled: hasSelection
                  label: 'Make Cell Left Aligned'
                  itemValue: alignColumnsLeft
                  translateLabel: true
                )
               (MenuItem
                  enabled: hasSelection
                  label: 'Make Cell Centered'
                  itemValue: alignColumnsCentered
                  translateLabel: true
                )
               (MenuItem
                  enabled: hasSelection
                  label: 'Make Cell Right Aligned'
                  itemValue: alignColumnsRight
                  translateLabel: true
                )
               )
              nil
              nil
            )
          )
         (MenuItem
            label: 'Colors'
            translateLabel: true
            submenu: 
           (Menu
              (
               (MenuItem
                  enabled: hasSelection
                  label: 'Set Cell Color Selectors'
                  itemValue: setCellColorSelectors
                  translateLabel: true
                )
               (MenuItem
                  enabled: hasSelection
                  label: 'Set Selected Cell Color Selectors'
                  itemValue: setSelectedCellColorSelectors
                  translateLabel: true
                )
               )
              nil
              nil
            )
          )
         (MenuItem
            label: 'Behavior'
            translateLabel: true
            submenu: 
           (Menu
              (
               (MenuItem
                  enabled: hasSelection
                  label: 'Make Selected Cells Unselectable'
                  itemValue: makeSelectedCellsUnselectable
                  translateLabel: true
                )
               (MenuItem
                  enabled: hasSelection
                  label: 'Make Selected Cells Selectable'
                  itemValue: makeSelectedCellsSelectable
                  translateLabel: true
                )
               )
              nil
              nil
            )
          )
         (MenuItem
            label: '-'
          )
         (MenuItem
            enabled: hasSelection
            label: 'Make Selectable'
            itemValue: makeColumnsSelectable
            translateLabel: true
          )
         (MenuItem
            enabled: hasSelection
            label: 'Make Unselectable'
            itemValue: makeColumnsUnselectable
            translateLabel: true
          )
         )
        nil
        nil
      )
!

menuEditWithoutAccelerators
    ^ self menuEdit decodeAsLiteralArray removeAllAccelerators
!

menuToolbar
    "This resource specification was automatically generated
     by the MenuEditor of ST/X."

    "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
     (Menu new fromLiteralArrayEncoding:(DataSetBuilder menuToolbar)) startUp
    "

    <resource: #menu>

    ^ 
     #(Menu
        (
         (MenuItem
            activeHelpKey: fileNew
            label: 'New'
            itemValue: doNew
            translateLabel: true
            isButton: true
            labelImage: (ResourceRetriever ToolbarIconLibrary newDataSetIcon)
          )
         (MenuItem
            label: '-'
          )
         (MenuItem
            activeHelpKey: fileLoad
            label: 'Load'
            itemValue: doLoad
            translateLabel: true
            isButton: true
            submenuChannel: menuHistory
            labelImage: (ResourceRetriever ToolbarIconLibrary loadFromMethodIcon)
          )
         (MenuItem
            activeHelpKey: fileSaveMethod
            label: 'Save'
            itemValue: doSave
            translateLabel: true
            isButton: true
            isVisible: notEditingSpecOnly
            labelImage: (ResourceRetriever ToolbarIconLibrary saveAsMethodIcon)
          )
         (MenuItem
            activeHelpKey: fileSave
            label: 'Save'
            itemValue: doSave
            translateLabel: true
            isButton: true
            isVisible: editingSpecOnly
            labelImage: (ResourceRetriever ToolbarIconLibrary saveToFileIcon)
          )
         (MenuItem
            label: '-'
          )
         (MenuItem
            activeHelpKey: editCut
            enabled: isColumnSelected
            label: 'Cut'
            itemValue: doCut
            translateLabel: true
            isButton: true
            labelImage: (ResourceRetriever ToolbarIconLibrary cutWidgetIcon)
          )
         (MenuItem
            activeHelpKey: editCopy
            enabled: isColumnSelected
            label: 'Copy'
            itemValue: doCopy
            translateLabel: true
            isButton: true
            labelImage: (ResourceRetriever ToolbarIconLibrary copyWidgetIcon)
          )
         (MenuItem
            activeHelpKey: editPaste
            enabled: canPasteHolder
            label: 'Paste'
            itemValue: doPaste
            translateLabel: true
            isButton: true
            labelImage: (ResourceRetriever ToolbarIconLibrary pasteWidgetIcon)
          )
         (MenuItem
            activeHelpKey: editDelete
            enabled: isColumnSelected
            label: 'Delete'
            itemValue: doDelete
            translateLabel: true
            isButton: true
            isVisible: false
            labelImage: (ResourceRetriever ToolbarIconLibrary deleteWidgetIcon)
          )
         (MenuItem
            label: '-'
          )
         (MenuItem
            activeHelpKey: addColumn
            enabled: columnIsNotEditing
            label: 'Add Column'
            itemValue: doCreateColumn
            translateLabel: true
            isButton: true
            labelImage: (ResourceRetriever nil newColumnIcon)
          )
         (MenuItem
            activeHelpKey: addNonSelectableColumn
            enabled: columnIsNotEditing
            label: 'Add Column (Non Selectable)'
            itemValue: doCreateNonSelectableColumn
            translateLabel: true
            isButton: true
            labelImage: (ResourceRetriever DataSetBuilder newColumnNonSelectableIcon)
          )
         (MenuItem
            label: ''
          )
         (MenuItem
            activeHelpKey: editMoveUp
            enabled: isColumnSelected
            label: 'Move Up'
            itemValue: doMoveColumn:
            translateLabel: true
            isButton: true
            startGroup: right
            labelImage: (ResourceRetriever Icon upIcon)
            argument: up
          )
         (MenuItem
            activeHelpKey: editMoveDown
            enabled: isColumnSelected
            label: 'Move Down'
            itemValue: doMoveColumn:
            translateLabel: true
            isButton: true
            startGroup: right
            labelImage: (ResourceRetriever Icon downIcon)
            argument: down
          )
         )
        nil
        nil
      )
! !

!DataSetBuilder methodsFor:'accessing'!

acceptedColumns
    "returns the last saved columns (internal, for specOnly edit mode)"

    ^ acceptedColumns
!

columns
    "returns list of columns"

    ^ columns
!

columns:aListOfColumns
    "setup columns from a column view"

    |list newColumns|

    newColumns := OrderedCollection new.
    list := self seqList.
    list removeAll.

    aListOfColumns size ~~ 0 ifTrue:[
        aListOfColumns do:[:aColumn||column|
            (column := aColumn) isSequenceable ifTrue:[
                column := DataSetColumnSpec decodeFromLiteralArray:aColumn
            ] ifFalse:[
                column := aColumn copy
            ].
            newColumns add:column.
            list add:(self labelFromColumn:column).  
        ]
    ].
    columns := newColumns.
    self updateColumnView.

    "Modified: / 27-03-2007 / 08:46:39 / cg"
!

editingSpecOnly
    ^ editingSpecOnly ? false
!

editingSpecOnly:something
    editingSpecOnly := something.
!

notEditingSpecOnly
    ^ self editingSpecOnly not
!

resolveRowClass
    "returns the resolved row class
    "
    ^ Smalltalk resolveName:rowClass inClass:self class
!

rowClassName

    ^ self resolveRowClass notNil ifTrue:[rowClass] ifFalse:[nil]
!

rowClassName:aClassName

    |cls|

    rowSuperClass := nil.

    (rowClass := aClassName) notNil ifTrue:[
        (cls := self resolveRowClass) notNil 
            ifTrue: [rowSuperClass := cls superclass name asString] 
            ifFalse:[rowSuperClass := 'Object']
    ]

! !

!DataSetBuilder methodsFor:'aspects'!

canvasHolder
    "returns a value holder which keeps selected column"

    |holder|

    (holder := builder bindingAt:#canvasHolder) isNil ifTrue:[
        builder aspectAt:#canvasHolder put:(holder := ValueHolder new).
    ].
    ^ holder
!

columnIsNotEditing
    "returns a boolean value holder which returns true if a columns attributes have not
     been modified (notebook fields)"

    |holder|

    (holder := builder bindingAt:#columnIsNotEditing) isNil ifTrue:[
        holder := BlockValue forLogicalNot:(self modifiedChannel).
        builder aspectAt:#columnIsNotEditing put:holder.
    ].
    ^ holder
!

editorTypeList
    "generate list of supported editor types"

    |list|

    (list := builder bindingAt:#editorTypeList) isNil ifTrue:[
        list := (DataSetColumnSpec slices collect:[:eachSlice | eachSlice at:1]) asSet.
        list := list asOrderedCollection sort.
        builder aspectAt:#editorTypeList put:list
    ].
    ^list
!

hasColumns
    "returns a boolean value holder which is set to true if there are any columns"

    ^ BlockValue
        with:[:m | m notEmptyOrNil]
        argument:(self seqList)
!

hasSelection
    ^ (selectedColumnIndex isCollection not and:[ selectedColumnIndex ~~ 0 ])
    or:[ selectedColumnIndex size > 0 ]
!

isColumnSelected
    "returns a boolean value holder which is set to true if some col is selected"

    ^builder valueAspectFor:#isColumnSelected initialValue: false
!

menuEdit
    "redefined to access my menu and not the one of the UIPainter"

    ^ [self class menuEdit]
!

possiblePrintConverterTypes
    ^ UISpecification possiblePrintConverterTypes
!

rendererTypeList
    "generate list of supported renderer types"

    |list|

    (list := builder bindingAt:#rendererTypeList) isNil ifTrue:[
        list := (DataSetColumnSpec slices collect:[:eachSlice | eachSlice at:2]) asSet.
        list := list asOrderedCollection sort.
        builder aspectAt:#rendererTypeList put:list
    ].
    ^list
!

selectedColumnModel
    "returns a value holder which keeps selected column"

    |holder|

    (holder := builder bindingAt:#selectedColumnModel) isNil ifTrue:[
        holder := AspectAdaptor new subject:self; forAspect:#selectedColumnIndex.
        builder aspectAt:#selectedColumnModel put:holder.
    ].
    ^ holder
!

seqList
    ^ builder listAspectFor:#seqList
!

style

    ^self aspectFor:#labelFont
!

tabList

    ^self class slices collect:[:aSlice|aSlice first]

! !

!DataSetBuilder methodsFor:'building'!

buildFromResourceSpec:aResourceSpec

    self columns:aResourceSpec.

"/    columns notEmpty ifTrue: [
"/        self tabModel value: 1. 
"/        self selectedColumnModel value:nil; value:1.    "/ toggle to force change
"/        self updateInputFields.
"/        self updateInfoLabel.
"/        self updateHistory
"/    ].

!

loadFromClass:aClass andSelector:aSelector
    |cls list|

    self assert:(aClass isNil or:[aClass isClass]).

    selectedColumnIndex := 0.

    "if opened on table columns"  

    aClass isNil ifTrue: [ 
        self tabModel value: 0. 
    "/    self columns removeAll.
    "/    self seqList removeAll.
        self updateColumnView.
        self updateInfoLabel.
        self isColumnSelected value: false.
        ^ self.
    ].

    specSelector isNil ifTrue: [
        self updateAfterColumnChange. 
        ^ self
    ].

    list := nil.

    (aClass notNil or:[self isStandAlone or:[self window shown]]) ifTrue:[
        (aClass notNil and:[aSelector notNil]) ifTrue:[
            cls := aClass isBehavior ifTrue:[ aClass ] ifFalse:[ self resolveName:aClass].

            (cls respondsTo: aSelector) ifTrue:[ 
                list := cls perform: aSelector.
            ].
        ]
    ] ifFalse:[
        list := columns
    ].
    self columns:list.
    self updateAfterColumnChange.
!

updateAfterColumnChange
    self tabModel changed "value:0; value:1".                 "/ toggle to force change
    self selectedColumnModel changed "value:nil; value:1".    "/ toggle to force change
    self updateColumnView.
    self updateInputFields.
    self updateInfoLabel.
    self updateHistory.
    self clearModifiedFlag.
    self enablingCommitButtonsHolder value:false.
! !

!DataSetBuilder methodsFor:'code generation'!

compile:aCode forClass:aClass inCategory:aCategory
    "compile method for class in a category"

    aClass 
        compile:(aCode withCRs) 
        classified:aCategory
!

generateBackgroundSelectorIn:aClass
    "generate code for #backgroundSelector"

    |sel catg code bCode|

    catg := #'accessing look'.
    code :=   '\'
            , '    "automatically generated by DataSetBuilder ..."\'
            , '\'
            , '    "specific background color for a cell"\'
            , '\'
            .

    columns do:
    [:aColumn|
        ((sel := aColumn backgroundSelector) notNil and:[(aClass includesSelector:sel) not]) 
        ifTrue:
        [
            bCode := sel asString, code, '    ^nil'.
            self compile:bCode forClass:aClass inCategory:catg
        ]
    ]
!

generateChoicesIn:aClass
    "generate code for #choices"

    |sel catg code edt|

    catg := #'accessing menu'.
    code :=   '\'
            , '    "automatically generated by DataSetBuilder ..."\'
            , '\'
            , '    "get choices for visual editor; (a list of labels)..."\'
            , '\'
            , '    ^ #( foo bar baz )'
            .

    columns do:[:aColumn|
        edt := aColumn editorType.

        (      aColumn canSelect
          and:[(sel := aColumn choices) notNil
          and:[(edt == #ComboBox or:[edt == #ComboList])
          and:[(aClass includesSelector:sel) not]]]
        ) ifTrue:[
            self compile:(sel asString, code) forClass:aClass inCategory:catg
        ]
    ]
!

generateDoubleClickSelectorIn:aClass
    "generate code for #foregroundSelector"

    |sel catg code bCode|

    catg := #'accessing-action'.
    code :=   '\'
            , '    "automatically generated by DataSetBuilder ..."\'
            , '\'
            , '    "specific selector to be called on double click"\'
            , '\'
            .

    columns do:
    [:aColumn|
        ((sel := aColumn doubleClickedSelector) notNil 
        and:[(aClass includesSelector:sel) not]) 
        ifTrue:
        [
            bCode := sel asString, code.
            self compile:bCode forClass:aClass inCategory:catg
        ]
    ]
!

generateForegroundSelectorIn:aClass
    "generate code for #foregroundSelector
    "
    |sel catg code bCode|

    catg := #'accessing-look'.
    code :=   '\'
            , '    "automatically generated by DataSetBuilder ..."\'
            , '\'
            , '    "specific foreground color for a cell"\'
            , '\'
            .

    columns do:
    [:aColumn|
        ((sel := aColumn foregroundSelector) notNil 
        and:[(aClass includesSelector:sel) not]) 
        ifTrue:
        [
            bCode := sel asString, code, '    ^ nil'.
            self compile:bCode forClass:aClass inCategory:catg
        ]
    ]
!

generateMenuIn:aClass
    "generate code for #menu"

    |sel catg code|

    catg := #'accessing menu'.
    code :=   '\'
            , '    "automatically generated by DataSetBuilder ..."\'
            , '\'
            , '    "get middleButton menu for selected cell in column"\'
            , '\'
            , '    ^nil'
            .

    columns do:
    [:aColumn|
        (aColumn canSelect
        and:[(sel := aColumn menu) notNil
        and:[(aClass includesSelector:sel) not]]) 
        ifTrue:
        [
            self compile:(sel asString, code) forClass:aClass inCategory:catg
        ]
    ]
!

generatePrintSelectorIn:aClass
    "generate code for #printSelector"

    |sel catg code|

    catg := #'accessing'.
    code :=   '\'
            , '    "automatically generated by DataSetBuilder ..."\'
            , '\'
            , '    "get drawable image or text on a gc"\'
            , '\'
            , '    ^ '
            .

    columns do:[:aColumn|
        (     aColumn rendererType ~~ #rowSelector
         and:[(sel := aColumn printSelector) notNil
         and:[(aClass includesSelector:sel) not]]
        ) ifTrue:[
            |numArgs bcode keys|
            bcode   := sel asString.
            numArgs    := sel numArgs.

            numArgs ~~ 0 ifTrue:[
                numArgs == 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
        ]
    ]
!

generateReadSelectorIn:aClass
    "generate code for #readSelector"

    |sel catg code bCode|

    catg := #'accessing'.
    code :=   '\'
            , '    "automatically generated by DataSetBuilder ..."\'
            , '\'
            , '    "get value"\'
            , '\'
            .

    columns do:
    [:aColumn|
        (aColumn rendererType ~~ #rowSelector 
        and:[(sel := aColumn readSelector) notNil
        and:[(aClass includesSelector:sel) not]]) 
        ifTrue:
        [
            (aColumn printSelector isNil or:[aColumn canSelect]) 
            ifTrue:
            [
                |selName|
                selName := sel asString.

                sel numArgs == 0 
                    ifTrue: [bCode := selName, code] 
                    ifFalse:[bCode := selName, 'anIndex\', code].
                aColumn rendererType == #CheckToggle 
                    ifFalse:[bCode := bCode, '    ^ ''', selName, ''''] 
                    ifTrue: [bCode := bCode, '    ^true']. 
                self compile:bCode forClass:aClass inCategory:catg
            ]
        ]
    ]
!

generateRowSeparatorSelectorIn:aClass
    "generate code for #rowSeparatorSelector"

    |sel catg code bCode|

    catg := #'accessing look'.
    code :=   '\'
            , '    "automatically generated by DataSetBuilder ..."\'
            , '\'
            , '    "specific row separator visibility for a cell"\'
            , '\'
            .

    columns do:
    [:aColumn|
        ((sel := aColumn rowSeparatorSelector) notNil and:[(aClass includesSelector:sel) not]) 
        ifTrue:
        [
            bCode := sel asString, code, '    ^true'.
            self compile:bCode forClass:aClass inCategory:catg
        ]
    ]
!

generateSelectSelectorIn:aClass
    "generate code for #selectSelector
    "
    |sel catg code bCode|

    catg := #'accessing selection'.
    code :=   '\'
            , '    "automatically generated by DataSetBuilder ..."\'
            , '\'
            , '    "can select cell in column"\'
            , '\'
            .

    columns do:
    [:aColumn|
        (aColumn rendererType ~~ #rowSelector 
         and:[(sel := aColumn selectSelector) notNil
         and:[(aClass includesSelector:sel) not]]) 
         ifTrue:
         [
            aColumn canSelect 
            ifTrue:
            [
                bCode := sel asString, code, '    ^true'.
                self compile:bCode forClass:aClass inCategory:catg
            ]
        ]
    ]
!

generateShowComboFieldSelectorIn:aClass
    "generate code for #showComboFieldSelector
    "
    |sel catg code bCode edt state|

    catg := #'accessing menu'.
    code :=   '\'
            , '    "automatically generated by DataSetBuilder ..."\'
            , '\'
            , '    "open an editField on a combo list or box"\'
            , '\'
            .

    columns do:[:aColumn|
        edt := aColumn editorType.

        (      aColumn canSelect
          and:[(sel := aColumn showComboFieldSelector) notNil
          and:[(edt == #ComboBox or:[edt == #ComboList])
          and:[(aClass includesSelector:sel) not]]]
        ) ifTrue:[
            state := edt == #ComboBoxView.

            bCode := sel asString, code, '    ^ ', state printString.
            self compile:bCode forClass:aClass inCategory:catg
        ]
    ]
!

generateWriteSelectorIn:aClass
    "generate code for #writeSelector"

    |sel catg code bCode sz|

    catg := #'accessing'.
    code :=   'aValue\'
            , '    "automatically generated by DataSetBuilder ..."\'
            , '\'
            , '    "set value"\'
            .

    columns do:
    [:aColumn|
        ((sel := aColumn writeSelector) notNil
         and:[aColumn editorType ~~ #None
         and:[aColumn canSelect
         and:[(aClass includesSelector:sel) not]]]) 
        ifTrue:
        [
            sel numArgs == 1 
            ifTrue:
            [
                bCode := sel asString
            ] 
            ifFalse:
            [
                sz := sel indexOf:$:.
                bCode := sel copyTo:sz.
                bCode := bCode, 'anIndex ', (sel copyFrom:sz + 1)
            ].
            self compile:(bCode, code) forClass:aClass inCategory:catg
        ]
    ]
! !

!DataSetBuilder methodsFor:'event handling'!

processEvent:anEvent
    "filter keyboard edit-events typed into the listOfItemsView.
     Return true, if I have eaten the event"

    |evView inView rawKey key|

    anEvent isKeyPressEvent ifFalse:[^ false].

    evView := anEvent targetView.
    evView isNil ifTrue:[ ^ false ].

    inView := evView isSameOrComponentOf:listOfItemsView.
    inView ifTrue:[^ false].

    key    := anEvent key.
    rawKey := anEvent rawKey.

    (    key == #Delete
     or:[key == #BackSpace
     or:[key == #Cut]]
    ) ifTrue:[
        self doCut.
        ^ true.
    ].

    key == #Copy  ifTrue:[ self doCopy.  ^ true ].
    key == #Paste ifTrue:[ self doPaste. ^ true ].

    (rawKey == #CtrlCursorUp) ifTrue:[
        self doMoveUp.
        ^ true.
    ].
    (rawKey == #CtrlCursorDown) ifTrue:[
        self doMoveDown.
        ^ true.
    ].

    ^ false.
! !

!DataSetBuilder methodsFor:'initialization'!

initialize
    "initializes"

    super initialize.

    selectedColumnIndex := 0.
    columns     := OrderedCollection new.
    modalOpened := false.
    listOfSpecViews := Array new:(self class slices size).
    editingSpecOnly := false.
!

loadFromResourceSpec: aResourceSpec
    self columns:aResourceSpec copy.
    modified := false.
    hasSaved := false.
    self updateAfterColumnChange.
!

setDefaultValuesInNewColumn:aDataSetColumnSpec
"/    aDataSetColumnSpec readSelector: #'valueAtColumnIndex:'.
"/    aDataSetColumnSpec writeSelector: #'valueAtColumnIndex:put:'.
"/    aDataSetColumnSpec backgroundSelector: #'bgAtRowIndex:columnIndex:'.
"/    aDataSetColumnSpec foregroundSelector: #'fgAtRowIndex:columnIndex:'.
"/    aDataSetColumnSpec selectSelector: #'selectAtColumnIndex:'.
"/    aDataSetColumnSpec editorType: #InputField.
! !

!DataSetBuilder methodsFor:'operations'!

addCellSeparators
    self addRowSeparators.
    self addColumnSeparators.
!

addColumnSeparators
    self selectedColumnsDo:[:eachColDescr |
        eachColDescr showColSeparator:true
    ].
    self updateAfterOperation.
!

addLabelColumnSeparators
    self selectedColumnsDo:[:eachColDescr |
        eachColDescr labelButtonType:#Button
    ].
    self updateAfterOperation.
!

addLabelSeparators
    self selectedColumnsDo:[:eachColDescr |
        eachColDescr labelButtonType:#Button
    ].
    self updateAfterOperation.
!

addRowSeparators
    self selectedColumnsDo:[:eachColDescr |
        eachColDescr showRowSeparator:true
    ].
    self updateAfterOperation.
!

alignColumns:how
    self selectedColumnsDo:[:eachColDescr |
        eachColDescr columnAlignment:how
    ].
    self updateAfterOperation.
!

alignColumnsCentered
    self alignColumns:#centered
!

alignColumnsLeft
    self alignColumns:#left
!

alignColumnsRight
    self alignColumns:#right
!

alignLabels:how
    self selectedColumnsDo:[:eachColDescr |
        eachColDescr labelAlignment:how
    ].
    self updateAfterOperation.
!

alignLabelsCentered
    self alignLabels:#centered
!

alignLabelsLeft
    self alignLabels:#left
!

alignLabelsRight
    self alignLabels:#right
!

makeColumnsSelectable
    self makeColumnsSelectable:true
!

makeColumnsSelectable:aBoolean
    self selectedColumnsDo:[:eachColDescr |
        eachColDescr canSelect:aBoolean
    ].
    self updateAfterOperation.
!

makeColumnsUnselectable
    self makeColumnsSelectable:false
!

makeSelectedCellsSelectable
    self selectedColumnsDo:[:eachColDescr |
        eachColDescr canSelect:true
    ].
    self updateAfterOperation.
!

makeSelectedCellsUnselectable
    self selectedColumnsDo:[:eachColDescr |
        eachColDescr canSelect:false
    ].
    self updateAfterOperation.
!

removeCellSeparators
    self removeRowSeparators.
    self removeColumnSeparators.
!

removeColumnSeparators
    self selectedColumnsDo:[:eachColDescr |
        eachColDescr showColSeparator:false
    ].
    self updateAfterOperation.
!

removeLabelColumnSeparators
    self selectedColumnsDo:[:eachColDescr |
        eachColDescr labelButtonType:#Group
    ].
    self updateAfterOperation.
!

removeLabelSeparators
    self selectedColumnsDo:[:eachColDescr |
        eachColDescr labelButtonType:#None
    ].
    self updateAfterOperation.
!

removeRowSeparators
    self selectedColumnsDo:[:eachColDescr |
        eachColDescr showRowSeparator:false
    ].
    self updateAfterOperation.
!

selectedColumnsDo:aBlock
    selectedColumnIndex isCollection ifTrue:[
        selectedColumnIndex do:[:idx | aBlock value:(columns at:idx)].
    ] ifFalse:[
        selectedColumnIndex ~~ 0 ifTrue:[
            selectedColumnIndex notNil ifTrue:[
                aBlock value:(columns at:selectedColumnIndex)
            ]
        ].  
    ].
!

setCellColorSelectors
    |fgSelector bgSelector|

    fgSelector := Dialog request:'FG-Selector for all selected Columns (accept empty for none):'.
    fgSelector isNil ifTrue:[^ self].

    bgSelector := Dialog request:'BG-Selector for all selected Columns (accept empty for none):'.
    bgSelector isNil ifTrue:[^ self].

    self selectedColumnsDo:[:eachColDescr |
        bgSelector notEmpty ifTrue:[
            eachColDescr backgroundSelector:bgSelector
        ].
        fgSelector notEmpty ifTrue:[
            eachColDescr foregroundSelector:fgSelector
        ].
    ].
    self updateAfterOperation.
!

setSelectedCellColorSelectors
    |fgSelector bgSelector|

    fgSelector := Dialog request:'Selected FG-Selector for all selected Columns (accept empty for none):'.
    fgSelector isNil ifTrue:[^ self].

    bgSelector := Dialog request:'Selected BG-Selector for all selected Columns (accept empty for none):'.
    bgSelector isNil ifTrue:[^ self].

    self selectedColumnsDo:[:eachColDescr |
        bgSelector notEmpty ifTrue:[
            eachColDescr selectedBackgroundSelector:bgSelector
        ].
        fgSelector notEmpty ifTrue:[
            eachColDescr selectedForegroundSelector:fgSelector
        ].
    ].
    self updateAfterOperation.
!

updateAfterOperation
    self updateColumnView.
    self updateInputFields.
    self setModified.
! !

!DataSetBuilder methodsFor:'private'!

labelFromColumn:aColumn
    |label|

    aColumn rendererType == #rowSelector ifTrue:[
        ^ 'Row Selector'
    ].
    label := aColumn label.
    label isNil ifTrue:[^ nil].

    label isString ifTrue:[^ label].

    label size > 0 ifTrue:[
         label := label at:1.
    ].
    ^ label printString
!

labelInPreviewPressed:anIndex
   (self componentAt:#labelAndColumns) selection:anIndex
!

updateColumnView
    "updates the column view from column descriptions"

    |size previewColumns columnList|

    columnView notNil ifTrue:[
        columnList     := List new.
        previewColumns := OrderedCollection new.

        (size := columns size) ~~ 0 ifTrue:[
            columns do:[:aCol|
                previewColumns add:(aCol copy)
            ].
            previewColumns keysAndValuesDo:[:anIndex :column| 
                column 
                    readSelector:  #at:;
                    writeSelector: #at:put:;
                    backgroundSelector:nil;
                    foregroundSelector:nil;
                    rowSeparatorSelector:nil;
                    selectSelector: nil;
                    showComboFieldSelector: nil;
                    selectSelector: nil;
                    doubleClickedSelector: nil;
                    printSelector: nil;
                    visibilitySelector: nil;
                    menu: nil;
                    labelActionSelector:#labelInPreviewPressed:;
                    labelActionArgument:anIndex;
                    choices:#choices;
                    sortSelector: nil;
                    isSortable: false
            ].
            #(' 1' ' 2' ' x') do:[:suffix|
                |oneRow|

                oneRow := Row new:size.
                1 to:size do:[:i | oneRow at: i put: ('Cell%1-%2' bindWith:suffix with:i)].
                columnList add: oneRow.
            ]
        ].

        columnView list: #().
        columnView columnDescriptors: previewColumns.
        columnView list: columnList.
    ].

    "Modified: / 27.10.1998 / 14:41:16 / cg"
!

updateInputFields
    "reloads item value into input fields"

    |column notifyValue|

    (column := self selectedColumn) isNil ifTrue:[
        self tabModel value:0.
    ] ifFalse:[
        notifyValue := nil.     "/ old: '' -> problems with Toggles (asBoolean)

        aspects do:[:anAspect| anAspect value:notifyValue ].
        aspects keysAndValuesDo:[:aKey :aModel |
            aModel value:(column perform:aKey) withoutNotifying: self
        ].

"/ REPALCE nil by empty string for specific inputFields without an adapter
        #( #labelActionArgument #formatString #id ) do:[:aKey| |model|
            model := aspects at:aKey.
            model value isNil ifTrue:[model value:notifyValue withoutNotifying: self]
        ].

        tabSelection == 0 ifTrue:[self tabModel value:1].
    ].
! !

!DataSetBuilder methodsFor:'selection'!

selectedColumn
    "returns selected column or nil"

    selectedColumnIndex isCollection ifTrue:[
        ^ selectedColumnIndex size == 1 
            ifTrue:[ columns at:selectedColumnIndex first ]
            ifFalse:[ nil ] 
    ].

    ^selectedColumnIndex == 0 
        ifFalse:[columns at:selectedColumnIndex ifAbsent: nil]
        ifTrue: [nil]
!

selectedColumnIndex
    "returns selected column index or 0"

    ^selectedColumnIndex
!

selectedColumnIndex:something
    "changes selected column and updates specifications"

    something == selectedColumnIndex ifFalse:[
        selectedColumnIndex := something ? 0.
        "/ self assert:( selectedColumnIndex <= columns size ).
        "/ self assert:( selectedColumnIndex <= self seqList size ).
        self isColumnSelected value: true
    ].
!

selectedColumnIndices
    "returns selected column indices or #()"

    selectedColumnIndex == 0 ifTrue:[ ^ #() ].
    selectedColumnIndex isNumber ifTrue:[ ^ Array with:selectedColumnIndex ].
    ^selectedColumnIndex
!

selectedColumns
    selectedColumnIndex isCollection ifTrue:[
        ^ selectedColumnIndex collect:[:idx | columns at:idx] 
    ].

    ^ selectedColumnIndex == 0 
        ifFalse:[ Array with:(columns at:selectedColumnIndex) ]
        ifTrue: [ #() ]
!

singleSelectedColumnIndex
    selectedColumnIndex isCollection ifTrue:[
        ^ selectedColumnIndex size == 1 
            ifTrue:[ selectedColumnIndex first ]
            ifFalse:[ 0 ] 
    ].

    ^ selectedColumnIndex
!

tabSelection:something
    "changes selected tab and set corresponding specification"

    |view spec|

    something == tabSelection ifTrue:[^self].

    (tabSelection := something) isNil ifTrue:[
        tabSelection == 0 ifTrue:[^ self].
        tabSelection := 0.
    ].

    self selectedColumn isNil ifTrue:[
        tabSelection ~~ 0 ifTrue:[
            self tabModel value:0
        ] ifFalse:[
            self canvasHolder value:nil
        ].
        ^ self
    ].

    tabSelection == 0 ifTrue:[
        ^ self tabModel value:1.
    ].

    (view := listOfSpecViews at:tabSelection) isNil ifTrue:[
        view := SimpleView new.
        spec := (self class slices at:tabSelection) last.

"/        view client:nil spec:(self class interfaceSpecFor:spec) builder:(self builder).
        view client:self spec:spec builder:(self builder).
        listOfSpecViews at:tabSelection put:view.
    ].
    self canvasHolder value:view
! !

!DataSetBuilder methodsFor:'startup & release'!

commonPostBuild
    columnView := self componentAt:#columnView.

    columns notEmpty ifTrue: [
        self tabModel value: 1. 
        self selectedColumnModel value:nil; value:1.    "/ toggle to force change
        self updateInputFields.
        self updateInfoLabel.
        self updateHistory
    ].

    (self componentAt: #labelAndColumns) 
        selectConditionBlock: [:i|self askForItemModification];
        action: [:i|self cancel];
        selection: 1.

    "/ using masters infoHolder ?
    (builder aspectAt:#useAlienInfoLabelHolder) == true ifTrue:[
        (builder componentAt:#mainPanel) layout bottomOffset:0.
        (builder componentAt:#infoBarSubSpec) beInvisible
    ]                         
!

openModal
    "sets the modalOpened flag, so later, 
     there is no need to ask for saving into a class"

    modalOpened := true.
    super openModal
!

openModalOnResourceSpec: aListSpec
    "sets the modalOpened flag, so later, 
     there is no need to ask for saving into a class"

    modalOpened := true.
    super openModalOnResourceSpec: aListSpec


!

postBuildListOfItemsView:aView
    listOfItemsView := aView
!

postBuildSpecView:aView
    listOfItemsView := aView
!

postOpenWith:aBuilder
    "reset keyboardProcessor for menuBar"

    super postOpenWith:aBuilder.
    aBuilder keyboardProcessor menuBar:nil.
    self windowGroup addPreEventHook:self.
! !

!DataSetBuilder methodsFor:'user actions'!

accept
    "accept changes made"

    |column type|

    super accept.

    (column := self selectedColumn) isNil ifTrue: [^self cancel].

    type := (aspects at:#rendererType) value.

    type == #rowSelector ifTrue:[
        #(label 
          width minWidth usePreferredWidth editorType choices translatedChoices
          readSelector writeSelector printSelector visibilitySelector
          formatString formatSelector type converterSelector size height 
          canSelect selectSelector showComboFieldSelector
          minValue maxValue
         ) do:[:aKey|
            (aspects at:aKey) value:nil
        ]
    ].
    aspects keysAndValuesDo:[:aKey :aModel| 
        column perform:(aKey , ':') asSymbol with: aModel value
    ].
    self seqList at:self singleSelectedColumnIndex put:(self labelFromColumn:column).
    self updateColumnView.
    self cancel.
    self clearModified.

    "Modified: / 25-10-2010 / 10:41:55 / cg"
!

cancel
    "remove all changes and reload selected column values"

    self updateInputFields.
    self enablingCommitButtonsHolder value:false.
    self clearModifiedFlag.
    self enablingCommitButtonsHolder value:false.

    "Modified: / 27.10.1998 / 14:41:41 / cg"
!

cutOrDelete:isCut
    "remove selected column and optionally put it to the clipboard"

    |indices selectionModel|

    ((indices := self selectedColumnIndices) notEmpty and:[self askForItemModification]) ifFalse:[
        ^ self
    ].
    isCut ifTrue:[
        self clipboard: (self selectedColumns)
    ].

    selectionModel := self selectedColumnModel.
    selectionModel value:0.

    indices sort reverseDo:[:idx |
        columns removeIndex:idx.
        self seqList removeIndex:idx.
    ].

    selectionModel value:((indices max) min:(columns size)).
    self updateColumnView.
    self updateInputFields.

    columns isEmpty ifTrue:[
        self isColumnSelected value: false
    ].
    self cancel.
    self setModified.
!

doAddColumn:descr
    "adds a new column after the selected column or at the left (if nothing is selected)"

    columns add:descr afterIndex:(self singleSelectedColumnIndex min:columns size).
    self setDefaultValuesInNewColumn:descr.
    self seqList add:(descr label) afterIndex:self singleSelectedColumnIndex.
    self enablingCommitButtonsHolder value ifFalse:[
        self selectedColumnModel value:self singleSelectedColumnIndex + 1
    ].
    self cancel.
    self updateColumnView.
    self setModified.
!

doBrowseRowClass
    "browse class of columns spec"

    |cls|

    (cls := self resolveRowClass) notNil 
        ifTrue: [Smalltalk browseInClass:cls] 
        ifFalse:[self information:'No class defined !!']

    "Modified: / 20.5.1998 / 03:48:04 / cg"
!

doCopy
    "copy selected columns to the clipboard"

    |cols|

    cols := self selectedColumns.
    cols notEmptyOrNil ifTrue:[
        self clipboard:(cols deepCopy)
    ]
!

doCreateColumn
    "create a new column after selected column or at left (nothing selected)"

    |label list dscs descr|

"/    list := self seqList.
"/    label := 'Column ', (list size + 1) printString.
"/    columns add:(dscs := DataSetColumnSpec label:label selector:nil) afterIndex:selectedColumnIndex.
"/    self setDefaultValuesInNewColumn:dscs.
"/    self seqList add:label afterIndex:selectedColumnIndex.
"/    self enablingCommitButtonsHolder value ifFalse:[
"/        self selectedColumnModel value:selectedColumnIndex + 1
"/    ].
"/    self cancel.
"/    self updateColumnView.
"/    self setModified.
"/

    label := 'Column ', (self seqList size + 1) printString.
    descr := DataSetColumnSpec label:label selector:nil.
    self doAddColumn:descr
!

doCreateNonSelectableColumn
    "create a new column after selected column or at left (nothing selected)"

    |label list dscs descr|

"/    list := self seqList.
"/    label := 'Column ', (list size + 1) printString.
"/    columns add:(dscs := DataSetColumnSpec label:label selector:nil) afterIndex:selectedColumnIndex.
"/    self setDefaultValuesInNewColumn:dscs.
"/    self seqList add:label afterIndex:selectedColumnIndex.
"/    self enablingCommitButtonsHolder value ifFalse:[
"/        self selectedColumnModel value:selectedColumnIndex + 1
"/    ].
"/    self cancel.
"/    self updateColumnView.
"/    self setModified.
"/

    label := 'Column ', (self seqList size + 1) printString.
    descr := DataSetColumnSpec label:label selector:nil.
    descr canSelect:false.
    self doAddColumn:descr
!

doCut
    "remove selected column and put it to the clipboard"

    self cutOrDelete:true
!

doDefineRowClass
    "launch a dialog to define class and superclass"

    |aspects cls oldClass oldSuper val classNameChannel superclassNameChannel|

    aspects  := IdentityDictionary new.
    oldClass := rowClass.
    oldSuper := rowSuperClass.

    [true] 
    whileTrue:
    [
        rowClass notNil ifTrue:[
            (cls := self resolveRowClass) notNil ifTrue:[
                rowSuperClass := cls superclass name asString
            ].
            val := rowClass
        ] ifFalse:[
            val := 'DSVRow'
        ].
        aspects at:#classNameChannel put:(classNameChannel := ValueHolder with:val).

        rowSuperClass notNil 
            ifTrue: [val := rowSuperClass] 
            ifFalse:[val := 'Object'].
        aspects at:#superclassNameChannel put:(superclassNameChannel := ValueHolder with:val).

        (self openDialogInterface:#defineClassNameSpec withBindings:aspects) 
        ifFalse:
        [
            rowClass := oldClass.
            rowSuperClass := oldSuper.
            ^self
        ].
        rowClass      := (classNameChannel value)      withoutSeparators.
        rowSuperClass := (superclassNameChannel value) withoutSeparators.

        rowClass size == 0 
        ifTrue:
        [
            rowClass := nil.
            self information:'no valid className'
        ] 
        ifFalse: 
        [
            cls := self resolveRowClass.

            cls notNil ifTrue:[cls := cls superclass name asString].

            rowSuperClass size == 0 
            ifTrue:
            [        
                cls notNil ifTrue:[
                    rowSuperClass := cls
                ] ifFalse:[
                    rowSuperClass := 'Object'
                ].
                self information: 'set superclassName'
            ] 
            ifFalse:
            [
                (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.

                rowSuperClass := cls
            ]
        ]
    ]

    "Modified: / 21.5.1998 / 03:08:42 / cg"
!

doDelete
    "remove selected column and put it to the clipboard"

    self cutOrDelete:false

!

doGenerateCode
    "generate code for column values"

    |cls superclass|

    rowClass isNil ifTrue:[^self information:'No class defined!!'].
    cls := self resolveRowClass.

    cls isNil 
    ifTrue:
    [
        superclass := Smalltalk resolveName:rowSuperClass inClass:self class.

        superclass isNil ifTrue:[^self information:'No superclass defined!!'].
        (self confirm:'create ' , rowClass , ' ?') ifFalse:[^self].
        cls := superclass subclass:rowClass asSymbol
                     instanceVariableNames:''
                     classVariableNames:''
                     poolDictionaries:''
                     category:'Applications'.
    ].

    self generateChoicesIn:cls.
    self generateMenuIn:cls.
    self generatePrintSelectorIn:cls.
    self generateReadSelectorIn:cls.
    self generateBackgroundSelectorIn:cls.
    self generateForegroundSelectorIn:cls.
    self generateSelectSelectorIn:cls.
    self generateWriteSelectorIn:cls.
    self generateDoubleClickSelectorIn:cls.
    self generateRowSeparatorSelectorIn:cls.
    self generateShowComboFieldSelectorIn:cls.

!

doMoveColumn:upOrDown
    "move selected column up or down"

    |idx list label col size tabIndex|

    (idx := self singleSelectedColumnIndex) == 0 ifTrue:[^self].
    list := self seqList.
    size := list size.

    size > 1 ifFalse:[ ^ self ].

    selectedColumnIndex := 0.
    tabIndex := self tabModel value.

    label := list at:idx.
    col   := columns at:idx.
    list    removeIndex:idx.
    columns removeIndex:idx.

    upOrDown == #up ifTrue:[
        idx == 1 ifTrue:[idx := size]
                ifFalse:[idx := idx - 1]
    ] ifFalse:[
        idx == size ifTrue:[idx := 1]
                   ifFalse:[idx := idx + 1]
    ].
    columns add:col   beforeIndex:idx.
    list    add:label beforeIndex:idx.

    self selectedColumnModel value:idx.
    self updateColumnView.
    self tabModel value:tabIndex.

    self setModified.
!

doMoveDown
    self doMoveColumn:#down
!

doMoveUp
    self doMoveColumn:#up
!

doPaste
    "paste clipboard copy column after selected column or at left (nothing selected)"

    |cols idx newSel|

    self askForItemModification ifFalse: [^ self].

    cols := self class clipboard.
    cols isEmptyOrNil ifTrue:[^ self].

    idx := (self selectedColumnIndices) isEmpty 
                ifTrue:[ columns size ]
                ifFalse:[ self selectedColumnIndices max ].

    newSel := OrderedCollection new.
    cols do:[:col |
        | lbl|

        lbl := self labelFromColumn:col.

        columns add:(col deepCopy) afterIndex:idx.
        self seqList add:lbl afterIndex:idx.
        idx := idx + 1.
        newSel add:idx.
    ].

    self enablingCommitButtonsHolder value ifFalse:[
        self selectedColumnModel value:newSel "/idx
    ].
    self updateColumnView.
    self updateInputFields.
    self setModified.
!

doPickColumns

    |view cls|

    view := Screen current viewFromUser.
    cls  := view class.

    (cls == DSVColumnView or:[cls == DataSetView or:[cls == DSVLabelView]]) ifTrue:[
        self columns:(view columnView columnDescriptors)
    ]
!

doSave
    |cls dst spc category mthd excla code resourceType|

    editingSpecOnly == true ifTrue:[
        acceptedColumns := columns.
        hasSaved := true.
        self clearModified.
        ^ self.
    ].

    (columns size ~~ 0 and:[super doSave]) ifFalse:[
        ^ nil
    ].

    cls := self resolveName:specClass.
    dst := columns collect:[:aCol| aCol literalArrayEncoding ].
    spc := WriteStream on:String new.
    spc nextPutAll:'    ^'.
    UISpecification prettyPrintSpecArray:dst asArray on:spc indent:4.
    spc := spc contents.

    "/ if that method already exists, do not overwrite the category

    resourceType := self class resourceType.
    category     := resourceType, ' specs'.

    (mthd := cls class compiledMethodAt:specSelector) notNil ifTrue:[
        category := mthd category.
    ].

    excla := Character excla asString.

    code := excla
            , (cls name , ' class methodsFor:' , category storeString)
            , excla , '\\'

            , specSelector , '\'
            , (self class codeGenerationComment replChar:$!! withString:'!!!!')
            , '\\    "\'
            , ('     DataSetBuilder new openOnClass:' , cls name , ' andSelector:#' , specSelector , '\')
            , '    "\'.

    code := code 
            , '\'
            , '    <resource: #', resourceType, '>\\'
            , spc
            , '\'
            , (excla , ' ' , excla)
            , '\\'.

    code := code withCRs.
    (ReadStream on:code) fileIn.

"/    self isStandAlone ifTrue: [self helpTool installHelpSpecsOnClass:self specClass].

    self updateHistory.
    self updateInfoLabel.

    hasSaved := true.
    self clearModified.
!

openDocumentation
   self openHTMLDocument:'tools/uipainter/DataSetBuilder.html'.
! !

!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
    ^ '$Header$'
!

version_CVS
    ^ '$Header$'
! !