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
Widget? content
The content displayed in the panel. May be set / re-set at any time.
- icon
Image? icon
As displayed in the panel's tab.
- isActive
Bool isActive := false { internal set }
Is the panel currently the active tab in the tab pane?
- isShowing
Bool isShowing := false { internal set }
Is the panel currently showing in the tab pane?
- make
new make(|This in)
Subclasses should define the following ctor:
new make(|This| in) : super(in) { ... }
- name
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
virtual Void onActivate()
Callback when this panel is selected as the active tab.
- onDeactivate
virtual Void onDeactivate()
Callback when this panel is unselected as the active tab.
- onHide
virtual Void onHide()
Callback when this panel is removed from the tab pane.
- onModify
virtual Void onModify()
Callback when panel details are modified, such as the name or icon.
- onShow
virtual Void onShow()
Callback when this panel is shown in the tab pane.
- prefAlign
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
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
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 thistrap()
method. Should that method returnVoid
and be prefixed withonXXX
then any Err thrown is logged with the Errors service.Simple Err handling without fuss!