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 aParameterPanelfor its parameters.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BaseFlatButtonm_ButtonApplythe apply button.protected BaseButtonm_ButtonFavoritesthe button for the favorites.protected booleanm_IgnoreOptionsUpdatewhether to ignore the update to the options.protected Map<String,Object>m_InitialOptionsinitial settings.protected ParameterPanelm_ParameterPanelthe 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 voidaddOptions(ParameterPanel paramPanel)Fills the parameter panel with the options.booleanapply(BaseFlatButton button)Applies the settings (if valid).voidapplyOptions()Applies the options.voidapplyOptionsQuietly()Applies the options quietly, i.e., doesn't trigger an event.protected BasePanelcreateOptionPanel()Creates the panel for setting the options.Map<String,Object>getCurrentOptions()Returns the current options as a map.protected StringgetFavoritesOptions()Returns the options for the favorites.protected booleangetOption(int index, String label, Component comp, Map<String,Object> map)Hook method for reacting to custom component types, retrieving their setting.BasePanelgetOptionPanel()Returns the panel for setting the options.protected voidinitialize()Initializes the members.protected voidpostProcessCurrentOptions(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.protected voidsetFavoritesOptions(String json)Parses the JSON string and sets the options.voidsetInitialOptions(Map<String,Object> value)Sets the options from the map.protected booleansetOption(int index, String label, Component comp, Object value)Hook method for reacting to custom component types, updating their setting.protected voidshowFavoritesMenu()Displays the favorites menu.protected voidupdateOptions(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_ButtonFavorites
protected BaseButton m_ButtonFavorites
the button for the favorites.
-
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:
initializein 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:
createOptionPanelin classAbstractTool- Returns:
- the options panel
-
apply
public boolean apply(BaseFlatButton button)
Applies the settings (if valid).- Overrides:
applyin classAbstractTool- Returns:
- true if applied
- See Also:
AbstractTool.doApply(),AbstractTool.checkBeforeApply()
-
applyOptions
public void applyOptions()
Applies the options.- Specified by:
applyOptionsin interfaceCustomizableTool
-
applyOptionsQuietly
public void applyOptionsQuietly()
Applies the options quietly, i.e., doesn't trigger an event.- Specified by:
applyOptionsQuietlyin 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:
setInitialOptionsin 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:
getCurrentOptionsin interfaceCustomizableTool- Returns:
- the options
-
getOptionPanel
public BasePanel getOptionPanel()
Returns the panel for setting the options.- Specified by:
getOptionPanelin interfaceTool- Overrides:
getOptionPanelin classAbstractTool- Returns:
- the options panel
-
getFavoritesOptions
protected String getFavoritesOptions()
Returns the options for the favorites.- Returns:
- the JSON string from the options
-
setFavoritesOptions
protected void setFavoritesOptions(String json)
Parses the JSON string and sets the options.- Parameters:
json- the options as json string
-
showFavoritesMenu
protected void showFavoritesMenu()
Displays the favorites menu.
-
-