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_FULLTEXT
          Fulltext indexed?
static java.lang.String OPTION_HTML_EDITOR
           
static java.lang.String OPTION_MAXLENGTH
           
static java.lang.String OPTION_MIMETYPE
          Mime type option
static java.lang.String OPTION_MULTILANG
           
static java.lang.String OPTION_MULTILINE
           
static java.lang.String OPTION_REFERENCE_SELECTONE
          Force an explicit select box with all existing instances for FxReference properties.
static java.lang.String OPTION_SEARCHABLE
           
static java.lang.String OPTION_SELECTMANY_CHECKBOXES
          Use checkboxes instead of a multi-select list for FxSelectMany properties.
static java.lang.String OPTION_SHOW_OVERVIEW
           
protected  boolean overridable
           
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 overridable, boolean set, boolean isInherited, java.lang.String value)
          Ctor w/ inheritance option
FxStructureOption(java.lang.String key, boolean overridable, 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 a list of options
static java.util.List<FxStructureOption> cloneOptions(java.util.List<FxStructureOption> options, boolean isInheritedOnly)
          Get a copy of a list of options - optionally only those which have their isInherited flag set to true
 boolean equals(java.lang.Object o)
          Checks for equality
(package private) static FxStructureOption findOption(java.lang.String opt, java.util.List<FxStructureOption> options)
          Internal option lookup that doesn't create temporary option instance and works only with upper-case option names
static java.util.List<FxStructureOption> getEmptyOptionList(int capacity)
          Get a list of empty options
 int getIntValue()
          Get the value as integer
 boolean getIsInherited()
          Is the option inherited by derived structures?
 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, overridable 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 isOverridable()
          Is the option overridable (in assignments)?
 boolean isSet()
          Is the option set, will return false if an unknown option is requested
 boolean isValid()
          Test if the option need to be saved
 boolean isValueTrue()
          Convenience method to check if value is set to true
 void setIsInherited(boolean isInherited)
          Set to true if the option should be inherited by derived structures
static void setOption(java.util.List<FxStructureOption> options, java.lang.String key, boolean overridable, 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 overridable, boolean isInherited, 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 overridable, boolean isInherited, java.lang.String value)
          Set or add a String value in a list of options
static void setOption(java.util.List<FxStructureOption> options, java.lang.String key, boolean overridable, java.lang.String value)
          Set or add a String value in a list of options
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

OPTION_MULTILANG

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

OPTION_FULLTEXT

public static final java.lang.String OPTION_FULLTEXT
Fulltext indexed?

Since:
3.1
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_REFERENCE_SELECTONE

public static final java.lang.String OPTION_REFERENCE_SELECTONE
Force an explicit select box with all existing instances for FxReference properties.

Since:
3.1
See Also:
Constant Field Values

OPTION_SELECTMANY_CHECKBOXES

public static final java.lang.String OPTION_SELECTMANY_CHECKBOXES
Use checkboxes instead of a multi-select list for FxSelectMany properties.

Since:
3.1
See Also:
Constant Field Values

OPTION_MIMETYPE

public static final java.lang.String OPTION_MIMETYPE
Mime type option

Since:
3.1
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

overridable

protected boolean overridable
Constructor Detail

FxStructureOption

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

Parameters:
key - key identifying the option
overridable - 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(java.lang.String key,
                         boolean overridable,
                         boolean set,
                         boolean isInherited,
                         java.lang.String value)
Ctor w/ inheritance option

Parameters:
key - key identifying the option
overridable - is the option overridable in assignments
set - is the option set? (non-existing options are returned as not-set options!)
isInherited - option inherited by derived structures?
value - the options value
Since:
3.1

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

isOverridable

public boolean isOverridable()
Is the option overridable (in assignments)?

Returns:
option overridable (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

isValid

public boolean isValid()
Test if the option need to be saved

Returns:
true if the option is set and the value is not empty
Since:
3.1

getValue

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

Returns:
value assigned to the option

getIsInherited

public boolean getIsInherited()
Is the option inherited by derived structures?

Returns:
true if the option is inherited by derived structures
Since:
3.1

setIsInherited

public void setIsInherited(boolean isInherited)
Set to true if the option should be inherited by derived structures

Parameters:
isInherited - flag
Since:
3.1

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, overridable 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 overridable,
                             java.lang.String value)
Set or add a String value in a list of options

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

setOption

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

Parameters:
options - list of existing options
key - option key
overridable - should the option be overridable?
isInherited - is the option inherited by derived structures?
value - String value to set for the option
Since:
3.1

setOption

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

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

setOption

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

Parameters:
options - list of existing options
key - option key
overridable - should the option be overridable?
isInherited - should the option be inherited by derived structures?
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 a list of options

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

cloneOptions

public static java.util.List<FxStructureOption> cloneOptions(java.util.List<FxStructureOption> options,
                                                             boolean isInheritedOnly)
Get a copy of a list of options - optionally only those which have their isInherited flag set to true

Parameters:
options - list to clone
isInheritedOnly - return only options whose isInherited flag is true
Returns:
cloned list of options
Since:
3.1.1

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

findOption

static FxStructureOption findOption(java.lang.String opt,
                                    java.util.List<FxStructureOption> options)
Internal option lookup that doesn't create temporary option instance and works only with upper-case option names

Parameters:
opt - the option key (in upper case)
options - the options
Returns:
the option instance, when it exists

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

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object