Class AbstractViewPlugin
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.tools.spreadsheetviewer.AbstractViewPlugin
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,ShallowCopySupporter<AbstractViewPlugin>
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
AbstractSelectedSheetsViewPlugin
,AbstractViewPluginWithGOE
,BoxPlot
,MatrixPlot
,Statistics
public abstract class AbstractViewPlugin extends AbstractOptionHandler implements ShallowCopySupporter<AbstractViewPlugin>
Ancestor for "information" plugins in the spreadsheet viewer.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_CanceledByUser
whether the user canceled the operation.protected SpreadSheetPanel
m_CurrentPanel
the current panel.protected static Hashtable<Class,Object>
m_LastSetup
for storing the last setup for a plugin.protected BasePanel
m_Panel
the generated panel.-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractViewPlugin()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
canView(SpreadSheetPanel panel)
Returns whether a view can be generated.protected String
check(SpreadSheet sheet)
Checks the spreadsheet.protected abstract BasePanel
doGenerate(SpreadSheet sheet)
Performs the actual generation of the information.BasePanel
generate(SpreadSheet sheet)
Processes the spreadsheet.boolean
getCanceledByUser()
Returns whether the operation was canceled by the user.SpreadSheetPanel
getCurrentPanel()
Returns the current panel.protected Object
getLastSetup()
Returns the last setup for this object's class.abstract String
getMenuIcon()
Returns the file name of the icon.abstract String
getMenuText()
Returns the text of the menu item.static String[]
getPlugins()
Returns a list with classnames of plugins.protected boolean
hasLastSetup()
Checks whether there is a setup available for the class of this object.boolean
requiresButtons()
Returns whether the dialog requires the OK/Cancel buttons.void
setCurrentPanel(SpreadSheetPanel value)
Sets the current panel.protected void
setLastSetup(Object setup)
Stores the setup for this object's class.AbstractViewPlugin
shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.AbstractViewPlugin
shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
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, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_LastSetup
protected static Hashtable<Class,Object> m_LastSetup
for storing the last setup for a plugin.
-
m_CurrentPanel
protected SpreadSheetPanel m_CurrentPanel
the current panel.
-
m_Panel
protected BasePanel m_Panel
the generated panel.
-
m_CanceledByUser
protected boolean m_CanceledByUser
whether the user canceled the operation.
-
-
Method Detail
-
getMenuText
public abstract String getMenuText()
Returns the text of the menu item.- Returns:
- the text
-
getMenuIcon
public abstract String getMenuIcon()
Returns the file name of the icon.- Returns:
- the filename or null if no icon available
-
setCurrentPanel
public void setCurrentPanel(SpreadSheetPanel value)
Sets the current panel.- Parameters:
value
- the panel
-
getCurrentPanel
public SpreadSheetPanel getCurrentPanel()
Returns the current panel.- Returns:
- the panel, null if none set
-
hasLastSetup
protected boolean hasLastSetup()
Checks whether there is a setup available for the class of this object.- Parameters:
obj
- the object to check for- Returns:
- true if a setup is available
-
getLastSetup
protected Object getLastSetup()
Returns the last setup for this object's class.- Parameters:
obj
- the object (actually the class) to get the setup for- Returns:
- the setup, null if none available
-
setLastSetup
protected void setLastSetup(Object setup)
Stores the setup for this object's class.- Parameters:
obj
- the object (actually the class) to get the setup forsetup
- the setup to store
-
getCanceledByUser
public boolean getCanceledByUser()
Returns whether the operation was canceled by the user.- Returns:
- true if the user canceled the operation
-
canView
public boolean canView(SpreadSheetPanel panel)
Returns whether a view can be generated.- Parameters:
panel
- the panel to check- Returns:
- true if view can be generated
-
check
protected String check(SpreadSheet sheet)
Checks the spreadsheet.
Default implementation only checks whether data was provided.- Parameters:
sheet
- the spreadsheet to check- Returns:
- null if check passed, otherwise error message
-
requiresButtons
public boolean requiresButtons()
Returns whether the dialog requires the OK/Cancel buttons.
Default implementation returns true.- Returns:
- true if the dialog requires the buttons
-
doGenerate
protected abstract BasePanel doGenerate(SpreadSheet sheet)
Performs the actual generation of the information.- Parameters:
sheet
- the sheet to process- Returns:
- the generated information panel
-
generate
public BasePanel generate(SpreadSheet sheet)
Processes the spreadsheet.- Parameters:
sheet
- the sheet to process- Returns:
- the generated information panel
- Throws:
IllegalArgumentException
- if the check failed- See Also:
check(SpreadSheet)
-
shallowCopy
public AbstractViewPlugin shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopy
in interfaceShallowCopySupporter<AbstractViewPlugin>
- Returns:
- the shallow copy
-
shallowCopy
public AbstractViewPlugin shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopy
in interfaceShallowCopySupporter<AbstractViewPlugin>
- Parameters:
expand
- whether to expand variables to their current values- Returns:
- the shallow copy
-
getPlugins
public static String[] getPlugins()
Returns a list with classnames of plugins.- Returns:
- the plugin classnames
-
-