uk.ac.starlink.ast.gui
Class AstAxisLabels

java.lang.Object
  extended by uk.ac.starlink.ast.gui.AbstractPlotControlsModel
      extended by uk.ac.starlink.ast.gui.AstAxisLabels
All Implemented Interfaces:
XMLEncodeDecode

public class AstAxisLabels
extends AbstractPlotControlsModel

AstAxisLabel is a model of the Axis label elements shown in say an AST Plot. It encompasses all the values that describe their representations (which are not independent, hence what seems to be two elements in one class) and returns these in various formats (such as the complete AST Plot options list for configuring it).

Version:
$Id$
Author:
Peter W. Draper

Field Summary
static int BOTTOM
          Description of the Field
protected  Color colour
          The colour of the labels.
protected  Font font
          The Font used to display the labels.
static double GAP_MAX
          The suggested maximum gap.
static double GAP_MIN
          The suggested minimum gap.
static double GAP_STEP
          The suggested gap resolution (i.e.
protected  DefaultGrfFontManager grfFontManager
          Reference to the GrfFontManager object.
protected  boolean isXSet
          Whether X label is set or unset.
protected  boolean isYSet
          Whether Y label is set or unset.
static int LEFT
          Enumerations of the possible edges.
static String NULL_LABEL
          A label to show that is the same as null.
static int RIGHT
          Description of the Field
protected  boolean showXUnits
          Whether the X label should also have the units displayed.
protected  boolean showYUnits
          Whether the Y label should also have the units displayed.
static int TOP
          Description of the Field
protected  int xEdge
          The edge that the X label should be displayed on.
protected  double xGap
          The gap between X label and plot border.
protected  String xLabel
          The value for the X label.
protected  boolean xShown
          Whether X label should be shown.
protected  int yEdge
          The edge that the Y label should be displayed on.
protected  double yGap
          The gap between Y label and the plot border.
protected  String yLabel
          The value for the Y label.
protected  boolean yShown
          Whether Y label should be shown.
 
Fields inherited from class uk.ac.starlink.ast.gui.AbstractPlotControlsModel
listeners
 
Constructor Summary
AstAxisLabels()
          Create an empty instance.
AstAxisLabels(String xLabel, String yLabel)
          Create an instance with initial values.
 
Method Summary
 void encode(Element rootElement)
          Description of the Method
 String getAstOptions()
          Get the AST plot options description of this object.
 Color getColour()
          Get the colour of the labels.
 Font getFont()
          Get the Font used to draw the labels.
 boolean getShowXUnits()
          Get whether we're displaying the units string on the X axis.
 boolean getShowYUnits()
          Get whether we're displaying the units string on the Y axis.
 String getTagName()
          The name of our enclosing tag.
 int getXEdge()
          Get the edge used to display the X axis.
 double getXGap()
          Get the gap between X label and border.
 String getXLabel()
          Get the current X label.
 boolean getXShown()
          Return if the X label is to be shown.
 boolean getXState()
          Return if the X label is set or unset.
 int getYEdge()
          Get the edge used to display the Y axis.
 double getYGap()
          Get the gap between Y label and border.
 String getYLabel()
          Get the current Y label.
 boolean getYShown()
          Return if the Y labels is to be shown.
 boolean getYState()
          Return if the Y label is set or unset.
 void setColour(Color colour)
          Set the colour of the labels.
 void setDefaults()
          Set/reset all values to their defaults.
 void setFont(Font font)
          Set the Font to be used when displaying the labels.
 void setFromString(String name, String value)
          Set the value of a member variable by matching its name to a known local property string.
 void setShowXUnits(boolean showXUnits)
          Set whether to display the units string on the X axis.
 void setShowYUnits(boolean showYUnits)
          Set whether to display the units string on the Y axis.
 void setXEdge(int xEdge)
          Set the edge to display the X label.
 void setXGap(double xGap)
          Set the gap between X label and border.
 void setXLabel(String xLabel)
          Set the X label.
 void setXShown(boolean xShown)
          Set whether the X label should be shown.
 void setXState(boolean isXSet)
          Set whether the X label is set or unset (unset implies that all label properties should remain at their AST defaults).
 void setYEdge(int yEdge)
          Set the edge to display the Y label.
 void setYGap(double yGap)
          Set the gap between Y label and border.
 void setYLabel(String yLabel)
          Set the Y label.
 void setYShown(boolean yShown)
          Set whether the Y label should be shown.
 void setYState(boolean isYSet)
          Set whether the Y label is set or unset (unset implies that all label properties should remain at their AST defaults).
 String toString()
          Get a string representation of the AST options.
 
Methods inherited from class uk.ac.starlink.ast.gui.AbstractPlotControlsModel
addChangeListener, addChildElement, addChildElement, addChildElement, addChildElement, addChildElement, addChildElement, booleanFromString, booleanToString, colorFromString, colorToString, decode, doubleFromString, doubleToString, fireChanged, fontFromString, fontToString, getChildren, getElementName, getElementValue, intFromString, intToString, longFromString, longToString, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

isXSet

protected boolean isXSet
Whether X label is set or unset.


isYSet

protected boolean isYSet
Whether Y label is set or unset.


xShown

protected boolean xShown
Whether X label should be shown.


yShown

protected boolean yShown
Whether Y label should be shown.


xLabel

protected String xLabel
The value for the X label.


yLabel

protected String yLabel
The value for the Y label.


font

protected Font font
The Font used to display the labels.


colour

protected Color colour
The colour of the labels.


xGap

protected double xGap
The gap between X label and plot border.


yGap

protected double yGap
The gap between Y label and the plot border.


GAP_MIN

public static final double GAP_MIN
The suggested minimum gap.

See Also:
Constant Field Values

GAP_MAX

public static final double GAP_MAX
The suggested maximum gap.

See Also:
Constant Field Values

GAP_STEP

public static final double GAP_STEP
The suggested gap resolution (i.e. interval between steps).

See Also:
Constant Field Values

NULL_LABEL

public static final String NULL_LABEL
A label to show that is the same as null.

See Also:
Constant Field Values

xEdge

protected int xEdge
The edge that the X label should be displayed on.


yEdge

protected int yEdge
The edge that the Y label should be displayed on.


showXUnits

protected boolean showXUnits
Whether the X label should also have the units displayed.


showYUnits

protected boolean showYUnits
Whether the Y label should also have the units displayed.


LEFT

public static final int LEFT
Enumerations of the possible edges.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Description of the Field

See Also:
Constant Field Values

TOP

public static final int TOP
Description of the Field

See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
Description of the Field

See Also:
Constant Field Values

grfFontManager

protected DefaultGrfFontManager grfFontManager
Reference to the GrfFontManager object. Use this to add and remove fonts from the global list. Also provides the index of the font as known to Grf.

Constructor Detail

AstAxisLabels

public AstAxisLabels()
Create an empty instance.


AstAxisLabels

public AstAxisLabels(String xLabel,
                     String yLabel)
Create an instance with initial values.

Parameters:
xLabel - Description of the Parameter
yLabel - Description of the Parameter
Method Detail

setDefaults

public void setDefaults()
Set/reset all values to their defaults.


setXState

public void setXState(boolean isXSet)
Set whether the X label is set or unset (unset implies that all label properties should remain at their AST defaults).

Parameters:
isXSet - The new xState value

getXState

public boolean getXState()
Return if the X label is set or unset.

Returns:
The xState value

setYState

public void setYState(boolean isYSet)
Set whether the Y label is set or unset (unset implies that all label properties should remain at their AST defaults).

Parameters:
isYSet - The new yState value

getYState

public boolean getYState()
Return if the Y label is set or unset.

Returns:
The yState value

setXShown

public void setXShown(boolean xShown)
Set whether the X label should be shown.

Parameters:
xShown - The new xShown value

getXShown

public boolean getXShown()
Return if the X label is to be shown.

Returns:
The xShown value

setYShown

public void setYShown(boolean yShown)
Set whether the Y label should be shown.

Parameters:
yShown - The new yShown value

getYShown

public boolean getYShown()
Return if the Y labels is to be shown.

Returns:
The yShown value

setXLabel

public void setXLabel(String xLabel)
Set the X label. If null then label is unset.

Parameters:
xLabel - The new xLabel value

getXLabel

public String getXLabel()
Get the current X label.

Returns:
The xLabel value

setYLabel

public void setYLabel(String yLabel)
Set the Y label. If null then label is unset.

Parameters:
yLabel - The new yLabel value

getYLabel

public String getYLabel()
Get the current Y label.

Returns:
The yLabel value

setFont

public void setFont(Font font)
Set the Font to be used when displaying the labels.

Parameters:
font - The new font value

getFont

public Font getFont()
Get the Font used to draw the labels.

Returns:
The font value

setColour

public void setColour(Color colour)
Set the colour of the labels.

Parameters:
colour - The new colour value

getColour

public Color getColour()
Get the colour of the labels.

Returns:
The colour value

setXGap

public void setXGap(double xGap)
Set the gap between X label and border. The value DefaultGrf.BAD means no value.

Parameters:
xGap - The new xGap value

getXGap

public double getXGap()
Get the gap between X label and border.

Returns:
The xGap value

setYGap

public void setYGap(double yGap)
Set the gap between Y label and border. The value DefaultGrf.BAD means no value.

Parameters:
yGap - The new yGap value

getYGap

public double getYGap()
Get the gap between Y label and border.

Returns:
The yGap value

setXEdge

public void setXEdge(int xEdge)
Set the edge to display the X label.

Parameters:
xEdge - The new xEdge value

getXEdge

public int getXEdge()
Get the edge used to display the X axis.

Returns:
The xEdge value

setYEdge

public void setYEdge(int yEdge)
Set the edge to display the Y label.

Parameters:
yEdge - The new yEdge value

getYEdge

public int getYEdge()
Get the edge used to display the Y axis.

Returns:
The yEdge value

setShowXUnits

public void setShowXUnits(boolean showXUnits)
Set whether to display the units string on the X axis.

Parameters:
showXUnits - The new showXUnits value

getShowXUnits

public boolean getShowXUnits()
Get whether we're displaying the units string on the X axis.

Returns:
The showXUnits value

setShowYUnits

public void setShowYUnits(boolean showYUnits)
Set whether to display the units string on the Y axis.

Parameters:
showYUnits - The new showYUnits value

getShowYUnits

public boolean getShowYUnits()
Get whether we're displaying the units string on the Y axis.

Returns:
The showYUnits value

getAstOptions

public String getAstOptions()
Get the AST plot options description of this object.

Returns:
The astOptions value

toString

public String toString()
Get a string representation of the AST options.

Overrides:
toString in class Object
Returns:
Description of the Return Value

getTagName

public String getTagName()
The name of our enclosing tag.

Returns:
the name of the root element.

encode

public void encode(Element rootElement)
Description of the Method

Specified by:
encode in interface XMLEncodeDecode
Specified by:
encode in class AbstractPlotControlsModel
Parameters:
rootElement - Description of the Parameter

setFromString

public void setFromString(String name,
                          String value)
Set the value of a member variable by matching its name to a known local property string.

Specified by:
setFromString in class AbstractPlotControlsModel
Parameters:
name - The new fromString value
value - The new fromString value


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.