Fantom

 

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 @fluxResource facet - if keyed by this facet, then subclass must define a make(Uri, Obj) constructor.

See docLib::Flux for details.

Slots

childrenSource

virtual Resource[]? children()

Get the navigation children of the resource. Return an empty list or null to indicate no children. Default returns null.

hasChildrenSource

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.

iconSource

virtual Image icon()

Get a 16x16 icon for the resource.

nameSource

abstract Str name()

Get the display name of the resource.

virtual Menu? popup(Frame? frame, Event? event)

Make a popup menu for this resource or return null. The default popup menu returns the viewsMenu.

resolveSource

static Resource resolve(Uri uri)

Resolve a uri into a resource:

  1. Resolve uri to obj via sys::Uri.get
  2. If obj is Resource, return it
  3. Resolve to obj type to resource type via @fluxResource facet

Throw UnresolvedErr if the uri can't be resolved, and UnsupportedErr if resource can't be mapped to a resource.

rootsSource

static Resource[] roots()

Get the root resources.

toStrSource

override Str toStr()

Overrides sys::Obj.toStr

Return uri.

uriSource

abstract Uri uri()

Get the absolute Uri of this resource.

viewsSource

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 for @fluxView bindings to this resource type.

viewsMenuSource

virtual Menu? viewsMenu(Frame? frame, Event? event)

Return a menu to hyperlink to the views supported by this resource.