org.pm4j.core.pm.impl
Class PmAttrEnumImpl<T_ENUM extends java.lang.Enum<T_ENUM>>

java.lang.Object
  extended by org.pm4j.core.pm.impl.PmObjectBase
      extended by org.pm4j.core.pm.impl.PmAttrBase<T_ENUM,T_ENUM>
          extended by org.pm4j.core.pm.impl.PmAttrEnumImpl<T_ENUM>
All Implemented Interfaces:
java.lang.Comparable<PmObject>, PmAttr<T_ENUM>, PmAttrEnum<T_ENUM>, PmDataInput, PmObject
Direct Known Subclasses:
PmTableColImpl.SortOrderAttr

public class PmAttrEnumImpl<T_ENUM extends java.lang.Enum<T_ENUM>>
extends PmAttrBase<T_ENUM,T_ENUM>
implements PmAttrEnum<T_ENUM>


Nested Class Summary
protected static class PmAttrEnumImpl.MetaData
           
protected static class PmAttrEnumImpl.PmConverterEnum
           
 
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
PmAttrEnumImpl(PmObject pmParent, java.lang.Class<T_ENUM> enumClass)
           
 
Method Summary
protected  java.lang.Class<T_ENUM> getEnumClass()
           
 PmOptionCfg.NullOption getNullOptionDefault()
          Provides the attribute type specific default definition, if an option set should contain a null option definition or not.
protected  java.lang.String getTitleForEnumValue(java.lang.Enum<?> value)
           
 java.lang.String getValueLocalized()
          The default implementation returns the result of PmAttrBase.getValueAsString().
protected  PmOptionImpl makeEnumOption(java.lang.Enum<?> value)
          Helper for manual enum option creation.
protected  PmOptionSetImpl makeEnumOptions(java.lang.Enum<?>... values)
          Helper for manual enum option set creation.
protected  PmObjectBase.MetaData makeMetaData()
          It's abstract because specific attribute types have to create their specific meta data.
protected  PmOptionSetDef<?> makeOptionSetDef(PmOptionCfg cfg, java.lang.reflect.Method getOptionValuesMethod)
           
 
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, initMetaData, initMetaDataBeanConstraint, isBufferedPmValueMode, isEmptyValue, isPmEnabledImpl, isPmReadonlyImpl, isPmValueChanged, isPmVisibleImpl, isRequired, isSupportingAsStringValues, isValidatingOnSetPmValue, 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, 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

PmAttrEnumImpl

public PmAttrEnumImpl(PmObject pmParent,
                      java.lang.Class<T_ENUM> enumClass)
Method Detail

getValueLocalized

public java.lang.String getValueLocalized()
Description copied from class: PmAttrBase
The default implementation returns the result of PmAttrBase.getValueAsString().

Specified by:
getValueLocalized in interface PmAttr<T_ENUM extends java.lang.Enum<T_ENUM>>
Overrides:
getValueLocalized in class PmAttrBase<T_ENUM extends java.lang.Enum<T_ENUM>,T_ENUM extends java.lang.Enum<T_ENUM>>
Returns:
The localized string value for the current value.

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<T_ENUM extends java.lang.Enum<T_ENUM>,T_ENUM extends java.lang.Enum<T_ENUM>>
Returns:
The attribute type specific null-option generation default value.

getTitleForEnumValue

protected java.lang.String getTitleForEnumValue(java.lang.Enum<?> value)

makeEnumOption

protected PmOptionImpl makeEnumOption(java.lang.Enum<?> value)
Helper for manual enum option creation.

Parameters:
value - The enum to get an option for.
Returns:
The option for the given enum.

makeEnumOptions

protected PmOptionSetImpl makeEnumOptions(java.lang.Enum<?>... values)
Helper for manual enum option set creation.

Parameters:
values - The enum values to get an option for.
Returns:
The option set for the given enum set.

getEnumClass

protected java.lang.Class<T_ENUM> getEnumClass()
Returns:
The represented enum class.

makeOptionSetDef

protected PmOptionSetDef<?> makeOptionSetDef(PmOptionCfg cfg,
                                             java.lang.reflect.Method getOptionValuesMethod)
Overrides:
makeOptionSetDef in class PmAttrBase<T_ENUM extends java.lang.Enum<T_ENUM>,T_ENUM extends java.lang.Enum<T_ENUM>>

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<T_ENUM extends java.lang.Enum<T_ENUM>,T_ENUM extends java.lang.Enum<T_ENUM>>
Returns:
A static data container for this presentation model.