org.geotools.axis
Class AbstractGraduation

java.lang.Object
  extended byorg.geotools.axis.AbstractGraduation
All Implemented Interfaces:
Graduation, java.io.Serializable
Direct Known Subclasses:
DateGraduation, NumberGraduation

public abstract class AbstractGraduation
extends java.lang.Object
implements Graduation, java.io.Serializable

Base class for graduation.

Since:
2.0
Version:
$Id: AbstractGraduation.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux
See Also:
Serialized Form

Field Summary
protected  java.beans.PropertyChangeSupport listenerList
          A list of event listeners for this component.
 
Fields inherited from interface org.geotools.axis.Graduation
AXIS_TITLE_FONT, TICK_LABEL_FONT, VISUAL_AXIS_LENGTH, VISUAL_TICK_SPACING
 
Constructor Summary
AbstractGraduation(javax.units.Unit unit)
          Construct a graduation with the supplied units.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list.
 boolean equals(java.lang.Object object)
          Compares this graduation with the specified object for equality.
 java.util.Locale getLocale()
          Returns the locale to use for formatting labels.
 java.lang.String getTitle(boolean includeSymbol)
          Returns the axis title.
 javax.units.Unit getUnit()
          Returns the graduation's units, or if unknow.
 int hashCode()
          Returns a hash value for this graduation.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list.
 void setLocale(java.util.Locale locale)
          Set the locale to use for formatting labels.
abstract  boolean setMaximum(double value)
          Set the maximum value for this graduation.
abstract  boolean setMinimum(double value)
          Set the minimum value for this graduation.
 void setTitle(java.lang.String title)
          Set the axis title, not including unit symbol.
 void setUnit(javax.units.Unit unit)
          Changes the graduation's units.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.geotools.axis.Graduation
getFormat, getMaximum, getMinimum, getRange, getTickIterator
 

Field Detail

listenerList

protected final java.beans.PropertyChangeSupport listenerList
A list of event listeners for this component.

Constructor Detail

AbstractGraduation

public AbstractGraduation(javax.units.Unit unit)
Construct a graduation with the supplied units.

Parameters:
unit - The axis's units, or if unknow.
Method Detail

setMinimum

public abstract boolean setMinimum(double value)
                            throws java.lang.IllegalArgumentException
Set the minimum value for this graduation. If the new minimum is greater than the current maximum, then the maximum will also be set to a value greater than or equals to the minimum.

Parameters:
value - The new minimum in getUnit() units.
Returns:
if the state of this graduation changed as a result of this call, or if the new value is identical to the previous one.
Throws:
java.lang.IllegalArgumentException - If is NaN ou infinite.
See Also:
Graduation.getMinimum(), setMaximum(double)

setMaximum

public abstract boolean setMaximum(double value)
                            throws java.lang.IllegalArgumentException
Set the maximum value for this graduation. If the new maximum is less than the current minimum, then the minimum will also be set to a value less than or equals to the maximum.

Parameters:
value - The new maximum in getUnit() units.
Returns:
if the state of this graduation changed as a result of this call, or if the new value is identical to the previous one.
Throws:
java.lang.IllegalArgumentException - If is NaN ou infinite.
See Also:
Graduation.getMaximum(), setMinimum(double)

getTitle

public java.lang.String getTitle(boolean includeSymbol)
Returns the axis title. If is , then the returned string will includes units as in "Temperature (?C)". The exact formatting is local-dependent.

Specified by:
getTitle in interface Graduation
Parameters:
includeSymbol - to format unit symbol after the name.
Returns:
The graduation name (also to be use as axis title).

setTitle

public void setTitle(java.lang.String title)
Set the axis title, not including unit symbol. This method will fire a property change event with the property name.

Parameters:
title - New axis title, or to remove any previous setting.

getUnit

public javax.units.Unit getUnit()
Returns the graduation's units, or if unknow.

Specified by:
getUnit in interface Graduation

setUnit

public void setUnit(javax.units.Unit unit)
             throws javax.units.ConversionException
Changes the graduation's units. Subclasses will automatically convert minimum and maximum values from the old units to the new one. This method fires a property change event with the property name.

Parameters:
unit - The new units, or if unknow. If null, minimum and maximum values are not converted.
Throws:
javax.units.ConversionException - if units are not convertible, or if the specified units is illegal for this graduation.

getLocale

public java.util.Locale getLocale()
Returns the locale to use for formatting labels.

Specified by:
getLocale in interface Graduation

setLocale

public void setLocale(java.util.Locale locale)
Set the locale to use for formatting labels. This will fire a property change event with the property name.


addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. The listener is registered for all properties. A PropertyChangeEvent will get fired in response to setting a property, such as setTitle(java.lang.String) or setLocale(java.util.Locale).

Specified by:
addPropertyChangeListener in interface Graduation

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list.

Specified by:
removePropertyChangeListener in interface Graduation

equals

public boolean equals(java.lang.Object object)
Compares this graduation with the specified object for equality. This method do not compare listeners registered in listenerList.


hashCode

public int hashCode()
Returns a hash value for this graduation.



Copyright © GeoTools. All Rights Reserved.