public interface OptionalPage
A descriptor of this type specifies a set of graphical console pages that can be opened on console initialization or whenever compatible subsystems connect to the buses.
Each page in the set is identified by a slash-separated path returned by getPage(AgentInfo) method.
The method is first called with null argument when this descriptor is registered with the console by a call
to Console#addOptionalPage(OptionalPage). If a non-null path is returned at this point,
a page will be created regardless of what other subsystems are present on the buses. After that,
the method is called with an appropriate AgentInfo instance for each of the
subsystems connected to the buses, and whenever a new subsystem joins the buses later.
Every time the getPage(AgentInfo) method returns a new non-null path, a new graphical console
page is enabled by creating a menu with that path. The menu can be used by the user to open or close
the page at any time. The return value of the isAutoOpen() method determines whether the pages
created by this descriptor are opened by default, before the user interacts with the menu.
Note that each page created by this descriptor can interact with zero or more subsystems,
and each subsystem is expected to contribute to no more than one such page.
When a subsystem contributing to one of the pages disconnects from the buses, this descriptor
is notified by a call to its agentDisconnected(AgentInfo) method. If the method
returns true, the page is closed and the menu is removed. Otherwise, the page will be
removed only when all the conditions below are satisfied:
getPage(null).
The title of the page can be explicitly specified by setting the name of the component returned by
the open(AgentInfo, JComponent) method. If the name is not specified, the last
segment of the page path is used as a title.
All methods declared by this interface are called by the framework on the AWT Event Dispatching Thread.
See also Console#addOptionalPage(OptionalPage).
| Modifier and Type | Method and Description |
|---|---|
default boolean |
agentDisconnected(org.lsst.ccs.bus.data.AgentInfo agent)
Called whenever an agent potentially contributing to this page disconnects from the buses.
|
default void |
closed(String page)
Called when the page is closed by the user.
|
String |
getPage(org.lsst.ccs.bus.data.AgentInfo agent)
Called with
null argument when this descriptor is registered, then whenever a new subsystem is detected on the buses. |
static LsstOptionalPageService |
getService() |
default boolean |
isAutoOpen()
Returns the default auto-open value.
|
default boolean |
isAutoSave()
Tells the framework whether the state of pages in this set (open or closed) should be
automatically saved or restored when the graphical console session is saved or restored.
|
JComponent |
open(org.lsst.ccs.bus.data.AgentInfo agent,
JComponent existingComponent)
Called when a page is being opened.
|
default void |
opened(String page)
Called after the page has been opened and made visible by the graphical console.
|
default void |
restore(HashMap<String,DataPanelDescriptor> storageBean)
Restores, to the extent possible, pages handled by this descriptor to the specified state.
|
default HashMap<String,DataPanelDescriptor> |
save()
Returns JavaBean describing the current state of pages handled by this descriptor.
|
default void |
setOpen(org.lsst.ccs.bus.data.AgentInfo agent,
boolean isOpen) |
default boolean isAutoOpen()
true, the page(s) will be open automatically on compatible subsystem discovery.
The default implementation returns true.
auto-open value.default boolean isAutoSave()
The default implementation returns false. It should be used if a plugin
prefers saving the state of its optional pages as a part of its own state. This is usually
preferable if those states contain additional information, or if the descriptor might not
be active throughout plugin's life time. If this method is overridden to return true,
the pages states will be automatically saved and restored (to the extend possible) by the framework.
String getPage(org.lsst.ccs.bus.data.AgentInfo agent)
null argument when this descriptor is registered, then whenever a new subsystem is detected on the buses.
This method should return the slash-separated page menu path if the subsystem
identified by the supplied parameter is compatible with this optional page descriptor.
Otherwise, it should return null.
If auto-open is true, the open(...) function will be called immediately
following this call. Otherwise, a menu item will be added to the graphical console to allow opening the
page at a later time.
agent - Agent that has been discovered on the buses, or null if this is the initial call on descriptor registration.JComponent open(org.lsst.ccs.bus.data.AgentInfo agent, JComponent existingComponent)
null is returned, the page is not displayed.
If a page with the path returned by getPage(AgentInfo) already exists
(this can happen if a single page communicates with multiple subsystems,
or if a subsystem restarted without closing the page),
it is passed to this method as existingComponent.agent - Agent descriptor.existingComponent - Existing component with the specified path.default boolean agentDisconnected(org.lsst.ccs.bus.data.AgentInfo agent)
getPage(AgentInfo) returns true.
This method may return true to request closing the page if currently open.
The default implementation returns false.
agent - Agent.true to close the page.default void opened(String page)
The default implementation does nothing.
page - Name of the opened page.default void closed(String page)
The default implementation does nothing.
page - Name of the closed page.static LsstOptionalPageService getService()
default void setOpen(org.lsst.ccs.bus.data.AgentInfo agent,
boolean isOpen)
default HashMap<String,DataPanelDescriptor> save()
default void restore(HashMap<String,DataPanelDescriptor> storageBean)
storageBean - Storage bean describing state.Copyright © 2023 LSST. All rights reserved.