uk.ac.starlink.ast.gui
Class AstGrid

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

public class AstGrid
extends AbstractPlotControlsModel

AstGrid is a model of the Grid element shown in say an AST Plot. It encompasses all the values that describe its representation and returns these in various formats (such as the complete AST Plot options list for drawing it).

Version:
$Id$
Author:
Peter W. Draper

Field Summary
protected  Color colour
          The colour of the grid.
protected  boolean isSet
          Whether grid is set or unset.
static int MAX_WIDTH
          Suggested maximum width.
static int MIN_WIDTH
          Suggested minimum width.
protected  boolean show
          Whether the grid should be shown (different from unset).
protected  int style
          The line style of the grid lines.
protected  double width
          The width of the grid lines.
 
Fields inherited from class uk.ac.starlink.ast.gui.AbstractPlotControlsModel
listeners
 
Constructor Summary
AstGrid()
          Create a 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 grid.
 boolean getShown()
          Get whether the grid is to be shown.
 boolean getState()
          Return if the grid is set or unset.
 int getStyle()
          Get the line style.
 String getTagName()
          The name of our enclosing tag.
 double getWidth()
          Get the line width.
 void setColour(Color colour)
          Set the colour of the grid.
 void setDefaults()
          Set object to default state.
 void setFromString(String name, String value)
          Set the value of a member variable by matching its name to a known local property string.
 void setShown(boolean show)
          Set whether the grid should be shown or not.
 void setState(boolean isSet)
          Set whether the grid is set or unset (unset implies that all properties should remain at their AST defaults).
 void setStyle(int style)
          Set the line style.
 void setWidth(double width)
          Set the line width.
 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

isSet

protected boolean isSet
Whether grid is set or unset.


show

protected boolean show
Whether the grid should be shown (different from unset).


colour

protected Color colour
The colour of the grid.


style

protected int style
The line style of the grid lines.


width

protected double width
The width of the grid lines.


MIN_WIDTH

public static int MIN_WIDTH
Suggested minimum width.


MAX_WIDTH

public static int MAX_WIDTH
Suggested maximum width.

Constructor Detail

AstGrid

public AstGrid()
Create a empty instance. This indicates that the grid element should remain at the AST Plot default.

Method Detail

setDefaults

public void setDefaults()
Set object to default state.


setState

public void setState(boolean isSet)
Set whether the grid is set or unset (unset implies that all properties should remain at their AST defaults).

Parameters:
isSet - The new state value

getState

public boolean getState()
Return if the grid is set or unset.

Returns:
The state value

setShown

public void setShown(boolean show)
Set whether the grid should be shown or not.

Parameters:
show - The new shown value

getShown

public boolean getShown()
Get whether the grid is to be shown.

Returns:
The shown value

setColour

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

Parameters:
colour - The new colour value

getColour

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

Returns:
The colour value

setWidth

public void setWidth(double width)
Set the line width. The value DefaultGrf.BAD means no value.

Parameters:
width - The new width value

getWidth

public double getWidth()
Get the line width.

Returns:
The width value

setStyle

public void setStyle(int style)
Set the line style. This should be a style known to the Grf class (i.e. Grf.PLAIN, Grf.DASH etc.)

Parameters:
style - The new style value

getStyle

public int getStyle()
Get the line style.

Returns:
The style 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.