|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jminor.common.model.combobox.DefaultFilteredComboBoxModel<Entity>
org.jminor.framework.client.model.DefaultEntityComboBoxModel
public class DefaultEntityComboBoxModel
A ComboBoxModel based on an Entity, showing by default all the entities in the underlying table.
Constructor Summary | |
---|---|
DefaultEntityComboBoxModel(String entityID,
EntityConnectionProvider connectionProvider)
|
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 |
EntityConnectionProvider |
getConnectionProvider()
|
Entity |
getEntity(Entity.Key primaryKey)
|
String |
getEntityID()
|
Collection<Entity> |
getForeignKeyFilterEntities(String foreignKeyPropertyID)
|
Entity |
getSelectedEntity()
|
protected List<Entity> |
initializeContents()
|
boolean |
isStaticData()
|
static void |
linkForeignKeyComboBoxModel(String foreignKeyPropertyID,
EntityComboBoxModel model,
EntityComboBoxModel foreignKeyModel)
|
protected List<Entity> |
performQuery(EntitySelectCriteria selectCriteria)
Retrieves the entities to present in this EntityComboBoxModel |
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. |
String |
toString()
|
protected Object |
translateSelectionItem(Object item)
|
protected boolean |
vetoSelectionChange(Object item)
|
Methods inherited from class org.jminor.common.model.combobox.DefaultFilteredComboBoxModel |
---|
addFilteringListener, addItem, addListDataListener, addSelectionListener, clear, contains, filterContents, fireContentsChanged, getAllItems, getElementAt, getFilterCriteria, getFilteredItemCount, getFilteredItems, getNullValueString, getSelectedItem, getSize, getVisibleItemCount, getVisibleItems, isCleared, isFiltered, isNullValueSelected, isVisible, refresh, removeFilteringListener, removeItem, removeListDataListener, removeSelectionListener, setContents, setFilterCriteria, setNullValueString, setSelectedItem |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
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 |
Constructor Detail |
---|
public DefaultEntityComboBoxModel(String entityID, EntityConnectionProvider connectionProvider)
entityID
- the ID of the entity this combo box model should representconnectionProvider
- a EntityConnectionProvider instanceMethod Detail |
---|
public final String toString()
toString
in class Object
public final EntityConnectionProvider getConnectionProvider()
getConnectionProvider
in interface EntityDataProvider
public final String getEntityID()
getEntityID
in interface EntityDataProvider
public final void forceRefresh()
forceRefresh
in interface EntityComboBoxModel
public final boolean isStaticData()
isStaticData
in interface EntityComboBoxModel
EntityComboBoxModel.forceRefresh()
public final EntityComboBoxModel setStaticData(boolean staticData)
setStaticData
in interface EntityComboBoxModel
staticData
- the value
public final Entity getEntity(Entity.Key primaryKey)
getEntity
in interface EntityComboBoxModel
primaryKey
- the primary key of the entity to fetch from this model
public final void setSelectedEntityByPrimaryKey(Entity.Key primaryKey)
setSelectedEntityByPrimaryKey
in interface EntityComboBoxModel
primaryKey
- the primary key of the entity to selectpublic final Entity getSelectedEntity()
getSelectedEntity
in interface EntityComboBoxModel
public final void setEntitySelectCriteria(EntitySelectCriteria entitySelectCriteria)
setEntitySelectCriteria
in interface EntityComboBoxModel
entitySelectCriteria
- the criteriapublic final void setForeignKeyFilterEntities(String foreignKeyPropertyID, Collection<Entity> entities)
setForeignKeyFilterEntities
in interface EntityComboBoxModel
foreignKeyPropertyID
- the property IDentities
- the entitiespublic final Collection<Entity> getForeignKeyFilterEntities(String foreignKeyPropertyID)
getForeignKeyFilterEntities
in interface EntityComboBoxModel
foreignKeyPropertyID
- the ID of the foreign key property
public final EntityComboBoxModel createForeignKeyFilterComboBoxModel(String foreignKeyPropertyID)
createForeignKeyFilterComboBoxModel
in interface EntityComboBoxModel
foreignKeyPropertyID
- the ID of the property with which values to create the combo box model
public final void addRefreshListener(ActionListener listener)
addRefreshListener
in interface EntityComboBoxModel
listener
- a listener to be notified each time this model is refreshedpublic final void removeRefreshListener(ActionListener listener)
removeRefreshListener
in interface EntityComboBoxModel
listener
- the listener to removepublic static void linkForeignKeyComboBoxModel(String foreignKeyPropertyID, EntityComboBoxModel model, EntityComboBoxModel foreignKeyModel)
protected Object translateSelectionItem(Object item)
translateSelectionItem
in class DefaultFilteredComboBoxModel<Entity>
protected final boolean vetoSelectionChange(Object item)
vetoSelectionChange
in class DefaultFilteredComboBoxModel<Entity>
protected final List<Entity> initializeContents()
initializeContents
in class DefaultFilteredComboBoxModel<Entity>
protected List<Entity> performQuery(EntitySelectCriteria selectCriteria)
selectCriteria
- the criteria to base the query on
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |