DataSetBuilder.st
author tz
Fri, 16 Jan 1998 17:00:50 +0100
changeset 411 7f21bc19cd51
parent 409 6fbb954fdd75
child 413 ac37b2a972ff
permissions -rw-r--r--
supports calling submenus with arguments

"
 COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
              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.
"





ToolApplicationModel subclass:#DataSetBuilder
	instanceVariableNames:'className superclassName hasChanged columnView columns
		selectedColumnIndex tabSelectionIndex aspects isModified'
	classVariableNames:'Number'
	poolDictionaries:''
	category:'Interface-UIPainter'
!

!DataSetBuilder class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
              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
"

! !

!DataSetBuilder class methodsFor:'columns specs'!

basicsEditSpec
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

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

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'DataSet Basic'
              #'layout:' #(#LayoutFrame 100 0 173 0 388 0 428 0)
              #'label:' 'DataSet Basic'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1280 1024)
              #'bounds:' #(#Rectangle 100 173 389 429)
              #'usePreferredExtent:' false
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#FramedBoxSpec
                    #'name:' 'framedBox1'
                    #'layout:' #(#LayoutFrame 0 0.0 3 0 0 1.0 92 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#LabelSpec
                              #'name:' 'label1'
                              #'layout:' #(#AlignmentOrigin 107 0 31 0 1 0.5)
                              #'label:' 'Label:'
                              #'resizeForLabel:' true
                          )
                           #(#InputFieldSpec
                              #'name:' 'labelField'
                              #'layout:' #(#LayoutFrame 110 0 21 0 15 1.0 43 0)
                              #'activeHelpKey:' #label
                              #'model:' #label
                          )
                           #(#CheckBoxSpec
                              #'name:' 'labelIsImage'
                              #'layout:' #(#LayoutOrigin 107 0 47 0)
                              #'activeHelpKey:' #labelIsImage
                              #'model:' #labelIsImage
                              #'label:' 'Label Is Image'
                          )
                        )
                    )
                    #'label:' 'Header:'
                    #'labelPosition:' #topLeft
                )
                 #(#FramedBoxSpec
                    #'name:' 'typesFrame'
                    #'layout:' #(#LayoutFrame 0 0.0 92 0 0 1.0 174 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#LabelSpec
                              #'name:' 'rendererLabel'
                              #'layout:' #(#AlignmentOrigin 107 0 28 0 1 0.5)
                              #'label:' 'Renderer:'
                              #'resizeForLabel:' true
                          )
                           #(#ComboListSpec
                              #'name:' 'rendererField'
                              #'layout:' #(#LayoutFrame 110 0 18 0 15 1.0 40 0)
                              #'activeHelpKey:' #rendererType
                              #'model:' #rendererType
                              #'comboList:' #rendererTypeList
                              #'useIndex:' false
                          )
                           #(#LabelSpec
                              #'name:' 'editorLabel'
                              #'layout:' #(#AlignmentOrigin 107 0 53 0 1 0.5)
                              #'label:' 'Editor:'
                              #'resizeForLabel:' true
                          )
                           #(#ComboBoxSpec
                              #'name:' 'editorField'
                              #'layout:' #(#LayoutFrame 110 0 44 0 15 1.0 66 0)
                              #'activeHelpKey:' #editorField
                              #'model:' #editorType
                              #'type:' #symbolOrNil
                              #'comboList:' #editorTypeList
                              #'useIndex:' false
                          )
                        )
                    )
                    #'label:' 'Cell Type:'
                    #'labelPosition:' #topLeft
                )
              )
          )
      )
!

colorsEditSpec
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

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

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'DataSet Misc'
              #'layout:' #(#LayoutFrame 354 0 229 0 722 0 528 0)
              #'label:' 'DataSet Misc'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1280 1024)
              #'bounds:' #(#Rectangle 354 229 723 529)
              #'usePreferredExtent:' false
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#FramedBoxSpec
                    #'name:' 'defaultColorsBox'
                    #'layout:' #(#LayoutFrame 0 0.0 88 0 0 1.0 230 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#ColorMenuSpec
                              #'name:' 'fgMenu'
                              #'layout:' #(#LayoutFrame 110 0 15 0 12 1.0 37 0)
                              #'activeHelpKey:' #foregroundColor
                              #'model:' #foregroundColor
                          )
                           #(#LabelSpec
                              #'name:' 'fgLabel'
                              #'layout:' #(#AlignmentOrigin 107 0 27 0 1 0.5)
                              #'label:' 'Foreground:'
                              #'adjust:' #right
                              #'resizeForLabel:' true
                          )
                           #(#LabelSpec
                              #'name:' 'bgLabel'
                              #'layout:' #(#AlignmentOrigin 107 0 55 0 1 0.5)
                              #'label:' 'Background:'
                              #'adjust:' #right
                              #'resizeForLabel:' true
                          )
                           #(#ColorMenuSpec
                              #'name:' 'bgMenu'
                              #'layout:' #(#LayoutFrame 110 0 43 0 12 1.0 65 0)
                              #'activeHelpKey:' #backgroundColor
                              #'model:' #backgroundColor
                          )
                           #(#LabelSpec
                              #'name:' 'fgSelLabel'
                              #'layout:' #(#AlignmentOrigin 107 0 89 0 1 0.5)
                              #'label:' 'FG-Selector:'
                              #'adjust:' #right
                              #'resizeForLabel:' true
                          )
                           #(#LabelSpec
                              #'name:' 'bgSelLabel'
                              #'layout:' #(#AlignmentOrigin 107 0 114 0 1 0.5)
                              #'label:' 'BG-Selector:'
                              #'adjust:' #right
                              #'resizeForLabel:' true
                          )
                           #(#InputFieldSpec
                              #'name:' 'bgSelField'
                              #'layout:' #(#LayoutFrame 110 0 103 0 15 1.0 125 0)
                              #'activeHelpKey:' #backgroundSelector
                              #'model:' #backgroundSelector
                              #'type:' #symbolOrNil
                          )
                           #(#InputFieldSpec
                              #'name:' 'fgSelField'
                              #'layout:' #(#LayoutFrame 110 0 78 0 15 1.0 100 0)
                              #'activeHelpKey:' #foregroundSelector
                              #'model:' #foregroundSelector
                              #'type:' #symbolOrNil
                          )
                        )
                    )
                    #'label:' 'Cell Colors:'
                    #'labelPosition:' #topLeft
                )
                 #(#FramedBoxSpec
                    #'name:' 'ColorsBox'
                    #'layout:' #(#LayoutFrame 0 0.0 3 0 0 1.0 88 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#ColorMenuSpec
                              #'name:' 'colorMenu1'
                              #'layout:' #(#LayoutFrame 110 0 15 0 12 1.0 37 0)
                              #'activeHelpKey:' #foregroundColor
                              #'model:' #labelForegroundColor
                          )
                           #(#LabelSpec
                              #'name:' 'label1'
                              #'layout:' #(#AlignmentOrigin 107 0 27 0 1 0.5)
                              #'label:' 'Foreground:'
                              #'adjust:' #right
                              #'resizeForLabel:' true
                          )
                           #(#LabelSpec
                              #'name:' 'label2'
                              #'layout:' #(#AlignmentOrigin 107 0 55 0 1 0.5)
                              #'label:' 'Background:'
                              #'adjust:' #right
                              #'resizeForLabel:' true
                          )
                           #(#ColorMenuSpec
                              #'name:' 'colorMenu2'
                              #'layout:' #(#LayoutFrame 110 0 43 0 12 1.0 65 0)
                              #'activeHelpKey:' #backgroundColor
                              #'model:' #labelBackgroundColor
                          )
                        )
                    )
                    #'label:' 'Label Colors:'
                    #'labelPosition:' #topLeft
                )
              )
          )
      )
!

formatEditSpec
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

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

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'DataSet Details'
              #'layout:' #(#LayoutFrame 54 0 445 0 441 0 736 0)
              #'label:' 'DataSet Details'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1280 1024)
              #'bounds:' #(#Rectangle 54 445 442 737)
              #'usePreferredExtent:' false
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#FramedBoxSpec
                    #'name:' 'framedBox1'
                    #'layout:' #(#LayoutFrame 0 0.0 3 0 0 1.0 87 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#LabelSpec
                              #'name:' 'typeLabel'
                              #'layout:' #(#AlignmentOrigin 107 0 26 0 1 0.5)
                              #'label:' 'Input Type:'
                              #'resizeForLabel:' true
                          )
                           #(#LabelSpec
                              #'name:' 'sizeLabel'
                              #'layout:' #(#AlignmentOrigin 107 0 55 0 1 0.5)
                              #'label:' 'Max Size:'
                              #'resizeForLabel:' true
                          )
                           #(#InputFieldSpec
                              #'name:' 'sizeField'
                              #'layout:' #(#LayoutFrame 110 0 44 0 15 1.0 66 0)
                              #'activeHelpKey:' #size
                              #'model:' #size
                              #'type:' #numberOrNil
                          )
                           #(#ComboListSpec
                              #'name:' 'typeCombo'
                              #'layout:' #(#LayoutFrame 110 0 18 0 15 1.0 40 0)
                              #'activeHelpKey:' #type
                              #'model:' #type
                              #'comboList:' 
                               #(#string
                                  #password #number
                                  #numberOrNil #symbolOrNil
                              )
                              #'useIndex:' false
                          )
                        )
                    )
                    #'label:' 'Input Format'
                    #'labelPosition:' #topLeft
                )
                 #(#FramedBoxSpec
                    #'name:' 'framedBox2'
                    #'layout:' #(#LayoutFrame 0 0.0 87 0 0 1.0 175 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#LabelSpec
                              #'name:' 'formatLabel'
                              #'layout:' #(#AlignmentOrigin 107 0 55 0 1 0.5)
                              #'label:' 'Text Format:'
                              #'resizeForLabel:' true
                          )
                           #(#LabelSpec
                              #'name:' 'JustificationLabel'
                              #'layout:' #(#LayoutOrigin 35 0 21 0)
                              #'label:' 'Justification:'
                              #'adjust:' #left
                              #'resizeForLabel:' true
                          )
                           #(#PopUpListSpec
                              #'name:' 'Alignment'
                              #'layout:' #(#LayoutFrame 110 0 18 0 15 1.0 40 0)
                              #'label:' 'Alignment'
                              #'model:' #labelAlignment
                              #'menu:' 
                               #(#left
                                  #right #center
                              )
                              #'useIndex:' false
                          )
                           #(#InputFieldSpec
                              #'name:' 'formatField'
                              #'layout:' #(#LayoutFrame 110 0 45 0 15 1.0 67 0)
                              #'activeHelpKey:' #formatString
                              #'model:' #formatString
                          )
                        )
                    )
                    #'label:' 'Output Format'
                    #'labelPosition:' #topLeft
                )
              )
          )
      )
!

frameEditSpec
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

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

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'DataSet Dimension'
              #'layout:' #(#LayoutFrame 442 0 269 0 732 0 482 0)
              #'label:' 'DataSet Dimension'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1280 1024)
              #'bounds:' #(#Rectangle 442 269 733 483)
              #'usePreferredExtent:' false
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#FramedBoxSpec
                    #'name:' 'separatorBox'
                    #'layout:' #(#LayoutFrame 0 0.0 3 0 0 1.0 86 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#CheckBoxSpec
                              #'name:' 'showRowSeparator'
                              #'layout:' #(#LayoutFrame 18 0 19 0 194 0 42 0)
                              #'activeHelpKey:' #showRowSeparator
                              #'model:' #showRowSeparator
                              #'label:' 'Show Row-Separator'
                          )
                           #(#CheckBoxSpec
                              #'name:' 'showColSeparator'
                              #'layout:' #(#LayoutFrame 18 0 45 0 194 0 68 0)
                              #'activeHelpKey:' #showColumnSeparator
                              #'model:' #showColSeparator
                              #'label:' 'Show Column-Separator'
                          )
                        )
                    )
                    #'label:' 'Separators'
                    #'labelPosition:' #topLeft
                )
                 #(#FramedBoxSpec
                    #'name:' 'framedBox1'
                    #'layout:' #(#LayoutFrame 0 0.0 86 0 0 1.0 198 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#InputFieldSpec
                              #'name:' 'heightField'
                              #'layout:' #(#LayoutFrame 110 0 73 0 15 1.0 95 0)
                              #'activeHelpKey:' #height
                              #'model:' #height
                              #'type:' #numberOrNil
                          )
                           #(#LabelSpec
                              #'name:' 'heightLabel'
                              #'layout:' #(#LayoutFrame 10 0.0 76 0 107 0.0 93 0)
                              #'label:' 'Row Height:'
                              #'adjust:' #right
                              #'resizeForLabel:' true
                          )
                           #(#LabelSpec
                              #'name:' 'minWidthLabel'
                              #'layout:' #(#LayoutFrame 10 0.0 45 0 107 0.0 62 0)
                              #'label:' 'Min Width:'
                              #'adjust:' #right
                              #'resizeForLabel:' true
                          )
                           #(#InputFieldSpec
                              #'name:' 'minWidthField'
                              #'layout:' #(#LayoutFrame 110 0 42 0 15 1.0 64 0)
                              #'activeHelpKey:' #minWidth
                              #'model:' #minWidth
                              #'type:' #numberOrNil
                          )
                           #(#LabelSpec
                              #'name:' 'widthLabel'
                              #'layout:' #(#LayoutFrame 10 0.0 20 0 107 0.0 37 0)
                              #'label:' 'Column Width:'
                              #'adjust:' #right
                              #'resizeForLabel:' true
                          )
                           #(#InputFieldSpec
                              #'name:' 'widthField'
                              #'layout:' #(#LayoutFrame 110 0 17 0 15 1.0 39 0)
                              #'activeHelpKey:' #width
                              #'model:' #width
                              #'type:' #numberOrNil
                          )
                        )
                    )
                    #'label:' 'Dimensions:'
                    #'labelPosition:' #topLeft
                )
              )
          )
      )
!

selectionEditSpec
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

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

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'DataSet Basic'
              #'layout:' #(#LayoutFrame 414 0 196 0 702 0 451 0)
              #'label:' 'DataSet Basic'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1280 1024)
              #'bounds:' #(#Rectangle 414 196 703 452)
              #'usePreferredExtent:' false
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#FramedBoxSpec
                    #'name:' 'framedBox1'
                    #'layout:' #(#LayoutFrame 0 0.0 3 0 0 1.0 84 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#CheckBoxSpec
                              #'name:' 'canSelect'
                              #'layout:' #(#Point 107 17)
                              #'activeHelpKey:' #canSelect
                              #'model:' #canSelect
                              #'label:' 'Is Selectable'
                          )
                           #(#LabelSpec
                              #'name:' 'selectorLabel'
                              #'layout:' #(#AlignmentOrigin 107 0 51 0 1 0.5)
                              #'label:' 'Selector:'
                              #'adjust:' #right
                              #'resizeForLabel:' true
                          )
                           #(#InputFieldSpec
                              #'name:' 'selectSelector'
                              #'layout:' #(#LayoutFrame 110 0 42 0 15 1.0 64 0)
                              #'activeHelpKey:' #selectSelector
                              #'model:' #selectSelector
                              #'type:' #symbolOrNil
                          )
                        )
                    )
                    #'label:' 'Selection:'
                    #'labelPosition:' #topLeft
                )
                 #(#FramedBoxSpec
                    #'name:' 'framedBox2'
                    #'layout:' #(#LayoutFrame 0 0.0 84 0 0 1.0 166 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#InputFieldSpec
                              #'name:' 'ArgumentValue'
                              #'layout:' #(#LayoutFrame 110 0 42 0 15 1.0 64 0)
                              #'model:' #labelActionArgument
                              #'type:' #string
                          )
                           #(#LabelSpec
                              #'name:' 'ArgumentLabel'
                              #'layout:' #(#AlignmentOrigin 107 0 52 0 1 0.5)
                              #'label:' 'Argument:'
                              #'adjust:' #left
                              #'resizeForLabel:' true
                          )
                           #(#LabelSpec
                              #'name:' 'ActionLabel'
                              #'layout:' #(#AlignmentOrigin 107 0 27 0 1 0.5)
                              #'label:' 'Selector:'
                              #'adjust:' #left
                              #'resizeForLabel:' true
                          )
                           #(#InputFieldSpec
                              #'name:' 'ActionSelector'
                              #'layout:' #(#LayoutFrame 110 0 17 0 15 1.0 39 0)
                              #'model:' #labelActionSelector
                              #'type:' #symbolOrNil
                          )
                        )
                    )
                    #'label:' 'Select Action:'
                    #'labelPosition:' #topLeft
                )
                 #(#FramedBoxSpec
                    #'name:' 'framedBox3'
                    #'layout:' #(#LayoutFrame 0 0.0 166 0 0 1.0 220 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#LabelSpec
                              #'name:' 'doubleLabel'
                              #'layout:' #(#AlignmentOrigin 107 0 26 0 1 0.5)
                              #'label:' 'Selector:'
                              #'adjust:' #right
                              #'resizeForLabel:' true
                          )
                           #(#InputFieldSpec
                              #'name:' 'doubleClicked'
                              #'layout:' #(#LayoutFrame 110 0 16 0 15 1.0 38 0)
                              #'activeHelpKey:' #doubleClickedSelector
                              #'model:' #doubleClickedSelector
                              #'type:' #symbolOrNil
                          )
                        )
                    )
                    #'label:' 'Doubel Click:'
                    #'labelPosition:' #topLeft
                )
              )
          )
      )
!

valuesEditSpec
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

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

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'DataSet Basic'
              #'layout:' #(#LayoutFrame 563 0 305 0 858 0 610 0)
              #'label:' 'DataSet Basic'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1280 1024)
              #'bounds:' #(#Rectangle 563 305 859 611)
              #'usePreferredExtent:' false
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#FramedBoxSpec
                    #'name:' 'valuesBox'
                    #'layout:' #(#LayoutFrame 0 0.0 3 0 0 1.0 107 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#LabelSpec
                              #'name:' 'readLabel'
                              #'layout:' #(#AlignmentOrigin 107 0 28 0 1 0.5)
                              #'label:' 'Read:'
                              #'adjust:' #right
                              #'resizeForLabel:' true
                          )
                           #(#InputFieldSpec
                              #'name:' 'readSelector'
                              #'layout:' #(#LayoutFrame 110 0 18 0 15 1.0 40 0)
                              #'activeHelpKey:' #readSelector
                              #'model:' #readSelector
                              #'type:' #symbolOrNil
                          )
                           #(#InputFieldSpec
                              #'name:' 'writeSelector'
                              #'layout:' #(#LayoutFrame 110 0 43 0 15 1.0 63 0)
                              #'activeHelpKey:' #writeSelector
                              #'model:' #writeSelector
                              #'type:' #symbolOrNil
                          )
                           #(#LabelSpec
                              #'name:' 'printLabel'
                              #'layout:' #(#AlignmentOrigin 107 0 76 0 1 0.5)
                              #'label:' 'Print:'
                              #'adjust:' #right
                              #'resizeForLabel:' true
                          )
                           #(#InputFieldSpec
                              #'name:' 'printSelector'
                              #'layout:' #(#LayoutFrame 110 0 66 0 15 1.0 86 0)
                              #'activeHelpKey:' #printSelector
                              #'model:' #printSelector
                              #'type:' #symbolOrNil
                          )
                           #(#LabelSpec
                              #'name:' 'writeLabel'
                              #'layout:' #(#AlignmentOrigin 107 0 53 0 1 0.5)
                              #'label:' 'Write:'
                              #'adjust:' #right
                              #'resizeForLabel:' true
                          )
                        )
                    )
                    #'label:' 'Value Selectors:'
                    #'labelPosition:' #topLeft
                )
                 #(#FramedBoxSpec
                    #'name:' 'menusBox'
                    #'layout:' #(#LayoutFrame 0 0.0 107 0 0 1.0 186 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#LabelSpec
                              #'name:' 'menuLabel'
                              #'layout:' #(#AlignmentOrigin 107 0 28 0 1 0.5)
                              #'label:' 'Menu:'
                              #'adjust:' #right
                              #'resizeForLabel:' true
                          )
                           #(#InputFieldSpec
                              #'name:' 'menuSelector'
                              #'layout:' #(#LayoutFrame 110 0 18 0 15 1.0 38 0)
                              #'activeHelpKey:' #menuSelector
                              #'model:' #menu
                              #'type:' #symbolOrNil
                          )
                           #(#LabelSpec
                              #'name:' 'choicesLabel'
                              #'layout:' #(#AlignmentOrigin 107 0 51 0 1 0.5)
                              #'label:' 'Choice:'
                              #'adjust:' #right
                              #'resizeForLabel:' true
                          )
                           #(#InputFieldSpec
                              #'name:' 'choicesSelector'
                              #'layout:' #(#LayoutFrame 110 0 41 0 15 1.0 61 0)
                              #'activeHelpKey:' #choices
                              #'model:' #choices
                              #'type:' #symbolOrNil
                          )
                        )
                    )
                    #'label:' 'Menu Selectors:'
                    #'labelPosition:' #topLeft
                )
              )
          )
      )
! !

!DataSetBuilder class methodsFor:'help specs'!

helpSpec
    "return a dictionary filled with helpKey -> helptext associations.
     These are used by the activeHelp tool."

    "
    UIHelpTool openOnClass:DataSetBuilder    
    "

  ^ super helpSpec addPairsFrom:#(

#backgroundColor
'set the background color of the column if the color-checkBox is turned on. Otherwise, the column uses its default background color (which is specified in the styleSheet).'

#backgroundSelector
'selector which returns the background color for a cell (optional). If the selector is nil or returns nil, the default background color is set.'

#canSelect
'if true, each cell in the column can be selected. In case of having a menu, the menu can be opened by selecting the cell and pressing down the right or middle button of the mouse. if false, the whole line is selected. The menu opened derives from the DataSetView, which is specified in the window specification (Basics).'

#choices
'selector to get the collection of choices for a column which is selectable and its editor is kind of a ComboBox or ComboList. If a cell in the column is selected, the visual editor is opened and in case of having choices, the choices are assigned to the widget.'

#editorField
'type of visual editor (using default editors) or a selector, which will return an visual editor. If the cell is selected, a visual editor is opened in in the cell. In case of an unsupported selector (user defined editor), the row object is asked for the visual editor by performing the selector on the row. A widget instance must be returned which is opened in the cell.'

#doubleClickedSelector
'selector evaluated without arguments on selected column'

#foregroundColor
'set the foreground color of the column  if the color-checkBox is turned on. Otherwise, the column uses its default foreground color (which is specified in the styleSheet).'

#foregroundSelector
'selector which returns the foreground color for a cell (optional). If the selector is nil or returns nil, the default foreground color is set.'

#formatString
'format string, which specifies the output format of a text in a cell. \ At the moment only numbers are supported. \ \ for example: 0.0000'

#height
'preferred height (optional)'

#label
'the label of the column. If ''label is image'' is off, this is the label string. Otherwise, it specifies the applications selector, which returns the label - either a string or a bitmap image.'

#labelIsImage
'if ''label is image'' is off (the default), the columns label is the string as entered in the label aspect. Otherwise, its the name of the message sent to the application - this should return a string or bitmap image, which is used as logo in the column.'

#menuSelector
'a selector to access the middleButton menu or nil. If a cell is selected. The menu will be opened by selecting the cell and pressing down the right or middle button of the mouse.'

#minWidth
'makes sense if the width is set to 0 or nil. This is the minimum size required; no computation dependent on the contents. When resizing the view the column may grow or shrink to the minimum width.'

#printSelector
'a selector with one argument, the DataSetView. Used to access a drawable display object. In case of nil, the value derived from the readSelector is shown in the unselected cell.\ \ Using bitmaps, the DataSetView offers three important methods:\ \ #registerImage:anImage key:aSymbol\ register an image with an unique symbol. This symbol can be used by the row object to access the image, using #registeredImageAt:. The image will be associated to the device.\ \ #registeredImageAt:aSymbol\ returns an image assigned to the symbol or nil. The image returned is associated to the device.\ \ #releaseAllRegisteredImages\ relaese all registered images'

#readSelector
'a selector, which is used to get or set (if the write selector is undefined) the value of a cell. The value returned by the method can be a string object or a bitmap. The set operation only is performed if the column is selectable.'

#rendererType
'This type specifies, how the text of an unselected cell should be shown. As Text, CheckToggle, ComboBox, ComboList or as a RowSelector.'

#selectSelector
'an optional selector, which is used to test whether the cell in the column is selectable; the ''Is Selectable'' flag must be enabled.'

#showColumnSeparator
'show or hide the column separator (right vertical separator).'

#showRowSeparator
'show or hide the row separator (bottom horizontal separator)'

#size
'max size of an InputField, ComboBox or ComboList. 0 or nil means unlimited.'

#type
'a type converter symbol used by the input field'

#width
'the width of a fixed column; in case of nil or 0 the column width will be computed dependent on the contents.'

#writeSelector
'a selector, which is used to set the value of a cell. If the selector is not defined, the selector derives from the printSelector.'

)
! !

!DataSetBuilder class methodsFor:'interface specs'!

defineClassNameSpec
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

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

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'Class Definition'
              #'layout:' #(#LayoutFrame 299 0 162 0 624 0 291 0)
              #'label:' 'Class Definition'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1152 900)
              #'bounds:' #(#Rectangle 299 162 625 292)
              #'usePreferredExtent:' false
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#LabelSpec
                    #'name:' 'classLabel'
                    #'layout:' #(#AlignmentOrigin 50 0.11 50 0 1 0.5)
                    #'label:' 'Class:'
                    #'adjust:' #right
                    #'resizeForLabel:' true
                )
                 #(#LabelSpec
                    #'name:' 'superClassLabel'
                    #'layout:' #(#AlignmentOrigin 50 0.11 77 0 1 0.5)
                    #'label:' 'Superclass:'
                    #'adjust:' #right
                    #'resizeForLabel:' true
                )
                 #(#LabelSpec
                    #'name:' 'topLabel'
                    #'layout:' #(#Point 2 10)
                    #'label:' 'Class for code:'
                    #'adjust:' #left
                    #'resizeForLabel:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'classNameField'
                    #'layout:' #(#LayoutFrame 51 0.11 39 0 -2 1.0 61 0)
                    #'tabable:' true
                    #'model:' #classNameChannel
                )
                 #(#HorizontalPanelViewSpec
                    #'name:' 'commitPanel'
                    #'layout:' #(#LayoutFrame 2 0.0 -30 1.0 -2 1.0 -2 1.0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#ActionButtonSpec
                              #'name:' 'button1'
                              #'label:' 'Cancel'
                              #'tabable:' true
                              #'model:' #cancel
                              #'extent:' #(#Point 156 22)
                          )
                           #(#ActionButtonSpec
                              #'name:' 'button2'
                              #'label:' 'OK'
                              #'tabable:' true
                              #'model:' #accept
                              #'isDefault:' true
                              #'extent:' #(#Point 157 22)
                          )
                        )
                    )
                    #'horizontalLayout:' #fitSpace
                    #'verticalLayout:' #fitSpace
                    #'horizontalSpace:' 3
                    #'verticalSpace:' 3
                )
                 #(#InputFieldSpec
                    #'name:' 'inputField1'
                    #'layout:' #(#LayoutFrame 51 0.11 67 0 -2 1.0 89 0)
                    #'tabable:' true
                    #'model:' #superclassNameChannel
                )
              )
          )
      )
!

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

windowSpec
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

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

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'Data Set Builder'
              #'layout:' #(#LayoutFrame 442 0 314 0 928 0 673 0)
              #'label:' 'Data Set Builder'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1152 900)
              #'bounds:' #(#Rectangle 442 314 929 674)
              #'menu:' #menu
              #'usePreferredExtent:' false
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#MenuPanelSpec
                    #'name:' 'menuToolbarView'
                    #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 34 0)
                    #'menu:' #menuToolbar
                )
                 #(#VariableHorizontalPanelSpec
                    #'name:' 'VariablePanel'
                    #'layout:' #(#LayoutFrame 0 0.0 36 0.0 0 1.0 -22 1.0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#ViewSpec
                              #'name:' 'labelsView'
                              #'component:' 
                               #(#SpecCollection
                                  #'collection:' 
                                   #(
                                     #(#SequenceViewSpec
                                        #'name:' 'columnView'
                                        #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
                                        #'enableChannel:' #isNotModified
                                        #'model:' #selectedColumnModel
                                        #'menu:' #menuEdit
                                        #'hasHorizontalScrollBar:' true
                                        #'hasVerticalScrollBar:' true
                                        #'miniScrollerHorizontal:' true
                                        #'useIndex:' true
                                        #'sequenceList:' #seqList
                                    )
                                  )
                              )
                          )
                           #(#ViewSpec
                              #'name:' 'specView'
                              #'component:' 
                               #(#SpecCollection
                                  #'collection:' 
                                   #(
                                     #(#TabViewSpec
                                        #'name:' 'tabView'
                                        #'layout:' #(#LayoutFrame 0 0.0 0 0 0 1.0 35 0)
                                        #'model:' #tabModel
                                        #'menu:' #tabList
                                        #'useIndex:' true
                                    )
                                     #(#SubCanvasSpec
                                        #'name:' 'specCanvas'
                                        #'layout:' #(#LayoutFrame 0 0.0 35 0.0 0 1.0 -30 1.0)
                                        #'specHolder:' #specChannel
                                    )
                                     #(#HorizontalPanelViewSpec
                                        #'name:' 'modifyPanel'
                                        #'layout:' #(#LayoutFrame 0 0.0 -30 1.0 0 1.0 0 1.0)
                                        #'component:' 
                                         #(#SpecCollection
                                            #'collection:' 
                                             #(
                                               #(#ActionButtonSpec
                                                  #'name:' 'cancelButton'
                                                  #'label:' 'Cancel'
                                                  #'model:' #cancel
                                                  #'enableChannel:' #modifiedChannel
                                                  #'extent:' #(#Point 173 24)
                                              )
                                               #(#ActionButtonSpec
                                                  #'name:' 'acceptButton'
                                                  #'label:' 'OK'
                                                  #'model:' #accept
                                                  #'enableChannel:' #modifiedChannel
                                                  #'extent:' #(#Point 174 24)
                                              )
                                            )
                                        )
                                        #'horizontalLayout:' #fitSpace
                                        #'verticalLayout:' #fitSpace
                                        #'horizontalSpace:' 3
                                        #'verticalSpace:' 3
                                    )
                                  )
                              )
                              #'borderWidth:' 1
                          )
                        )
                    )
                    #'handles:' #(#Any 0.265905 1.0)
                )
                 #(#LabelSpec
                    #'name:' 'infoLabel'
                    #'layout:' #(#LayoutFrame 0 0.0 -22 1 -80 1.0 0 1.0)
                    #'labelChannel:' #valueOfInfoLabel
                    #'level:' 1
                    #'adjust:' #left
                )
                 #(#LabelSpec
                    #'name:' 'timeLabel'
                    #'layout:' #(#LayoutFrame -80 1 -22 1 0 1.0 0 1.0)
                    #'labelChannel:' #valueOfTimeLabel
                    #'level:' 1
                    #'adjust:' #right
                )
              )
          )
      )
! !

!DataSetBuilder class methodsFor:'menu specs'!

menu
    "this window spec was automatically generated by the ST/X MenuEditor"

    "do not manually edit this - the builder may not be able to
     handle the specification if its corrupted."

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

    <resource: #menu>

    ^
     
       #(#Menu
          
           #(
             #(#MenuItem
                #'label:' 'About'
                #'labelImage:' #(#ResourceRetriever #UIPainter #icon)
                #'submenuChannel:' #menuAbout
            )
             #(#MenuItem
                #'label:' 'File'
                #'accessCharacterPosition:' 1
                #'submenu:' 
                 #(#Menu
                    
                     #(
                       #(#MenuItem
                          #'label:' 'Generate Code'
                          #'value:' #doGenerateCode
                      )
                       #(#MenuItem
                          #'label:' '-'
                      )
                       #(#MenuItem
                          #'label:' 'Define Class...'
                          #'value:' #doDefineClass
                      )
                       #(#MenuItem
                          #'label:' 'Browse Class'
                          #'value:' #doBrowseClass
                      )
                       #(#MenuItem
                          #'label:' '-'
                      )
                       #(#MenuItem
                          #'label:' 'Exit'
                          #'value:' #closeRequest
                      )
                    ) nil
                    nil
                )
            )
             #(#MenuItem
                #'label:' 'Edit'
                #'accessCharacterPosition:' 1
                #'submenuChannel:' #menuEdit
            )
          ) nil
          nil
      )
!

menuEdit
    "this window spec was automatically generated by the ST/X MenuEditor"

    "do not manually edit this - the builder may not be able to
     handle the specification if its corrupted."

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

    <resource: #menu>

    ^
     
       #(#Menu
          
           #(
             #(#MenuItem
                #'label:' 'Cut'
                #'value:' #doCutColumn
                #'enabled:' #isColumnSelected
                #'shortcutKeyCharacter:' #Cut
            )
             #(#MenuItem
                #'label:' 'Copy'
                #'value:' #doCopyColumn
                #'enabled:' #isColumnSelected
                #'shortcutKeyCharacter:' #Copy
            )
             #(#MenuItem
                #'label:' 'Paste'
                #'value:' #doPasteColumn
                #'enabled:' #valueOfHavingClipboard
                #'shortcutKeyCharacter:' #Paste
            )
             #(#MenuItem
                #'label:' '-'
            )
             #(#MenuItem
                #'label:' 'Create Column'
                #'value:' #doCreateColumn
                #'enabled:' #isNotModified
                #'labelImage:' #(#ResourceRetriever #DataSetBuilder #newColumnIcon 'Create Column')
            )
             #(#MenuItem
                #'label:' '-'
            )
             #(#MenuItem
                #'label:' 'Shift Up'
                #'value:' #'doMoveColumn:'
                #'enabled:' #isColumnSelected
                #'argument:' #up
                #'labelImage:' #(#ResourceRetriever #DataSetBuilder #upIcon 'Shift Up')
            )
             #(#MenuItem
                #'label:' 'Shift Down'
                #'value:' #'doMoveColumn:'
                #'enabled:' #isColumnSelected
                #'argument:' #down
                #'labelImage:' #(#ResourceRetriever #DataSetBuilder #downIcon 'Shift Down')
            )
          ) nil
          nil
      )
!

menuToolbar
    "this window spec was automatically generated by the ST/X MenuEditor"

    "do not manually edit this - the builder may not be able to
     handle the specification if its corrupted."

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

    <resource: #menu>

    ^
     
       #(#Menu
          
           #(
             #(#MenuItem
                #'label:' 'createColumn'
                #'isButton:' true
                #'value:' #doCreateColumn
                #'enabled:' #isNotModified
                #'labelImage:' #(#ResourceRetriever nil #newColumnIcon)
            )
             #(#MenuItem
                #'label:' ''
            )
             #(#MenuItem
                #'label:' 'stepUp'
                #'isButton:' true
                #'value:' #'doMoveColumn:'
                #'enabled:' #isColumnSelected
                #'argument:' #up
                #'labelImage:' #(#ResourceRetriever nil #upIcon)
            )
             #(#MenuItem
                #'label:' 'stepDown'
                #'isButton:' true
                #'value:' #'doMoveColumn:'
                #'enabled:' #isColumnSelected
                #'argument:' #down
                #'labelImage:' #(#ResourceRetriever nil #downIcon)
            )
          ) nil
          nil
      )
! !

!DataSetBuilder class methodsFor:'resources'!

newColumnIcon
    "ImageEditor openOnClass:self andSelector:#newColumnIcon"

    <resource: #image>
    ^(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(#[17 17 16 0 0 0 0 0 0 17 17 17 17 16 17 17 17 17 17 32 17 17 17 17 16 18 34 34 34 34 48 17 17 17 17 16 18 32 2 32 34 48 17 17 17 17 16 18 2 34 2 2 48 17 17 17 17 16 18 2 34 2 2 48 17 17 17 17 16 18 32 2 32 34 48 17 17 16 17 16 18 34 34 34 34 48 17 17 17 17 16 18 2 34 2 2 48 17 17 17 17 16 18 2 34 2 2 48 17 17 17 17 16 18 2 34 2 2 48 17 17 17 17 16 18 0 2 0 2 48 17 17 17 17 16 18 34 34 34 34 48 17 17 17 17 16 18 34 34 34 34 48 17 17 17 17 16 18 2 2 2 2 48 17 17 17 17 16 18 0 2 0 2 48 17 17 17 17 16 18 2 2 0 2 48 17 17 17 17 16 18 2 2 2 2 48 17 17 17 17 16 18 34 34 34 34 48 17 17 17 17 16 18 34 34 34 34 48 17 17 17 17 16 35 51 51 51 51 48 17 17 17 17 16 0 0 0 0 0 0 17 17]) ; colorMap:((OrderedCollection new add:(Color black); add:(Color white); add:(Color grey:66.9978); add:(Color grey:49.9962); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9992 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9992 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9992); add:(Color red:0.0 green:49.9992 blue:49.9992); add:(Color red:49.9992 green:49.9992 blue:0.0); add:(Color red:49.9992 green:0.0 blue:49.9992); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[7 255 192 7 255 192 7 255 192 7 255 192 7 255 192 7 255 192 7 255 192 7 255 192 7 255 195 7 255 192 7 255 192 7 255 192 7 255 192 7 255 195 7 255 193 7 255 192 7 255 195 7 255 192 7 255 195 7 255 192 7 255 192 7 255 193]) ; yourself); yourself! !

!DataSetBuilder methodsFor:'accessing'!

columns
    "returns list of columns
    "
    ^ columns
!

columns:aListOfColumns fromView:aColumnView
    "setup columns from a column view
    "
    |list|

    columnView := aColumnView.
    columns    := OrderedCollection new.
    list       := self seqList.
    hasChanged := false.

    list removeAll.

    aListOfColumns size ~~ 0 ifTrue:[
        aListOfColumns do:[:aCol|
            columns add:(aCol copy).
            aCol rendererType == #rowSelector ifFalse:[list add:(aCol label)]
                                               ifTrue:[list add:'Row Selector'].
        ]
    ].
!

rowClassName
    ^ (Smalltalk resolveName:className inClass:self class) notNil ifTrue:[className] ifFalse:[nil]
!

rowClassName:aClassName
    |cls|

    superclassName := nil.

    (className := aClassName) notNil ifTrue:[
        (cls := self resolveClassNamed) notNil ifTrue:[
            superclassName := cls superclass name asString.
        ] ifFalse:[
            superclassName := 'Object'
        ]
    ]

! !

!DataSetBuilder methodsFor:'accessing menu'!

columnMenu
    "this window spec was automatically generated by the UI Builder"

    ^ self class columnMenu


!

doBrowseClass
    |cls|

    (cls := self resolveClassNamed) notNil ifTrue:[
        SystemBrowser openInClass:cls
    ] ifFalse:[
        self information:'no class yet'.
    ].



!

doCopyColumn
    "copy selected column to the clipboard"

    |idx|

    (idx := selectedColumnIndex) ~~ 0 ifTrue:[
        self clipboard: (columns at: idx) deepCopy.
    ].
!

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

    list := self seqList.
    label := 'Column ', list size printString.
    columns add:(DataSetColumnSpec label:label selector:nil) afterIndex:selectedColumnIndex.
    self seqList add:label afterIndex:selectedColumnIndex.
    hasChanged := true.

    self modified ifFalse:[
        self selectedColumnModel value:(selectedColumnIndex + 1)
    ].
    self updateColumnView.

!

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

    |idx|

    (idx := selectedColumnIndex) ~~ 0 ifTrue:[
        self selectedColumnModel value:0.
        self clipboard: (columns at: idx).
        columns removeIndex:idx.
        self seqList removeIndex:idx.
        self updateColumnView.
        columns isEmpty ifTrue: [self isColumnSelected value: false].
        hasChanged := true
    ].
!

doDefineClass
    "launch a dialog to define class and superclass
    "
    |aspects cls oldClass oldSuper|

    aspects  := IdentityDictionary new.
    oldClass := className.
    oldSuper := superclassName.

    [true] whileTrue:[
        className notNil ifTrue:[
            (cls := self resolveClassNamed) notNil ifTrue:[
                superclassName := cls superclass name asString.
            ].
            aspects at:#classNameChannel put:className asValue
        ] ifFalse:[
            aspects at:#classNameChannel put:'DSVRow' asValue
        ].

        superclassName notNil ifTrue:[
            aspects at:#superclassNameChannel put:superclassName asValue
        ] ifFalse:[
            aspects at:#superclassNameChannel put:'Object' asValue
        ].

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

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

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

            superclassName size == 0 ifTrue:[        
                cls notNil ifTrue:[
                    superclassName := cls
                ] ifFalse:[
                    superclassName := 'Object'
                ].
                self information:( 'set superclassName' ).
            ] ifFalse:[
                (cls isNil or:[superclassName = cls]) ifTrue:[
                    hasChanged := true.
                    ^ self
                ].
                self information:('a global named ' , className , ' exists,\' ,
                                  'but is not a subclass of ' , superclassName, '.\\' ,
                                  'Check and try again if that is not what you want.') withCRs.

                superclassName := cls.
            ]
        ]
    ]
!

doGenerateCode
    |cls superclass|

    className isNil ifTrue:[
        ^ self information:'no class defined'
    ].
    cls := self resolveClassNamed.

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

        superclass isNil ifTrue:[
            ^ self information:'no superclass defined'
        ].
        (self confirm:'create ' , className , ' ?') ifFalse:[
            ^ self
        ].
        cls := superclass subclass:(className 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.
!

doMoveColumn:upOrDown
    "move selected column up or down
    "
    |idx list label col size|

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

    size == 1 ifTrue:[
        ^ self
    ].
    hasChanged := true.
    selectedColumnIndex := 0.
    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.
!

doPasteColumn
    "paste clipboard copy column after selected column or at left (nothing selected)
    "
    |label list|

    list := self seqList.
    label := self class clipboard label.
    columns add: self class clipboard deepCopy afterIndex:selectedColumnIndex.
    self seqList add: label afterIndex:selectedColumnIndex.
    hasChanged := true.

    self modified ifFalse:[
        self selectedColumnModel value:(selectedColumnIndex + 1)
    ].
    self updateColumnView.

!

mainMenu
    "this window spec was automatically generated by the UI Builder"

    ^ self class mainMenu


!

menu
    "this window spec was automatically generated by the UI Builder"

    ^ self class menu


!

menuEdit
    "this window spec was automatically generated by the UI Builder"

    ^ self class menuEdit


!

menuToolbar
    "this window spec was automatically generated by the UI Builder"

    ^ self class menuToolbar


!

subMenu
    "this window spec was automatically generated by the UI Builder"

    ^ self class subMenu


! !

!DataSetBuilder methodsFor:'actions'!

accept
    "accept changes made
    "
    |column type|

    self modifiedChannel value == false ifTrue:[
        ^ self
    ].
    isModified := true.

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

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

    type == #rowSelector ifTrue:[
        #( label width minWidth editorType choices readSelector writeSelector printSelector
           formatString type size height canSelect selectSelector
         ) do:[:aKey| (aspects at:aKey) value:nil ].
    ].
        
    aspects keysAndValuesDo:[:aKey :aModel|
        column perform:(aKey , ':') asSymbol with:(aModel value).
    ].
    self seqList at:selectedColumnIndex put:((aspects at:#label) value).
    self updateColumnView.
    self cancel
!

cancel
    "remove all changes and reload selected column
    "
    |column|

    isModified := true.
    (column := self selectedColumn) isNil ifTrue:[
        self tabModel value:0.
    ] ifFalse:[
        aspects keysAndValuesDo:[:aKey :aModel|
            aModel value:(column perform:aKey)
        ].
        tabSelectionIndex == 0 ifTrue:[self tabModel value:1].
    ].
    self modifiedChannel value:false.
    isModified := false.
! !

!DataSetBuilder methodsFor:'aspects'!

aspectFor:aKey
    "returns aspect for a key or nil
    "
  ^ aspects at:aKey ifAbsent:[ super aspectFor:aKey ]


!

editorTypeList
    "generate list of supported editor types
    "
    |list|

    (list := builder bindingAt:#editorTypeList) isNil ifTrue:[
        list := OrderedCollection new.
        DataSetColumnSpec slices do:[:aSlice||type|
            type := aSlice at:1.
            (list includes:type) ifFalse:[list add:type].
        ].
        builder aspectAt:#editorTypeList put:list.

    ].
    ^ list
!

isColumnSelected
    "returns a boolean value holder which is set to true if something is modified
     and not accepted
    "
    ^ builder valueAspectFor:#isColumnSelected initialValue: false



!

modifiedChannel
    "returns a boolean value holder which is set to true if something is modified
     and not accepted
    "
    ^ builder booleanValueAspectFor:#modifiedChannel



!

rendererTypeList
    "generate list of supported renderer types
    "
    |list|

    (list := builder bindingAt:#rendererTypeList) isNil ifTrue:[
        list := OrderedCollection new.
        DataSetColumnSpec slices do:[:aSlice||type|
            type := aSlice at:2.
            (list includes:type) ifFalse:[list add:type].
        ].
        builder aspectAt:#rendererTypeList put:list.

    ].
    ^ list
!

selectedColumnModel
    "automatically generated by UIPainter ..."

    |holder|

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

seqList
    "automatically generated by UIPainter ..."

    |list|

    (list := builder bindingAt:#seqList) isNil ifTrue:[
        builder aspectAt:#seqList put:(list :=  List new).
    ].
    ^ list
!

specChannel
    "automatically generated by UIPainter ..."

    |holder|

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

style
    ^ self aspectFor:#labelFont
!

tabList
    "automatically generated by UIPainter ..."

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

!

tabModel
    "returns a value holder which keeps the index of the current selected tab or 0
    "
    |holder|

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

!DataSetBuilder methodsFor:'change & update'!

update:something with:aParameter from:someObject
    "one of my aspects has changed; update modified channel
    "
    isModified ifFalse:[
        isModified := hasChanged := true.
        self modifiedChannel value:true.
        "self isNotModified   value:false. "
    ]
! !

!DataSetBuilder methodsFor:'code generation'!

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

generateBackgroundSelectorIn:aClass
    "generate code for #backgroundSelector
    "
    |sel catg code bCode|

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

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


!

generateChoicesIn:aClass
    "generate code for #choices
    "
    |sel catg code|

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

    columns do:[:aColumn|
        (     aColumn canSelect
         and:[aColumn rendererType ~~ #rowSelector
         and:[(sel := aColumn choices) notNil
         and:[(aClass implements: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' asSymbol.
    code :=   '\'
            , '    "automatically generated by DataSetBuilder ..."\'
            , '\'
            , '    "specific selector to be called on double click"\'
            , '\'
            .

    columns do:[:aCol|
        ((sel := aCol doubleClickedSelector) notNil and:[(aClass implements: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' asSymbol.
    code :=   '\'
            , '    "automatically generated by DataSetBuilder ..."\'
            , '\'
            , '    "specific foreground color for a cell"\'
            , '\'
            .

    columns do:[:aCol|
        ((sel := aCol foregroundSelector) notNil and:[(aClass implements: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' asSymbol.
    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 implements:sel) not]]
        ) ifTrue:[
            self compile:(sel asString, code) forClass:aClass inCategory:catg
        ]
    ]
!

generatePrintSelectorIn:aClass
    "generate code for #printSelector
    "
    |sel catg code|

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

    columns do:[:aColumn|
        (     aColumn rendererType ~~ #rowSelector
         and:[(sel := aColumn printSelector) notNil
         and:[(aClass implements:sel) not]]
        ) ifTrue:[
            self compile:(sel asString, code) forClass:aClass inCategory:catg
        ]
    ]
!

generateReadSelectorIn:aClass
    "generate code for #readSelector
    "
    |sel catg code bCode|

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

    columns do:[:aColumn|
        (     aColumn rendererType ~~ #rowSelector 
         and:[(sel := aColumn readSelector) notNil
         and:[(aClass implements:sel) not]]
        ) ifTrue:[
            (aColumn printSelector isNil or:[aColumn canSelect]) ifTrue:[
                sel numArgs == 0 ifTrue:[
                    bCode := sel asString, code
                ] ifFalse:[
                    bCode := sel asString, 'anIndex\', code
                ].
                aColumn rendererType == #CheckToggle ifFalse:[
                    bCode := bCode, '    ^ nil'
                ] ifTrue:[
                    bCode := bCode, '    ^ true'
                ]. 
                self compile:bCode forClass:aClass inCategory:catg
            ]
        ]
    ]
!

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

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

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

generateWriteSelectorIn:aClass
    "generate code for #writeSelector
    "
    |sel catg code bCode sz|

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

    columns do:[:aColumn|
        (    (sel := aColumn writeSelector) notNil
         and:[(aColumn canSelect)
         and:[(aClass implements: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:'initialization'!

initialize
    "setup aspects used by column description specifications
    "
    |holder|

    super initialize.
    selectedColumnIndex := 0.
    tabSelectionIndex   := 0.
    columns := OrderedCollection new.
    aspects := IdentityDictionary new.
    hasChanged := false.
    isModified := false.

    #(
        label
        canSelect
        choices
        editorType
        formatString
        labelIsImage
        size
        type
        width
        minWidth
        height
        menu
        foregroundSelector
        backgroundSelector
        doubleClickedSelector
        selectSelector
        printSelector
        readSelector
        writeSelector
        rendererType
        showColSeparator
        showRowSeparator
        backgroundColor
        foregroundColor
        labelForegroundColor
        labelBackgroundColor
        labelFont
        labelActionSelector
        labelActionArgument
        labelAlignment
     ) do:[:aKey|
        aspects at:aKey put:(holder := ValueHolder new).
        holder addDependent:self.
    ].

! !

!DataSetBuilder methodsFor:'private'!

checkMenuItemModified
    "check column modification"

    self modifiedChannel value
    ifTrue:
    [
        ((YesNoBox title:'Column was modified!!\Save it?\' withCRs)        
            noText:'No';
            yesText:'Yes';
            showAtPointer;
            accepted) ifFalse: [self modifiedChannel value: false. ^true].
        self accept
    ].
    ^true

!

resolveClassNamed
    "returns current class or nil
    "
    ^ Smalltalk resolveName:className inClass:self class.

!

updateColumnView
    "update column view from column descriptions
    "
    columnView notNil ifTrue:[
        columnView columnDescriptors:columns.
    ].
! !

!DataSetBuilder methodsFor:'queries'!

hasChanged
    "returns true if changes are done to the original column description
    "
    ^ hasChanged
!

modified
    "returns true if current specification is modified
    "
    ^ self modifiedChannel value
! !

!DataSetBuilder methodsFor:'selection'!

selectedColumn
    "returns selected column or nil
    "
    ^ selectedColumnIndex == 0 ifFalse:[columns at:selectedColumnIndex]
                                ifTrue:[nil]
!

selectedColumnIndex
    "returns selected column index or 0
    "
    ^ selectedColumnIndex
!

selectedColumnIndex:something
    "change selected column and update specifications
    "
    something == selectedColumnIndex ifFalse:[
        selectedColumnIndex := something ? 0.
        self cancel.
        self isColumnSelected value: true
    ].

!

tabSelectionIndex
    "returns selected tab index or 0
    "
    ^ tabSelectionIndex
!

tabSelectionIndex:something
    "change selected tab and set corresponding specification
    "
    |specSelector|

    something == tabSelectionIndex ifTrue:[
        ^ self
    ].
    self selectedColumn isNil ifTrue:[
        tabSelectionIndex == 0 ifTrue:[^ self ].
        tabSelectionIndex := 0
    ] ifFalse:[
        (tabSelectionIndex := something) ~~ 0 ifTrue:[
            specSelector := (self class slices at:tabSelectionIndex) last.
        ]
    ].
    self specChannel value:specSelector


! !

!DataSetBuilder methodsFor:'startup / release'!

closeRequest
    "close request
    "
    self checkMenuItemModified ifTrue: [super closeRequest]
!

postBuildWith:builder

    super postBuildWith:builder.

    (builder componentAt: #columnView) selectConditionBlock: [:i|self checkMenuItemModified]



! !

!DataSetBuilder class methodsFor:'documentation'!

version
    ^ '$Header$'
! !