Class AbstractDataPlugin
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.tools.spreadsheetviewer.AbstractDataPlugin
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,ShallowCopySupporter<AbstractDataPlugin>,SizeOfHandler,Serializable
- Direct Known Subclasses:
AbstractDataPluginWithGOE,AbstractSelectedSheetsDataPlugin
public abstract class AbstractDataPlugin extends AbstractOptionHandler implements ShallowCopySupporter<AbstractDataPlugin>
Ancestor for "processing" 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 booleanm_CanceledByUserwhether the user canceled the operation.protected SpreadSheetPanelm_CurrentPanelthe current panel.protected static Hashtable<Class,Object>m_LastSetupfor storing the last setup for a plugin.-
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 AbstractDataPlugin()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleancanProcess(SpreadSheetPanel panel)Returns whether the panel can be processed.protected Stringcheck(SpreadSheet sheet)Checks the spreadsheet.protected abstract SpreadSheetdoProcess(SpreadSheet sheet)Performs the actual processing of the spreadsheet.booleangetCanceledByUser()Returns whether the operation was canceled by the user.SpreadSheetPanelgetCurrentPanel()Returns the current panel.protected ObjectgetLastSetup()Returns the last setup for this object's class.abstract StringgetMenuIcon()Returns the file name of the icon.abstract StringgetMenuText()Returns the text of the menu item.static String[]getPlugins()Returns a list with classnames of plugins.protected booleanhasLastSetup()Checks whether there is a setup available for the class of this object.abstract booleanisInPlace()Returns whether the processed sheet should rather get placed ("in-place") in the same tab rather than in a new one.SpreadSheetprocess(SpreadSheet sheet)Processes the spreadsheet.voidsetCurrentPanel(SpreadSheetPanel value)Sets the current panel.protected voidsetLastSetup(Object setup)Stores the setup for this object's class.AbstractDataPluginshallowCopy()Returns a shallow copy of itself, i.e., based on the commandline options.AbstractDataPluginshallowCopy(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_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
-
isInPlace
public abstract boolean isInPlace()
Returns whether the processed sheet should rather get placed ("in-place") in the same tab rather than in a new one.- Returns:
- true if to replace current sheet with processed one
-
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
-
canProcess
public boolean canProcess(SpreadSheetPanel panel)
Returns whether the panel can be processed.- Parameters:
panel- the panel to check- Returns:
- true if can be processed
-
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
-
doProcess
protected abstract SpreadSheet doProcess(SpreadSheet sheet)
Performs the actual processing of the spreadsheet.- Parameters:
sheet- the sheet to process- Returns:
- the processed sheet
-
process
public SpreadSheet process(SpreadSheet sheet)
Processes the spreadsheet.- Parameters:
sheet- the sheet to process- Returns:
- the processed sheet
- Throws:
IllegalArgumentException- if the check failed- See Also:
check(SpreadSheet)
-
shallowCopy
public AbstractDataPlugin shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopyin interfaceShallowCopySupporter<AbstractDataPlugin>- Returns:
- the shallow copy
-
shallowCopy
public AbstractDataPlugin shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopyin interfaceShallowCopySupporter<AbstractDataPlugin>- 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
-
-