uk.ac.starlink.ast.gui
Class ColourStore

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

public class ColourStore
extends AbstractPlotControlsModel

Store a java.awt.Color. Offers the ability for ChangeListeners to be informed when the Color changes and the encode and decode of the Color as an integer XML snippet.

This model is not directly related an AST plot.

Version:
$Id$
Author:
Peter W. Draper

Field Summary
protected  Color colour
          The Color.
protected  String tagName
          Name of the tag.
 
Fields inherited from class uk.ac.starlink.ast.gui.AbstractPlotControlsModel
listeners
 
Constructor Summary
ColourStore()
          Create an instance with the default color and tag name.
ColourStore(String tagName)
          Create an instance with the default color.
ColourStore(String tagName, Color colour)
          Create an instance with a given colour.
 
Method Summary
 void encode(Element rootElement)
          Encode this value in an XML snippet.
 Color getColour()
          Get the colour.
 int getIntColour()
          Get the colour as an RGB integer (can be used by DefaultGrf).
 String getTagName()
          The name of our enclosing tag.
 void setColor(Color colour)
          Set the colour.
 void setFromString(String name, String value)
          Set the colour from an integer encode as a String.
 void setIntColour(int icolour)
          Set the colour from an RGB integer (supplied from DefaultGrf).
 void setTagName(String tagName)
          The name of our enclosing tag.
 
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, toString, wait, wait, wait
 

Field Detail

colour

protected Color colour
The Color.


tagName

protected String tagName
Name of the tag.

Constructor Detail

ColourStore

public ColourStore()
Create an instance with the default color and tag name.


ColourStore

public ColourStore(String tagName)
Create an instance with the default color. The tagName defines what the colour is stored as.


ColourStore

public ColourStore(String tagName,
                   Color colour)
Create an instance with a given colour.

Method Detail

setColor

public void setColor(Color colour)
Set the colour.


getColour

public Color getColour()
Get the colour.


setIntColour

public void setIntColour(int icolour)
Set the colour from an RGB integer (supplied from DefaultGrf).


getIntColour

public int getIntColour()
Get the colour as an RGB integer (can be used by DefaultGrf).


getTagName

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

Returns:
the name of the root element.

setTagName

public void setTagName(String tagName)
The name of our enclosing tag.


encode

public void encode(Element rootElement)
Encode this value in an XML snippet.

Specified by:
encode in interface XMLEncodeDecode
Specified by:
encode in class AbstractPlotControlsModel
Parameters:
rootElement - the Element within which the object should store its configuration.

setFromString

public void setFromString(String name,
                          String value)
Set the colour from an integer encode as a String.

Specified by:
setFromString in class AbstractPlotControlsModel


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