org.pm4j.core.pm.impl
Class PmAttrListImpl<T>

java.lang.Object
  extended by org.pm4j.core.pm.impl.PmObjectBase
      extended by org.pm4j.core.pm.impl.PmAttrBase<java.util.List<T>,java.util.Collection<T>>
          extended by org.pm4j.core.pm.impl.PmAttrListImpl<T>
All Implemented Interfaces:
java.lang.Comparable<PmObject>, PmAttr<java.util.List<T>>, PmAttrList<T>, PmDataInput, PmObject
Direct Known Subclasses:
PmAttrListImpl.PmAttrListOfIntegers, PmAttrListImpl.PmAttrListOfLongs, PmAttrListImpl.PmAttrListOfStrings

public class PmAttrListImpl<T>
extends PmAttrBase<java.util.List<T>,java.util.Collection<T>>
implements PmAttrList<T>


Nested Class Summary
protected static class PmAttrListImpl.MetaData
           
static class PmAttrListImpl.PmAttrListOfIntegers
           
static class PmAttrListImpl.PmAttrListOfLongs
           
static class PmAttrListImpl.PmAttrListOfStrings
           
 
Nested classes/interfaces inherited from class org.pm4j.core.pm.impl.PmObjectBase
PmObjectBase.NameBuilder, PmObjectBase.NameBuilderAbsoluteName, PmObjectBase.NameBuilderShortName, PmObjectBase.NameBuilderTitle
 
Nested classes/interfaces inherited from interface org.pm4j.core.pm.PmAttr
PmAttr.Converter<T>
 
Field Summary
 
Fields inherited from class org.pm4j.core.pm.impl.PmObjectBase
pmCacheLog
 
Fields inherited from interface org.pm4j.core.pm.PmObject
STYLE_CLASS_DISABLED, STYLE_CLASS_ERROR, STYLE_CLASS_INFO, STYLE_CLASS_REQUIRED, STYLE_CLASS_WARN
 
Constructor Summary
PmAttrListImpl(PmObject pmParent)
           
 
Method Summary
protected  PmAttr.Converter<T> getItemConverter()
          The item-Converter can be configured using the annotation PmAttrListCfg.itemConverter() or by overriding this method.
 PmOptionCfg.NullOption getNullOptionDefault()
          Provides the attribute type specific default definition, if an option set should contain a null option definition or not.
 int getSize()
           
 java.util.List<T> getValueAsList()
          An explicte list value signature.
 java.util.List<java.lang.String> getValueAsStringList()
          A string list interface for UI controls that only support string lists.
Example: rich:pickList
 java.util.List<T> getValueSubset(int fromIdx, int numItems)
          Provides a subset of the whole item set.
protected  void initMetaData(PmObjectBase.MetaData metaData)
           
protected  boolean isEmptyValue(java.util.List<T> value)
          Checks the attribute type specific null or empty value condition.
protected  PmObjectBase.MetaData makeMetaData()
          It's abstract because specific attribute types have to create their specific meta data.
 void setValueAsList(java.util.List<T> value)
           
 void setValueAsStringList(java.util.List<java.lang.String> value)
          A string list interface for UI controls that only support string lists.
Example: rich:pickList
 
Methods inherited from class org.pm4j.core.pm.impl.PmAttrBase
accept, clearCachedPmValues, clearPmInvalidValues, commitBufferedPmChanges, compareTo, convertBackingValueToPmValue, convertPmValueToBackingValue, equalValues, getBackingValue, getBackingValueImpl, getConverter, getDefaultValue, getDefaultValueImpl, getFormatDefaultResKey, getFormatString, getMaxLen, getMinLen, getOptionSet, getOptionSetImpl, getOptionValues, getPmParentElement, getPmStyleClassesImpl, getUncachedValidValue, getValue, getValueAsString, getValueImpl, getValueLocalized, initMetaDataBeanConstraint, isBufferedPmValueMode, isPmEnabledImpl, isPmReadonlyImpl, isPmValueChanged, isPmVisibleImpl, isRequired, isSupportingAsStringValues, isValidatingOnSetPmValue, makeOptionSetDef, pmValidate, resetPmValues, rollbackBufferedPmChanges, setBackingValue, setBackingValueImpl, setPmValueChanged, setValue, setValueAsString, setValueImpl, validate
 
Methods inherited from class org.pm4j.core.pm.impl.PmObjectBase
addToPmComposite, canSetPmTitle, ensurePmMetaDataInitialization, findAnnotationsInPmHierarchy, getPmConversation, getPmConversationImpl, getPmIconPath, getPmMetaData, getPmMetaDataWithoutPmInitCall, getPmName, getPmParent, getPmProperty, getPmRelativeName, getPmResKey, getPmResKeyBase, getPmResLoaderCtxtClasses, getPmShortTitle, getPmStyleClasses, getPmTitle, getPmTitleDef, getPmTitleImpl, getPmTooltip, getPmTooltipImpl, getVisiblePmCommands, getVisiblePmCommands, isMetaDataInitialized, isPmEnabled, isPmReadonly, isPmValid, isPmVisible, onPmChildStateChange, onPmInit, onPmValueChange, readCacheStrategy, removePmChild, setPmEnabled, setPmParent, setPmProperty, setPmTitle, setPmVisible, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.pm4j.core.pm.PmAttr
getFormatString, getMaxLen, getMinLen, getOptionSet, getValue, getValueAsString, getValueLocalized, isPmValueChanged, isRequired, resetPmValues, setPmValueChanged, setValue, setValueAsString
 
Methods inherited from interface org.pm4j.core.pm.PmDataInput
commitBufferedPmChanges, isBufferedPmValueMode, pmValidate, rollbackBufferedPmChanges
 
Methods inherited from interface org.pm4j.core.pm.PmObject
accept, canSetPmTitle, compareTo, getPmConversation, getPmIconPath, getPmName, getPmParent, getPmProperty, getPmRelativeName, getPmShortTitle, getPmStyleClasses, getPmTitle, getPmTooltip, isPmEnabled, isPmReadonly, isPmValid, isPmVisible, setPmEnabled, setPmParent, setPmProperty, setPmTitle, setPmVisible
 

Constructor Detail

PmAttrListImpl

public PmAttrListImpl(PmObject pmParent)
Method Detail

getValueAsList

public java.util.List<T> getValueAsList()
Description copied from interface: PmAttrList
An explicte list value signature. This signature is required for reflection based frameworks that analyze the method signature for their data binding (e.g. JSF). Such analysis for PmAttr.getValue() will just find out that the method returns an object. The same analysis perfomed on this method will provide the result that the returned value is a list...

Specified by:
getValueAsList in interface PmAttrList<T>
Returns:
The list value.

setValueAsList

public void setValueAsList(java.util.List<T> value)
Specified by:
setValueAsList in interface PmAttrList<T>
Parameters:
value - The new list value.
See Also:
PmAttrList.getValueAsList()

getValueAsStringList

public java.util.List<java.lang.String> getValueAsStringList()
Description copied from interface: PmAttrList
A string list interface for UI controls that only support string lists.
Example: rich:pickList

Attention: Will only work if an PmAttrListCfg.itemConverter() is defined.

Specified by:
getValueAsStringList in interface PmAttrList<T>
Returns:
The items as a list of strings.

setValueAsStringList

public void setValueAsStringList(java.util.List<java.lang.String> value)
                          throws org.pm4j.core.exception.PmConverterException
Description copied from interface: PmAttrList
A string list interface for UI controls that only support string lists.
Example: rich:pickList

Attention: Will only work if an PmAttrListCfg.itemConverter() is defined.

Specified by:
setValueAsStringList in interface PmAttrList<T>
Parameters:
value - The items as a list of strings.
Throws:
org.pm4j.core.exception.PmConverterException

getItemConverter

protected PmAttr.Converter<T> getItemConverter()
The item-Converter can be configured using the annotation PmAttrListCfg.itemConverter() or by overriding this method.

Returns:
The Converter used for the list item values.

isEmptyValue

protected boolean isEmptyValue(java.util.List<T> value)
Description copied from class: PmAttrBase
Checks the attribute type specific null or empty value condition.

Overrides:
isEmptyValue in class PmAttrBase<java.util.List<T>,java.util.Collection<T>>
Returns:
true when the value is a null or empty value equivalent.

getValueSubset

public java.util.List<T> getValueSubset(int fromIdx,
                                        int numItems)
Description copied from interface: PmAttrList
Provides a subset of the whole item set.

Specified by:
getValueSubset in interface PmAttrList<T>
Parameters:
fromIdx - Index of the first item to get.
numItems - The maximal number of items to get.
Returns:
The subset. May be empty but never null

getSize

public int getSize()
Specified by:
getSize in interface PmAttrList<T>
Returns:
number of list items provided by #{link PmAttr.getValue().

getNullOptionDefault

public PmOptionCfg.NullOption getNullOptionDefault()
Description copied from class: PmAttrBase
Provides the attribute type specific default definition, if an option set should contain a null option definition or not.

Usualy non-list attributes provide the default PmOptionCfg.NullOption#FOR_OPTIONAL_ATTR and list attributes PmOptionCfg.NullOption#NO.

Overrides:
getNullOptionDefault in class PmAttrBase<java.util.List<T>,java.util.Collection<T>>
Returns:
The attribute type specific null-option generation default value.

makeMetaData

protected PmObjectBase.MetaData makeMetaData()
Description copied from class: PmAttrBase
It's abstract because specific attribute types have to create their specific meta data.

Specified by:
makeMetaData in class PmAttrBase<java.util.List<T>,java.util.Collection<T>>
Returns:
A static data container for this presentation model.

initMetaData

protected void initMetaData(PmObjectBase.MetaData metaData)
Overrides:
initMetaData in class PmAttrBase<java.util.List<T>,java.util.Collection<T>>