org.graffiti.plugin.parameter
Class AbstractSingleParameter<T>

java.lang.Object
  extended by org.graffiti.plugin.parameter.AbstractSingleParameter<T>
All Implemented Interfaces:
Serializable, Displayable<T>, Parameter<T>, SingleParameter<T>
Direct Known Subclasses:
AbstractLimitableParameter, AttributeParameter, BooleanParameter, EdgeParameter, NodeParameter, ObjectParameter, SelectionParameter, StringParameter, StringSelectionParameter

public abstract class AbstractSingleParameter<T>
extends Object
implements SingleParameter<T>

Implements functions that are common in all SingleParameters.

Version:
$Revision: 5767 $
See Also:
Serialized Form

Constructor Summary
AbstractSingleParameter(String name, String description)
          Constructs a new abstract single parameter class.
AbstractSingleParameter(T val, String name, String description)
          Constructs a new abstract single parameter class.
 
Method Summary
 boolean canCopy()
           
 Parameter<T> copy()
           
 Parameter<?> getDependencyParent()
           
 Object getDependencyValue()
           
 String getDescription()
          Returns the description of the parameter.
 BufferedImage getImage()
          Returns the image representing the parameter.
 String getName()
          Returns the name of the parameter.
 T getValue()
          Returns the encapsulated object.
 boolean isVisible()
           
 void setDependency(Parameter<?> parent, Object value)
          Sets a depencency.
 void setDescription(String description)
          Sets the description.
 void setObjectValue(Object value)
           
 void setValue(T val)
          Sets the encapsulated object.
 void setVisible(boolean visible)
           
 String toString()
           
 String toXMLString()
          Returns a well-formed XML string representing the Displayable.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractSingleParameter

public AbstractSingleParameter(T val,
                               String name,
                               String description)
Constructs a new abstract single parameter class.

Parameters:
val - DOCUMENT ME!
name - the name of the parameter.
description - the description of the parameter.

AbstractSingleParameter

public AbstractSingleParameter(String name,
                               String description)
Constructs a new abstract single parameter class.

Parameters:
name - the name of the parameter.
description - the description of the parameter.
Method Detail

setDescription

public void setDescription(String description)
Sets the description.

Specified by:
setDescription in interface Displayable<T>
Parameters:
description -

getDescription

public String getDescription()
Returns the description of the parameter.

Specified by:
getDescription in interface Displayable<T>
Returns:
the description of the parameter.

getImage

public BufferedImage getImage()
Returns the image representing the parameter.

Specified by:
getImage in interface Parameter<T>
Returns:
the image representing the parameter.

getName

public String getName()
Returns the name of the parameter.

Specified by:
getName in interface Displayable<T>
Returns:
the name of the parameter.

setValue

public void setValue(T val)
              throws IllegalArgumentException
Description copied from interface: Displayable
Sets the encapsulated object.

Specified by:
setValue in interface Displayable<T>
Throws:
IllegalArgumentException - thrown if val is not of the apropriate type.
See Also:
Displayable.setValue(java.lang.Object)

getValue

public T getValue()
Description copied from interface: Displayable
Returns the encapsulated object.

Specified by:
getValue in interface Displayable<T>
Returns:
Object
See Also:
Displayable.getValue()

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

toXMLString

public String toXMLString()
Description copied from interface: Displayable
Returns a well-formed XML string representing the Displayable. The Displayable should be reconstructable via this representation. Therefore it must at least include the type of Displayable (classname) and a representation of its value. PROBABLE FUTURE DESIGN: The Displayables themselves will provide a method to reconstruct their value from the XML representation they provided.

Specified by:
toXMLString in interface Displayable<T>
Returns:
string holding an XML representation of this Displayable
See Also:
Displayable.toXMLString()

copy

public Parameter<T> copy()
Specified by:
copy in interface Parameter<T>

canCopy

public boolean canCopy()
Specified by:
canCopy in interface Parameter<T>

setObjectValue

public void setObjectValue(Object value)
Specified by:
setObjectValue in interface Parameter<T>

setDependency

public void setDependency(Parameter<?> parent,
                          Object value)
Description copied from interface: Parameter
Sets a depencency. this is only visible in the parameter dialog, if parent is visible and has the value value.

Specified by:
setDependency in interface Parameter<T>

getDependencyParent

public Parameter<?> getDependencyParent()
Specified by:
getDependencyParent in interface Parameter<T>

getDependencyValue

public Object getDependencyValue()
Specified by:
getDependencyValue in interface Parameter<T>

setVisible

public void setVisible(boolean visible)
Specified by:
setVisible in interface Parameter<T>

isVisible

public boolean isVisible()
Specified by:
isVisible in interface Parameter<T>


Generated at 2012-05-30 11:00:14 PM CEST