ResourceSelectionBrowser.st
changeset 648 d0724edba450
parent 641 06bf664cab3c
child 649 1896945cf5d4
equal deleted inserted replaced
647:4a16c0a3be56 648:d0724edba450
    71         andClass: aClass
    71         andClass: aClass
    72         andSelector: aSelector
    72         andSelector: aSelector
    73         withResourceTypes: aResourceTypes
    73         withResourceTypes: aResourceTypes
    74 ! !
    74 ! !
    75 
    75 
       
    76 !ResourceSelectionBrowser class methodsFor:'callbacks - default'!
       
    77 
       
    78 treeViewChildren
       
    79 
       
    80     ^[:aTreeItem| aTreeItem contents subclasses asSortedCollection: [:i1 :i2| i1 name < i2 name]]
       
    81 
       
    82 !
       
    83 
       
    84 treeViewContents
       
    85 
       
    86     ^Smalltalk at: #Object
       
    87 
       
    88 
       
    89 
       
    90 
       
    91 !
       
    92 
       
    93 treeViewIcon
       
    94 
       
    95     ^[:aTreeItem|  
       
    96         aTreeItem contents subclasses notEmpty 
       
    97         ifTrue: 
       
    98         [
       
    99             aTreeItem hide 
       
   100                 ifTrue:  [self iconHidingSubclasses] 
       
   101                 ifFalse: [self iconShowingSubclasses]] 
       
   102         ifFalse: 
       
   103         [
       
   104             self iconClass
       
   105         ]
       
   106      ]
       
   107 
       
   108 !
       
   109 
       
   110 treeViewLabel
       
   111 
       
   112     ^[:aTreeItem|aTreeItem contents name]
       
   113 ! !
       
   114 
    76 !ResourceSelectionBrowser class methodsFor:'interface specs'!
   115 !ResourceSelectionBrowser class methodsFor:'interface specs'!
    77 
   116 
    78 windowSpec
   117 windowSpec
    79     "this window spec was automatically generated by the ST/X UIPainter"
   118     "this window spec was automatically generated by the ST/X UIPainter"
    80 
   119 
    90     <resource: #canvas>
   129     <resource: #canvas>
    91 
   130 
    92     ^
   131     ^
    93      
   132      
    94        #(#FullSpec
   133        #(#FullSpec
    95           #'window:' 
   134           #window: 
    96            #(#WindowSpec
   135            #(#WindowSpec
    97               #'name:' 'Resource Selection Browser'
   136               #name: 'Resource Selection Browser'
    98               #'layout:' #(#LayoutFrame 69 0 395 0 668 0 744 0)
   137               #layout: #(#LayoutFrame 65 0 500 0 664 0 849 0)
    99               #'label:' 'Resource Selection Browser'
   138               #label: 'Resource Selection Browser'
   100               #'min:' #(#Point 400 300)
   139               #min: #(#Point 400 300)
   101               #'max:' #(#Point 1152 864)
   140               #max: #(#Point 1152 864)
   102               #'bounds:' #(#Rectangle 69 395 669 745)
   141               #bounds: #(#Rectangle 65 500 665 850)
   103               #'usePreferredExtent:' false
   142               #usePreferredExtent: false
   104           )
   143           )
   105           #'component:' 
   144           #component: 
   106            #(#SpecCollection
   145            #(#SpecCollection
   107               #'collection:' 
   146               #collection: 
   108                #(
   147                #(
   109                  #(#VariableHorizontalPanelSpec
   148                  #(#VariableHorizontalPanelSpec
   110                     #'name:' 'variableHorizontalPanel'
   149                     #name: 'variableHorizontalPanel'
   111                     #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -40 1.0)
   150                     #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -40 1.0)
   112                     #'component:' 
   151                     #component: 
   113                      #(#SpecCollection
   152                      #(#SpecCollection
   114                         #'collection:' 
   153                         #collection: 
   115                          #(
   154                          #(
   116                            #(#ViewSpec
   155                            #(#ViewSpec
   117                               #'name:' 'view1'
   156                               #name: 'view1'
   118                               #'component:' 
   157                               #component: 
   119                                #(#SpecCollection
   158                                #(#SpecCollection
   120                                   #'collection:' 
   159                                   #collection: 
   121                                    #(
   160                                    #(
   122                                      #(#SelectionInTreeViewSpec
   161                                      #(#SelectionInTreeViewSpec
   123                                         #'name:' 'listOfClassesView'
   162                                         #name: 'listOfClassesView'
   124                                         #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -22 1.0)
   163                                         #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -22 1.0)
   125                                         #'model:' #selectionOfClass
   164                                         #model: #selectionOfClass
   126                                         #'hasHorizontalScrollBar:' true
   165                                         #hasHorizontalScrollBar: true
   127                                         #'hasVerticalScrollBar:' true
   166                                         #hasVerticalScrollBar: true
   128                                         #'miniScrollerHorizontal:' true
   167                                         #miniScrollerHorizontal: true
   129                                         #'showDirectoryIndicatorForRoot:' false
   168                                         #showDirectoryIndicatorForRoot: false
   130                                         #'showDirectoryIndicator:' true
   169                                         #showDirectoryIndicator: true
   131                                         #'valueChangeSelector:' #'classSelected:'
   170                                         #valueChangeSelector: #classSelected:
   132                                         #'hierarchicalList:' #listOfClasses
   171                                         #hierarchicalList: #listOfClasses
   133                                         #'contentsSelector:' #treeViewContents
   172                                         #contentsSelector: #treeViewContents
   134                                         #'labelSelector:' #treeViewLabel
   173                                         #labelSelector: #treeViewLabel
   135                                         #'childrenSelector:' #treeViewChildren
   174                                         #childrenSelector: #treeViewChildren
   136                                         #'iconSelector:' #treeViewIcon
   175                                         #iconSelector: #treeViewIcon
   137                                     )
   176                                     )
   138                                      #(#InputFieldSpec
   177                                      #(#InputFieldSpec
   139                                         #'name:' 'classNameInputField'
   178                                         #name: 'classNameInputField'
   140                                         #'layout:' #(#LayoutFrame 2 0.0 -22 1 -1 1.0 0 1)
   179                                         #layout: #(#LayoutFrame 2 0.0 -22 1 -1 1.0 0 1)
   141                                         #'model:' #valueOfClassName
   180                                         #model: #valueOfClassName
   142                                     )
   181                                     )
   143                                   )
   182                                   )
   144                               )
   183                               )
   145                           )
   184                           )
   146                            #(#ViewSpec
   185                            #(#ViewSpec
   147                               #'name:' 'view2'
   186                               #name: 'view2'
   148                               #'component:' 
   187                               #component: 
   149                                #(#SpecCollection
   188                                #(#SpecCollection
   150                                   #'collection:' 
   189                                   #collection: 
   151                                    #(
   190                                    #(
   152                                      #(#DataSetSpec
   191                                      #(#DataSetSpec
   153                                         #'name:' 'resourcesDataSetView'
   192                                         #name: 'resourcesDataSetView'
   154                                         #'layout:' #(#LayoutFrame 2 0.0 0 0.0 -2 1.0 -22 1.0)
   193                                         #layout: #(#LayoutFrame 2 0.0 0 0.0 -2 1.0 -22 1.0)
   155                                         #'model:' #selectionOfResource
   194                                         #model: #selectionOfResource
   156                                         #'hasHorizontalScrollBar:' true
   195                                         #hasHorizontalScrollBar: true
   157                                         #'hasVerticalScrollBar:' true
   196                                         #hasVerticalScrollBar: true
   158                                         #'miniScrollerHorizontal:' true
   197                                         #miniScrollerHorizontal: true
   159                                         #'rowClassName:' 'ResourceSelectionBrowser::Row'
   198                                         #rowClassName: 'ResourceSelectionBrowser::Row'
   160                                         #'dataList:' #listOfResources
   199                                         #dataList: #listOfResources
   161                                         #'useIndex:' false
   200                                         #useIndex: false
   162                                         #'has3Dsepartors:' true
   201                                         #has3Dsepartors: true
   163                                         #'doubleClickSelector:' #resourceDoubleClicked
   202                                         #doubleClickSelector: #resourceDoubleClicked
   164                                         #'valueChangeSelector:' #resourceSelected
   203                                         #columnHolder: #columnsOfDataSetView
   165                                         #'verticalSpacing:' 1
   204                                         #valueChangeSelector: #resourceSelected
   166                                         #'columns:' 
   205                                         #verticalSpacing: 1
   167                                          #(
   206 
   168                                            #(#DataSetColumnSpec
       
   169                                               #'width:' 20
       
   170                                               #'height:' 20
       
   171                                               #'printSelector:' #'iconOn:'
       
   172                                               #'canSelect:' false
       
   173                                           )
       
   174                                            #(#DataSetColumnSpec
       
   175                                               #'label:' 'Selector'
       
   176                                               #'model:' #selector
       
   177                                               #'canSelect:' false
       
   178                                           )
       
   179                                            #(#DataSetColumnSpec
       
   180                                               #'label:' 'Resource'
       
   181                                               #'model:' #resourceType
       
   182                                               #'canSelect:' false
       
   183                                           )
       
   184                                         )
       
   185                                     )
   207                                     )
   186                                      #(#InputFieldSpec
   208                                      #(#InputFieldSpec
   187                                         #'name:' 'selectorInputField'
   209                                         #name: 'selectorInputField'
   188                                         #'layout:' #(#LayoutFrame 2 0.0 -22 1 -2 1.0 0 1)
   210                                         #layout: #(#LayoutFrame 2 0.0 -22 1 -2 1.0 0 1)
   189                                         #'model:' #valueOfSelector
   211                                         #model: #valueOfSelector
   190                                     )
   212                                     )
   191                                   )
   213                                   )
   192                               )
   214                               )
   193                           )
   215                           )
   194                         )
   216                         )
   195                     )
   217                     )
   196                     #'handles:' #(#Any 0.5 1.0)
   218                     #handles: #(#Any 0.5 1.0)
   197                 )
   219                 )
   198                  #(#UISubSpecification
   220                  #(#UISubSpecification
   199                     #'name:' 'SubSpecification'
   221                     #name: 'SubSpecification'
   200                     #'layout:' #(#LayoutFrame 2 0.0 -32 1 -2 1.0 -8 1.0)
   222                     #layout: #(#LayoutFrame 2 0.0 -32 1 -2 1.0 -8 1.0)
   201                     #'majorKey:' #ToolApplicationModel
   223                     #majorKey: #ToolApplicationModel
   202                     #'minorKey:' #windowSpecForCommitWithoutChannels
   224                     #minorKey: #windowSpecForCommitWithoutChannels
   203                 )
   225                 )
   204               )
   226               )
   205           )
   227           )
   206       )
   228       )
   207 ! !
   229 ! !
   208 
   230 
       
   231 !ResourceSelectionBrowser class methodsFor:'list specs'!
       
   232 
       
   233 columnsOfDataSetView
       
   234 
       
   235   ^ #(#(#DataSetColumnSpec
       
   236       #width: 20
       
   237       #height: 20
       
   238       #printSelector: #iconOn:
       
   239       #canSelect: false
       
   240   )
       
   241    #(#DataSetColumnSpec
       
   242       #label: 'Selector'
       
   243       #model: #selector
       
   244       #canSelect: false
       
   245   )
       
   246    (#DataSetColumnSpec
       
   247       #label: 'Resource'
       
   248       #model: #resourceType
       
   249       #canSelect: false
       
   250   ))
       
   251 ! !
       
   252 
   209 !ResourceSelectionBrowser class methodsFor:'resources'!
   253 !ResourceSelectionBrowser class methodsFor:'resources'!
   210 
   254 
   211 iconClass
   255 iconClass
   212     "Generated by the Image Editor"
   256     "Generated by the Image Editor"
   213     "
   257     "
   256     ^builder componentAt: #listOfClassesView
   300     ^builder componentAt: #listOfClassesView
   257 ! !
   301 ! !
   258 
   302 
   259 !ResourceSelectionBrowser methodsFor:'aspects'!
   303 !ResourceSelectionBrowser methodsFor:'aspects'!
   260 
   304 
       
   305 columnsOfDataSetView
       
   306 
       
   307     |holder|
       
   308     (holder := builder bindingAt:#columnsOfDataSetView) isNil ifTrue:[
       
   309         builder aspectAt:#columnsOfDataSetView put:(holder := List new).
       
   310         holder addAll: (self class columnsOfDataSetView collect: [:i| i decodeAsLiteralArray]).
       
   311     ].
       
   312     ^ holder
       
   313 
       
   314 
       
   315 !
       
   316 
   261 listOfClasses
   317 listOfClasses
   262 
   318 
   263     |holder|
   319     |holder|
   264     (holder := builder bindingAt:#listOfClasses) isNil ifTrue:[
   320     (holder := builder bindingAt:#listOfClasses) isNil ifTrue:[
   265         builder aspectAt:#listOfClasses put: (holder := TreeItem new)
   321         builder aspectAt:#listOfClasses put: (holder := TreeItem new)
   314     ^ holder
   370     ^ holder
   315 ! !
   371 ! !
   316 
   372 
   317 !ResourceSelectionBrowser methodsFor:'callbacks - tree view'!
   373 !ResourceSelectionBrowser methodsFor:'callbacks - tree view'!
   318 
   374 
   319 treeViewChildren
       
   320 
       
   321     ^[:aTreeItem| aTreeItem contents subclasses asSortedCollection: [:i1 :i2| i1 name < i2 name]]
       
   322 
       
   323 
       
   324 !
       
   325 
       
   326 treeViewContents
   375 treeViewContents
   327 
   376 
   328     ^Smalltalk at: resourceSuperclass ? #Object
   377     ^(Smalltalk at: resourceSuperclass) ? self class treeViewContents
   329 
   378 
   330 
   379 
   331 !
   380 !
   332 
   381 
   333 treeViewIcon
   382 treeViewIcon
   334 
   383 
   335     ^[:aTreeItem|  
   384     ^self class treeViewIcon
   336         aTreeItem contents subclasses notEmpty 
       
   337         ifTrue: 
       
   338         [
       
   339             aTreeItem hide 
       
   340                 ifTrue:  [self class iconHidingSubclasses] 
       
   341                 ifFalse: [self class iconShowingSubclasses]] 
       
   342         ifFalse: 
       
   343         [
       
   344             self class iconClass
       
   345         ]
       
   346      ]
       
   347 
       
   348 
       
   349 !
   385 !
   350 
   386 
   351 treeViewLabel
   387 treeViewLabel
   352 
   388 
   353     ^[:aTreeItem|aTreeItem contents name]
   389     ^self class treeViewLabel
   354 
       
   355 
   390 
   356 ! !
   391 ! !
   357 
   392 
   358 !ResourceSelectionBrowser methodsFor:'callbacks - user'!
   393 !ResourceSelectionBrowser methodsFor:'callbacks - user'!
   359 
   394