Added field that shows XPath like path to selected widged.
--- a/Tools__ViewTreeApplication.st Fri May 16 17:58:43 2014 +0200
+++ b/Tools__ViewTreeApplication.st Mon May 19 19:56:11 2014 +0200
@@ -16,7 +16,7 @@
ToolApplicationModel subclass:#ViewTreeInspectorApplication
instanceVariableNames:'model treeView hasSingleSelectionHolder clickedItem clickedPoint
motionAction process followFocusChannel showNamesHolder
- inspectorView inspectorModeIndexHolder'
+ inspectorView inspectorModeIndexHolder path'
classVariableNames:''
poolDictionaries:''
category:'Interface-Smalltalk'
@@ -330,7 +330,7 @@
name: 'View Tree Inspector'
min: (Point 10 10)
max: (Point 1024 9999)
- bounds: (Rectangle 0 0 381 654)
+ bounds: (Rectangle 0 0 693 643)
menu: menu
)
component:
@@ -348,23 +348,52 @@
component:
(SpecCollection
collection: (
- (HierarchicalListViewSpec
- name: 'List'
- level: 1
- model: model
- menu: middleButtonMenu
- hasHorizontalScrollBar: true
- hasVerticalScrollBar: true
- miniScrollerHorizontal: true
- miniScrollerVertical: false
- listModel: listOfItems
- multipleSelectOk: true
- useIndex: false
- highlightMode: label
- showLeftIndicators: false
- indicatorSelector: indicatorClicked:
- useDefaultIcons: false
- postBuildCallback: postBuildTree:
+ (ViewSpec
+ name: 'PathAndListPane'
+ component:
+ (SpecCollection
+ collection: (
+ (ViewSpec
+ name: 'PathPane'
+ layout: (LayoutFrame 0 0 0 0 0 1 25 0)
+ component:
+ (SpecCollection
+ collection: (
+ (InputFieldSpec
+ name: 'Path'
+ layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+ model: path
+ acceptOnReturn: true
+ acceptOnTab: true
+ acceptOnPointerLeave: true
+ emptyFieldReplacementText: 'No View Selected'
+ )
+ )
+
+ )
+ )
+ (HierarchicalListViewSpec
+ name: 'List'
+ layout: (LayoutFrame 0 0 25 0 0 1 0 1)
+ level: 1
+ model: model
+ menu: middleButtonMenu
+ hasHorizontalScrollBar: true
+ hasVerticalScrollBar: true
+ miniScrollerHorizontal: true
+ miniScrollerVertical: false
+ listModel: listOfItems
+ multipleSelectOk: true
+ useIndex: false
+ highlightMode: label
+ showLeftIndicators: false
+ indicatorSelector: indicatorClicked:
+ useDefaultIcons: false
+ postBuildCallback: postBuildTree:
+ )
+ )
+
+ )
)
(ViewSpec
name: 'Box2'
@@ -382,8 +411,8 @@
(ViewSpec
name: 'Inspector'
layout: (LayoutFrame 0 0 26 0 0 1 0 1)
+ postBuildCallback: postBuildInspectorView:
viewClassName: 'InspectorView'
- postBuildCallback: postBuildInspectorView:
)
)
@@ -948,6 +977,17 @@
^ model
!
+path
+ <resource: #uiAspect>
+
+ path isNil ifTrue:[
+ path := PluggableAdaptor on: self model getter:[ :model | model path ]
+ ].
+ ^ path.
+
+ "Modified: / 19-05-2014 / 18:40:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
selectOnClickHolder
"boolean holder, which indicates whether the selection will change on click"
@@ -3089,6 +3129,34 @@
].
!
+path
+ "Return a XPath like path to this item"
+
+ | view views|
+
+ selection isNil ifTrue:[ ^ nil ].
+ selection isCollection ifTrue:[
+ selection size ~~ 1 ifTrue:[ ^ nil ].
+ view := selection anElement widget.
+ ] ifFalse:[
+ view := selection widget.
+ ].
+ views := OrderedCollection new.
+ [ view notNil ] whileTrue:[
+ views add: view.
+ view := view superView.
+ ].
+ views removeLast.
+ ^ String streamContents:[ :s|
+ views reverseDo:[:each |
+ s nextPutAll:' / '.
+ s nextPutAll: each name asString storeString.
+ ].
+ ]
+
+ "Created: / 19-05-2014 / 18:15:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
rootItem
"get the rootItem the event viewer is established on
"