de.cau.cs.kieler.kiml.layout
Class LayoutOptionData

java.lang.Object
  extended by de.cau.cs.kieler.kiml.layout.LayoutOptionData

public class LayoutOptionData
extends Object

Data type used to store information for a layout option.

Rating proposed yellow
(2009-12-11) msp

Nested Class Summary
static class LayoutOptionData.Target
          option target enumeration.
static class LayoutOptionData.Type
          data type enumeration.
 
Field Summary
static String[] BOOLEAN_CHOICES
          choices for boolean type options.
static String BOOLEAN_LITERAL
          literal value constant for booleans.
static String EDGES_LITERAL
          literal value constant for edges target.
static String ENUM_LITERAL
          literal value constant for enumerations.
static String FLOAT_LITERAL
          literal value constant for floating point numbers.
static String INT_LITERAL
          literal value constant for integer numbers.
static String LABELS_LITERAL
          literal value constant for labels target.
static String NODES_LITERAL
          literal value constant for nodes target.
static String PARENTS_LITERAL
          literal value constant for diagram target.
static String PORTS_LITERAL
          literal value constant for ports target.
static String STRING_LITERAL
          literal value constant for strings.
 
Constructor Summary
LayoutOptionData()
           
 
Method Summary
 boolean equals(Object obj)
          
 String[] getChoices()
          Creates an array of choices that can be selected by the user to set a value for this option.
 String getDescription()
          Returns the description.
 Enum<?> getEnumValue(int intValue)
          Returns the enumeration value for a given index.
 String getId()
          Returns the identifier.
 String getName()
          Returns the name.
 String getTargetsDescription()
          Returns a user friendly description of the active targets of this layout option.
 LayoutOptionData.Type getType()
          Returns the type.
 int hashCode()
          
 boolean hasTarget(LayoutOptionData.Target target)
          Checks whether the given target is active for this layout option.
 Object parseValue(String valueString)
          Parses a string value for this layout option.
 void setDescription(String thedescription)
          Sets the description.
 void setId(String theid)
          Sets the identifier.
 void setName(String thename)
          Sets the name.
 void setTargets(String targetsString)
          Sets the targets property of this layout option data.
 void setType(LayoutOptionData.Type thetype)
          Sets the data type.
 void setType(String typeLiteral)
          Sets the type field depending on the given literal.
 void setValue(KLayoutData layoutData, Object value)
          Sets the given value of this layout option in the given layout data.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

BOOLEAN_LITERAL

public static final String BOOLEAN_LITERAL
literal value constant for booleans.

See Also:
Constant Field Values

INT_LITERAL

public static final String INT_LITERAL
literal value constant for integer numbers.

See Also:
Constant Field Values

STRING_LITERAL

public static final String STRING_LITERAL
literal value constant for strings.

See Also:
Constant Field Values

FLOAT_LITERAL

public static final String FLOAT_LITERAL
literal value constant for floating point numbers.

See Also:
Constant Field Values

ENUM_LITERAL

public static final String ENUM_LITERAL
literal value constant for enumerations.

See Also:
Constant Field Values

PARENTS_LITERAL

public static final String PARENTS_LITERAL
literal value constant for diagram target.

See Also:
Constant Field Values

NODES_LITERAL

public static final String NODES_LITERAL
literal value constant for nodes target.

See Also:
Constant Field Values

EDGES_LITERAL

public static final String EDGES_LITERAL
literal value constant for edges target.

See Also:
Constant Field Values

PORTS_LITERAL

public static final String PORTS_LITERAL
literal value constant for ports target.

See Also:
Constant Field Values

LABELS_LITERAL

public static final String LABELS_LITERAL
literal value constant for labels target.

See Also:
Constant Field Values

BOOLEAN_CHOICES

public static final String[] BOOLEAN_CHOICES
choices for boolean type options.

Constructor Detail

LayoutOptionData

public LayoutOptionData()
Method Detail

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

toString

public String toString()

Overrides:
toString in class Object

setType

public void setType(String typeLiteral)
Sets the type field depending on the given literal.

Parameters:
typeLiteral - a string value that is expected to be equal to one of the predefined literal value constants

parseValue

public Object parseValue(String valueString)
Parses a string value for this layout option.

Parameters:
valueString - a serialized value
Returns:
an instance of the corresponding correctly typed value, or null if the given value string is invalid

getChoices

public String[] getChoices()
Creates an array of choices that can be selected by the user to set a value for this option. This makes only sense for enumeration type or boolean type options.

Returns:
an array of values to be displayed for the user

getEnumValue

public Enum<?> getEnumValue(int intValue)
Returns the enumeration value for a given index.

Parameters:
intValue - zero-based index of the enumeration value
Returns:
the corresponding enumeration value

setValue

public void setValue(KLayoutData layoutData,
                     Object value)
Sets the given value of this layout option in the given layout data.

Parameters:
layoutData - layout data for which the option shall be set
value - the new value of this option

setTargets

public void setTargets(String targetsString)
Sets the targets property of this layout option data.

Parameters:
targetsString - comma separated list of targets

hasTarget

public boolean hasTarget(LayoutOptionData.Target target)
Checks whether the given target is active for this layout option.

Parameters:
target - a layout option target
Returns:
true if the target is active

getTargetsDescription

public String getTargetsDescription()
Returns a user friendly description of the active targets of this layout option.

Returns:
a description of the active targets, or null if there are no active targets

setId

public void setId(String theid)
Sets the identifier.

Parameters:
theid - the identifier to set

getId

public String getId()
Returns the identifier.

Returns:
the identifier

setType

public void setType(LayoutOptionData.Type thetype)
Sets the data type.

Parameters:
thetype - the data type to set

getType

public LayoutOptionData.Type getType()
Returns the type.

Returns:
the type

setName

public void setName(String thename)
Sets the name.

Parameters:
thename - the name to set

getName

public String getName()
Returns the name.

Returns:
the name

setDescription

public void setDescription(String thedescription)
Sets the description.

Parameters:
thedescription - the description to set

getDescription

public String getDescription()
Returns the description.

Returns:
the description