org.beanfabrics
Class ModelProvider

java.lang.Object
  extended by org.beanfabrics.AbstractBean
      extended by org.beanfabrics.ModelProvider
All Implemented Interfaces:
Bean, IModelProvider

public class ModelProvider
extends AbstractBean
implements IModelProvider

The default implementation of a IModelProvider.

Author:
Michael Karneim

Constructor Summary
ModelProvider()
          Constructs an empty ModelProvider.
ModelProvider(java.lang.Class<? extends PresentationModel> presentationModelType)
          Constructs an empty ModelProvider for the given presentationModel type.
ModelProvider(PresentationModel presentationModel)
          Constructs a ModelProvider with the given presentationModel.
 
Method Summary
 void addModelProviderListener(Path path, ModelProviderListener l)
          Adds a ModelProviderListener to the listener list.
<T extends PresentationModel>
T
getPresentationModel()
          Returns the presentation model hold by this container.
<T extends PresentationModel>
T
getPresentationModel(Path path)
          Returns the presentation model found at the end of the specified path or null if nothing is found.
 java.lang.Class<? extends PresentationModel> getPresentationModelType()
          Returns the type of the presentation model object.
 void removeModelProviderListener(Path path, ModelProviderListener l)
          Removes a ModelProviderListener from the listener list that was registered for a specific path.
 void setPresentationModel(PresentationModel newPresentationModel)
          Sets the presentation model root object.
 void setPresentationModelType(java.lang.Class<? extends PresentationModel> newType)
          Sets the type of presentation model object.
 
Methods inherited from class org.beanfabrics.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, equals, getPropertyChangeSupport, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelProvider

public ModelProvider()
Constructs an empty ModelProvider.


ModelProvider

public ModelProvider(java.lang.Class<? extends PresentationModel> presentationModelType)
Constructs an empty ModelProvider for the given presentationModel type.


ModelProvider

public ModelProvider(PresentationModel presentationModel)
Constructs a ModelProvider with the given presentationModel.

Method Detail

getPresentationModel

public <T extends PresentationModel> T getPresentationModel()
Description copied from interface: IModelProvider
Returns the presentation model hold by this container.

Specified by:
getPresentationModel in interface IModelProvider
Type Parameters:
T - the provided presentation model type
Returns:
the presentation model hold by this container

setPresentationModel

public void setPresentationModel(PresentationModel newPresentationModel)
Sets the presentation model root object.

Specified by:
setPresentationModel in interface IModelProvider
Parameters:
newPresentationModel - the root presentation model to set

getPresentationModel

public <T extends PresentationModel> T getPresentationModel(Path path)
Returns the presentation model found at the end of the specified path or null if nothing is found.

Specified by:
getPresentationModel in interface IModelProvider
Type Parameters:
T - the provided presentation model type
Parameters:
path - the path which references the presentation model
Returns:
the presentation model found at the end of the specified path or null if nothing was found

getPresentationModelType

public java.lang.Class<? extends PresentationModel> getPresentationModelType()
Returns the type of the presentation model object.

Specified by:
getPresentationModelType in interface IModelProvider
Returns:
the type of the presentation model object

setPresentationModelType

public void setPresentationModelType(java.lang.Class<? extends PresentationModel> newType)
Sets the type of presentation model object.

Specified by:
setPresentationModelType in interface IModelProvider
Parameters:
newType - the type of the presentation model to set

addModelProviderListener

public void addModelProviderListener(Path path,
                                     ModelProviderListener l)
Adds a ModelProviderListener to the listener list. The listener is registered for all structural changes along the given path and will be informed whenever the model reference at the end of the path changes.

Specified by:
addModelProviderListener in interface IModelProvider
Parameters:
path - the path which references the presentation model
l - the listener to add

removeModelProviderListener

public void removeModelProviderListener(Path path,
                                        ModelProviderListener l)
Removes a ModelProviderListener from the listener list that was registered for a specific path.

Specified by:
removeModelProviderListener in interface IModelProvider
Parameters:
path - the path which references the presentation model
l - the listener to remove


© 2010 by Michael Karneim, http://www.beanfabrics.org