Tools__ViewTreeApplication.st
changeset 2458 64d8f3c973b3
parent 2455 93aaf62a6b95
child 2744 5bee95e91ffd
equal deleted inserted replaced
2457:04459d76932e 2458:64d8f3c973b3
     2 
     2 
     3 "{ NameSpace: Tools }"
     3 "{ NameSpace: Tools }"
     4 
     4 
     5 ApplicationModel subclass:#ViewTreeApplication
     5 ApplicationModel subclass:#ViewTreeApplication
     6 	instanceVariableNames:'model treeView hasSingleSelectionHolder clickedItem clickedPoint
     6 	instanceVariableNames:'model treeView hasSingleSelectionHolder clickedItem clickedPoint
     7 		motionAction infoChannel process followFocusChannel
     7 		motionAction process followFocusChannel showNamesHolder'
     8 		showNamesHolder'
       
     9 	classVariableNames:''
     8 	classVariableNames:''
    10 	poolDictionaries:''
     9 	poolDictionaries:''
    11 	category:'A-Views-Support'
    10 	category:'A-Views-Support'
    12 !
    11 !
    13 
    12 
   148               menu: toolbarMenu
   147               menu: toolbarMenu
   149               textDefault: true
   148               textDefault: true
   150             )
   149             )
   151            (HierarchicalListViewSpec
   150            (HierarchicalListViewSpec
   152               name: 'List'
   151               name: 'List'
   153               layout: (LayoutFrame 0 0.0 32 0.0 0 1.0 -24 1.0)
   152               layout: (LayoutFrame 0 0.0 32 0.0 0 1.0 0 1.0)
   154               level: 1
   153               level: 1
   155               model: model
   154               model: model
   156               menu: middleButtonMenu
   155               menu: middleButtonMenu
   157               hasHorizontalScrollBar: true
   156               hasHorizontalScrollBar: true
   158               hasVerticalScrollBar: true
   157               hasVerticalScrollBar: true
   160               miniScrollerVertical: false
   159               miniScrollerVertical: false
   161               listModel: listOfItems
   160               listModel: listOfItems
   162               multipleSelectOk: true
   161               multipleSelectOk: true
   163               useIndex: false
   162               useIndex: false
   164               highlightMode: label
   163               highlightMode: label
   165               doubleClickSelector: doubleClicked:
       
   166               valueChangeSelector: selectionChanged
       
   167               showLeftIndicators: false
   164               showLeftIndicators: false
   168               indicatorSelector: indicatorClicked:
   165               indicatorSelector: indicatorClicked:
   169               useDefaultIcons: false
   166               useDefaultIcons: false
   170               postBuildCallback: postBuildTree:
   167               postBuildCallback: postBuildTree:
   171             )
       
   172            (LabelSpec
       
   173               name: 'infoChannel'
       
   174               layout: (LayoutFrame 0 0.0 -24 1.0 0 1.0 0 1.0)
       
   175               level: 1
       
   176               translateLabel: true
       
   177               labelChannel: infoChannel
       
   178               adjust: left
       
   179             )
   168             )
   180            )
   169            )
   181          
   170          
   182         )
   171         )
   183       )
   172       )
   514       )
   503       )
   515 ! !
   504 ! !
   516 
   505 
   517 !ViewTreeApplication methodsFor:'actions'!
   506 !ViewTreeApplication methodsFor:'actions'!
   518 
   507 
   519 doubleClicked:anIndex
       
   520     self doInspect:#view.
       
   521 !
       
   522 
       
   523 indicatorClicked:anIndex
   508 indicatorClicked:anIndex
   524     |item sensor|
   509     |item sensor|
   525 
   510 
   526     item := model listOfItems at:anIndex ifAbsent:nil.
   511     item := model listOfItems at:anIndex ifAbsent:nil.
   527 
   512 
   554     "answer the channel which is set to true if a target widget exists"
   539     "answer the channel which is set to true if a target widget exists"
   555 
   540 
   556     ^ model hasTargetWidgetChannel
   541     ^ model hasTargetWidgetChannel
   557 !
   542 !
   558 
   543 
   559 infoChannel
       
   560     "channel, which keeps a printable information"
       
   561 
       
   562     ^ infoChannel
       
   563 !
       
   564 
       
   565 listOfItems
   544 listOfItems
   566     "returns the hierarchical list of items"
   545     "returns the hierarchical list of items"
   567 
   546 
   568     ^ model listOfItems
   547     ^ model listOfItems
   569 !
   548 !
   623 
   602 
   624     ] ifFalse:[
   603     ] ifFalse:[
   625         info := ''
   604         info := ''
   626     ].
   605     ].
   627     hasSingleSelectionHolder value:(view notNil).
   606     hasSingleSelectionHolder value:(view notNil).
   628     infoChannel value:info.
       
   629 !
   607 !
   630 
   608 
   631 update:something with:someArgument from:aModel
   609 update:something with:someArgument from:aModel
   632     |oldSelection|
   610     |oldSelection|
   633 
   611 
   636         model selectedItem:nil.
   614         model selectedItem:nil.
   637         self listOfItems showWidgetNames:(aModel value).
   615         self listOfItems showWidgetNames:(aModel value).
   638         model selectedItem:oldSelection.
   616         model selectedItem:oldSelection.
   639         ^ self
   617         ^ self
   640     ].
   618     ].
       
   619 
       
   620     aModel == model ifTrue:[
       
   621         self selectionChanged.
       
   622         ^ self
       
   623     ].
       
   624 
   641     super update:something with:someArgument from:aModel.
   625     super update:something with:someArgument from:aModel.
   642 ! !
   626 ! !
   643 
   627 
   644 !ViewTreeApplication methodsFor:'event processing'!
   628 !ViewTreeApplication methodsFor:'event processing'!
   645 
   629 
   874 initialize
   858 initialize
   875     "setup my model and channels"
   859     "setup my model and channels"
   876 
   860 
   877     super initialize.
   861     super initialize.
   878 
   862 
   879     infoChannel              := ''    asValue.
       
   880     hasSingleSelectionHolder := false asValue.
   863     hasSingleSelectionHolder := false asValue.
   881     followFocusChannel       := false asValue.
   864     followFocusChannel       := false asValue.
   882 
   865 
   883     model := ViewTreeModel new.
   866     model := ViewTreeModel new.
   884     model inputEventAction:[:ev| self processEvent:ev ].
   867     model inputEventAction:[:ev| self processEvent:ev ].
   885     model mappedViewAction:[:vw| self processMappedView:vw ].
   868     model mappedViewAction:[:vw| self processMappedView:vw ].
   886     model application:self.
   869     model application:self.
       
   870     model addDependent:self.
       
   871 
   887 
   872 
   888     showNamesHolder := false asValue.
   873     showNamesHolder := false asValue.
   889     showNamesHolder addDependent:self.
   874     showNamesHolder addDependent:self.
   890 !
   875 !
   891 
   876