org.pm4j.core.pm.impl
Class PmBeanBase<T_BEAN>

java.lang.Object
  extended by org.pm4j.core.pm.impl.PmObjectBase
      extended by org.pm4j.core.pm.impl.PmDataInputBase
          extended by org.pm4j.core.pm.impl.PmElementBase
              extended by org.pm4j.core.pm.impl.PmBeanBase<T_BEAN>
All Implemented Interfaces:
java.lang.Comparable<PmObject>, PmBean<T_BEAN>, PmDataInput, PmElement, PmObject, PmTreeNode
Direct Known Subclasses:
PmBeanBase.Nested, PmPagerImpl, PmPagerImpl.SelectableItemPm

public abstract class PmBeanBase<T_BEAN>
extends PmElementBase
implements PmBean<T_BEAN>


Nested Class Summary
protected static class PmBeanBase.MetaData
          Shared meta data for all attributes of the same kind.
static class PmBeanBase.Nested<T_BEAN>
          A special PmBeanBase class that provides access to the bean that is handled by the embedding PmBeanBase instance.
 
Nested classes/interfaces inherited from class org.pm4j.core.pm.impl.PmObjectBase
PmObjectBase.NameBuilder, PmObjectBase.NameBuilderAbsoluteName, PmObjectBase.NameBuilderShortName, PmObjectBase.NameBuilderTitle
 
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
PmBeanBase()
          Default constructor for dependency injected PM's.
PmBeanBase(PmObject pmParent, T_BEAN bean)
          Initializing constructor.
 
Method Summary
protected  T_BEAN findPmBeanImpl()
          Looks up for the bean behind this PM.
 T_BEAN getPmBean()
           
 java.lang.Class<?> getPmBeanClass()
           
protected  T_BEAN getPmBeanImpl()
          Will be called if pmBean is null.
 java.io.Serializable getPmKey()
          The default implementation provides a unique identifier for the memory bean behind this model.
protected  void initMetaData(PmObjectBase.MetaData metaData)
           
protected  PmBeanBase.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 setPmBean(T_BEAN bean)
          Re-associates the PM to another bean instance and fires all change events for this instance and all children.
 
Methods inherited from class org.pm4j.core.pm.impl.PmElementBase
accept, clearCachedPmValues, findAnnotationsInPmHierarchy, getNodeDetailsPm, getPmAttribute, getPmAttributes, getPmChildNodes, getPmChildNodesImpl, getPmConversation, isPmReadonlyImpl, isPmTreeLeaf, isValidatingOnSetPmValue
 
Methods inherited from class org.pm4j.core.pm.impl.PmDataInputBase
commitBufferedPmChanges, isBufferedPmValueMode, isPmValueChanged, pmValidate, resetPmValues, rollbackBufferedPmChanges
 
Methods inherited from class org.pm4j.core.pm.impl.PmObjectBase
addToPmComposite, canSetPmTitle, clearPmInvalidValues, compareTo, ensurePmMetaDataInitialization, getPmConversationImpl, getPmIconPath, getPmMetaData, getPmMetaDataWithoutPmInitCall, getPmName, getPmParent, getPmProperty, getPmRelativeName, getPmResKey, getPmResKeyBase, getPmResLoaderCtxtClasses, getPmShortTitle, getPmStyleClasses, getPmStyleClassesImpl, getPmTitle, getPmTitleDef, getPmTitleImpl, getPmTooltip, getPmTooltipImpl, getVisiblePmCommands, getVisiblePmCommands, isMetaDataInitialized, isPmEnabled, isPmEnabledImpl, isPmReadonly, isPmValid, isPmVisible, isPmVisibleImpl, 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.PmElement
getPmAttribute, getPmAttributes
 
Methods inherited from interface org.pm4j.core.pm.PmDataInput
commitBufferedPmChanges, isBufferedPmValueMode, isPmValueChanged, pmValidate, resetPmValues, rollbackBufferedPmChanges
 
Methods inherited from interface org.pm4j.core.pm.PmTreeNode
getNodeDetailsPm, getPmChildNodes, isPmTreeLeaf
 
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

PmBeanBase

public PmBeanBase()
Default constructor for dependency injected PM's. The referenced bean can be accessed only after construction time.


PmBeanBase

public PmBeanBase(PmObject pmParent,
                  T_BEAN bean)
Initializing constructor. Allows to access the bean behind this PM at construction time.

Parameters:
pmParent - The context this PM is created in (e.g. field, session).
bean - The bean this PM is constructed for.
Method Detail

getPmBean

public T_BEAN getPmBean()
Specified by:
getPmBean in interface PmBean<T_BEAN>
Returns:
The data bean behind this presentation model element.
May provide null if the backing bean is null and:

findPmBeanImpl

protected T_BEAN findPmBeanImpl()
Looks up for the bean behind this PM.

The default implementation looks for a PM property for the expression provided by #getPmBeanKey().

Subclasses may provide alternative implementations.

Returns:
The found bean or null.

getPmBeanImpl

protected T_BEAN getPmBeanImpl()
Will be called if pmBean is null.

The default implementation tries to get a the bean addressed by #getPmBeanKey().

Returns:
The found bean.

setPmBean

public void setPmBean(T_BEAN bean)
Re-associates the PM to another bean instance and fires all change events for this instance and all children.

Parameters:
bean - The new bean behind this PM.

getPmKey

public java.io.Serializable getPmKey()
The default implementation provides a unique identifier for the memory bean behind this model.

Specified by:
getPmKey in interface PmElement
Overrides:
getPmKey in class PmElementBase
Returns:
A key that identifies the element within the session.

getPmBeanClass

public java.lang.Class<?> getPmBeanClass()
Specified by:
getPmBeanClass in interface PmBean<T_BEAN>
Returns:
The supported bean class.

makeMetaData

protected PmBeanBase.MetaData makeMetaData()
Description copied from class: PmObjectBase
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.

Overrides:
makeMetaData in class PmElementBase
Returns:
A static data container for this presentation model.

initMetaData

protected void initMetaData(PmObjectBase.MetaData metaData)
Overrides:
initMetaData in class PmObjectBase