abstract class flux::Resource
sys::Obj flux::Resource
Resource represents the objects a user navigates, views, and edits in a flux application. Resources are mapped to objects via the indexed prop flux.resource.{target}={resource}
, where both "target" and "resource" are qualied type names. Subclasses must define a make(Uri, Obj)
constructor.
See pod doc for details.
- children
-
virtual Resource[]? children()
Get the navigation children of the resource. Return an empty list or null to indicate no children. Default returns null.
- hasChildren
-
virtual Bool hasChildren()
Return if this resource has or might have children. This is an optimization to display the expansion control in a tree without loading all the children. The default calls
children
. - icon
-
virtual Image icon()
Get a 16x16 icon for the resource.
- name
-
abstract Str name()
Get the display name of the resource.
- popup
-
virtual Menu? popup(Frame? frame, Event? event)
Make a popup menu for this resource or return null. The default popup menu returns the
viewsMenu
. - resolve
-
static Resource resolve(Uri uri)
Resolve a uri into a resource:
- Resolve uri to obj via
Uri.get
- If obj is Resource, return it
- Resolve to obj type to resource type via
flux.resource.{qname}
indexed property for type hierarchy
Throw UnresolvedErr if the uri can't be resolved, and UnsupportedErr if resource can't be mapped to a resource.
- Resolve uri to obj via
- roots
-
static Resource[] roots()
Get the root resources.
- toStr
-
virtual override Str toStr()
Return
uri
. - uri
-
abstract Uri uri()
Get the absolute Uri of this resource.
- views
-
virtual Type[] views()
Get the list of available
View
types for the resource. The first view should be the default view. The default implementation searches the type database index props formatted as "flux.view.{target}={view}", where "target" is this type (and its inherited classes, and "view" is view type qname. - viewsMenu
-
virtual Menu? viewsMenu(Frame? frame, Event? event)
Return a menu to hyperlink to the views supported by this resource.