DataSetBuilder.st
changeset 377 5cbb117efc19
parent 370 c90e57ac04a5
child 379 1a24037cd490
equal deleted inserted replaced
376:3023fc08ee35 377:5cbb117efc19
    77      
    77      
    78        #(#FullSpec
    78        #(#FullSpec
    79           #'window:' 
    79           #'window:' 
    80            #(#WindowSpec
    80            #(#WindowSpec
    81               #'name:' 'DataSet Basic'
    81               #'name:' 'DataSet Basic'
    82               #'layout:' #(#LayoutFrame 350 0 22 0 638 0 277 0)
    82               #'layout:' #(#LayoutFrame 219 0 193 0 507 0 448 0)
    83               #'label:' 'DataSet Basic'
    83               #'label:' 'DataSet Basic'
    84               #'min:' #(#Point 10 10)
    84               #'min:' #(#Point 10 10)
    85               #'max:' #(#Point 1280 1024)
    85               #'max:' #(#Point 1280 1024)
    86               #'bounds:' #(#Rectangle 350 22 639 278)
    86               #'bounds:' #(#Rectangle 219 193 508 449)
    87               #'usePreferredExtent:' false
    87               #'usePreferredExtent:' false
    88           )
    88           )
    89           #'component:' 
    89           #'component:' 
    90            #(#SpecCollection
    90            #(#SpecCollection
    91               #'collection:' 
    91               #'collection:' 
   103                     #'activeHelpKey:' #label
   103                     #'activeHelpKey:' #label
   104                     #'model:' #label
   104                     #'model:' #label
   105                 )
   105                 )
   106                  #(#FramedBoxSpec
   106                  #(#FramedBoxSpec
   107                     #'name:' 'typesFrame'
   107                     #'name:' 'typesFrame'
   108                     #'layout:' #(#LayoutFrame 8 0.0 51 0 0 1.0 131 0)
   108                     #'layout:' #(#LayoutFrame 8 0.0 69 0 0 1.0 149 0)
   109                     #'component:' 
   109                     #'component:' 
   110                      #(#SpecCollection
   110                      #(#SpecCollection
   111                         #'collection:' 
   111                         #'collection:' 
   112                          #(
   112                          #(
   113                            #(#LabelSpec
   113                            #(#LabelSpec
   143                     )
   143                     )
   144                     #'label:' 'Types:'
   144                     #'label:' 'Types:'
   145                     #'labelPosition:' #topLeft
   145                     #'labelPosition:' #topLeft
   146                 )
   146                 )
   147                  #(#CheckBoxSpec
   147                  #(#CheckBoxSpec
   148                     #'name:' 'canSelect'
       
   149                     #'layout:' #(#LayoutOrigin 9 0 145 0)
       
   150                     #'activeHelpKey:' #canSelect
       
   151                     #'model:' #canSelect
       
   152                     #'label:' 'Is Selectable'
       
   153                 )
       
   154                  #(#CheckBoxSpec
       
   155                     #'name:' 'labelIsImage'
   148                     #'name:' 'labelIsImage'
   156                     #'layout:' #(#LayoutOrigin 9 0 169 0)
   149                     #'layout:' #(#LayoutOrigin 9 0 189 0)
   157                     #'activeHelpKey:' #labelIsImage
   150                     #'activeHelpKey:' #labelIsImage
   158                     #'model:' #labelIsImage
   151                     #'model:' #labelIsImage
   159                     #'label:' 'Label Is Image'
   152                     #'label:' 'Label Is Image'
   160                 )
   153                 )
   161               )
   154               )
   229                         )
   222                         )
   230                     )
   223                     )
   231                     #'label:' 'Colors:'
   224                     #'label:' 'Colors:'
   232                     #'labelPosition:' #topLeft
   225                     #'labelPosition:' #topLeft
   233                 )
   226                 )
       
   227               )
       
   228           )
       
   229       )
       
   230 !
       
   231 
       
   232 detailsEditSpec
       
   233     "this window spec was automatically generated by the ST/X UIPainter"
       
   234 
       
   235     "do not manually edit this - the painter/builder may not be able to
       
   236      handle the specification if its corrupted."
       
   237 
       
   238     "
       
   239      UIPainter new openOnClass:DataSetBuilder andSelector:#detailsEditSpec
       
   240      DataSetBuilder new openInterface:#detailsEditSpec
       
   241     "
       
   242 
       
   243     <resource: #canvas>
       
   244 
       
   245     ^
       
   246      
       
   247        #(#FullSpec
       
   248           #'window:' 
       
   249            #(#WindowSpec
       
   250               #'name:' 'DataSet Basic'
       
   251               #'layout:' #(#LayoutFrame 219 0 193 0 507 0 448 0)
       
   252               #'label:' 'DataSet Basic'
       
   253               #'min:' #(#Point 10 10)
       
   254               #'max:' #(#Point 1280 1024)
       
   255               #'bounds:' #(#Rectangle 219 193 508 449)
       
   256               #'usePreferredExtent:' false
       
   257           )
       
   258           #'component:' 
       
   259            #(#SpecCollection
       
   260               #'collection:' 
       
   261                #(
       
   262                  #(#FramedBoxSpec
       
   263                     #'name:' 'selectionBox'
       
   264                     #'layout:' #(#LayoutFrame 0 0.0 20 0 0 1.0 101 0)
       
   265                     #'component:' 
       
   266                      #(#SpecCollection
       
   267                         #'collection:' 
       
   268                          #(
       
   269                            #(#CheckBoxSpec
       
   270                               #'name:' 'canSelect'
       
   271                               #'layout:' #(#Point 83 15)
       
   272                               #'activeHelpKey:' #canSelect
       
   273                               #'model:' #canSelect
       
   274                               #'label:' 'Is Selectable'
       
   275                           )
       
   276                            #(#LabelSpec
       
   277                               #'name:' 'selectorLabel'
       
   278                               #'layout:' #(#AlignmentOrigin 84 0 51 0 1 0.5)
       
   279                               #'label:' 'Selector:'
       
   280                               #'adjust:' #right
       
   281                               #'resizeForLabel:' true
       
   282                           )
       
   283                            #(#InputFieldSpec
       
   284                               #'name:' 'selectSelector'
       
   285                               #'layout:' #(#LayoutFrame 86 0 42 0 17 1.0 62 0)
       
   286                               #'activeHelpKey:' #selectSelector
       
   287                               #'model:' #selectSelector
       
   288                               #'type:' #symbolOrNil
       
   289                           )
       
   290                         )
       
   291                     )
       
   292                     #'label:' 'Selection:'
       
   293                     #'labelPosition:' #topLeft
       
   294                 )
   234                  #(#FramedBoxSpec
   295                  #(#FramedBoxSpec
   235                     #'name:' 'separatorBox'
   296                     #'name:' 'separatorBox'
   236                     #'layout:' #(#LayoutFrame 0 0.0 131 0 0 1.0 217 0)
   297                     #'layout:' #(#LayoutFrame 0 0.0 131 0 0 1.0 217 0)
   237                     #'component:' 
   298                     #'component:' 
   238                      #(#SpecCollection
   299                      #(#SpecCollection
   376      
   437      
   377        #(#FullSpec
   438        #(#FullSpec
   378           #'window:' 
   439           #'window:' 
   379            #(#WindowSpec
   440            #(#WindowSpec
   380               #'name:' 'DataSet Details'
   441               #'name:' 'DataSet Details'
   381               #'layout:' #(#LayoutFrame 327 0 282 0 617 0 495 0)
   442               #'layout:' #(#LayoutFrame 219 0 193 0 509 0 406 0)
   382               #'label:' 'DataSet Details'
   443               #'label:' 'DataSet Details'
   383               #'min:' #(#Point 10 10)
   444               #'min:' #(#Point 10 10)
   384               #'max:' #(#Point 1280 1024)
   445               #'max:' #(#Point 1280 1024)
   385               #'bounds:' #(#Rectangle 327 282 618 496)
   446               #'bounds:' #(#Rectangle 219 193 510 407)
       
   447               #'usePreferredExtent:' false
   386           )
   448           )
   387           #'component:' 
   449           #'component:' 
   388            #(#SpecCollection
   450            #(#SpecCollection
   389               #'collection:' 
   451               #'collection:' 
   390                #(
   452                #(
   400                     #'label:' 'Format:'
   462                     #'label:' 'Format:'
   401                     #'resizeForLabel:' true
   463                     #'resizeForLabel:' true
   402                 )
   464                 )
   403                  #(#InputFieldSpec
   465                  #(#InputFieldSpec
   404                     #'name:' 'formatField'
   466                     #'name:' 'formatField'
   405                     #'layout:' #(#LayoutFrame 87 0 37 0 -19 1.0 59 0)
   467                     #'layout:' #(#LayoutFrame 87 0 37 0 -2 1.0 59 0)
   406                     #'activeHelpKey:' #formatString
   468                     #'activeHelpKey:' #formatString
   407                     #'model:' #formatString
   469                     #'model:' #formatString
   408                 )
   470                 )
   409                  #(#LabelSpec
   471                  #(#LabelSpec
   410                     #'name:' 'inpFieldDescription'
   472                     #'name:' 'inpFieldDescription'
   418                     #'label:' 'Type:'
   480                     #'label:' 'Type:'
   419                     #'resizeForLabel:' true
   481                     #'resizeForLabel:' true
   420                 )
   482                 )
   421                  #(#ComboListSpec
   483                  #(#ComboListSpec
   422                     #'name:' 'typeCombo'
   484                     #'name:' 'typeCombo'
   423                     #'layout:' #(#LayoutFrame 87 0 102 0 289 0 122 0)
   485                     #'layout:' #(#LayoutFrame 87 0 102 0 -2 1.0 122 0)
   424                     #'activeHelpKey:' #type
   486                     #'activeHelpKey:' #type
   425                     #'model:' #type
   487                     #'model:' #type
   426                     #'comboList:' #typeList
   488                     #'comboList:' #typeList
   427                     #'useIndex:' false
   489                     #'useIndex:' false
   428                 )
   490                 )
   432                     #'label:' 'Size:'
   494                     #'label:' 'Size:'
   433                     #'resizeForLabel:' true
   495                     #'resizeForLabel:' true
   434                 )
   496                 )
   435                  #(#InputFieldSpec
   497                  #(#InputFieldSpec
   436                     #'name:' 'sizeField'
   498                     #'name:' 'sizeField'
   437                     #'layout:' #(#LayoutFrame 87 0 126 0 -19 1.0 148 0)
   499                     #'layout:' #(#LayoutFrame 87 0 126 0 -2 1.0 148 0)
   438                     #'activeHelpKey:' #size
   500                     #'activeHelpKey:' #size
   439                     #'model:' #size
   501                     #'model:' #size
   440                     #'type:' #numberOrNil
   502                     #'type:' #numberOrNil
   441                 )
   503                 )
   442               )
   504               )
   472           )
   534           )
   473           #'component:' 
   535           #'component:' 
   474            #(#SpecCollection
   536            #(#SpecCollection
   475               #'collection:' 
   537               #'collection:' 
   476                #(
   538                #(
   477                  #(#LabelSpec
       
   478                     #'name:' 'labelLabel'
       
   479                     #'layout:' #(#AlignmentOrigin 84 0 29 0 1 0.5)
       
   480                     #'label:' 'Label:'
       
   481                     #'adjust:' #right
       
   482                     #'resizeForLabel:' true
       
   483                 )
       
   484                  #(#InputFieldSpec
       
   485                     #'name:' 'labelField'
       
   486                     #'layout:' #(#LayoutFrame 86 0 20 0 -12 1.0 40 0)
       
   487                     #'activeHelpKey:' #label
       
   488                     #'model:' #label
       
   489                 )
       
   490                  #(#FramedBoxSpec
   539                  #(#FramedBoxSpec
   491                     #'name:' 'valuesBox'
   540                     #'name:' 'valuesBox'
   492                     #'layout:' #(#LayoutFrame 0 0.0 20 0 0 1.0 101 0)
   541                     #'layout:' #(#LayoutFrame 0 0.0 20 0 0 1.0 101 0)
   493                     #'component:' 
   542                     #'component:' 
   494                      #(#SpecCollection
   543                      #(#SpecCollection
   623 #readSelector
   672 #readSelector
   624 'a selector, which is used to get or set 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.'
   673 'a selector, which is used to get or set 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.'
   625 
   674 
   626 #rendererType
   675 #rendererType
   627 'This type specifies, how the text of an unselected cell should be shown. As Text, CheckToggle, ComboBox, ComboList or as a RowSelector.'
   676 'This type specifies, how the text of an unselected cell should be shown. As Text, CheckToggle, ComboBox, ComboList or as a RowSelector.'
       
   677 
       
   678 #selectSelector
       
   679 'an optional selector, which is used to test whether the cell in the column is selectable; the ''Is Selectable'' flag must be enabled.'
   628 
   680 
   629 #showColumnSeparator
   681 #showColumnSeparator
   630 'show or hide the column separator (right vertical separator).'
   682 'show or hide the column separator (right vertical separator).'
   631 
   683 
   632 #showRowSeparator
   684 #showRowSeparator
   750       )
   802       )
   751 !
   803 !
   752 
   804 
   753 slices
   805 slices
   754     ^  #(       (Basics         basicsEditSpec)
   806     ^  #(       (Basics         basicsEditSpec)
       
   807                 (Details        detailsEditSpec)
   755                 (Selectors      selectorsEditSpec)
   808                 (Selectors      selectorsEditSpec)
   756                 (Format         formatEditSpec)
   809                 (Format         formatEditSpec)
   757                 (Colors         colorEditSpec)
   810                 (Colors         colorEditSpec)
   758                 (Dimension      dimensionEditSpec)
   811                 (Dimension      dimensionEditSpec)
   759         )
   812         )
   777      
   830      
   778        #(#FullSpec
   831        #(#FullSpec
   779           #'window:' 
   832           #'window:' 
   780            #(#WindowSpec
   833            #(#WindowSpec
   781               #'name:' 'unnamed canvas'
   834               #'name:' 'unnamed canvas'
   782               #'layout:' #(#LayoutFrame 219 0 193 0 690 0 533 0)
   835               #'layout:' #(#LayoutFrame 262 0 460 0 774 0 802 0)
   783               #'label:' 'unnamed canvas'
   836               #'label:' 'unnamed canvas'
   784               #'min:' #(#Point 10 10)
   837               #'min:' #(#Point 10 10)
   785               #'max:' #(#Point 1152 900)
   838               #'max:' #(#Point 1152 900)
   786               #'bounds:' #(#Rectangle 219 193 691 534)
   839               #'bounds:' #(#Rectangle 262 460 775 803)
   787               #'usePreferredExtent:' false
   840               #'usePreferredExtent:' false
   788           )
   841           )
   789           #'component:' 
   842           #'component:' 
   790            #(#SpecCollection
   843            #(#SpecCollection
   791               #'collection:' 
   844               #'collection:' 
   856                                                #(#ActionButtonSpec
   909                                                #(#ActionButtonSpec
   857                                                   #'name:' 'cancelButton'
   910                                                   #'name:' 'cancelButton'
   858                                                   #'label:' 'cancel'
   911                                                   #'label:' 'cancel'
   859                                                   #'model:' #cancel
   912                                                   #'model:' #cancel
   860                                                   #'enableChannel:' #modifiedChannel
   913                                                   #'enableChannel:' #modifiedChannel
   861                                                   #'extent:' #(#Point 150 24)
   914                                                   #'extent:' #(#Point 171 24)
   862                                               )
   915                                               )
   863                                                #(#ActionButtonSpec
   916                                                #(#ActionButtonSpec
   864                                                   #'name:' 'acceptButton'
   917                                                   #'name:' 'acceptButton'
   865                                                   #'label:' 'ok'
   918                                                   #'label:' 'ok'
   866                                                   #'model:' #accept
   919                                                   #'model:' #accept
   867                                                   #'enableChannel:' #modifiedChannel
   920                                                   #'enableChannel:' #modifiedChannel
   868                                                   #'extent:' #(#Point 151 24)
   921                                                   #'extent:' #(#Point 172 24)
   869                                               )
   922                                               )
   870                                             )
   923                                             )
   871                                         )
   924                                         )
   872                                         #'horizontalLayout:' #fitSpace
   925                                         #'horizontalLayout:' #fitSpace
   873                                         #'verticalLayout:' #fitSpace
   926                                         #'verticalLayout:' #fitSpace
   878                               )
   931                               )
   879                               #'borderWidth:' 1
   932                               #'borderWidth:' 1
   880                           )
   933                           )
   881                         )
   934                         )
   882                     )
   935                     )
   883                     #'handles:' #(#Any 0.334746 1.0)
   936                     #'handles:' #(#Any 0.307992 1.0)
   884                 )
   937                 )
   885               )
   938               )
   886           )
   939           )
   887       )
   940       )
   888 ! !
   941 ! !
  1229 
  1282 
  1230     self generateChoicesIn:cls.
  1283     self generateChoicesIn:cls.
  1231     self generateMenuIn:cls.
  1284     self generateMenuIn:cls.
  1232     self generatePrintSelectorIn:cls.
  1285     self generatePrintSelectorIn:cls.
  1233     self generateReadSelectorIn:cls.
  1286     self generateReadSelectorIn:cls.
       
  1287     self generateSelectSelectorIn:cls.
  1234     self generateWriteSelectorIn:cls.
  1288     self generateWriteSelectorIn:cls.
  1235 !
  1289 !
  1236 
  1290 
  1237 doMoveColumn:upOrDown
  1291 doMoveColumn:upOrDown
  1238     "move selected column up or down
  1292     "move selected column up or down
  1302 
  1356 
  1303     type := (aspects at:#rendererType) value.
  1357     type := (aspects at:#rendererType) value.
  1304 
  1358 
  1305     type == #rowSelector ifTrue:[
  1359     type == #rowSelector ifTrue:[
  1306         #( label width minWidth editorType choices readSelector printSelector
  1360         #( label width minWidth editorType choices readSelector printSelector
  1307            formatString type size height canSelect
  1361            formatString type size height canSelect selectSelector
  1308          ) do:[:aKey| (aspects at:aKey) value:nil ].
  1362          ) do:[:aKey| (aspects at:aKey) value:nil ].
  1309     ].
  1363     ].
  1310         
  1364         
  1311     aspects keysAndValuesDo:[:aKey :aModel|
  1365     aspects keysAndValuesDo:[:aKey :aModel|
  1312         column perform:(aKey , ':') asSymbol with:(aModel value).
  1366         column perform:(aKey , ':') asSymbol with:(aModel value).
  1580             ]
  1634             ]
  1581         ]
  1635         ]
  1582     ]
  1636     ]
  1583 !
  1637 !
  1584 
  1638 
       
  1639 generateSelectSelectorIn:aClass
       
  1640     "generate code for #selectSelector
       
  1641     "
       
  1642     |sel catg code bCode|
       
  1643 
       
  1644     catg := 'accessing selectSelector' asSymbol.
       
  1645     code :=   '\'
       
  1646             , '    "automatically generated by DataSetBuilder ..."\'
       
  1647             , '\'
       
  1648             , '    "can select cell in column"\'
       
  1649             , '\'
       
  1650             .
       
  1651 
       
  1652     columns do:[:aColumn|
       
  1653         (     aColumn rendererType ~~ #rowSelector 
       
  1654          and:[(sel := aColumn selectSelector) notNil
       
  1655          and:[(aClass implements:sel) not]]
       
  1656         ) ifTrue:[
       
  1657             aColumn canSelect ifTrue:[
       
  1658                 bCode := sel asString, code, '    ^ true'.
       
  1659                 self compile:bCode forClass:aClass inCategory:catg
       
  1660             ]
       
  1661         ]
       
  1662     ]
       
  1663 !
       
  1664 
  1585 generateWriteSelectorIn:aClass
  1665 generateWriteSelectorIn:aClass
  1586     "generate code for #writeSelector
  1666     "generate code for #writeSelector
  1587     "
  1667     "
  1588     |sel catg code|
  1668     |sel catg code|
  1589 
  1669 
  1629         type
  1709         type
  1630         width
  1710         width
  1631         minWidth
  1711         minWidth
  1632         height
  1712         height
  1633         menu
  1713         menu
       
  1714         selectSelector
  1634         printSelector
  1715         printSelector
  1635         readSelector
  1716         readSelector
  1636         rendererType
  1717         rendererType
  1637         showColSeparator
  1718         showColSeparator
  1638         showRowSeparator
  1719         showRowSeparator