org.grinvin.invariants.values

Class AbstractInvariantValueDelegate<T,extends,InvariantValue>

Implemented Interfaces:
InvariantValueDelegate<T,extends,InvariantValue>
Known Direct Subclasses:
BooleanValueDelegate, IntegerMatrixValueDelegate, ListOfIntegersValueDelegate, ListOfRealsValueDelegate, NumericValueDelegate<T,extends,NumericValue>, UnavailableValueDelegate

public abstract class AbstractInvariantValueDelegate<T,extends,InvariantValue>
extends java.lang.Object
implements InvariantValueDelegate<T,extends,InvariantValue>

Method Summary

static InvariantValue
fromElement(Element element)
Convert a JDOM-element to an invariant value of the correct class.
static InvariantValue
fromElement_1_0(Element element)
Convert a JDOM-element to an invariant value of the correct class.
boolean
hasDetails(T value)
Is it possible to obtain a 'details window' for this component?

The standard implementation always returns false.

void
initLabel(JLabel label, T value)
Initialize a label which is used to display this invariant value.
T
load(Element element)
Initialize the components of this value from a JDOM-element.
abstract T
loadValue(Element element, Invariant invariant, String computerId, String computerVersion)
Should be overridden to load the actual value from a JDOM-element.
T
load_1_0(Element element)
Initialize the components of this value from a JDOM-element.
abstract void
saveValue(Element element, T value)
Should be overridden to save the actual value into a JDOM-element.
void
showDetails(T value, GraphListElement element, JComponent component, int x, int y)
Show a 'details window' for this component.
Element
toElement(T value)
Converts this value to a JDOM element.

Method Details

fromElement

public static InvariantValue fromElement(Element element)
            throws IOFormatException,
                   UnknownInvariantException,
                   UnknownInvariantTypeException
Convert a JDOM-element to an invariant value of the correct class.

fromElement_1_0

public static InvariantValue fromElement_1_0(Element element)
            throws IOFormatException,
                   UnknownInvariantException,
                   UnknownInvariantTypeException
Convert a JDOM-element to an invariant value of the correct class. This method implements 1.0 compatibility.

hasDetails

public boolean hasDetails(T value)
Is it possible to obtain a 'details window' for this component?

The standard implementation always returns false.

Specified by:
hasDetails in interface InvariantValueDelegate<T,extends,InvariantValue>

initLabel

public void initLabel(JLabel label,
                      T value)
Specified by:
initLabel in interface InvariantValueDelegate<T,extends,InvariantValue>

load

public T load(Element element)
            throws IOFormatException,
                   UnknownInvariantException,
                   UnknownInvariantTypeException
Initialize the components of this value from a JDOM-element. The element is known to be of type 'invariantvalue'. Delegates to loadValue(Element,Invariant,String,String) to load the actual value.
Specified by:
load in interface InvariantValueDelegate<T,extends,InvariantValue>

loadValue

public abstract T loadValue(Element element,
                            Invariant invariant,
                            String computerId,
                            String computerVersion)
            throws IOFormatException
Should be overridden to load the actual value from a JDOM-element. Clients should throw an IOFormatException when element is not in the correct format.
Parameters:
element - JDOM element, which is known to be of type 'value'
See Also:
load(Element)

load_1_0

public T load_1_0(Element element)
            throws IOFormatException,
                   UnknownInvariantException,
                   UnknownInvariantTypeException
Initialize the components of this value from a JDOM-element. The element is known to be of type 'invariantvalue'. Delegates to loadValue(Element,Invariant,String,String) to load the actual value. This method implements 1.0 compatibility.
Specified by:
load_1_0 in interface InvariantValueDelegate<T,extends,InvariantValue>

saveValue

public abstract void saveValue(Element element,
                               T value)
Should be overridden to save the actual value into a JDOM-element.
Parameters:
element - JDOM element, which is of type 'value'

showDetails

public void showDetails(T value,
                        GraphListElement element,
                        JComponent component,
                        int x,
                        int y)
Show a 'details window' for this component.

The standard implementation does nothing.

Specified by:
showDetails in interface InvariantValueDelegate<T,extends,InvariantValue>
Parameters:
value - The invariant value
element - Graph list element for which this invariant value was computed
component - Component which invoked this method
x - X coordinate of mouse pointer when this method was invoked
y - Y coordinate of mouse pointer when this method was invoked

toElement

public Element toElement(T value)
Specified by:
toElement in interface InvariantValueDelegate<T,extends,InvariantValue>