classafReflux::ResourceTree
sys::Obj afReflux::ResourceTree
(Widget) - A tree widget that displays Resource hierarchies. ResourceTree is a wrapper around the FWT Tree widget with the following enhancements:
- A Resourcespecific tree model.
- Hassle free refreshResource()andshowResource()methods that just work.
- Event data return the Resourcethat's been actioned.
Because ResourceTree does not extend fwt:Widget it can not be added directly. Instead, add the tree field which returns the wrapped FWT Tree instance.
tree := ResourceTree(reflux)
ContentPane() {
    it.content = tree.tree
}
- isExpanded
- Bool isExpanded(Resource resource)- Return the expanded state for this - Resource.
- make
- new make(Reflux reflux, |This? in := null)- Creates a - ResourceTree. Use the ctor to pass in a tree:- ResourceTree(reflux) { it.tree = Tree { it.border = false } it.roots = myRoots it.model = MyModel() }- Note that, as shown above, the - treemust be set before the model and / or roots.
- model
- ResourceTreeModel model := ResourceTreeModelImpl.<ctor>()- The model that customises the look of the tree. Leave as is for default behaviour. - You should call - refreshAllafter setting a new model.
- onAction
- EventListeners onAction()- Callback when a node is double clicked or Return/Enter key is pressed. - Event id fired: - EventId.modified
 - Event fields: - Event.data: the- Resourceactioned
 
- onPopup
- EventListeners onPopup()- Callback when user invokes a right click popup action. If the callback wishes to display a popup, then set the - Event.popupfield with menu to open. If multiple callbacks are installed, the first one to return a nonnull popup consumes the event.- To show a menu created from the - Resource, add the following:- tree.onPopup.add |Event event| { event.popup = (event.data as Resource)?.populatePopup(Menu()) }- Event id fired: - EventId.popup
 - Event fields: - Event.data: the- Resourceselected, or- nullif this is a background popup.
- Event.pos: the mouse position of the popup.
 
- onSelect
- EventListeners onSelect()- Callback when selected nodes change. - Event id fired: - EventId.select
 - Event fields: - Event.data: the- Resourceselected
 
- refreshAll
- Void refreshAll()- Update the entire tree's contents from the model. 
- refreshResource
- Void refreshResource(Resource resource)- Updates the specified resource in the model before showing it. 
- refreshResourceUri
- Void refreshResourceUri(Uri resourceUri)- Updates the specified resource in the model before showing it. 
- resourceAt
- Resource? resourceAt(Point pos)- Return the - Resourceat the specified coordinate relative to this widget. Return- nullif there is no- Resourceat given coordinate.
- roots
- Resource[] roots := Resource#.emptyList- The root resources of the tree. - You should call - refreshAllafter setting new roots.
- selected
- Resource[] selected- Get and set the selected nodes. - Convenience for - tree.selected()
- setExpanded
- Void setExpanded(Resource resource, Bool expanded)- Set the expanded state for this - Resource.
- showResource
- Void showResource(Resource resource)- Scrolls and expands the tree until the - Resourceis visible. This also selects the resource in the tree.
- showResourceUri
- Void showResourceUri(Uri resourceUri)- Scrolls and expands the tree until the - Resourceis visible. This also selects the resource in the tree.
- tree
- Tree tree- The underlying FWT Tree widget.