org.beanfabrics
Interface IModelProvider

All Known Implementing Classes:
ModelProvider

public interface IModelProvider

A container for an PresentationModel object. ModelProviderListeners can subscribe for change events on the structure of the presentation object model.


Method Summary
 void addModelProviderListener(Path path, ModelProviderListener l)
          Adds a ModelProviderListener to the listener list.
<T extends PresentationModel>
T
getPresentationModel()
          Returns the PM instance hold by this container.
<T extends PresentationModel>
T
getPresentationModel(Path path)
          Returns the PM 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 PM, that is declared to be held at the root node of this provider.
 void removeModelProviderListener(Path path, ModelProviderListener l)
          Removes a ModelProviderListener from the listener list that was registered for a specific path.
 void setPresentationModel(PresentationModel pm)
          Sets the given PM instance as root node into this provider.
 void setPresentationModelType(java.lang.Class<? extends PresentationModel> newType)
          Declares the type of the PM, that should be held at the root node of this provider.
 

Method Detail

getPresentationModelType

java.lang.Class<? extends PresentationModel> getPresentationModelType()
Returns the type of the PM, that is declared to be held at the root node of this provider. Never returns null.

Returns:
the type of the PM, that is declared to be held at the root node of this provider

setPresentationModelType

void setPresentationModelType(java.lang.Class<? extends PresentationModel> newType)
Declares the type of the PM, that should be held at the root node of this provider.

Parameters:
newType - the type of the PM

getPresentationModel

<T extends PresentationModel> T getPresentationModel()
Returns the PM instance hold by this container. TODO: remove this unsafe type cast, or declare the type parameter at class level.

Type Parameters:
T - the provided PM type
Returns:
the PM instance hold by this container

setPresentationModel

void setPresentationModel(PresentationModel pm)
Sets the given PM instance as root node into this provider.

Parameters:
pm - the PM

getPresentationModel

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

Type Parameters:
T - the provided PM type
Parameters:
path - the path to the target PM relative to the root node held by this provider
Returns:
the PM found at the end of the specified path or null if nothing was found

addModelProviderListener

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.

Parameters:
path - the path which references the presentation model
l - the listener to add

removeModelProviderListener

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

Parameters:
path - the path which references the presentation model
l - the listener to remove