gov.noaa.pmel.sgt.beans
Class Legend

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

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

Encapsulates reference to SGTData and key.

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

Field Summary
static int COLOR
          ColorKey legend type
static int LINE
          LineKey legend type
static int NO_BORDER
          No border line border style.
static int PLAIN_LINE
          Plain line border style.
static int POINT
          PointCollectionKey legend type
static int RAISED
          Raised line border style.
static int VECTOR
          VectorKey legend type
 
Constructor Summary
Legend()
          Default constructor.
Legend(java.lang.String id, Rectangle2D.Double boundsP)
          Legend constructor.
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener l)
          Add change listener.
protected  void fireStateChanged()
           
 int getBorderStyle()
          Get legend border style.
 Rectangle2D.Double getBoundsP()
          Get Legend bounds.
 int getColumns()
          Get number of columns.
 double getHeightP()
          Get legend height.
 java.lang.String getId()
          Get legend identifier
 double getKeyLabelHeightP()
          Get key label height.
 double getLineLength()
          Get the legend line, or vector length in physical coordinages.
 Point2D.Double getLocationP()
          Get the location of the upper left corner.
 PanelHolder getPanelHolder()
          Get PanelHolder parent.
 java.awt.Color getScaleColor()
          Get COLOR legend scale color.
 java.awt.Font getScaleLabelFont()
          Get COLOR legend scale font.
 java.lang.String getScaleLabelFormat()
          Get COLOR legend scale label format.
 double getScaleLabelHeightP()
          Get COLOR legend scale label height in physical coordinates.
 int getScaleLabelInterval()
          Get COLOR legend scale label interval.
 double getScaleLargeTicHeightP()
          Get COLOR legend scale large tick height.
 int getScaleNumberSmallTics()
          Get COLOR legend scale number of small tics.
 int getScaleSignificantDigits()
          Get COLOR legend scale significant digits.
 double getScaleSmallTicHeightP()
          Get COLOR legend scale small tick height.
 int getType()
          Get legend type.
 double getWidthP()
          Get legend width
 boolean isColor()
          Test if legend of type COLOR.
 boolean isInstantiated()
          Test if the key instantiated.
 boolean isScaleVisible()
          Test if COLOR legend scale visible.
 boolean isVisible()
          Test if legend visible.
 void removeAllChangeListeners()
          Remove all change listeners.
 void removeChangeListener(javax.swing.event.ChangeListener l)
          Remove change listener.
 void removeDesignChangeListeners()
          Remove change listeners that implement DesignListener.
 void setBorderStyle(int borderStyle)
          Set legend border style.
 void setBoundsP(Rectangle2D.Double boundsP)
          Set legend bounds.
 void setColumns(int columns)
          Set number of columns.
 void setHeightP(double heightP)
          Set legend height.
 void setId(java.lang.String id)
          Set legend identifier.
 void setInstantiated(boolean instantiated)
          Set legend state to instatiated.
 void setKeyLabelHeightP(double keyLabelHeightP)
          Set key label height in physical coordinates.
 void setLineLength(double lineLength)
          Set the legend line or vector lenght in physical units.
 void setLocationP(Point2D.Double locationP)
          Set the location of the TOP-LEFT corner
 void setPanelHolder(PanelHolder pHolder)
          Set PanelHolder parent.
 void setScaleColor(java.awt.Color scaleColor)
          Set COLOR legend scale color.
 void setScaleLabelFont(java.awt.Font scaleLabelFont)
          Set COLOR legend scale font.
 void setScaleLabelFormat(java.lang.String scaleLabelFormat)
          Set COLOR legend scale label format.
 void setScaleLabelHeightP(double scaleLabelHeightP)
          Set COLOR legend scale label heigth.
 void setScaleLabelInterval(int scaleLabelInterval)
          Set COLOR legend scale label interval.
 void setScaleLargeTicHeightP(double scaleLargeTicHeightP)
          Set COLOR legend scale large tick height in physical coordinates.
 void setScaleNumberSmallTics(int scaleNumberSmallTics)
          Set COLOR legend scale number of small tics.
 void setScaleSignificantDigits(int scaleSignificantDigits)
          Set COLOR legend scale significant digits.
 void setScaleSmallTicHeightP(double scaleSmallTicHeightP)
          Set COLOR legend scale small tick height in physical coordinates.
 void setScaleVisible(boolean scaleVisible)
          Set COLOR legend scale visible.
 void setType(int type)
          Set legend type.
 void setVisible(boolean visible)
          Set visibility for legend.
 void setWidthP(double widthP)
          Set legend width
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLAIN_LINE

public static final int PLAIN_LINE
Plain line border style.

See Also:
Constant Field Values

RAISED

public static final int RAISED
Raised line border style.

See Also:
Constant Field Values

NO_BORDER

public static final int NO_BORDER
No border line border style.

See Also:
Constant Field Values

LINE

public static final int LINE
LineKey legend type

See Also:
Constant Field Values

COLOR

public static final int COLOR
ColorKey legend type

See Also:
Constant Field Values

VECTOR

public static final int VECTOR
VectorKey legend type

See Also:
Constant Field Values

POINT

public static final int POINT
PointCollectionKey legend type

See Also:
Constant Field Values
Constructor Detail

Legend

public Legend()
Default constructor. Legend id and bounds set to null.


Legend

public Legend(java.lang.String id,
              Rectangle2D.Double boundsP)
Legend constructor.

Parameters:
id - legend identifier
boundsP - bounds in physical units
Method Detail

setId

public void setId(java.lang.String id)
Set legend identifier.

Parameters:
id - identifier

getId

public java.lang.String getId()
Get legend identifier

Returns:
ident

setBoundsP

public void setBoundsP(Rectangle2D.Double boundsP)
Set legend bounds.

Parameters:
boundsP - bounds in physical coordinates

getBoundsP

public Rectangle2D.Double getBoundsP()
Get Legend bounds.

Returns:
bounds

setLocationP

public void setLocationP(Point2D.Double locationP)
Set the location of the TOP-LEFT corner

Parameters:
locationP - upper left corner in physical coordinates

getLocationP

public Point2D.Double getLocationP()
Get the location of the upper left corner.

Returns:
upper left corner

setHeightP

public void setHeightP(double heightP)
Set legend height.

Parameters:
heightP - height on physical coordinates

getHeightP

public double getHeightP()
Get legend height.

Returns:
height

setWidthP

public void setWidthP(double widthP)
Set legend width

Parameters:
widthP - width in physcial coordinates

getWidthP

public double getWidthP()
Get legend width

Returns:
width

removeChangeListener

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

Parameters:
l - change listener

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener l)
Add change listener.

Parameters:
l - change listener

removeDesignChangeListeners

public void removeDesignChangeListeners()
Remove change listeners that implement DesignListener.


removeAllChangeListeners

public void removeAllChangeListeners()
Remove all change listeners.


fireStateChanged

protected void fireStateChanged()

setVisible

public void setVisible(boolean visible)
Set visibility for legend.

Parameters:
visible - visibility state

isVisible

public boolean isVisible()
Test if legend visible.

Returns:
true, if legend is visible

setInstantiated

public void setInstantiated(boolean instantiated)
Set legend state to instatiated. This is called internally when the property Key has been instatiated.

Parameters:
instantiated - instatiation state

isInstantiated

public boolean isInstantiated()
Test if the key instantiated.

Returns:
true, if key has been instantiated

isColor

public boolean isColor()
Test if legend of type COLOR.

Returns:
true, if legend is COLOR

getType

public int getType()
Get legend type.

Returns:
legend type.

setType

public void setType(int type)
Set legend type. Types include COLOR, LINE, POINT, and VECTOR.

Parameters:
type - legend type

getBorderStyle

public int getBorderStyle()
Get legend border style.

Returns:
border style

setBorderStyle

public void setBorderStyle(int borderStyle)
Set legend border style. Border styles include: PLAIN_LINE, RAISED, and NO_BORDER. Default = NO_BORDER.

Parameters:
borderStyle - border style

getColumns

public int getColumns()
Get number of columns. Not used with COLOR legends.

Returns:
number of columns

setColumns

public void setColumns(int columns)
Set number of columns. Not used with COLOR legends. Default = 1.

Parameters:
columns - number of columns

getLineLength

public double getLineLength()
Get the legend line, or vector length in physical coordinages. Not used with COLOR legends.

Returns:
line or vector length

setLineLength

public void setLineLength(double lineLength)
Set the legend line or vector lenght in physical units. Not used with COLOR legends. Defautl = 0.3

Parameters:
lineLength - line or vector length

getScaleColor

public java.awt.Color getScaleColor()
Get COLOR legend scale color. Only used with COLOR legends.

Returns:
scale color

setScaleColor

public void setScaleColor(java.awt.Color scaleColor)
Set COLOR legend scale color. Only used with COLOR legends. Deault = black.

Parameters:
scaleColor - scale color

getScaleLabelFont

public java.awt.Font getScaleLabelFont()
Get COLOR legend scale font. Only used with COLOR legends.

Returns:
scale font

setScaleLabelFont

public void setScaleLabelFont(java.awt.Font scaleLabelFont)
Set COLOR legend scale font. Only used with COLOR legends. Deault = ("Helvetica", PLAIN, 10).

Parameters:
scaleLabelFont - scale font

getScaleLabelHeightP

public double getScaleLabelHeightP()
Get COLOR legend scale label height in physical coordinates. Only used with COLOR legends.

Returns:
scale label height

setScaleLabelHeightP

public void setScaleLabelHeightP(double scaleLabelHeightP)
Set COLOR legend scale label heigth. Only used with COLOR legends. Deault = 0.2.

Parameters:
scaleLabelHeightP - scale label height

getScaleLabelInterval

public int getScaleLabelInterval()
Get COLOR legend scale label interval. Only used with COLOR legends.

Returns:
scale label interval

setScaleLabelInterval

public void setScaleLabelInterval(int scaleLabelInterval)
Set COLOR legend scale label interval. Only used with COLOR legends. Deault = 2.

Parameters:
scaleLabelInterval - scale label interval

getScaleNumberSmallTics

public int getScaleNumberSmallTics()
Get COLOR legend scale number of small tics. Only used with COLOR legends.

Returns:
scale number of small tics

setScaleNumberSmallTics

public void setScaleNumberSmallTics(int scaleNumberSmallTics)
Set COLOR legend scale number of small tics. Only used with COLOR legends. Deault = 0.

Parameters:
scaleNumberSmallTics - scale number of small tics

getScaleLabelFormat

public java.lang.String getScaleLabelFormat()
Get COLOR legend scale label format. Only used with COLOR legends.

Returns:
scale label format

setScaleLabelFormat

public void setScaleLabelFormat(java.lang.String scaleLabelFormat)
Set COLOR legend scale label format. Only used with COLOR legends. Deault = "".

Parameters:
scaleLabelFormat - scale label format

getScaleLargeTicHeightP

public double getScaleLargeTicHeightP()
Get COLOR legend scale large tick height. Only used with COLOR legends.

Returns:
scale large tick height

setScaleLargeTicHeightP

public void setScaleLargeTicHeightP(double scaleLargeTicHeightP)
Set COLOR legend scale large tick height in physical coordinates. Only used with COLOR legends. Deault = 0.1.

Parameters:
scaleLargeTicHeightP - scale large tick height

getScaleSignificantDigits

public int getScaleSignificantDigits()
Get COLOR legend scale significant digits. Only used with COLOR legends.

Returns:
scale significant digits

setScaleSignificantDigits

public void setScaleSignificantDigits(int scaleSignificantDigits)
Set COLOR legend scale significant digits. Only used with COLOR legends. Deault = 2.

Parameters:
scaleSignificantDigits - scale significant digits

getScaleSmallTicHeightP

public double getScaleSmallTicHeightP()
Get COLOR legend scale small tick height. Only used with COLOR legends.

Returns:
scale small tick height

setScaleSmallTicHeightP

public void setScaleSmallTicHeightP(double scaleSmallTicHeightP)
Set COLOR legend scale small tick height in physical coordinates. Only used with COLOR legends. Deault = 0.05.

Parameters:
scaleSmallTicHeightP - scale small tick height

isScaleVisible

public boolean isScaleVisible()
Test if COLOR legend scale visible. Only used with COLOR legends.

Returns:
true, if scale visible

setScaleVisible

public void setScaleVisible(boolean scaleVisible)
Set COLOR legend scale visible. Only used with COLOR legends. Deault = true.

Parameters:
scaleVisible - scale visible

getPanelHolder

public PanelHolder getPanelHolder()
Get PanelHolder parent.

Returns:
panelholder

setPanelHolder

public void setPanelHolder(PanelHolder pHolder)
Set PanelHolder parent.

Parameters:
pHolder - panelholder

getKeyLabelHeightP

public double getKeyLabelHeightP()
Get key label height.

Returns:
key label height

setKeyLabelHeightP

public void setKeyLabelHeightP(double keyLabelHeightP)
Set key label height in physical coordinates. Default = 0.16.

Parameters:
keyLabelHeightP - key label height