org.pm4j.core.pm.impl
Class PmAttrPmRefImpl<T_REFED_PM extends PmBean<?>,T_BEAN>

java.lang.Object
  extended by org.pm4j.core.pm.impl.PmObjectBase
      extended by org.pm4j.core.pm.impl.PmAttrBase<T_REFED_PM,T_BEAN>
          extended by org.pm4j.core.pm.impl.PmAttrPmRefImpl<T_REFED_PM,T_BEAN>
Type Parameters:
T_REFED_PM -
All Implemented Interfaces:
java.lang.Comparable<PmObject>, PmAttr<T_REFED_PM>, PmAttrPmRef<T_REFED_PM>, PmDataInput, PmObject

public class PmAttrPmRefImpl<T_REFED_PM extends PmBean<?>,T_BEAN>
extends PmAttrBase<T_REFED_PM,T_BEAN>
implements PmAttrPmRef<T_REFED_PM>

TODOC:

Keeps a reference to the bean differently for different scenarios:

Author:
olaf boede

Nested Class Summary
protected static class PmAttrPmRefImpl.MetaData
           
 
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
PmAttrPmRefImpl(PmObject pmParent)
           
 
Method Summary
 int compareTo(PmObject otherPm)
          Compares the referenced PM's by calling their compareTo(PmObject) method.
 T_REFED_PM convertBackingValueToPmValue(T_BEAN beanAttrValue)
           
 T_BEAN convertPmValueToBackingValue(T_REFED_PM pmAttrValue)
           
 java.lang.Object getValueAsBean()
           
protected  void initMetaData(PmObjectBase.MetaData metaData)
           
protected  PmObjectBase.MetaData makeMetaData()
          Gets called when the meta data instance for this presentation model is not yet available (first call within the VM live time).
 void pmValidate()
          In addition to standard checks (required check) it forwards the validation to the bean-PM provided by the parameter.
 T_REFED_PM setValueAsBean(java.lang.Object bean)
          Sets the reference using a bean.
 
Methods inherited from class org.pm4j.core.pm.impl.PmAttrBase
accept, clearCachedPmValues, clearPmInvalidValues, commitBufferedPmChanges, equalValues, getBackingValue, getBackingValueImpl, getConverter, getDefaultValue, getDefaultValueImpl, getFormatDefaultResKey, getFormatString, getMaxLen, getMinLen, getNullOptionDefault, getOptionSet, getOptionSetImpl, getOptionValues, getPmParentElement, getPmStyleClassesImpl, getUncachedValidValue, getValue, getValueAsString, getValueImpl, getValueLocalized, initMetaDataBeanConstraint, isBufferedPmValueMode, isEmptyValue, isPmEnabledImpl, isPmReadonlyImpl, isPmValueChanged, isPmVisibleImpl, isRequired, isSupportingAsStringValues, isValidatingOnSetPmValue, makeOptionSetDef, 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.PmAttrPmRef
getValue
 
Methods inherited from interface org.pm4j.core.pm.PmAttr
getFormatString, getMaxLen, getMinLen, getOptionSet, getValueAsString, getValueLocalized, isPmValueChanged, isRequired, resetPmValues, setPmValueChanged, setValue, setValueAsString
 
Methods inherited from interface org.pm4j.core.pm.PmDataInput
commitBufferedPmChanges, isBufferedPmValueMode, rollbackBufferedPmChanges
 
Methods inherited from interface org.pm4j.core.pm.PmObject
accept, canSetPmTitle, getPmConversation, getPmIconPath, getPmName, getPmParent, getPmProperty, getPmRelativeName, getPmShortTitle, getPmStyleClasses, getPmTitle, getPmTooltip, isPmEnabled, isPmReadonly, isPmValid, isPmVisible, setPmEnabled, setPmParent, setPmProperty, setPmTitle, setPmVisible
 

Constructor Detail

PmAttrPmRefImpl

public PmAttrPmRefImpl(PmObject pmParent)
Method Detail

getValueAsBean

public java.lang.Object getValueAsBean()
Specified by:
getValueAsBean in interface PmAttrPmRef<T_REFED_PM extends PmBean<?>>
Returns:
The bean behind the referenced model.

setValueAsBean

public T_REFED_PM setValueAsBean(java.lang.Object bean)
Description copied from interface: PmAttrPmRef
Sets the reference using a bean.

Specified by:
setValueAsBean in interface PmAttrPmRef<T_REFED_PM extends PmBean<?>>
Parameters:
bean - A bean to reference.
Returns:
The presentation model for the given bean.

pmValidate

public void pmValidate()
In addition to standard checks (required check) it forwards the validation to the bean-PM provided by the parameter.

Specified by:
pmValidate in interface PmDataInput
Overrides:
pmValidate in class PmAttrBase<T_REFED_PM extends PmBean<?>,T_BEAN>

convertBackingValueToPmValue

public T_REFED_PM convertBackingValueToPmValue(T_BEAN beanAttrValue)
Overrides:
convertBackingValueToPmValue in class PmAttrBase<T_REFED_PM extends PmBean<?>,T_BEAN>

convertPmValueToBackingValue

public T_BEAN convertPmValueToBackingValue(T_REFED_PM pmAttrValue)
Overrides:
convertPmValueToBackingValue in class PmAttrBase<T_REFED_PM extends PmBean<?>,T_BEAN>

compareTo

public int compareTo(PmObject otherPm)
Compares the referenced PM's by calling their compareTo(PmObject) method.

Specified by:
compareTo in interface java.lang.Comparable<PmObject>
Specified by:
compareTo in interface PmObject
Overrides:
compareTo in class PmAttrBase<T_REFED_PM extends PmBean<?>,T_BEAN>
Parameters:
otherPm - The PM to compare.
Returns:
The usual Comparable result: a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

makeMetaData

protected PmObjectBase.MetaData makeMetaData()
Gets called when the meta data instance for this presentation model is not yet available (first call within the VM live time).

Subclasses that provide more specific meta data should override this method to provide their meta data information container.

Specified by:
makeMetaData in class PmAttrBase<T_REFED_PM extends PmBean<?>,T_BEAN>
Parameters:
attrName - The name of the attribute. Unique within the parent element scope.
Returns:
A meta data container for this presentation model.

initMetaData

protected void initMetaData(PmObjectBase.MetaData metaData)
Overrides:
initMetaData in class PmAttrBase<T_REFED_PM extends PmBean<?>,T_BEAN>