org.jminor.framework.client.model
Interface EntityModel

All Superinterfaces:
EntityDataProvider, Refreshable
All Known Implementing Classes:
DefaultEntityModel

public interface EntityModel
extends Refreshable, EntityDataProvider

Specifies a class responsible for, among other things, coordinating a EntityEditModel and an EntityTableModel.


Method Summary
 void addAfterRefreshListener(ActionListener listener)
           
 void addBeforeRefreshListener(ActionListener listener)
           
 EntityModel addDetailModel(EntityModel detailModel)
          Adds the given detail model to this model
 void addDetailModels(EntityModel... detailModels)
          Adds the given detail models to this model.
 void addLinkedDetailModelsListener(ActionListener listener)
           
 void clearDetailModels()
          Clears the detail models.
 boolean containsDetailModel(Class<? extends EntityModel> modelClass)
           
 boolean containsDetailModel(EntityModel detailModel)
           
 boolean containsDetailModel(String entityID)
           
 boolean containsTableModel()
           
 EntityModel getDetailModel(Class<? extends EntityModel> modelClass)
          Returns the first detail model of the given type, this method does not automatically create an entity model if none is available
 EntityModel getDetailModel(String entityID)
          Returns a detail model of the given type, automatically creates a default entity model if none is available and auto creation is turned on
 Collection<? extends EntityModel> getDetailModels()
           
 EntityEditModel getEditModel()
           
 Collection<EntityModel> getLinkedDetailModels()
           
 EntityModel getMasterModel()
           
 EntityTableModel getTableModel()
           
 void initialize(String masterEntityID, List<Entity> selectedMasterEntities)
          Initializes this EntityModel according to the given master entities, sets the appropriate property value and filters the EntityTableModel
 void refreshDetailModels()
          Refreshes the detail models.
 void removeAfterRefreshListener(ActionListener listener)
           
 void removeBeforeRefreshListener(ActionListener listener)
           
 void removeLinkedDetailModelsListener(ActionListener listener)
           
 void setLinkedDetailModels(EntityModel... detailModels)
          Sets the currently linked detail models.
 void setMasterModel(EntityModel entityModel)
          Sets the model serving as master model
 
Methods inherited from interface org.jminor.common.model.Refreshable
clear, refresh
 
Methods inherited from interface org.jminor.framework.client.model.EntityDataProvider
getConnectionProvider, getEntityID
 

Method Detail

getEditModel

EntityEditModel getEditModel()
Returns:
the EntityEditModel instance used by this EntityModel

getTableModel

EntityTableModel getTableModel()
Returns:
the EntityTableModel, null if none is specified

containsTableModel

boolean containsTableModel()
Returns:
true if this EntityModel contains a TableModel

getLinkedDetailModels

Collection<EntityModel> getLinkedDetailModels()
Returns:
an unmodifiable collection containing the detail models that are currently linked to this model

setLinkedDetailModels

void setLinkedDetailModels(EntityModel... detailModels)
Sets the currently linked detail models. Linked models are updated and filtered according to the entity/entities selected in this (the master) model

Parameters:
detailModels - the detail models to link

initialize

void initialize(String masterEntityID,
                List<Entity> selectedMasterEntities)
Initializes this EntityModel according to the given master entities, sets the appropriate property value and filters the EntityTableModel

Parameters:
masterEntityID - the ID of the master entity
selectedMasterEntities - the master entities

setMasterModel

void setMasterModel(EntityModel entityModel)
Sets the model serving as master model

Parameters:
entityModel - the master entity model

getMasterModel

EntityModel getMasterModel()
Returns:
the master model, if any

addDetailModels

void addDetailModels(EntityModel... detailModels)
Adds the given detail models to this model.

Parameters:
detailModels - the detail models to add

addDetailModel

EntityModel addDetailModel(EntityModel detailModel)
Adds the given detail model to this model

Parameters:
detailModel - the detail model
Returns:
the detail model just added

containsDetailModel

boolean containsDetailModel(Class<? extends EntityModel> modelClass)
Parameters:
modelClass - the detail model class
Returns:
true if this model contains a detail model of the given class

containsDetailModel

boolean containsDetailModel(String entityID)
Parameters:
entityID - the entity ID
Returns:
true if this model contains a detail model for the given entity ID

containsDetailModel

boolean containsDetailModel(EntityModel detailModel)
Parameters:
detailModel - the detail model
Returns:
true if this model contains the given detail model

getDetailModel

EntityModel getDetailModel(Class<? extends EntityModel> modelClass)
Returns the first detail model of the given type, this method does not automatically create an entity model if none is available

Parameters:
modelClass - the type of the required EntityModel
Returns:
the detail model of type entityModelClass, null if none is found

getDetailModel

EntityModel getDetailModel(String entityID)
Returns a detail model of the given type, automatically creates a default entity model if none is available and auto creation is turned on

Parameters:
entityID - the entity ID of the required EntityModel
Returns:
the detail model of type entityModelClass
See Also:
Configuration.AUTO_CREATE_ENTITY_MODELS

getDetailModels

Collection<? extends EntityModel> getDetailModels()
Returns:
an unmodifiable collection containing the detail models this model contains

refreshDetailModels

void refreshDetailModels()
Refreshes the detail models.


clearDetailModels

void clearDetailModels()
Clears the detail models.


addBeforeRefreshListener

void addBeforeRefreshListener(ActionListener listener)
Parameters:
listener - a listener to be notified before a refresh is performed

removeBeforeRefreshListener

void removeBeforeRefreshListener(ActionListener listener)
Parameters:
listener - the listener to remove

addAfterRefreshListener

void addAfterRefreshListener(ActionListener listener)
Parameters:
listener - a listener to be notified each time a refresh has been performed

removeAfterRefreshListener

void removeAfterRefreshListener(ActionListener listener)
Parameters:
listener - the listener to remove

addLinkedDetailModelsListener

void addLinkedDetailModelsListener(ActionListener listener)
Parameters:
listener - a listener to be notified each time the linked detail models change

removeLinkedDetailModelsListener

void removeLinkedDetailModelsListener(ActionListener listener)
Parameters:
listener - the listener to remove