com.flexive.shared.structure
Class FxStructureOption

java.lang.Object
  extended by com.flexive.shared.structure.FxStructureOption
All Implemented Interfaces:
java.io.Serializable

public class FxStructureOption
extends java.lang.Object
implements java.io.Serializable

Option for structure elements (groups, properties, assignments)

Author:
Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
See Also:
Serialized Form

Field Summary
static java.lang.String OPTION_HTML_EDITOR
           
static java.lang.String OPTION_MAXLENGTH
           
static java.lang.String OPTION_MULTILANG
           
static java.lang.String OPTION_MULTILINE
           
static java.lang.String OPTION_SEARCHABLE
           
static java.lang.String OPTION_SHOW_OVERVIEW
           
protected  boolean overrideable
           
static java.lang.String VALUE_FALSE
           
static java.lang.String VALUE_TRUE
           
 
Constructor Summary
FxStructureOption(FxStructureOption o)
          Copy Constructor
FxStructureOption(java.lang.String key, boolean overrideable, boolean set, java.lang.String value)
          Ctor
 
Method Summary
static void clearOption(java.util.List<FxStructureOption> options, java.lang.String key)
          Clear the option with the given key - removing it from the list if it exists
static java.util.List<FxStructureOption> cloneOptions(java.util.List<FxStructureOption> options)
          Get a copy of the a list of options
 boolean equals(java.lang.Object o)
          Checks for equality
static java.util.List<FxStructureOption> getEmptyOptionList(int capacity)
          Get a list of empty options
 int getIntValue()
          Get the value as integer
 java.lang.String getKey()
          Get the option key
static FxStructureOption getOption(java.lang.String key, java.util.List<FxStructureOption> options)
          Get an option entry for the given key, if the key is invalid or not found a FxStructureOption object will be returned with set set to false, overrideable set to false and value set to an empty String.
static java.util.List<FxStructureOption> getUnmodifieableOptions(java.util.List<FxStructureOption> options)
          Convert a list of options to an unmodifieable list
 java.lang.String getValue()
          Get the value assigned to the option
 int hashCode()
          
static boolean hasOption(java.lang.String key, java.util.List<FxStructureOption> options)
          Check if an option is set for the requested key
 boolean isOverrideable()
          Is the option overrideable (in assignments)?
 boolean isSet()
          Is the option set, will return false if an unknown option is requested
 boolean isValueTrue()
          Convenience method to check if value is set to true
static void setOption(java.util.List<FxStructureOption> options, java.lang.String key, boolean overrideable, boolean value)
          Set or add a boolean value in a list of options
static void setOption(java.util.List<FxStructureOption> options, java.lang.String key, boolean overrideable, java.lang.String value)
          Set or add a String value in a list of options
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPTION_MULTILANG

public static final java.lang.String OPTION_MULTILANG
See Also:
Constant Field Values

OPTION_SHOW_OVERVIEW

public static final java.lang.String OPTION_SHOW_OVERVIEW
See Also:
Constant Field Values

OPTION_HTML_EDITOR

public static final java.lang.String OPTION_HTML_EDITOR
See Also:
Constant Field Values

OPTION_SEARCHABLE

public static final java.lang.String OPTION_SEARCHABLE
See Also:
Constant Field Values

OPTION_MAXLENGTH

public static final java.lang.String OPTION_MAXLENGTH
See Also:
Constant Field Values

OPTION_MULTILINE

public static final java.lang.String OPTION_MULTILINE
See Also:
Constant Field Values

VALUE_TRUE

public static final java.lang.String VALUE_TRUE
See Also:
Constant Field Values

VALUE_FALSE

public static final java.lang.String VALUE_FALSE
See Also:
Constant Field Values

overrideable

protected boolean overrideable
Constructor Detail

FxStructureOption

public FxStructureOption(java.lang.String key,
                         boolean overrideable,
                         boolean set,
                         java.lang.String value)
Ctor

Parameters:
key - key identifying the option
overrideable - is the option overridable in assignments
set - is the option set? (non-existing options are returned as not-set options!)
value - the options value

FxStructureOption

public FxStructureOption(FxStructureOption o)
Copy Constructor

Parameters:
o - an FxStructureOption
Method Detail

getKey

public java.lang.String getKey()
Get the option key

Returns:
option key

isOverrideable

public boolean isOverrideable()
Is the option overrideable (in assignments)?

Returns:
option overrideable (in assignments)?

isSet

public boolean isSet()
Is the option set, will return false if an unknown option is requested

Returns:
if option is set, will return false if an unknown option is requested

getValue

public java.lang.String getValue()
Get the value assigned to the option

Returns:
value assigned to the option

getIntValue

public int getIntValue()
Get the value as integer

Returns:
value as integer

isValueTrue

public boolean isValueTrue()
Convenience method to check if value is set to true

Returns:
if value is set to true

hasOption

public static boolean hasOption(java.lang.String key,
                                java.util.List<FxStructureOption> options)
Check if an option is set for the requested key

Parameters:
key - option key
options - the available options
Returns:
if an option is set for the requested key

getOption

public static FxStructureOption getOption(java.lang.String key,
                                          java.util.List<FxStructureOption> options)
Get an option entry for the given key, if the key is invalid or not found a FxStructureOption object will be returned with set set to false, overrideable set to false and value set to an empty String.

Parameters:
key - option key
options - the available options
Returns:
the found option or an object that indicates that the option is not set

getEmptyOptionList

public static java.util.List<FxStructureOption> getEmptyOptionList(int capacity)
Get a list of empty options

Parameters:
capacity - desired capacity
Returns:
list of empty options

setOption

public static void setOption(java.util.List<FxStructureOption> options,
                             java.lang.String key,
                             boolean overrideable,
                             java.lang.String value)
Set or add a String value in a list of options

Parameters:
options - list of existing options
key - option key
overrideable - should the option be overrideable?
value - String value to set for the option

setOption

public static void setOption(java.util.List<FxStructureOption> options,
                             java.lang.String key,
                             boolean overrideable,
                             boolean value)
Set or add a boolean value in a list of options

Parameters:
options - list of existing options
key - option key
overrideable - should the option be overrideable?
value - boolean value to set for the option (will be converted internally to a String)

clearOption

public static void clearOption(java.util.List<FxStructureOption> options,
                               java.lang.String key)
Clear the option with the given key - removing it from the list if it exists

Parameters:
options - list options to clear the option for
key - key of the option to remove

cloneOptions

public static java.util.List<FxStructureOption> cloneOptions(java.util.List<FxStructureOption> options)
Get a copy of the a list of options

Parameters:
options - list to clone
Returns:
cloned list of options

getUnmodifieableOptions

public static java.util.List<FxStructureOption> getUnmodifieableOptions(java.util.List<FxStructureOption> options)
Convert a list of options to an unmodifieable list

Parameters:
options - list to convert
Returns:
unmodifieable list of options

equals

public boolean equals(java.lang.Object o)
Checks for equality

Overrides:
equals in class java.lang.Object
Returns:
if the option's values equal this

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object