uk.ac.starlink.ast.gui
Class AstNumberLabels

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

public class AstNumberLabels
extends AbstractPlotControlsModel

AstNumberLabels is a model of the axis numeric 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 - X & Y - in one class, in fact these are also related to the text labels, which determine the edge) 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
protected  Color colour
          The colour of the labels.
protected  int digits
          The number of digits used to determine gap between major axes.
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 numeric labels are set or unset.
protected  boolean isYSet
          Whether Y numeric labels are set or unset.
protected  boolean logLabelSet
          Whether log-style labelling control is set.
protected  double xGap
          The gap between X labels and plot border.
protected  boolean xLogLabel
          Whether X numeric labels should use log-style labelling.
protected  boolean xRotated
          Whether X numeric labels are drawn rotated.
protected  boolean xShown
          Whether X numeric labels should be shown.
protected  double yGap
          The gap between Y labels and the plot border.
protected  boolean yLogLabel
          Whether Y numeric labels should use log-style labelling.
protected  boolean yRotated
          Whether Y numeric labels are drawn rotated.
protected  boolean yShown
          Whether Y numeric labels should be shown.
 
Fields inherited from class uk.ac.starlink.ast.gui.AbstractPlotControlsModel
listeners
 
Constructor Summary
AstNumberLabels()
          Create an empty instance.
 
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.
 int getDigits()
          Get the number of digits of precision.
 Font getFont()
          Get the Font used to draw the labels.
 boolean getLogLabelSet()
          Get whether the X label log labelling is set or unset.
 String getTagName()
          The name of our enclosing tag.
 double getXGap()
          Get the gap between X labels and border.
 boolean getXLogLabel()
          Return if the X labels are to be drawing using log-labelling.
 boolean getXRotated()
          Return if the X labels are drawn rotated if possible.
 boolean getXShown()
          Return if the X labels are to be shown.
 boolean getXState()
          Return if the X labels are set or unset.
 double getYGap()
          Get the gap between Y labels and border.
 boolean getYLogLabel()
          Return if the Y labels are to be drawing using log-labelling.
 boolean getYRotated()
          Return if the Y labels are drawn rotated if possible.
 boolean getYShown()
          Return if the Y labels are to be shown.
 boolean getYState()
          Return if the Y labels are set or unset.
 void setColour(Color colour)
          Set the colour of the labels.
 void setDefaults()
          Set/reset all values to their defaults.
 void setDigits(int digits)
          Set the number of digits of precision that may be used in the numeric labels.
 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 setLogLabelSet(boolean logLabelSet)
          Set whether the X label log labelling is set or unset (unset implies that label properties should remain at their AST defaults).
 void setXGap(double xGap)
          Set the gap between X labels and border.
 void setXLogLabel(boolean xLogLabel)
          Set whether the X labels should use log-labelling.
 void setXRotated(boolean xRotated)
          Set whether X labels are drawn rotated if possible (only really useful for interior axis).
 void setXShown(boolean xShown)
          Set whether the X labels should be shown.
 void setXState(boolean isXSet)
          Set whether the X labels are set or unset (unset implies that all label properties should remain at their AST defaults).
 void setYGap(double yGap)
          Set the gap between Y labels and border.
 void setYLogLabel(boolean yLogLabel)
          Set whether the Y labels should use log-labelling.
 void setYRotated(boolean yRotated)
          Set whether Y labels are drawn rotated if possible (only really useful for interior axis).
 void setYShown(boolean yShown)
          Set whether the Y labels should be shown.
 void setYState(boolean isYSet)
          Set whether the Y labels are 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 numeric labels are set or unset.


isYSet

protected boolean isYSet
Whether Y numeric labels are set or unset.


xShown

protected boolean xShown
Whether X numeric labels should be shown.


yShown

protected boolean yShown
Whether Y numeric labels should be shown.


logLabelSet

protected boolean logLabelSet
Whether log-style labelling control is set. Otherwise the default behaviour is used (set for log axis, false otherwise).


xLogLabel

protected boolean xLogLabel
Whether X numeric labels should use log-style labelling.


yLogLabel

protected boolean yLogLabel
Whether Y numeric labels should use log-style labelling.


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 labels and plot border.


yGap

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


digits

protected int digits
The number of digits used to determine gap between major axes. (-1 for not set).


yRotated

protected boolean yRotated
Whether Y numeric labels are drawn rotated.


xRotated

protected boolean xRotated
Whether X numeric labels are drawn rotated.


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

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

AstNumberLabels

public AstNumberLabels()
Create an empty instance.

Method Detail

setDefaults

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


setXState

public void setXState(boolean isXSet)
Set whether the X labels are 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 labels are set or unset.

Returns:
The xState value

setYState

public void setYState(boolean isYSet)
Set whether the Y labels are 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 labels are set or unset.

Returns:
The yState value

setXShown

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

Parameters:
xShown - The new xShown value

getXShown

public boolean getXShown()
Return if the X labels are to be shown.

Returns:
The xShown value

setYShown

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

Parameters:
yShown - The new yShown value

getYShown

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

Returns:
The yShown value

setLogLabelSet

public void setLogLabelSet(boolean logLabelSet)
Set whether the X label log labelling is set or unset (unset implies that label properties should remain at their AST defaults).

Parameters:
setLogLabelling - The new value.

getLogLabelSet

public boolean getLogLabelSet()
Get whether the X label log labelling is set or unset.


setXLogLabel

public void setXLogLabel(boolean xLogLabel)
Set whether the X labels should use log-labelling.

Parameters:
xLogLabel - The new xLogLabel value

getXLogLabel

public boolean getXLogLabel()
Return if the X labels are to be drawing using log-labelling.

Returns:
The xLogLabel value

setYLogLabel

public void setYLogLabel(boolean yLogLabel)
Set whether the Y labels should use log-labelling.

Parameters:
yLogLabel - The new yLogLabel value

getYLogLabel

public boolean getYLogLabel()
Return if the Y labels are to be drawing using log-labelling.

Returns:
The yLogLabel 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 labels and border. The value DefaultGrf.BAD means no value.

Parameters:
xGap - The new xGap value

getXGap

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

Returns:
The xGap value

setYGap

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

Parameters:
yGap - The new yGap value

getYGap

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

Returns:
The yGap value

setDigits

public void setDigits(int digits)
Set the number of digits of precision that may be used in the numeric labels. This also effects what the major intervals are chosen for ticks and grid positioning. If -1 then the default digits are used.

Parameters:
digits - The new digits value

getDigits

public int getDigits()
Get the number of digits of precision.

Returns:
The digits value

setXRotated

public void setXRotated(boolean xRotated)
Set whether X labels are drawn rotated if possible (only really useful for interior axis).

Parameters:
xRotated - The new rotated value

getXRotated

public boolean getXRotated()
Return if the X labels are drawn rotated if possible.

Returns:
The current rotated state

setYRotated

public void setYRotated(boolean yRotated)
Set whether Y labels are drawn rotated if possible (only really useful for interior axis).

Parameters:
yRotated - The new rotated value

getYRotated

public boolean getYRotated()
Return if the Y labels are drawn rotated if possible.

Returns:
The current rotated state

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.