abstract classafReflux::Panel

sys::Obj
  afReflux::Panel

@Js

Panels are widget panes that decorate the edges of the main window. Only one instance of each panel type may exist. They are (typically) created at application startup and live until the application shuts down.

Panel implementations should be autobuilt and contributed to the Panels service:

@Contribute { serviceType=Panels# }
static Void contributePanels(Configuration config) {
    config["myPanel"] = config.autobuild(MyPanel#)
}

Panels are automatically added to the EventHub, so to receive events they only need to implement the required event mixin.

content

Source

Widget? content

The content displayed in the panel. May be set / re-set at any time.

icon

Source

Image? icon

As displayed in the panel's tab.

isActive

Source

Bool isActive := false { internal set }

Is the panel currently the active tab in the tab pane?

isShowing

Source

Bool isShowing := false { internal set }

Is the panel currently showing in the tab pane?

make

Source

new make(|This in)

Subclasses should define the following ctor:

new make(|This| in) : super(in) { ... }
name

Source

Str name := ""

As displayed in the panel's tab. If no name is given, it defaults the the Panel's type, minus any Panel suffix.

onActivate

Source

virtual Void onActivate()

Callback when this panel is selected as the active tab.

onDeactivate

Source

virtual Void onDeactivate()

Callback when this panel is unselected as the active tab.

onHide

Source

virtual Void onHide()

Callback when this panel is removed from the tab pane.

onModify

Source

virtual Void onModify()

Callback when panel details are modified, such as the name or icon.

onShow

Source

virtual Void onShow()

Callback when this panel is shown in the tab pane.

prefAlign

Source

Obj prefAlign := Halign.left

Return this panel's preferred alignment which is used to determine its default position. Valid values are:

  • Halign.left (default)
  • Halign.right
  • Valign.bottom
refresh

Source

virtual Void refresh(Resource? resource := null)

Callback for when the panel should refresh it's contents. Typically, active panels are asked to refresh when the refresh button is clicked.

The given resource is a hint as to what's been updated. If null then all content should be refreshed

trap

Source

virtual override Obj? trap(Str name, Obj?[]? args := null)

It is common to handle events from FWT widgets, such as onSelect(), but should these throw an Err they are usually just swallowed (or at best traced to std err). To work around it, follow this pattern:

class MyPanel : Panel {
    new make(|This| in) : super(in) {
        content = Tree() { it.onSelect.add |e| { this->onSelect(e) } }
    }

    private Void onSelect(Event e) {
        ...
    }
}

Routing the event to a handler method via -> calls this trap() method. Should that method return Void and be prefixed with onXXX then any Err thrown is logged with the Errors service.

Simple Err handling without fuss!