UIListEditor.st
changeset 2282 cc1eded4d84d
child 2588 2b4338afd9d5
equal deleted inserted replaced
2281:e6cc565bff35 2282:cc1eded4d84d
       
     1 "{ Package: 'stx:libtool2' }"
       
     2 
       
     3 SimpleDialog subclass:#UIListEditor
       
     4 	instanceVariableNames:'informationLabel listTextHolder useSymbolsHolder'
       
     5 	classVariableNames:''
       
     6 	poolDictionaries:''
       
     7 	category:'Interface-UIPainter'
       
     8 !
       
     9 
       
    10 
       
    11 !UIListEditor class methodsFor:'help specs'!
       
    12 
       
    13 helpSpec
       
    14     "This resource specification was automatically generated
       
    15      by the UIHelpTool of ST/X."
       
    16 
       
    17     "Do not manually edit this!! If it is corrupted,
       
    18      the UIHelpTool may not be able to read the specification."
       
    19 
       
    20     "
       
    21      UIHelpTool openOnClass:UIListEditor    
       
    22     "
       
    23 
       
    24     <resource: #help>
       
    25 
       
    26     ^ super helpSpec addPairsFrom:#(
       
    27 
       
    28 #useSymbols
       
    29 'Store list elements as symbols'
       
    30 
       
    31 )
       
    32 ! !
       
    33 
       
    34 !UIListEditor class methodsFor:'interface specs'!
       
    35 
       
    36 windowSpec
       
    37     "This resource specification was automatically generated
       
    38      by the UIPainter of ST/X."
       
    39 
       
    40     "Do not manually edit this!! If it is corrupted,
       
    41      the UIPainter may not be able to read the specification."
       
    42 
       
    43     "
       
    44      UIPainter new openOnClass:UIListEditor andSelector:#windowSpec
       
    45      UIListEditor new openInterface:#windowSpec
       
    46      UIListEditor open
       
    47     "
       
    48 
       
    49     <resource: #canvas>
       
    50 
       
    51     ^ 
       
    52      #(FullSpec
       
    53         name: windowSpec
       
    54         window: 
       
    55        (WindowSpec
       
    56           label: 'Edit List'
       
    57           name: 'Edit List'
       
    58           min: (Point 10 10)
       
    59           bounds: (Rectangle 0 0 354 422)
       
    60         )
       
    61         component: 
       
    62        (SpecCollection
       
    63           collection: (
       
    64            (LabelSpec
       
    65               name: 'Label1'
       
    66               layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 28 0)
       
    67               translateLabel: true
       
    68               labelChannel: informationLabel
       
    69             )
       
    70            (TextEditorSpec
       
    71               name: 'TextEditor1'
       
    72               layout: (LayoutFrame 0 0 30 0 0 1 -63 1)
       
    73               model: listTextHolder
       
    74               hasHorizontalScrollBar: true
       
    75               hasVerticalScrollBar: true
       
    76               viewClassName: ''
       
    77             )
       
    78            (CheckBoxSpec
       
    79               label: 'Use Symbols'
       
    80               name: 'CheckBox1'
       
    81               layout: (LayoutFrame 5 0 368 0 141 0 390 0)
       
    82               activeHelpKey: useSymbols
       
    83               model: useSymbolsHolder
       
    84               translateLabel: true
       
    85             )
       
    86            (HorizontalPanelViewSpec
       
    87               name: 'HorizontalPanel1'
       
    88               layout: (LayoutFrame 0 0 -33 1 0 1 0 1)
       
    89               horizontalLayout: fitSpace
       
    90               verticalLayout: center
       
    91               horizontalSpace: 3
       
    92               verticalSpace: 3
       
    93               component: 
       
    94              (SpecCollection
       
    95                 collection: (
       
    96                  (ActionButtonSpec
       
    97                     label: 'Cancel'
       
    98                     name: 'Button1'
       
    99                     translateLabel: true
       
   100                     model: doCancel
       
   101                     extent: (Point 172 22)
       
   102                   )
       
   103                  (ActionButtonSpec
       
   104                     label: 'OK'
       
   105                     name: 'Button2'
       
   106                     translateLabel: true
       
   107                     model: doAccept
       
   108                     isDefault: true
       
   109                     extent: (Point 173 22)
       
   110                   )
       
   111                  )
       
   112                
       
   113               )
       
   114             )
       
   115            )
       
   116          
       
   117         )
       
   118       )
       
   119 ! !
       
   120 
       
   121 !UIListEditor methodsFor:'accessing'!
       
   122 
       
   123 informationLabel
       
   124     ^ informationLabel
       
   125 !
       
   126 
       
   127 informationLabel:something
       
   128     informationLabel := something.
       
   129 !
       
   130 
       
   131 list
       
   132     "answer the list as an array"
       
   133 
       
   134     |list|
       
   135 
       
   136     list := self listTextHolder value asStringCollection asArray.
       
   137     self useSymbolsHolder value ifTrue:[
       
   138         list := list collect:[:e| e asSymbol].
       
   139     ].
       
   140 
       
   141     ^ list
       
   142 !
       
   143 
       
   144 list:anArray
       
   145     self listTextHolder value:anArray asStringCollection asString.
       
   146 !
       
   147 
       
   148 useSymbols:aBoolean
       
   149     self useSymbolsHolder value:aBoolean
       
   150 ! !
       
   151 
       
   152 !UIListEditor methodsFor:'aspects'!
       
   153 
       
   154 listTextHolder
       
   155     <resource: #uiAspect>
       
   156 
       
   157     listTextHolder isNil ifTrue:[
       
   158         listTextHolder := '' asValue.
       
   159     ].
       
   160     ^ listTextHolder.
       
   161 !
       
   162 
       
   163 useSymbolsHolder
       
   164     <resource: #uiAspect>
       
   165 
       
   166     useSymbolsHolder isNil ifTrue:[
       
   167         useSymbolsHolder := false asValue.
       
   168     ].
       
   169     ^ useSymbolsHolder.
       
   170 ! !
       
   171 
       
   172 !UIListEditor class methodsFor:'documentation'!
       
   173 
       
   174 version
       
   175     ^ '$Header$'
       
   176 ! !