Class AbstractPaintlet
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.visualization.image.paintlet.AbstractPaintlet
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,ShallowCopySupporter<Paintlet>,SizeOfHandler,Paintlet,Serializable
- Direct Known Subclasses:
Null
public abstract class AbstractPaintlet extends AbstractOptionHandler implements Paintlet
An abstract superclass for paint engines that can be plugged into panels.- 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_Enabledwhether the paintlet is enabled.protected booleanm_Initializingwhether the paintlet is currently being initialized and should ignore repaint requests.protected ImagePanelm_Panelthe panel this paintlet is for.protected booleanm_RepaintOnChangewhether the paintlet reacts with repaints to changes of its members.-
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 AbstractPaintlet()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidfinishInit()Finishes the initialization in the constructor.static PaintletforCommandLine(String cmdline)Instantiates the paintlet from the given commandline (i.e., classname and optional options).static PaintletforName(String classname, String[] options)Instantiates the paintlet with the given options.static String[]getPaintlets()Returns a list with classnames of paintlets.ImagePanel.PaintPanelgetPaintPanel()Returns the paint panel of the panel, null if no panel present.ImagePanelgetPanel()Returns the panel currently in use.ImagePanel.PaintPanelgetPlot()Returns the plot panel of the panel, null if no panel present.booleangetRepaintOnChange()Returns whether the paintlet reacts with repaints to changes of its members.booleanhasPanel()Returns whether a panel has been set.protected voidinitialize()Initializes the members.booleanisEnabled()Returns whether the paintlet is currently enabled.protected booleanisInitializing()Whether the paintlet is currently being initialized.voidmemberChanged()Executes a repaints only if the changes to members are not ignored.voidmemberChanged(boolean updatePanel)Executes a repaints only if the changes to members are not ignored.voidpaint(Graphics g)The paint routine of the paintlet.protected abstract voidperformPaint(Graphics g)The paint routine of the paintlet.voidrepaint()Repaints if possible (and enabled!).voidsetEnabled(boolean value)Sets whether the paintlet is enabled or not.voidsetPanel(ImagePanel value)Sets the panel to use, null to disable painting.voidsetPanel(ImagePanel value, boolean register)Sets the panel to use, null to disable painting.voidsetRepaintOnChange(boolean value)Sets whether the paintlet reacts with repaints to changes of its members.PaintletshallowCopy()Returns a shallow copy of itself, i.e., based on the commandline options.PaintletshallowCopy(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, getDefaultLoggingLevel, getOptionManager, globalInfo, 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_Panel
protected transient ImagePanel m_Panel
the panel this paintlet is for.
-
m_Enabled
protected boolean m_Enabled
whether the paintlet is enabled.
-
m_RepaintOnChange
protected boolean m_RepaintOnChange
whether the paintlet reacts with repaints to changes of its members.
-
m_Initializing
protected boolean m_Initializing
whether the paintlet is currently being initialized and should ignore repaint requests.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classAbstractOptionHandler
-
finishInit
protected void finishInit()
Finishes the initialization in the constructor.
Calls memberChanged.- Overrides:
finishInitin classAbstractOptionHandler- See Also:
memberChanged()
-
isInitializing
protected boolean isInitializing()
Whether the paintlet is currently being initialized.- Returns:
- true if the paintlet is currently being initialized
-
setPanel
public void setPanel(ImagePanel value)
Sets the panel to use, null to disable painting.
-
setPanel
public void setPanel(ImagePanel value, boolean register)
Sets the panel to use, null to disable painting.
-
getPanel
public ImagePanel getPanel()
Returns the panel currently in use.
-
getPaintPanel
public ImagePanel.PaintPanel getPaintPanel()
Returns the paint panel of the panel, null if no panel present.- Specified by:
getPaintPanelin interfacePaintlet- Returns:
- the paint panel
-
hasPanel
public boolean hasPanel()
Returns whether a panel has been set.
-
getPlot
public ImagePanel.PaintPanel getPlot()
Returns the plot panel of the panel, null if no panel present.- Returns:
- the plot panel
-
setEnabled
public void setEnabled(boolean value)
Sets whether the paintlet is enabled or not. Setting it to true automatically initiates a repaint. Is not affected by m_RepaintOnChange.- Specified by:
setEnabledin interfacePaintlet- Parameters:
value- if true then the paintlet is enabled- See Also:
m_RepaintOnChange
-
isEnabled
public boolean isEnabled()
Returns whether the paintlet is currently enabled.
-
setRepaintOnChange
public void setRepaintOnChange(boolean value)
Sets whether the paintlet reacts with repaints to changes of its members.- Specified by:
setRepaintOnChangein interfacePaintlet- Parameters:
value- if true then the paintlet repaints whenever members get changed
-
getRepaintOnChange
public boolean getRepaintOnChange()
Returns whether the paintlet reacts with repaints to changes of its members.- Specified by:
getRepaintOnChangein interfacePaintlet- Returns:
- true if paintlet repaints whenever members get changed
-
performPaint
protected abstract void performPaint(Graphics g)
The paint routine of the paintlet.- Parameters:
g- the graphics context to use for painting
-
paint
public void paint(Graphics g)
The paint routine of the paintlet.- Specified by:
paintin interfacePaintlet- Parameters:
g- the graphics context to use for painting- See Also:
isEnabled()
-
memberChanged
public void memberChanged()
Executes a repaints only if the changes to members are not ignored.- See Also:
getRepaintOnChange(),isInitializing(),repaint()
-
memberChanged
public void memberChanged(boolean updatePanel)
Executes a repaints only if the changes to members are not ignored.- Parameters:
updatePanel- whether to call the update() method of the associated panel- See Also:
getRepaintOnChange(),isInitializing(),repaint()
-
repaint
public void repaint()
Repaints if possible (and enabled!).- See Also:
m_Panel,isEnabled()
-
shallowCopy
public Paintlet shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopyin interfaceShallowCopySupporter<Paintlet>- Returns:
- the shallow copy
-
shallowCopy
public Paintlet shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopyin interfaceShallowCopySupporter<Paintlet>- Parameters:
expand- whether to expand variables to their current values- Returns:
- the shallow copy
-
getPaintlets
public static String[] getPaintlets()
Returns a list with classnames of paintlets.- Returns:
- the filter classnames
-
forName
public static Paintlet forName(String classname, String[] options)
Instantiates the paintlet with the given options.- Parameters:
classname- the classname of the paintlet to instantiateoptions- the options for the paintlet- Returns:
- the instantiated paintlet or null if an error occurred
-
forCommandLine
public static Paintlet forCommandLine(String cmdline)
Instantiates the paintlet from the given commandline (i.e., classname and optional options).- Parameters:
cmdline- the classname (and optional options) of the paintlet to instantiate- Returns:
- the instantiated paintlet or null if an error occurred
-
-