com.flexive.shared.value
Class FxSelectOne

java.lang.Object
  extended by com.flexive.shared.value.FxValue<FxSelectListItem,FxSelectOne>
      extended by com.flexive.shared.value.FxSelectOne
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<FxValue>

public class FxSelectOne
extends FxValue<FxSelectListItem,FxSelectOne>
implements java.io.Serializable

FxValue implementation for FxSelectList items with one selectable item

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

Field Summary
(package private) static FxSelectListItem EMPTY
           
 
Fields inherited from class com.flexive.shared.value.FxValue
DEFAULT_MULTILANGUAGE, defaultLanguage, emptyTranslations, multiLanguage, singleValue, translations, VALUE_NODATA
 
Constructor Summary
FxSelectOne(boolean multiLanguage, FxSelectListItem value)
          Constructor
FxSelectOne(boolean multiLanguage, long defaultLanguage, FxSelectListItem value)
          Constructor
FxSelectOne(boolean multiLanguage, long defaultLanguage, java.util.Map<java.lang.Long,FxSelectListItem> translations)
          Constructor
FxSelectOne(boolean multiLanguage, java.util.Map<java.lang.Long,FxSelectListItem> translations)
          Constructor
FxSelectOne(FxSelectListItem value)
          Constructor
FxSelectOne(FxValue<FxSelectListItem,FxSelectOne> clone)
          Constructor
FxSelectOne(long defaultLanguage, boolean multiLanguage)
          Constructor
FxSelectOne(long defaultLanguage, FxSelectListItem value)
          Constructor
FxSelectOne(long defaultLanguage, java.util.Map<java.lang.Long,FxSelectListItem> translations)
          Constructor
FxSelectOne(java.util.Map<java.lang.Long,FxSelectListItem[]> translations, int pos)
          Constructor - create value from an array of translations
FxSelectOne(java.util.Map<java.lang.Long,FxSelectListItem> translations)
          Constructor
 
Method Summary
 FxSelectOne copy()
          Creates a copy of the given object (useful if the actual type is unknown).
protected  FxSelectListItem copyValue(FxSelectListItem value)
          Implement this method for data types that return false from FxValue.isImmutableValueType().
 FxSelectListItem fromString(java.lang.String value)
          Evaluates the given string value to an object of type T.
 FxSelectListItem getEmptyValue()
          Returns an empty value object for this FxValue type.
 FxSelectList getSelectList()
          Get the SelectList for this SelectOne
 java.lang.String getStringValue(FxSelectListItem value)
          Converts the given instance of T to a string that can be parsed again by FxValue.fromString(String).
 java.lang.Class<FxSelectListItem> getValueClass()
          Return the class instance of the value type.
 void setSelectList(FxSelectList list)
          Updates the select list.
 
Methods inherited from class com.flexive.shared.value.FxValue
clearDefaultLanguage, clearValueData, compareTo, equals, fromPortableString, getBestTranslation, getBestTranslation, getBestTranslation, getBestTranslation, getDefaultLanguage, getDefaultTranslation, getErrorValue, getIsEmpty, getMaxInputLength, getPortableStringValue, getSelectedLanguage, getSqlValue, getTranslatedLanguages, getTranslation, getTranslation, getValueData, getValueDataRaw, getXPath, getXPathName, hasDefaultLanguage, hashCode, hasValueData, isAcceptsEmptyDefaultTranslations, isDefaultLanguage, isEmpty, isImmutableValueType, isMultiLanguage, isReadOnly, isTranslationEmpty, isTranslationEmpty, isValid, isValid, isValid, removeLanguage, setChangeListener, setDefaultLanguage, setDefaultLanguage, setDefaultTranslation, setEmpty, setEmpty, setMaxInputLength, setReadOnly, setSelectedLanguage, setTranslation, setTranslation, setValue, setValueData, setXPath, setXPath, toString, translationExists
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY

static final FxSelectListItem EMPTY
Constructor Detail

FxSelectOne

public FxSelectOne(long defaultLanguage,
                   boolean multiLanguage)
Constructor

Parameters:
multiLanguage - multilanguage value?
defaultLanguage - the default language

FxSelectOne

public FxSelectOne(boolean multiLanguage,
                   long defaultLanguage,
                   java.util.Map<java.lang.Long,FxSelectListItem> translations)
Constructor

Parameters:
multiLanguage - multilanguage value?
defaultLanguage - the default language
translations - HashMap containing language->translation mapping

FxSelectOne

public FxSelectOne(long defaultLanguage,
                   java.util.Map<java.lang.Long,FxSelectListItem> translations)
Constructor

Parameters:
defaultLanguage - the default language
translations - HashMap containing language->translation mapping

FxSelectOne

public FxSelectOne(boolean multiLanguage,
                   java.util.Map<java.lang.Long,FxSelectListItem> translations)
Constructor

Parameters:
multiLanguage - multilanguage value?
translations - HashMap containing language->translation mapping

FxSelectOne

public FxSelectOne(java.util.Map<java.lang.Long,FxSelectListItem> translations)
Constructor

Parameters:
translations - HashMap containing language->translation mapping

FxSelectOne

public FxSelectOne(java.util.Map<java.lang.Long,FxSelectListItem[]> translations,
                   int pos)
Constructor - create value from an array of translations

Parameters:
translations - HashMap containing language->translation mapping
pos - position (index) in the array to use

FxSelectOne

public FxSelectOne(boolean multiLanguage,
                   long defaultLanguage,
                   FxSelectListItem value)
Constructor

Parameters:
multiLanguage - multilanguage value?
defaultLanguage - the default language
value - single initializing value

FxSelectOne

public FxSelectOne(long defaultLanguage,
                   FxSelectListItem value)
Constructor

Parameters:
defaultLanguage - the default language
value - single initializing value

FxSelectOne

public FxSelectOne(boolean multiLanguage,
                   FxSelectListItem value)
Constructor

Parameters:
multiLanguage - multilanguage value?
value - single initializing value

FxSelectOne

public FxSelectOne(FxSelectListItem value)
Constructor

Parameters:
value - single initializing value

FxSelectOne

public FxSelectOne(FxValue<FxSelectListItem,FxSelectOne> clone)
Constructor

Parameters:
clone - original FxValue to be cloned
Method Detail

getValueClass

public java.lang.Class<FxSelectListItem> getValueClass()
Return the class instance of the value type.

Specified by:
getValueClass in class FxValue<FxSelectListItem,FxSelectOne>
Returns:
the class instance of the value type.

getStringValue

public java.lang.String getStringValue(FxSelectListItem value)
Converts the given instance of T to a string that can be parsed again by FxValue.fromString(String).

Overrides:
getStringValue in class FxValue<FxSelectListItem,FxSelectOne>
Parameters:
value - the value to be converted
Returns:
a string representation of the given value that can be parsed again using FxValue.fromString(String).

fromString

public FxSelectListItem fromString(java.lang.String value)
Evaluates the given string value to an object of type T.

Specified by:
fromString in class FxValue<FxSelectListItem,FxSelectOne>
Parameters:
value - string value to be evaluated
Returns:
the value interpreted as T

copy

public FxSelectOne copy()
Creates a copy of the given object (useful if the actual type is unknown).

Specified by:
copy in class FxValue<FxSelectListItem,FxSelectOne>
Returns:
a copy of the given object (useful if the actual type is unknown).

copyValue

protected FxSelectListItem copyValue(FxSelectListItem value)
Implement this method for data types that return false from FxValue.isImmutableValueType().

The default implementation returns the argument as-is and throws an IllegalArgumentException when the container class has mutable value types.

Overrides:
copyValue in class FxValue<FxSelectListItem,FxSelectOne>
Parameters:
value - the value to be copied (not null)
Returns:
an independent copy of value

getEmptyValue

public FxSelectListItem getEmptyValue()
Returns an empty value object for this FxValue type.

Specified by:
getEmptyValue in class FxValue<FxSelectListItem,FxSelectOne>
Returns:
an empty value object for this FxValue type.

getSelectList

public FxSelectList getSelectList()
Get the SelectList for this SelectOne

Returns:
SelectList

setSelectList

public void setSelectList(FxSelectList list)
Updates the select list.

Parameters:
list - the new select list instance