gov.noaa.pmel.sgt.beans
Class AxisHolder

java.lang.Object
  extended by gov.noaa.pmel.sgt.beans.AxisHolder
All Implemented Interfaces:
java.io.Serializable

public class AxisHolder
extends java.lang.Object
implements java.io.Serializable

Contains the data necessary to instantiate an axis. This class is used with DataGroup.

Since:
3.0
Version:
$Revision$, $Date$
Author:
Donald Denbo
See Also:
Serialized Form

Constructor Summary
AxisHolder()
          Default constructor.
AxisHolder(int type, int dir, DataGroup dataGroup)
          Construct a new AxisHolder.
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener l)
          Add a ChangeListener.
 java.awt.Color getAxisColor()
          Get the axis color.
 int getAxisOrientation()
          Get the axis orientation.
 Point2D.Double getAxisOriginP()
          Get axis origin.
 int getAxisPosition()
          Get the axis position
 int getAxisType()
          Get the axis type.
 Rectangle2D getBoundsP()
          Get axis bounds.
 DataGroup getDataGroup()
          Get the DataGroup parent.
 java.awt.Color getLabelColor()
          Get the axis label color.
 java.awt.Font getLabelFont()
          Get the axis label font.
 java.lang.String getLabelFormat()
          Get the label format.
 double getLabelHeightP()
          Get label height.
 int getLabelInterval()
          Get the label interval.
 int getLabelPosition()
          If labelPosition is AUTO then return computed labelPosition, otherwise return stored value
 int getLabelSignificantDigits()
          Get axis label significant digits
 double getLargeTicHeightP()
          Get large tic height.
 java.lang.String getMajorFormat()
          Get time axis major label format
 int getMajorInterval()
          Get time axis major label interval
 java.lang.String getMinorFormat()
          Get time axis minor label format.
 int getMinorInterval()
          Get time axis minor label interval
 int getNumSmallTics()
          Get the number of small tics.
 Range2D getRangeP()
          Get range of axis (long direction) in physical coordinates.
 double getSmallTicHeightP()
          Get small tic height.
 double getThickTicWidth()
          Get the thick tic width.
 int getTicPosition()
          If ticPosition is AUTO then returns computed position, otherwise returns stored value.
 int getTimeAxisStyle()
          Get the time axis style.
 SGLabel getTitle()
          Get the axis title.
 java.lang.String getTransformGroup()
          Get transform group name.
 int getTransformType()
          Get the axis transform type.
 SoTRange getUserRange()
          Get the user range.
 boolean isAutoRange()
          Test if the axis in autoRange mode.
 boolean isLabelPositionAuto()
          Test if label position in auto mode.
 boolean isLocationAtOrigin()
          Test if the axis at the origin.
 boolean isSelectable()
          Test if the axis selectable.
 boolean isTicPositionAuto()
          Test if tic position in auto mode.
 boolean isTime()
          Test if the axis time.
 boolean isTitleAuto()
          Test if the title in auto mode.
 boolean isVisible()
          Test if the axis visible.
 void removeAllChangeListeners()
          Remove all ChangeListeners.
 void removeChangeListener(javax.swing.event.ChangeListener l)
          Remove a ChangeListener.
 void removeDesignChangeListeners()
          Remove all ChangeListeners that implement the DesignListener interface.
 void setAutoRange(boolean autoRange)
          Set autoRange property.
 void setAxisColor(java.awt.Color axisColor)
          Set axis color.
 void setAxisOrientation(int dir)
          Set the axis orientation.
 void setAxisOriginP(Point2D.Double axisOriginP)
          Set the axis origin in physical coordinates.
 void setAxisPosition(int axisPosition)
          Set the axis position.
 void setAxisType(int axisType)
          Set the axis type.
 void setBoundsP(Rectangle2D boundsP)
          Set bounds of axis in physical coordinates.
 void setDataGroup(DataGroup dataGroup)
          Set the parent DataGroup.
 void setLabelColor(java.awt.Color labelColor)
          Set axis label color.
 void setLabelFont(java.awt.Font labelFont)
          Set the axis label font.
 void setLabelFormat(java.lang.String labelFormat)
          Set the axis label format.
 void setLabelHeightP(double labelHeightP)
          Set label height in physical coordinates (inches).
 void setLabelInterval(int labelInterval)
          Set the label interval.
 void setLabelPosition(int labelPosition)
          Set the label position.
 void setLabelSignificantDigits(int labelSignificantDigits)
          Set the axis label significant digits.
 void setLargeTicHeightP(double largeTicHeightP)
          Set large tic height in physical coordinates.
 void setLocationAtOrigin(boolean locationAtOrigin)
          Set axis at origin of perpendicular axis.
 void setMajorFormat(java.lang.String majorFormat)
          Get the time axis major label format.
 void setMajorInterval(int majorInterval)
          Set time axis major label interval.
 void setMinorFormat(java.lang.String minorFormat)
          Set the time axis minor label format.
 void setMinorInterval(int minorInterval)
          Set time axis minor label interval.
 void setNumSmallTics(int numSmallTics)
          Set the number of small tics between the large tics.
 void setSelectable(boolean selectable)
          Set the selecatability of the axis.
 void setSmallTicHeightP(double smallTicHeightP)
          Set small tic height in physical coordinates.
 void setThickTicWidth(double thickTicWidth)
          Set the thick tic width (for Time axes).
 void setTicPosition(int ticPosition)
          Set the tic position.
 void setTimeAxisStyle(int timeAxisStyle)
          Set the time axis style.
 void setTitle(SGLabel title)
          Set the axis title.
 void setTitleAuto(boolean titleAuto)
          Set the title auto property.
 void setTransformGroup(java.lang.String transformGroup)
          Set the transform group.
 void setTransformType(int transformType)
          Set the axis transform type.
 void setUserRange(SoTRange userRange)
          Set the user range.
 void setVisible(boolean visible)
          Set/unset the axis visibility.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AxisHolder

public AxisHolder()
Default constructor. The methods setAxisType, setAxisOrientation, and setDataGroup must be called.


AxisHolder

public AxisHolder(int type,
                  int dir,
                  DataGroup dataGroup)
Construct a new AxisHolder. This constructor includes the necessary fields.

Parameters:
type - Type of axis
dir - Direction of axis
dataGroup - DataGroup parent
See Also:
setAxisType, setAxisOrientation, setDataGroup
Method Detail

getDataGroup

public DataGroup getDataGroup()
Get the DataGroup parent.

Returns:
DataGroup parent

setDataGroup

public void setDataGroup(DataGroup dataGroup)
Set the parent DataGroup. No default.

Parameters:
dataGroup - Parent object to AxisHolder

isTime

public boolean isTime()
Test if the axis time.

Returns:
True if axis is time.

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener l)
Remove a ChangeListener.

Parameters:
l - ChangeListener to remove

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener l)
Add a ChangeListener. Listener will be notified if a change occurs.

Parameters:
l - ChangeListener to add.

removeDesignChangeListeners

public void removeDesignChangeListeners()
Remove all ChangeListeners that implement the DesignListener interface.

See Also:
DesignListener

removeAllChangeListeners

public void removeAllChangeListeners()
Remove all ChangeListeners.


setAxisType

public void setAxisType(int axisType)
Set the axis type. The possible types include:
 axisType = DataGroup.PLAIN, DataGroup.TIME, or DataGroup.LOG
 
No default.

Parameters:
axisType - (see above)

getAxisType

public int getAxisType()
Get the axis type.

Returns:
axis type

getAxisOrientation

public int getAxisOrientation()
Get the axis orientation.

Returns:
axis orientation.

setAxisOrientation

public void setAxisOrientation(int dir)
Set the axis orientation. Orientations are:
 axisOrientation = DataGroup.X_DIR or DataGroup.Y_DIR
 
No default.

Parameters:
dir - axis orientation

setAxisColor

public void setAxisColor(java.awt.Color axisColor)
Set axis color. Default = black.

Parameters:
axisColor - axis color

getAxisColor

public java.awt.Color getAxisColor()
Get the axis color.

Returns:
axis color

setAutoRange

public void setAutoRange(boolean autoRange)
Set autoRange property. True to automatically compute the axis range from the data. Default = true.

Parameters:
autoRange - auto range

isAutoRange

public boolean isAutoRange()
Test if the axis in autoRange mode.

Returns:
True, if in autoRange mode.

setUserRange

public void setUserRange(SoTRange userRange)
Set the user range. User range is only used if autoRange is false. Default = (1, 10, 1)

Parameters:
userRange - user supplied range

getUserRange

public SoTRange getUserRange()
Get the user range.

Returns:
user range

setLabelColor

public void setLabelColor(java.awt.Color labelColor)
Set axis label color. Default = black.

Parameters:
labelColor - label color

getLabelColor

public java.awt.Color getLabelColor()
Get the axis label color.

Returns:
axis label color

setLabelFont

public void setLabelFont(java.awt.Font labelFont)
Set the axis label font. Default = ("Helvetica", ITALIC, 10).

Parameters:
labelFont - label font

getLabelFont

public java.awt.Font getLabelFont()
Get the axis label font.

Returns:
axis label font

setLabelHeightP

public void setLabelHeightP(double labelHeightP)
Set label height in physical coordinates (inches). Default = 0.15.

Parameters:
labelHeightP - label height

getLabelHeightP

public double getLabelHeightP()
Get label height.

Returns:
label height in physical coordinates

setLabelPosition

public void setLabelPosition(int labelPosition)
Set the label position. Label position can be:
 labelPosition = Axis.AUTO, Axis.POSITIVE_SIDE,
                 Axis.NEGATIVE_SIDE, Axis.NO_LABEL
 
Default = AUTO.

Parameters:
labelPosition - label position

isLabelPositionAuto

public boolean isLabelPositionAuto()
Test if label position in auto mode.

Returns:
true if in auto mode

getLabelPosition

public int getLabelPosition()
If labelPosition is AUTO then return computed labelPosition, otherwise return stored value

Returns:
label position

setBoundsP

public void setBoundsP(Rectangle2D boundsP)
Set bounds of axis in physical coordinates. Default = (0, 0, 0, 0).

Parameters:
boundsP - axis bounds

getBoundsP

public Rectangle2D getBoundsP()
Get axis bounds.

Returns:
axis bounds in physical coordinates.

getRangeP

public Range2D getRangeP()
Get range of axis (long direction) in physical coordinates. The bounds are used to determine the axis range.

Returns:
axis range (long direction)

setLargeTicHeightP

public void setLargeTicHeightP(double largeTicHeightP)
Set large tic height in physical coordinates. Default = 0.1.

Parameters:
largeTicHeightP - large tic height

getLargeTicHeightP

public double getLargeTicHeightP()
Get large tic height.

Returns:
large tic height in physical coordinates.

setSmallTicHeightP

public void setSmallTicHeightP(double smallTicHeightP)
Set small tic height in physical coordinates. Default = 0.05.

Parameters:
smallTicHeightP - small tic height

getSmallTicHeightP

public double getSmallTicHeightP()
Get small tic height.

Returns:
small tic height in physical coordinates

setNumSmallTics

public void setNumSmallTics(int numSmallTics)
Set the number of small tics between the large tics. This should be one less than the number of intervals you want. Default = 0.

Parameters:
numSmallTics - number of small tics

getNumSmallTics

public int getNumSmallTics()
Get the number of small tics.

Returns:
number of small tics between large tics

setThickTicWidth

public void setThickTicWidth(double thickTicWidth)
Set the thick tic width (for Time axes). Default = 0.025.

Parameters:
thickTicWidth - thick tic width

getThickTicWidth

public double getThickTicWidth()
Get the thick tic width. Valid for Time axes

Returns:
thick tic width

setTicPosition

public void setTicPosition(int ticPosition)
Set the tic position. Tic position include:
 ticPosition = Axis.AUTO, Axis.POSITIVE_SIDE,
               Axis.NEGATIVE_SIDE, Axis.BOTH_SIDES
 
Default = AUTO.

Parameters:
ticPosition - tic position

isTicPositionAuto

public boolean isTicPositionAuto()
Test if tic position in auto mode.

Returns:
true if in auto mode

getTicPosition

public int getTicPosition()
If ticPosition is AUTO then returns computed position, otherwise returns stored value.

Returns:
tic position

setTitle

public void setTitle(SGLabel title)
Set the axis title. Axis title is a SGLabel enabling the Color, Font, size to be set.

Parameters:
title - axis title

getTitle

public SGLabel getTitle()
Get the axis title.

Returns:
axis title

setSelectable

public void setSelectable(boolean selectable)
Set the selecatability of the axis. If true, axis can be selected with the mouse. Default = true.

Parameters:
selectable - selectable

isSelectable

public boolean isSelectable()
Test if the axis selectable.

Returns:
true, if the axis can be selected

setVisible

public void setVisible(boolean visible)
Set/unset the axis visibility. If true, the axis will be displayed. Default = true.

Parameters:
visible - visible

isVisible

public boolean isVisible()
Test if the axis visible.

Returns:
true, if axis is set visible

setLabelFormat

public void setLabelFormat(java.lang.String labelFormat)
Set the axis label format. Not used with time axes. Default = ""

Parameters:
labelFormat - axis label format

getLabelFormat

public java.lang.String getLabelFormat()
Get the label format.

Returns:
label format.

setLabelInterval

public void setLabelInterval(int labelInterval)
Set the label interval. Not used with time axes. Default = 2.

Parameters:
labelInterval - axis label interval

getLabelInterval

public int getLabelInterval()
Get the label interval.

Returns:
label interval

setLabelSignificantDigits

public void setLabelSignificantDigits(int labelSignificantDigits)
Set the axis label significant digits. Not used with time axes. Default = 2.

Parameters:
labelSignificantDigits - axis label significant digits

getLabelSignificantDigits

public int getLabelSignificantDigits()
Get axis label significant digits

Returns:
significant digits

setMinorFormat

public void setMinorFormat(java.lang.String minorFormat)
Set the time axis minor label format. Default = "MMM", appropriate for MONTH_YEAR.

Parameters:
minorFormat - time axis minor format

getMinorFormat

public java.lang.String getMinorFormat()
Get time axis minor label format.

Returns:
minor label format

setMajorFormat

public void setMajorFormat(java.lang.String majorFormat)
Get the time axis major label format. Default = "yyyy", appropriate for MONTH_YEAR.

Parameters:
majorFormat - time axis major format

getMajorFormat

public java.lang.String getMajorFormat()
Get time axis major label format

Returns:
major label format

setMinorInterval

public void setMinorInterval(int minorInterval)
Set time axis minor label interval. Default = 2.

Parameters:
minorInterval - time axis minor interval

getMinorInterval

public int getMinorInterval()
Get time axis minor label interval

Returns:
minor label interval

setMajorInterval

public void setMajorInterval(int majorInterval)
Set time axis major label interval. Default = 1.

Parameters:
majorInterval - time axis major interval

getMajorInterval

public int getMajorInterval()
Get time axis major label interval

Returns:
major label interval

setTimeAxisStyle

public void setTimeAxisStyle(int timeAxisStyle)
Set the time axis style. Styles include:
 timeAxisStyle = TimeAxis.AUTO, TimeAxis.DAY_MONTH, TimeAxis.HOUR_DAY,
                 TimeAxis.MINUTE_HOUR, TimeAxis.MONTH_YEAR,
                 TimeAxis.YEAR_DECADE
 
Default = AUTO.

Parameters:
timeAxisStyle - time axis style

getTimeAxisStyle

public int getTimeAxisStyle()
Get the time axis style.

Returns:
time axis style

setTransformType

public void setTransformType(int transformType)
Set the axis transform type. Transform types include:
 transformType = DataGroup.LINEAR, DataGroup.LOG, DataGroup.REFERENCE
 
Default = LINEAR.

Parameters:
transformType - axis transform type

getTransformType

public int getTransformType()
Get the axis transform type.

Returns:
transform type

setTransformGroup

public void setTransformGroup(java.lang.String transformGroup)
Set the transform group. The transform group is used when the transformType = DataGroup.REFERENCE. The transformGroup is the DataGroup id containing the transform to be referenced. No default.

Parameters:
transformGroup - axis transform group name

getTransformGroup

public java.lang.String getTransformGroup()
Get transform group name.

Returns:
transform group

setAxisPosition

public void setAxisPosition(int axisPosition)
Set the axis position. Axis positions include:
 axisPosition = DataGroup.TOP, DataGroup.BOTTOM, (for x axes)
                DataGroup.LEFT, DataGroup.RIGHT, (for y axes)
                DataGroup.MANUAL
 
No default.

Parameters:
axisPosition - axis position

getAxisPosition

public int getAxisPosition()
Get the axis position

Returns:
axis position

setAxisOriginP

public void setAxisOriginP(Point2D.Double axisOriginP)
Set the axis origin in physical coordinates. This is used when axisPosition = MANUAL. Default = (0, 0).

Parameters:
axisOriginP - axis origin

getAxisOriginP

public Point2D.Double getAxisOriginP()
Get axis origin.

Returns:
axis origin

setLocationAtOrigin

public void setLocationAtOrigin(boolean locationAtOrigin)
Set axis at origin of perpendicular axis. Not implemented. Default = false.

Parameters:
locationAtOrigin - set location at origin

isLocationAtOrigin

public boolean isLocationAtOrigin()
Test if the axis at the origin. Not presently implemented.

Returns:
true, if axis will be at origin

setTitleAuto

public void setTitleAuto(boolean titleAuto)
Set the title auto property. Set true to determine the title from the data. Default = true.

Parameters:
titleAuto - auto title property

isTitleAuto

public boolean isTitleAuto()
Test if the title in auto mode.

Returns:
true, if title is automatically generated