public class TemplateTool extends ToolAddonUIAdapter implements YouScopeFrameListener
ToolAddonUI
specifying e.g. different layouts of the UI depending on if the UI is shown in an own frame,
or as a sub-element of another user interface. However, implementing this interface directly is typically rather complicated. For most tools it
is therefore sufficient to extend the adapter class ToolAddonUIAdapter
instead of implementing ToolAddonUI
directly. The
adapter class takes over most of the boilerplate code being the same for nearly all tools, such that one can concentrate on the "real functionality"
of the tool. However, it is still possible to implement ToolAddonUI
directly if the tool has to do something different then most other tools...Modifier and Type | Field and Description |
---|---|
static java.lang.String |
TYPE_IDENTIFIER
The type identifier is a unique ID of your tool.
|
Constructor and Description |
---|
TemplateTool(YouScopeClient client,
YouScopeServer server)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.awt.Component |
createUI()
Return a Component (typically a JPanel) containing the UI elements of the addon.
|
void |
frameClosed()
Activated when the frame is closing.
|
void |
frameOpened()
Activated when frame is opened/displayed.
|
static ToolMetadata |
getMetadata()
Returns the metadata of this tool.
|
addFrameListener, closeAddon, getAddonMetadata, getClient, getCloseButtonLabel, getContainingFrame, getMicroscope, getPreferredSize, getServer, getTitle, isInitialized, isMaximizable, isMaximize, isResizable, isSeparateFrame, isShowCloseButton, notifyLayoutChanged, removeFrameListener, sendErrorMessage, sendMessage, setCloseButtonLabel, setDescription, setMaximizable, setMaximize, setPreferredSize, setResizable, setShowCloseButton, setTitle, toFrame, toPanel
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAddonMetadata, toFrame, toPanel
public static final java.lang.String TYPE_IDENTIFIER
public TemplateTool(YouScopeClient client, YouScopeServer server) throws AddonException
ToolAddonUIAdapter
with all necessary information to provide the standard
functionality which has to be exposed by every tool, such that we can concentrate on the fundamentals.
Do not initialize the UI elements here (do this in createUI()
).client
- Interface to the YouScope client, e.g. allowing to open or close new windows, or permanently save settings.server
- Interface to the YouScope server, e.g. allowing access to the microscope.AddonException
public static ToolMetadata getMetadata()
ToolMetadata
ourselves, we return an instance of the adapter class ToolMetadataAdapter
, which does most of the
boilerplate code for us.public java.awt.Component createUI()
AddonUIAdapter
AddonUIAdapter.setShowCloseButton(boolean)
and AddonUIAdapter.setCloseButtonLabel(String)
).createUI
in class AddonUIAdapter<ToolMetadata>
public void frameClosed()
YouScopeFrameListener
frameClosed
in interface YouScopeFrameListener
public void frameOpened()
YouScopeFrameListener
frameOpened
in interface YouScopeFrameListener