classafReflux::ResourceTable
sys::Obj afReflux::ResourceTable
@Js
(Widget) - A table widget that displays Resources. ResourceTable is a wrapper around the FWT Table widget with the following enhancements:
- A
Resourcespecific table model. - Event data return the
Resourcethat's been actioned.
Because ResourceTable does not extend fwt:Widget it can not be added directly. Instead, add the table field which returns the wrapped FWT Table instance.
table := ResourceTable(reflux)
ContentPane() {
it.content = table.table
}
- make
new make(Reflux reflux, |This? in := null)Creates a
ResourceTable. Use the ctor to pass in a table:ResourceTable(reflux) { it.table = Table { it.border = false } it.roots = myRoots it.model = MyModel() }Note that, as shown above, the
tablemust be set before the model and / or roots.- model
ResourceTableModel model := ResourceTableModelImpl.<ctor>()The model that customises the look of the table. Leave as is for default behaviour.
You should call
refreshAllafter setting a new model.- onAction
EventListeners onAction()Callback when a row is double clicked or Return/Enter key is pressed.
Event id fired:
EventId.modified
Event fields:
Event.data: theResourceactioned
- 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:table.onPopup.add |Event event| { event.popup = (event.data as Resource)?.populatePopup(Menu()) }Event id fired:
EventId.popup
Event fields:
Event.data: theResourceselected, ornullif this is a background popup.Event.pos: the mouse position of the popup.
- onSelect
EventListeners onSelect()Callback when the selected row changes.
Event id fired:
EventId.select
Event fields:
Event.data: theResourceselected, ornullif nothing is selected.
- refreshAll
Void refreshAll()Update the entire table's contents from the model.
- refreshResourceUris
Void refreshResourceUris(Uri[] resourceUris)Updates the specified resource in the model before showing it.
- refreshResources
Void refreshResources(Resource[] resources)Updates the specified resources in the tables
- resourceAt
Resource? resourceAt(Point pos)Return the
Resourceat the specified coordinate relative to this widget. Returnnullif there is noResourceat given coordinate.- roots
Resource[] roots := Resource#.emptyListThe root resources of the table.
You should call
refreshAllafter setting new roots.- selected
Resource[] selectedGet and set the selected nodes.
Convenience for
table.selected()- table
Table tableThe underlying FWT Table widget.