Class AbstractToolWithParameterPanel
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.gui.visualization.object.tools.AbstractTool
-
- adams.gui.visualization.object.tools.AbstractToolWithParameterPanel
-
- All Implemented Interfaces:
CleanUpHandler
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,SizeOfHandler
,CustomizableTool
,Tool
,Serializable
public abstract class AbstractToolWithParameterPanel extends AbstractTool implements CustomizableTool
Tool that uses aParameterPanel
for its parameters.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BaseFlatButton
m_ButtonApply
the apply button.protected boolean
m_IgnoreOptionsUpdate
whether to ignore the update to the options.protected Map<String,Object>
m_InitialOptions
initial settings.protected ParameterPanel
m_ParameterPanel
the parameter panel.-
Fields inherited from class adams.gui.visualization.object.tools.AbstractTool
m_CanvasPanel, m_KeyListener, m_Listener, m_Modified, m_MotionListener, m_PanelFullOptions, m_PanelOptions
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractToolWithParameterPanel()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
addOptions(ParameterPanel paramPanel)
Fills the parameter panel with the options.boolean
apply(BaseFlatButton button)
Applies the settings (if valid).void
applyOptions()
Applies the options.void
applyOptionsQuietly()
Applies the options quietly, i.e., doesn't trigger an event.protected BasePanel
createOptionPanel()
Creates the panel for setting the options.Map<String,Object>
getCurrentOptions()
Returns the current options as a map.protected boolean
getOption(int index, String label, Component comp, Map<String,Object> map)
Hook method for reacting to custom component types, retrieving their setting.BasePanel
getOptionPanel()
Returns the panel for setting the options.protected void
initialize()
Initializes the members.protected void
postProcessCurrentOptions(Map<String,Object> value)
Hook method for post-processing the options before returning them.Map<String,Object>
retrieveCurrentOptions()
Returns the current options as a map.void
setInitialOptions(Map<String,Object> value)
Sets the options from the map.protected boolean
setOption(int index, String label, Component comp, Object value)
Hook method for reacting to custom component types, updating their setting.protected void
updateOptions(Map<String,Object> value)
Sets the options from the map.-
Methods inherited from class adams.gui.visualization.object.tools.AbstractTool
activate, checkBeforeApply, cleanUp, createApplyButton, createCursor, createKeyListener, createMouseListener, createMouseMotionListener, deactivate, doApply, getCanvas, getCursor, getImage, getKeyListener, getModifiedIcon, getMouseListener, getMouseMotionListener, getUnmodifiedIcon, getZoom, hasImage, isModified, setApplyButtonState, setCanvas, update
-
Methods inherited from class adams.core.logging.CustomLoggingLevelObject
setLoggingLevel
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface adams.core.CleanUpHandler
cleanUp
-
Methods inherited from interface adams.core.GlobalInfoSupporter
globalInfo
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel, setLoggingLevel
-
Methods inherited from interface adams.core.logging.LoggingSupporter
getLogger, isLoggingEnabled
-
Methods inherited from interface adams.gui.visualization.object.tools.Tool
activate, deactivate, getCanvas, getCursor, getIcon, getImage, getKeyListener, getMouseListener, getMouseMotionListener, getName, getZoom, hasImage, isModified, setCanvas, update
-
-
-
-
Field Detail
-
m_ButtonApply
protected BaseFlatButton m_ButtonApply
the apply button.
-
m_ParameterPanel
protected ParameterPanel m_ParameterPanel
the parameter panel.
-
m_IgnoreOptionsUpdate
protected boolean m_IgnoreOptionsUpdate
whether to ignore the update to the options.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractTool
-
addOptions
protected abstract void addOptions(ParameterPanel paramPanel)
Fills the parameter panel with the options.- Parameters:
paramPanel
- for adding the options to
-
createOptionPanel
protected BasePanel createOptionPanel()
Creates the panel for setting the options.- Specified by:
createOptionPanel
in classAbstractTool
- Returns:
- the options panel
-
apply
public boolean apply(BaseFlatButton button)
Applies the settings (if valid).- Overrides:
apply
in classAbstractTool
- Returns:
- true if applied
- See Also:
AbstractTool.doApply()
,AbstractTool.checkBeforeApply()
-
applyOptions
public void applyOptions()
Applies the options.- Specified by:
applyOptions
in interfaceCustomizableTool
-
applyOptionsQuietly
public void applyOptionsQuietly()
Applies the options quietly, i.e., doesn't trigger an event.- Specified by:
applyOptionsQuietly
in interfaceCustomizableTool
-
setOption
protected boolean setOption(int index, String label, Component comp, Object value)
Hook method for reacting to custom component types, updating their setting.- Parameters:
index
- the parameter indexlabel
- the current labelcomp
- the parameter to updatevalue
- the value to update with- Returns:
- true if successfully updated
-
updateOptions
protected void updateOptions(Map<String,Object> value)
Sets the options from the map.- Parameters:
value
- the options to use
-
setInitialOptions
public void setInitialOptions(Map<String,Object> value)
Sets the options from the map.- Specified by:
setInitialOptions
in interfaceCustomizableTool
- Parameters:
value
- the options to use
-
getOption
protected boolean getOption(int index, String label, Component comp, Map<String,Object> map)
Hook method for reacting to custom component types, retrieving their setting.- Parameters:
index
- the parameter indexlabel
- the current labelcomp
- the parameter to retrievemap
- the options map to update with the current value- Returns:
- true if successfully retrieved
-
retrieveCurrentOptions
public Map<String,Object> retrieveCurrentOptions()
Returns the current options as a map.- Returns:
- the options
-
postProcessCurrentOptions
protected void postProcessCurrentOptions(Map<String,Object> value)
Hook method for post-processing the options before returning them.- Parameters:
value
- the options to post-process- See Also:
getCurrentOptions()
-
getCurrentOptions
public Map<String,Object> getCurrentOptions()
Returns the current options as a map.- Specified by:
getCurrentOptions
in interfaceCustomizableTool
- Returns:
- the options
-
getOptionPanel
public BasePanel getOptionPanel()
Returns the panel for setting the options.- Specified by:
getOptionPanel
in interfaceTool
- Overrides:
getOptionPanel
in classAbstractTool
- Returns:
- the options panel
-
-