Class AbstractAnnotator
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.visualization.object.annotator.AbstractAnnotator
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
AbstractReportBasedAnnotator
,ClassificationLabelAnnotator
,NullAnnotator
public abstract class AbstractAnnotator extends AbstractOptionHandler implements CleanUpHandler
Ancestor for annotation handlers.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected ObjectAnnotationPanel
m_Owner
the owner.protected boolean
m_Selecting
whether the selection box is currently been drawn.-
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 AbstractAnnotator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
annotationsChanged()
Hook method for when annotations change.protected void
applyStroke(Graphics g, float stroke)
Applies the stroke thickness.void
cleanUp()
Cleans up data structures, frees up memory.protected abstract void
doInstall()
Installs the annotator with the owner.protected abstract void
doPaintSelection(Graphics g)
Paints the selection.protected abstract void
doUninstall()
Uninstalls the annotator with the owner.String
getCurrentLabel()
Returns the currently set label.ObjectAnnotationPanel
getOwner()
Returns the owner.protected float
getStrokeWidth(Graphics g, float defValue)
Returns the thickness of the stroke.boolean
hasCurrentLabel()
Checks whether an actual label is set.protected void
initialize()
Initializes the members.void
install()
Installs the annotator with the owner.void
labelChanged()
Gets called when the label changes.void
paintSelection(Graphics g)
Paints the selection.void
setOwner(ObjectAnnotationPanel value)
Sets the owner.void
uninstall()
Uninstalls the annotator with the owner.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, destroy, finishInit, 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_Owner
protected ObjectAnnotationPanel m_Owner
the owner.
-
m_Selecting
protected boolean m_Selecting
whether the selection box is currently been drawn.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractOptionHandler
-
setOwner
public void setOwner(ObjectAnnotationPanel value)
Sets the owner.- Parameters:
value
- the owner
-
getOwner
public ObjectAnnotationPanel getOwner()
Returns the owner.- Returns:
- the owner
-
doInstall
protected abstract void doInstall()
Installs the annotator with the owner.
-
install
public void install()
Installs the annotator with the owner.
-
doUninstall
protected abstract void doUninstall()
Uninstalls the annotator with the owner.
-
uninstall
public void uninstall()
Uninstalls the annotator with the owner.
-
annotationsChanged
public void annotationsChanged()
Hook method for when annotations change.
-
hasCurrentLabel
public boolean hasCurrentLabel()
Checks whether an actual label is set.- Returns:
- true if actual label set
-
getCurrentLabel
public String getCurrentLabel()
Returns the currently set label.- Returns:
- the label, can be null
-
labelChanged
public void labelChanged()
Gets called when the label changes.
Default implementation does nothing.
-
getStrokeWidth
protected float getStrokeWidth(Graphics g, float defValue)
Returns the thickness of the stroke.- Parameters:
g
- graphics context to get the thickness fromdefValue
- the default value to return in case of failure- Returns:
- the stroke, default value if failed to extract
-
applyStroke
protected void applyStroke(Graphics g, float stroke)
Applies the stroke thickness.- Parameters:
stroke
- the thickness to apply
-
doPaintSelection
protected abstract void doPaintSelection(Graphics g)
Paints the selection.- Parameters:
g
- the graphics context
-
paintSelection
public void paintSelection(Graphics g)
Paints the selection.- Parameters:
g
- the graphics context
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceCleanUpHandler
-
-