Class AbstractDateBasedAxisModel
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.gui.visualization.core.axis.AbstractAxisModel
-
- adams.gui.visualization.core.axis.AbstractDateBasedAxisModel
-
- All Implemented Interfaces:
LoggingSupporter
,SizeOfHandler
,FlippableAxisModel
,Serializable
- Direct Known Subclasses:
DateAxisModel
,DateTimeAxisModel
,DateTimeMsecAxisModel
,TimeAxisModel
public abstract class AbstractDateBasedAxisModel extends AbstractAxisModel implements FlippableAxisModel
Ancestor axis model for displaying date-based values.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_Flipped
whether the axis is flipped.-
Fields inherited from class adams.gui.visualization.core.axis.AbstractAxisModel
m_ActualMaximum, m_ActualMaximumNoMargin, m_ActualMinimum, m_ActualMinimumNoMargin, m_CustomerFormatter, m_Formatter, m_ManualMarginBottom, m_ManualMarginTop, m_ManualMaximum, m_ManualMinimum, m_MarginBottom, m_MarginTop, m_Maximum, m_Minimum, m_NthValueToShow, m_Parent, m_PixelOffset, m_PixelOffsets, m_TickGenerator, m_Validated, m_ZoomHandler
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractDateBasedAxisModel()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description double
adjustMaximum(double max)
Adjusts the maximum to work with this model.double
adjustMinimum(double min)
Adjusts the minimum to work with this model.void
assign(AbstractAxisModel model)
Obtains the necessary values from the given model and updates itself.protected boolean
canAssignFormatter(Formatter formatter)
Returns whether the formatter can be assigned.boolean
canHandle(double min, double max)
Checks whether the data range can be handled by the model.protected String
doValueToDisplay(double value)
Returns the display string of the value for the tooltip, for instance.protected abstract String
getDefaultDateFormat()
Returns the default format for the date/time formatter.protected Formatter
getDefaultFormatter()
Returns the default formatter.abstract String
getDisplayName()
Returns the display name of this model.protected void
initialize()
Initializes the member variables.boolean
isFlipped()
Returns whether the axis is flipped.double
posToValue(int pos)
Returns the value for the given position on the axis.void
pushZoom(double min, double max)
Adds the zoom to its internal list and updates the axis.void
setFlipped(boolean value)
Sets whether to flip the axis.int
valueToPos(double value)
Returns the position on the axis for the given value.-
Methods inherited from class adams.gui.visualization.core.axis.AbstractAxisModel
canZoom, clearZoom, getActualFormatter, getActualMaximum, getActualMaximumNoMargin, getActualMinimum, getActualMinimumNoMargin, getBottomMargin, getCustomFormatter, getDefaultNumberFormat, getManualBottomMargin, getManualMaximum, getManualMinimum, getManualTopMargin, getMaximum, getMinimum, getMinZoomDifference, getNthValueToShow, getNumberFormat, getParent, getPixelOffset, getTickGenerator, getTicks, getTopMargin, hasCustomFormatter, invalidate, isZoomed, popZoom, setBottomMargin, setCustomFormatter, setManualBottomMargin, setManualMaximum, setManualMinimum, setManualTopMargin, setMaximum, setMinimum, setNthValueToShow, setNumberFormat, setParent, setPixelOffset, setTickGenerator, setTopMargin, toString, update, validate, valueToDisplay
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the member variables.- Overrides:
initialize
in classAbstractAxisModel
-
getDefaultFormatter
protected Formatter getDefaultFormatter()
Returns the default formatter.- Overrides:
getDefaultFormatter
in classAbstractAxisModel
- Returns:
- the formatter
-
assign
public void assign(AbstractAxisModel model)
Obtains the necessary values from the given model and updates itself.- Overrides:
assign
in classAbstractAxisModel
- Parameters:
model
- the model to get the parameters from
-
canAssignFormatter
protected boolean canAssignFormatter(Formatter formatter)
Returns whether the formatter can be assigned.- Overrides:
canAssignFormatter
in classAbstractAxisModel
- Parameters:
formatter
- the formatter to check- Returns:
- true if it can be used
-
canHandle
public boolean canHandle(double min, double max)
Checks whether the data range can be handled by the model.- Specified by:
canHandle
in classAbstractAxisModel
- Parameters:
min
- the minimum valuemax
- the maximum value- Returns:
- always true
-
adjustMinimum
public double adjustMinimum(double min)
Adjusts the minimum to work with this model.- Specified by:
adjustMinimum
in classAbstractAxisModel
- Parameters:
min
- the minimum to adjust- Returns:
- the updated value
-
adjustMaximum
public double adjustMaximum(double max)
Adjusts the maximum to work with this model.- Specified by:
adjustMaximum
in classAbstractAxisModel
- Parameters:
max
- the maximum to adjust- Returns:
- the updated value
-
getDefaultDateFormat
protected abstract String getDefaultDateFormat()
Returns the default format for the date/time formatter.- Returns:
- the format string
-
getDisplayName
public abstract String getDisplayName()
Returns the display name of this model.- Specified by:
getDisplayName
in classAbstractAxisModel
- Returns:
- the display name
-
setFlipped
public void setFlipped(boolean value)
Sets whether to flip the axis.- Specified by:
setFlipped
in interfaceFlippableAxisModel
- Parameters:
value
- if true the axis gets flipped
-
isFlipped
public boolean isFlipped()
Returns whether the axis is flipped.- Specified by:
isFlipped
in interfaceFlippableAxisModel
- Returns:
- true if the axis is flipped
-
doValueToDisplay
protected String doValueToDisplay(double value)
Returns the display string of the value for the tooltip, for instance.- Specified by:
doValueToDisplay
in classAbstractAxisModel
- Parameters:
value
- the value to turn into string- Returns:
- the display string
-
valueToPos
public int valueToPos(double value)
Returns the position on the axis for the given value.- Specified by:
valueToPos
in classAbstractAxisModel
- Parameters:
value
- the value to get the position for- Returns:
- the corresponding position
-
posToValue
public double posToValue(int pos)
Returns the value for the given position on the axis.- Specified by:
posToValue
in classAbstractAxisModel
- Parameters:
pos
- the position to get the corresponding value for- Returns:
- the corresponding value
-
pushZoom
public void pushZoom(double min, double max)
Adds the zoom to its internal list and updates the axis.- Overrides:
pushZoom
in classAbstractAxisModel
- Parameters:
min
- the minimum of the zoommax
- the maximum of the zoom
-
-