|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface EntityEditModel
Specifies a class for editing entity instances.
Method Summary | |
---|---|
void |
addAfterDeleteListener(ActionListener listener)
|
void |
addAfterInsertListener(ActionListener listener)
|
void |
addAfterRefreshListener(ActionListener listener)
|
void |
addAfterUpdateListener(ActionListener listener)
|
void |
addBeforeDeleteListener(ActionListener listener)
|
void |
addBeforeInsertListener(ActionListener listener)
|
void |
addBeforeRefreshListener(ActionListener listener)
|
void |
addBeforeUpdateListener(ActionListener listener)
|
void |
addEntitiesChangedListener(ActionListener listener)
|
void |
clearComboBoxModels()
Clears the data from all combo box models |
boolean |
containsComboBoxModel(String propertyID)
Returns true if this edit model contains a ComboBoxModel for the given property |
EntityComboBoxModel |
createEntityComboBoxModel(Property.ForeignKeyProperty foreignKeyProperty)
Creates a default EntityComboBoxModel for the given property, override to provide specific EntityComboBoxModels (filtered for example) for properties. |
EntityLookupModel |
createEntityLookupModel(String entityID,
List<Property.ColumnProperty> lookupProperties,
Criteria additionalSearchCriteria)
Creates a EntityLookupModel for the given entityID |
FilteredComboBoxModel |
createPropertyComboBoxModel(Property.ColumnProperty property,
EventObserver refreshEvent,
String nullValueString)
Creates a combo box model containing the current values of the given property |
List<Entity> |
delete()
Deletes the active entity |
List<Entity> |
delete(List<Entity> entities)
Deletes the given entities, returns silently on recieving an empty list |
StateObserver |
getAllowDeleteState()
|
StateObserver |
getAllowInsertState()
|
StateObserver |
getAllowUpdateState()
|
Object |
getDefaultValue(Property property)
Returns the default value for the given property, used when initializing a new default entity for this edit model. |
EntityComboBoxModel |
getEntityComboBoxModel(Property.ForeignKeyProperty foreignKeyProperty)
|
EntityComboBoxModel |
getEntityComboBoxModel(String propertyID)
|
Entity |
getEntityCopy()
|
Entity |
getEntityCopy(boolean includePrimaryKeyValues)
|
StateObserver |
getEntityNullState()
|
Entity |
getForeignKeyValue(String foreignKeyPropertyID)
Returns the value associated with the given propertyID assuming it is an Entity instance |
FilteredComboBoxModel |
getPropertyComboBoxModel(Property.ColumnProperty property)
|
ValueCollectionProvider |
getValueProvider(Property property)
Initializes a value provider for the given property, used for adding lookup functionality to input fields for example. |
EntityComboBoxModel |
initializeEntityComboBoxModel(Property.ForeignKeyProperty foreignKeyProperty)
|
EntityComboBoxModel |
initializeEntityComboBoxModel(String propertyID)
|
FilteredComboBoxModel |
initializePropertyComboBoxModel(Property.ColumnProperty property,
EventObserver refreshEvent,
String nullValueString)
|
List<Entity.Key> |
insert()
Performs a insert on the active entity |
List<Entity.Key> |
insert(List<Entity> entities)
Performs an insert on the given entities, returns silently on recieving an empty list |
boolean |
isDeleteAllowed()
|
boolean |
isEntityNew()
|
boolean |
isInsertAllowed()
|
boolean |
isReadOnly()
|
boolean |
isUpdateAllowed()
|
boolean |
persistValueOnClear(Property property)
Returns true if the last available value for this property should be used when initializing a default entity. |
void |
refreshComboBoxModels()
Refreshes the Refreshable ComboBoxModels associated with this EntityEditModel |
void |
removeAfterDeleteListener(ActionListener listener)
|
void |
removeAfterInsertListener(ActionListener listener)
|
void |
removeAfterRefreshListener(ActionListener listener)
|
void |
removeAfterUpdateListener(ActionListener listener)
|
void |
removeBeforeDeleteListener(ActionListener listener)
|
void |
removeBeforeInsertListener(ActionListener listener)
|
void |
removeBeforeRefreshListener(ActionListener listener)
|
void |
removeBeforeUpdateListener(ActionListener listener)
|
void |
removeEntitiesChangedListener(ActionListener listener)
|
void |
replaceForeignKeyValues(String foreignKeyEntityID,
Collection<Entity> newForeignKeyValues)
For every field referencing the given foreign key values, replaces that foreign key instance with the corresponding entity from foreignKeyValues , useful when property
values have been changed in the referenced entity that must be reflected in the edit model. |
EntityEditModel |
setDeleteAllowed(boolean value)
|
void |
setEntity(Entity entity)
Sets the Entity instance to edit |
EntityEditModel |
setInsertAllowed(boolean value)
|
EntityEditModel |
setPersistValueOnClear(String propertyID,
boolean persistValueOnClear)
|
EntityEditModel |
setReadOnly(boolean readOnly)
|
EntityEditModel |
setUpdateAllowed(boolean value)
|
List<Entity> |
update()
Performs a update on the active entity |
List<Entity> |
update(List<Entity> entities)
Updates the given Entities. |
Methods inherited from interface org.jminor.common.model.valuemap.ValueChangeMapEditModel |
---|
addValueListener, addValueMapSetListener, addValueSetListener, getDefaultValueMap, getModifiedState, getValidator, getValidState, getValue, getValueChangeObserver, isModified, isNullable, isValid, isValid, isValueNull, removeValueListener, removeValueMapSetListener, removeValueSetListener, setValue, setValueMap, validate |
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 |
---|
void setEntity(Entity entity)
entity
- the entityEntity getEntityCopy()
ValueChangeMap.getCopy()
Entity getEntityCopy(boolean includePrimaryKeyValues)
includePrimaryKeyValues
- if false then the primary key values are excluded
ValueChangeMap.getCopy()
boolean isEntityNew()
Entity.isPrimaryKeyNull()
Entity getForeignKeyValue(String foreignKeyPropertyID)
foreignKeyPropertyID
- the ID of the property
ClassCastException
- in case the value was not an Entityvoid replaceForeignKeyValues(String foreignKeyEntityID, Collection<Entity> newForeignKeyValues)
foreignKeyValues
, useful when property
values have been changed in the referenced entity that must be reflected in the edit model.
foreignKeyEntityID
- the entity ID of the foreign key valuesnewForeignKeyValues
- the new foreign key entitiesValueCollectionProvider getValueProvider(Property property)
property
- the property
boolean isReadOnly()
EntityEditModel setReadOnly(boolean readOnly)
readOnly
- the read only status
EntityEditModel setPersistValueOnClear(String propertyID, boolean persistValueOnClear)
propertyID
- the property IDpersistValueOnClear
- true if this model should persist the value of the given property on clear
Configuration.PERSIST_FOREIGN_KEY_VALUES
boolean isInsertAllowed()
EntityEditModel setInsertAllowed(boolean value)
value
- true if this model should allow inserts
boolean isUpdateAllowed()
EntityEditModel setUpdateAllowed(boolean value)
value
- true if this model should allow records to be updated
boolean isDeleteAllowed()
EntityEditModel setDeleteAllowed(boolean value)
value
- true if this model should allow records to be deleted
EntityComboBoxModel createEntityComboBoxModel(Property.ForeignKeyProperty foreignKeyProperty)
foreignKeyProperty
- the foreign key property for which to create a EntityComboBoxModel
Configuration.DEFAULT_COMBO_BOX_NULL_VALUE_ITEM
,
Property.isNullable()
EntityLookupModel createEntityLookupModel(String entityID, List<Property.ColumnProperty> lookupProperties, Criteria additionalSearchCriteria)
entityID
- the ID of the entitylookupProperties
- the properties involved in the lookupadditionalSearchCriteria
- an additional search criteria applied when performing the lookup
FilteredComboBoxModel initializePropertyComboBoxModel(Property.ColumnProperty property, EventObserver refreshEvent, String nullValueString)
property
- the property for which to get the ComboBoxModelrefreshEvent
- the combo box model is refreshed when this event fires,
if none is specified addEntitiesChangedListener()
is used.nullValueString
- the value to use for representing the null item at the top of the list,
if this value is null then no such item is included
property
, if no combo box model
has been initialized for the given property, a new one is created and associated with
the property, to be returned the next time this method is calledFilteredComboBoxModel getPropertyComboBoxModel(Property.ColumnProperty property)
property
- the property for which to get the ComboBoxModel
property
RuntimeException
- if no combo box has been initialized for the given propertyboolean containsComboBoxModel(String propertyID)
propertyID
- the ID of the property
EntityComboBoxModel getEntityComboBoxModel(String propertyID)
propertyID
- the ID of the property for which to retrieve the EntityComboBoxModel
propertyID
,
if no combo box model is associated with the property a new one is initialized, and associated
with the given property
RuntimeException
- if no combo box has been initialized for the given propertyEntityComboBoxModel getEntityComboBoxModel(Property.ForeignKeyProperty foreignKeyProperty)
foreignKeyProperty
- the foreign key property for which to retrieve the EntityComboBoxModel
property
RuntimeException
- if no combo box has been initialized for the given propertyEntityComboBoxModel initializeEntityComboBoxModel(String propertyID)
propertyID
- the ID of the foreign key property for which to retrieve the EntityComboBoxModel
property
,
if no combo box model is associated with the property a new one is initialized, and associated
with the given propertyEntityComboBoxModel initializeEntityComboBoxModel(Property.ForeignKeyProperty foreignKeyProperty)
foreignKeyProperty
- the foreign key property for which to retrieve the EntityComboBoxModel
property
,
if no combo box model is associated with the property a new one is initialized, and associated
with the given propertyFilteredComboBoxModel createPropertyComboBoxModel(Property.ColumnProperty property, EventObserver refreshEvent, String nullValueString)
property
- the propertyrefreshEvent
- the combo box model is refreshed each time this event is firednullValueString
- the string to use as a null value caption
void refreshComboBoxModels()
Refreshable
void clearComboBoxModels()
Object getDefaultValue(Property property)
persistValueOnClear
should be overridden so that it returns true
for that property.
property
- the property
Property.setDefaultValue(Object)
,
persistValueOnClear(org.jminor.framework.domain.Property)
boolean persistValueOnClear(Property property)
Configuration.PERSIST_FOREIGN_KEY_VALUES
.
property
- the property
Configuration.PERSIST_FOREIGN_KEY_VALUES
List<Entity.Key> insert() throws CancelException, DatabaseException, ValidationException
DatabaseException
- in case of a database exception
CancelException
- in case the user cancels the operation
ValidationException
- in case validation failsEntity.Validator.validate(java.util.Collection, int)
List<Entity.Key> insert(List<Entity> entities) throws CancelException, DatabaseException, ValidationException
entities
- the entities to insert
DatabaseException
- in case of a database exception
CancelException
- in case the user cancels the operation
ValidationException
- in case validation failsaddBeforeInsertListener(java.awt.event.ActionListener)
,
addAfterInsertListener(java.awt.event.ActionListener)
,
Entity.Validator.validate(java.util.Collection, int)
List<Entity> update() throws CancelException, DatabaseException, ValidationException
DatabaseException
- in case of a database exception
CancelException
- in case the user cancels the operation
RecordModifiedException
- in case an entity was modified by another user
ValidationException
- in case validation failsEntity.Validator.validate(java.util.Collection, int)
List<Entity> update(List<Entity> entities) throws DatabaseException, CancelException, ValidationException
entities
- the Entities to update
DatabaseException
- in case of a database exception
CancelException
- in case the user cancels the operation
RecordModifiedException
- in case an entity was modified by another user
ValidationException
- in case validation failsaddBeforeUpdateListener(java.awt.event.ActionListener)
,
addAfterUpdateListener(java.awt.event.ActionListener)
,
Entity.Validator.validate(java.util.Collection, int)
List<Entity> delete() throws DatabaseException, CancelException
DatabaseException
- in case of a database exception
CancelException
- in case the user cancels the operationaddBeforeDeleteListener(java.awt.event.ActionListener)
,
addAfterDeleteListener(java.awt.event.ActionListener)
List<Entity> delete(List<Entity> entities) throws DatabaseException, CancelException
entities
- the entities to delete
DatabaseException
- in case of a database exception
CancelException
- in case the user cancels the operationaddBeforeDeleteListener(java.awt.event.ActionListener)
,
addAfterDeleteListener(java.awt.event.ActionListener)
StateObserver getAllowDeleteState()
isDeleteAllowed()
,
setDeleteAllowed(boolean)
StateObserver getEntityNullState()
StateObserver getAllowUpdateState()
isUpdateAllowed()
,
setUpdateAllowed(boolean)
StateObserver getAllowInsertState()
isInsertAllowed()
,
setInsertAllowed(boolean)
void addBeforeInsertListener(ActionListener listener)
listener
- a listener to be notified before an insert is performedvoid removeBeforeInsertListener(ActionListener listener)
listener
- a listener to be notified each timevoid addAfterInsertListener(ActionListener listener)
listener
- a listener to be notified each time a insert has been performedvoid removeAfterInsertListener(ActionListener listener)
listener
- a listener to be notified each timevoid addBeforeUpdateListener(ActionListener listener)
listener
- a listener to be notified before an update is performedvoid removeBeforeUpdateListener(ActionListener listener)
listener
- a listener to be notified each timevoid addAfterUpdateListener(ActionListener listener)
listener
- a listener to be notified each time an update has been performedvoid removeAfterUpdateListener(ActionListener listener)
listener
- a listener to be notified each timevoid addBeforeDeleteListener(ActionListener listener)
listener
- a listener to be notified before a delete is performedvoid removeBeforeDeleteListener(ActionListener listener)
listener
- a listener to be notified each timevoid addAfterDeleteListener(ActionListener listener)
listener
- a listener to be notified each time a delete has been performedvoid removeAfterDeleteListener(ActionListener listener)
listener
- a listener to be notified each timevoid addBeforeRefreshListener(ActionListener listener)
listener
- a listener to be notified before a refresh is performedvoid removeBeforeRefreshListener(ActionListener listener)
listener
- a listener to be notified each timevoid addAfterRefreshListener(ActionListener listener)
listener
- a listener to be notified each time a refresh has been performedvoid removeAfterRefreshListener(ActionListener listener)
listener
- a listener to be notified each timevoid addEntitiesChangedListener(ActionListener listener)
listener
- a listener to be notified each time a entity is modified via this model,
updated, inserted or deletedvoid removeEntitiesChangedListener(ActionListener listener)
listener
- a listener to be notified each time
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |