org.jminor.framework.client.model
Interface EntityComboBoxModel

All Superinterfaces:
ComboBoxModel, EntityDataProvider, FilteredComboBoxModel<Entity>, FilteredModel<Entity>, ListModel, Refreshable
All Known Implementing Classes:
DefaultEntityComboBoxModel

public interface EntityComboBoxModel
extends FilteredComboBoxModel<Entity>, EntityDataProvider

Specifies a ComboBoxModel containing entities.


Method Summary
 void addRefreshListener(ActionListener listener)
           
 EntityComboBoxModel createForeignKeyFilterComboBoxModel(String foreignKeyPropertyID)
          Returns a combo box model for selecting a foreign key value for filtering this model
 void forceRefresh()
          Forces a refresh of this model, disregarding the staticData directive
 Entity getEntity(Entity.Key primaryKey)
           
 Collection<Entity> getForeignKeyFilterEntities(String foreignKeyPropertyID)
           
 Entity getSelectedEntity()
           
 boolean isStaticData()
           
 void removeRefreshListener(ActionListener listener)
           
 void setEntitySelectCriteria(EntitySelectCriteria entitySelectCriteria)
          Sets the criteria to use when querying data
 void setForeignKeyFilterEntities(String foreignKeyPropertyID, Collection<Entity> entities)
          Filters this combo box model so that only entities referencing the given foreign key entities via the given foreign key property are shown.
 void setSelectedEntityByPrimaryKey(Entity.Key primaryKey)
          Selects the entity with the given primary key, if the entity is not available in the model this method returns silently without changing the selection
 EntityComboBoxModel setStaticData(boolean staticData)
          Specifies whether or not this model's data should be considered static, that is, only fetched once.
 
Methods inherited from interface org.jminor.common.model.combobox.FilteredComboBoxModel
addItem, addSelectionListener, getNullValueString, isCleared, isNullValueSelected, removeItem, removeSelectionListener, setContents, setNullValueString
 
Methods inherited from interface org.jminor.common.model.FilteredModel
addFilteringListener, contains, filterContents, getAllItems, getFilterCriteria, getFilteredItemCount, getFilteredItems, getVisibleItemCount, getVisibleItems, isFiltered, isVisible, removeFilteringListener, setFilterCriteria
 
Methods inherited from interface javax.swing.ComboBoxModel
getSelectedItem, setSelectedItem
 
Methods inherited from interface javax.swing.ListModel
addListDataListener, getElementAt, getSize, removeListDataListener
 
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

getSelectedEntity

Entity getSelectedEntity()
Returns:
the selected entity or null if none is selected

getEntity

Entity getEntity(Entity.Key primaryKey)
Parameters:
primaryKey - the primary key of the entity to fetch from this model
Returns:
the entity with the given key if it is contained in the model, null otherwise

getForeignKeyFilterEntities

Collection<Entity> getForeignKeyFilterEntities(String foreignKeyPropertyID)
Parameters:
foreignKeyPropertyID - the ID of the foreign key property
Returns:
the entity values currently used to filter the contents of this model

setForeignKeyFilterEntities

void setForeignKeyFilterEntities(String foreignKeyPropertyID,
                                 Collection<Entity> entities)
Filters this combo box model so that only entities referencing the given foreign key entities via the given foreign key property are shown.

Parameters:
foreignKeyPropertyID - the property ID
entities - the entities

createForeignKeyFilterComboBoxModel

EntityComboBoxModel createForeignKeyFilterComboBoxModel(String foreignKeyPropertyID)
Returns a combo box model for selecting a foreign key value for filtering this model

Parameters:
foreignKeyPropertyID - the ID of the property with which values to create the combo box model
Returns:
a combo box model for selecting a filtering value for this combo box model

setSelectedEntityByPrimaryKey

void setSelectedEntityByPrimaryKey(Entity.Key primaryKey)
Selects the entity with the given primary key, if the entity is not available in the model this method returns silently without changing the selection

Parameters:
primaryKey - the primary key of the entity to select

forceRefresh

void forceRefresh()
Forces a refresh of this model, disregarding the staticData directive


setStaticData

EntityComboBoxModel setStaticData(boolean staticData)
Specifies whether or not this model's data should be considered static, that is, only fetched once.

Parameters:
staticData - the value
Returns:
this EntityComboBoxModel instance

isStaticData

boolean isStaticData()
Returns:
true if the data for this model should only be fetched once
See Also:
forceRefresh()

setEntitySelectCriteria

void setEntitySelectCriteria(EntitySelectCriteria entitySelectCriteria)
Sets the criteria to use when querying data

Parameters:
entitySelectCriteria - the criteria

addRefreshListener

void addRefreshListener(ActionListener listener)
Parameters:
listener - a listener to be notified each time this model is refreshed

removeRefreshListener

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