Added field that shows XPath like path to selected widged.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 19 May 2014 19:56:11 +0200
changeset 311280453ab62df9
parent 3111 618a32168c9c
child 3113 7b82f9dd4e1b
Added field that shows XPath like path to selected widged.
Tools__ViewTreeApplication.st
     1.1 --- a/Tools__ViewTreeApplication.st	Fri May 16 17:58:43 2014 +0200
     1.2 +++ b/Tools__ViewTreeApplication.st	Mon May 19 19:56:11 2014 +0200
     1.3 @@ -16,7 +16,7 @@
     1.4  ToolApplicationModel subclass:#ViewTreeInspectorApplication
     1.5  	instanceVariableNames:'model treeView hasSingleSelectionHolder clickedItem clickedPoint
     1.6  		motionAction process followFocusChannel showNamesHolder
     1.7 -		inspectorView inspectorModeIndexHolder'
     1.8 +		inspectorView inspectorModeIndexHolder path'
     1.9  	classVariableNames:''
    1.10  	poolDictionaries:''
    1.11  	category:'Interface-Smalltalk'
    1.12 @@ -330,7 +330,7 @@
    1.13           name: 'View Tree Inspector'
    1.14           min: (Point 10 10)
    1.15           max: (Point 1024 9999)
    1.16 -         bounds: (Rectangle 0 0 381 654)
    1.17 +         bounds: (Rectangle 0 0 693 643)
    1.18           menu: menu
    1.19         )
    1.20         component: 
    1.21 @@ -348,23 +348,52 @@
    1.22               component: 
    1.23              (SpecCollection
    1.24                 collection: (
    1.25 -                (HierarchicalListViewSpec
    1.26 -                   name: 'List'
    1.27 -                   level: 1
    1.28 -                   model: model
    1.29 -                   menu: middleButtonMenu
    1.30 -                   hasHorizontalScrollBar: true
    1.31 -                   hasVerticalScrollBar: true
    1.32 -                   miniScrollerHorizontal: true
    1.33 -                   miniScrollerVertical: false
    1.34 -                   listModel: listOfItems
    1.35 -                   multipleSelectOk: true
    1.36 -                   useIndex: false
    1.37 -                   highlightMode: label
    1.38 -                   showLeftIndicators: false
    1.39 -                   indicatorSelector: indicatorClicked:
    1.40 -                   useDefaultIcons: false
    1.41 -                   postBuildCallback: postBuildTree:
    1.42 +                (ViewSpec
    1.43 +                   name: 'PathAndListPane'
    1.44 +                   component: 
    1.45 +                  (SpecCollection
    1.46 +                     collection: (
    1.47 +                      (ViewSpec
    1.48 +                         name: 'PathPane'
    1.49 +                         layout: (LayoutFrame 0 0 0 0 0 1 25 0)
    1.50 +                         component: 
    1.51 +                        (SpecCollection
    1.52 +                           collection: (
    1.53 +                            (InputFieldSpec
    1.54 +                               name: 'Path'
    1.55 +                               layout: (LayoutFrame 0 0 0 0 0 1 0 1)
    1.56 +                               model: path
    1.57 +                               acceptOnReturn: true
    1.58 +                               acceptOnTab: true
    1.59 +                               acceptOnPointerLeave: true
    1.60 +                               emptyFieldReplacementText: 'No View Selected'
    1.61 +                             )
    1.62 +                            )
    1.63 +                          
    1.64 +                         )
    1.65 +                       )
    1.66 +                      (HierarchicalListViewSpec
    1.67 +                         name: 'List'
    1.68 +                         layout: (LayoutFrame 0 0 25 0 0 1 0 1)
    1.69 +                         level: 1
    1.70 +                         model: model
    1.71 +                         menu: middleButtonMenu
    1.72 +                         hasHorizontalScrollBar: true
    1.73 +                         hasVerticalScrollBar: true
    1.74 +                         miniScrollerHorizontal: true
    1.75 +                         miniScrollerVertical: false
    1.76 +                         listModel: listOfItems
    1.77 +                         multipleSelectOk: true
    1.78 +                         useIndex: false
    1.79 +                         highlightMode: label
    1.80 +                         showLeftIndicators: false
    1.81 +                         indicatorSelector: indicatorClicked:
    1.82 +                         useDefaultIcons: false
    1.83 +                         postBuildCallback: postBuildTree:
    1.84 +                       )
    1.85 +                      )
    1.86 +                    
    1.87 +                   )
    1.88                   )
    1.89                  (ViewSpec
    1.90                     name: 'Box2'
    1.91 @@ -382,8 +411,8 @@
    1.92                        (ViewSpec
    1.93                           name: 'Inspector'
    1.94                           layout: (LayoutFrame 0 0 26 0 0 1 0 1)
    1.95 +                         postBuildCallback: postBuildInspectorView:
    1.96                           viewClassName: 'InspectorView'
    1.97 -                         postBuildCallback: postBuildInspectorView:
    1.98                         )
    1.99                        )
   1.100                      
   1.101 @@ -948,6 +977,17 @@
   1.102      ^ model
   1.103  !
   1.104  
   1.105 +path
   1.106 +    <resource: #uiAspect>
   1.107 +
   1.108 +    path isNil ifTrue:[
   1.109 +        path := PluggableAdaptor on: self model getter:[ :model | model path ]
   1.110 +    ].
   1.111 +    ^ path.
   1.112 +
   1.113 +    "Modified: / 19-05-2014 / 18:40:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   1.114 +!
   1.115 +
   1.116  selectOnClickHolder
   1.117      "boolean holder, which indicates whether the selection will change on click"
   1.118  
   1.119 @@ -3089,6 +3129,34 @@
   1.120      ].
   1.121  !
   1.122  
   1.123 +path
   1.124 +    "Return a XPath like path to this item"
   1.125 +
   1.126 +    | view views|
   1.127 +
   1.128 +    selection isNil ifTrue:[ ^ nil ].
   1.129 +    selection isCollection ifTrue:[ 
   1.130 +        selection size ~~ 1 ifTrue:[ ^ nil ].
   1.131 +        view := selection anElement widget.
   1.132 +    ] ifFalse:[ 
   1.133 +        view := selection widget.
   1.134 +    ].
   1.135 +    views := OrderedCollection new.
   1.136 +    [ view notNil ] whileTrue:[ 
   1.137 +        views add: view.
   1.138 +        view := view superView.
   1.139 +    ].
   1.140 +    views removeLast.
   1.141 +    ^ String streamContents:[ :s|
   1.142 +        views reverseDo:[:each |
   1.143 +            s nextPutAll:' / '.
   1.144 +            s nextPutAll: each name asString storeString.
   1.145 +        ].
   1.146 +    ]
   1.147 +
   1.148 +    "Created: / 19-05-2014 / 18:15:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   1.149 +!
   1.150 +
   1.151  rootItem
   1.152      "get the rootItem the event viewer is established on
   1.153      "