PanelBuilder
An object implementing the PanelBuilder
interface builds views for std:ui:panel
standard templates, and renders them.
The PanelBuilder
adds the following features over constructing view yourself.
- It’s designed for passing to multiple co-operating plugins to build a combined user interface. The
std_action_panel
plugin uses it to render Elements containing panel elements from multiple plugins.
- Each panel element has a priority, and elements are sorted according to their priority before rendering.
- The
PanelBuilder
supports multiple panels, treated as a single element, so user interface can be logically grouped.
All builder functions return the PanelBuilder
object itself for easy chaining.
Construction
Call O.ui.panel()
with your required options.
Interface (panel elements)
These builder functions add panel elements.
function element(priority, element)
Add a generic panel element to this panel, with the given priority
.
element
is the view for this element, described in panel element views.
function link(priority, href, label, indicator)
Add a simple link to the panel with the given priority
, href
and label
properties. indicator
is optional.
function status(priority, text)
Add a panel element displaying the status of a process.
function relatedInfo(priority, href, label, heading)
Add a panel element as a link to related information which isn’t an integral part of the current process.
Interface (panels)
These builder functions create and configure the individual panels.
function panel(priority)
Return a PanelBuilder
for the given priority.
The same PanelBuilder
will be returned for each priority
value. All returned PanelBuilders
are related, and calling panel()
on any of them will return the same object. The PanelBuilder
returned by O.ui.panel()
has a priority of "default"
.
function title(title)
Set the title
of this panel.
function highlight(highlight)
Set the highlight
value for this panel. The default highlight value is set by the defaultHighlight
to O.ui.panel()
.
See highlight
for the supported values.
function spaceAbove()
Add additional space above this panel.
function hidePanel()
Prevent this panel from being rendered. It’s intended to allow customisations to remove user interface from other plugins which isn’t required for a particular application.
function hideAllPanels()
Prevents any panel on this PanelBuilder
from being rendered. It’s intended to allow customisations to remove user interface from other plugins which isn’t required for a particular application.
Rendering
These rendering functions should only be called on the root PanelBuilder
returned by O.ui.panel()
.
function render()
Render the panel, returning HTML.
function deferredRender()
Deferred render of the panel, returning a object which can be used with the render() template function.
function anyBuilderShouldBeRendered()
At least one of the builders returns true
to shouldBeRendered()
.
function shouldBeRendered()
Return true
if this individual panel should be rendered. It must have some elements and hidePanel()
must not have been called.