AROM-2_2_13

helix.util.ui.parameters
Class ObjectParameter

java.lang.Object
  |
  +--helix.util.ui.parameters.ObjectParameter
All Implemented Interfaces:
Parameter
Direct Known Subclasses:
BooleanParameter, ListParameter, StringParameter

public class ObjectParameter
extends Object
implements Parameter

Basic implementation of a parameter object.


Field Summary
 
Fields inherited from interface helix.util.ui.parameters.Parameter
BOOLEAN_TYPE, LIST_TYPE, OBJECT_TYPE, STRING_TYPE
 
Constructor Summary
ObjectParameter(String key, String label, Object value, Object defaultValue, Object[] values, Constraints constraint, boolean isPrefSaved)
          Constructor.
 
Method Summary
 void addListener(ParameterListener listener)
          Adds a listener to this parameter.
 Constraints getConstraint()
          Returns the constraint that value have to respect.
 Object getDefaultValue()
          Returns the default value for this parameter.
 Object getInitialValue()
          Returns the inital value of this parameter (value at the parameter creation).
 String getKey()
          Returns the parameter key.
 String getLabel()
          Returns the label related to this parameter
 int getType()
          Returns the parameter type.
 Object getValue()
          Returns the parameter value (the value is setted after user validation).
 Object[] getValues()
          Returns the domain values (may be null)
 boolean hasConstraints()
          Returns true if this parameter has a constraints object.
 boolean hasDomainValues()
          Returns true if this parameter has a constraints object.
 boolean isEnable()
          Indicates if this parameter enable or not.
 boolean isPreferenceSaved()
          Returns true if value of this parameter could be saved in preferences.
 void removeListener(ParameterListener listener)
          Removes a current listener of this parameter.
 void setEnable(boolean enable)
          Renders this parameter enable or not.
 void setValue(Object value)
          Set the value of this parameter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectParameter

public ObjectParameter(String key,
                       String label,
                       Object value,
                       Object defaultValue,
                       Object[] values,
                       Constraints constraint,
                       boolean isPrefSaved)
                throws IllegalArgumentException
Constructor.

Parameters:
key - identifier of Parameter (can not be null)
label - label which present the parameter
value - initial value (can not be null)
defaultValue - default value (can not be null)
values - domain values (if not null must contains value)
constraint - could be null
isPrefSaved - indicates if value could be store in Preferences
Method Detail

setValue

public void setValue(Object value)
              throws IllegalArgumentException
Set the value of this parameter.

Specified by:
setValue in interface Parameter
Throws:
IllegalArgumentException - if new value is null or does not respect constraint or domain values

hasDomainValues

public boolean hasDomainValues()
Description copied from interface: Parameter
Returns true if this parameter has a constraints object.

Specified by:
hasDomainValues in interface Parameter
Returns:
true

getKey

public String getKey()
Description copied from interface: Parameter
Returns the parameter key.

Specified by:
getKey in interface Parameter
Returns:
String

getValue

public Object getValue()
Description copied from interface: Parameter
Returns the parameter value (the value is setted after user validation).

Specified by:
getValue in interface Parameter
Returns:
Object

setEnable

public void setEnable(boolean enable)
Description copied from interface: Parameter
Renders this parameter enable or not. If disable, the user could not modify his value (nevertheless it is always possible to call setValue).
Listeners of this parameter will be advertise in case of value changed.

Specified by:
setEnable in interface Parameter
Parameters:
enable -

isEnable

public boolean isEnable()
Description copied from interface: Parameter
Indicates if this parameter enable or not.

Specified by:
isEnable in interface Parameter
Returns:
boolean

getDefaultValue

public Object getDefaultValue()
Description copied from interface: Parameter
Returns the default value for this parameter.

Specified by:
getDefaultValue in interface Parameter
Returns:
Object

getInitialValue

public Object getInitialValue()
Description copied from interface: Parameter
Returns the inital value of this parameter (value at the parameter creation).

Specified by:
getInitialValue in interface Parameter
Returns:
Object

getLabel

public String getLabel()
Description copied from interface: Parameter
Returns the label related to this parameter

Specified by:
getLabel in interface Parameter
Returns:
String

getValues

public Object[] getValues()
Description copied from interface: Parameter
Returns the domain values (may be null)

Specified by:
getValues in interface Parameter
Returns:
Object[]

getConstraint

public Constraints getConstraint()
Description copied from interface: Parameter
Returns the constraint that value have to respect.

Specified by:
getConstraint in interface Parameter
Returns:
Constraints

getType

public int getType()
Description copied from interface: Parameter
Returns the parameter type.

Specified by:
getType in interface Parameter
Returns:

hasConstraints

public boolean hasConstraints()
Description copied from interface: Parameter
Returns true if this parameter has a constraints object.

Specified by:
hasConstraints in interface Parameter
Returns:
true

isPreferenceSaved

public boolean isPreferenceSaved()
Description copied from interface: Parameter
Returns true if value of this parameter could be saved in preferences.

Specified by:
isPreferenceSaved in interface Parameter
Returns:
boolean

addListener

public void addListener(ParameterListener listener)
Description copied from interface: Parameter
Adds a listener to this parameter.

Specified by:
addListener in interface Parameter
Parameters:
listener -

removeListener

public void removeListener(ParameterListener listener)
Description copied from interface: Parameter
Removes a current listener of this parameter.

Specified by:
removeListener in interface Parameter
Parameters:
listener -

AROM-2_2_13