-
- All Known Implementing Classes:
AbstractEntityEditModel
,FXEntityEditModel
,SwingEntityEditModel
public interface EntityEditModel
Specifies a class for editingEntity
instances.
-
-
Field Summary
Fields Modifier and Type Field Description static PropertyValue<Boolean>
PERSIST_FOREIGN_KEY_VALUES
Specifies whether foreign key values should persist when the UI is cleared or be reset to null
Value type: Boolean
Default value: truestatic PropertyValue<Boolean>
POST_EDIT_EVENTS
Specifies whether edit models post their insert, update and delete events toEntityEditEvents
Value type: Boolean
Default value: truestatic PropertyValue<Boolean>
WARN_ABOUT_UNSAVED_DATA
Indicates whether the application should ask for confirmation when exiting if some data is unsaved
and whether it should warn when unsaved data is about to be lost, i.e.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addAfterDeleteListener(EventDataListener<List<Entity>> listener)
void
addAfterInsertListener(EventDataListener<List<Entity>> listener)
void
addAfterUpdateListener(EventDataListener<Map<Key,Entity>> listener)
void
addBeforeDeleteListener(EventDataListener<List<Entity>> listener)
void
addBeforeInsertListener(EventDataListener<List<Entity>> listener)
void
addBeforeUpdateListener(EventDataListener<Map<Key,Entity>> listener)
void
addConfirmSetEntityObserver(EventDataListener<State> listener)
<T> void
addEditListener(Attribute<T> attribute, EventDataListener<T> listener)
Adds a listener notified each time the value associated with the given attribute is edited viaput(Attribute, Object)
orremove(Attribute)
, note that this event is only fired if the value actually changes.void
addEntitiesEditedListener(EventListener listener)
void
addEntityListener(EventDataListener<Entity> listener)
Notified each time the entity is set viasetEntity(Entity)
.void
addForeignKeyValues(ForeignKey foreignKey, Collection<Entity> entities)
Adds the inserted entities to all foreign key models based on that entity typevoid
addRefreshingObserver(StateObserver refreshingObserver)
Adds aStateObserver
instance to this edit models refreshing observervoid
addRefreshListener(EventListener listener)
void
addValueListener(EventDataListener<Attribute<?>> listener)
<T> void
addValueListener(Attribute<T> attribute, EventDataListener<T> listener)
Adds a listener notified each time the value associated with the given attribute changes, either via editing or when the active entity is set.EntityConnectionProvider
connectionProvider()
boolean
containsSearchModel(ForeignKey foreignKey)
Returns true if this edit model contains aEntitySearchModel
for the given foreign keyboolean
containsUnsavedData()
Returns true if an entity is selected and a value has been modified or if the entity is new and one or more non-default values have been enteredEntitySearchModel
createForeignKeySearchModel(ForeignKey foreignKey)
Creates aEntitySearchModel
for looking up entities referenced by the given foreign key, using the search attributes defined for that entity type.Entity
delete()
Deletes the active entityList<Entity>
delete(List<Entity> entities)
Deletes the given entities, returns silently on receiving an empty listStateObserver
deleteEnabledObserver()
Entities
entities()
Entity
entityCopy()
EntityDefinition
entityDefinition()
StateObserver
entityNewObserver()
EntityType
entityType()
EntitySearchModel
foreignKeySearchModel(ForeignKey foreignKey)
<T> T
get(Attribute<T> attribute)
Returns the value associated with the given attribute<T> Optional<T>
getOptional(Attribute<T> attribute)
Returns the value associated with the given attributeEntity
insert()
Performs an insert on the active entity, sets the primary key values of the active entity according to the primary key of the inserted entityList<Entity>
insert(List<Entity> entities)
Performs an insert on the given entities, returns silently on receiving an empty list.StateObserver
insertEnabledObserver()
boolean
isDeleteEnabled()
boolean
isEntityNew()
Returns true if the active entity is new or false if it represents a row already persisted.boolean
isInsertEnabled()
boolean
isModified()
boolean
isNotNull(Attribute<?> attribute)
boolean
isNull(Attribute<?> attribute)
boolean
isNullable(Attribute<?> attribute)
boolean
isPersistValue(Attribute<?> attribute)
Returns true if the last available value for this attribute should be used when initializing a default entity.boolean
isPostEditEvents()
Returns true if this edit model posts its insert, update and delete events on theEntityEditEvents
event busboolean
isReadOnly()
boolean
isUpdateEnabled()
boolean
isValid()
boolean
isValid(Attribute<?> attribute)
Returns true if the value associated with the given attribute is valid, using thevalidate(Attribute)
method.boolean
isWarnAboutUnsavedData()
StateObserver
modifiedObserver()
Returns aStateObserver
responsible for indicating when and if any values in the underlying Entity have been modified.StateObserver
modifiedObserver(Attribute<?> attribute)
Returns aStateObserver
instance indicating whether the value of the given attribute has been modified.StateObserver
nullObserver(Attribute<?> attribute)
Returns aStateObserver
indicating whether the value of the given attribute is null.StateObserver
primaryKeyNullObserver()
<T> void
put(Attribute<T> attribute, T value)
Sets the given value in the underlying EntityEntity
referencedEntity(ForeignKey foreignKey)
Returns the value associated with the given foreign key.void
refresh()
Refreshes all data models used by this edit model, combo box models f.ex.void
refreshEntity()
Refreshes the active Entity from the database, discarding all changes.StateObserver
refreshingObserver()
<T> T
remove(Attribute<T> attribute)
Removes the given value from the underlying Entityvoid
removeAfterDeleteListener(EventDataListener<List<Entity>> listener)
Removes the given listener.void
removeAfterInsertListener(EventDataListener<List<Entity>> listener)
Removes the given listener.void
removeAfterUpdateListener(EventDataListener<Map<Key,Entity>> listener)
Removes the given listener.void
removeBeforeDeleteListener(EventDataListener<List<Entity>> listener)
Removes the given listener.void
removeBeforeInsertListener(EventDataListener<List<Entity>> listener)
Removes the given listener.void
removeBeforeUpdateListener(EventDataListener<Map<Key,Entity>> listener)
Removes the given listener.void
removeConfirmSetEntityObserver(EventDataListener<State> listener)
Removes the given listener.<T> void
removeEditListener(Attribute<T> attribute, EventDataListener<T> listener)
Removes the given listener.void
removeEntitiesEditedListener(EventListener listener)
Removes the given listener.void
removeEntityListener(EventDataListener<Entity> listener)
Removes the given listener.void
removeForeignKeyValues(ForeignKey foreignKey, Collection<Entity> entities)
Removes the given entities from all foreign key models based on that entity type and clears any foreign key values referencing them.void
removeRefreshListener(EventListener listener)
Removes the given listener.void
removeValueListener(EventDataListener<Attribute<?>> listener)
<T> void
removeValueListener(Attribute<T> attribute, EventDataListener<T> listener)
Removes the given listener.void
replaceForeignKeyValues(ForeignKey foreignKey, Collection<Entity> entities)
For every field referencing the given foreign key values, replaces that foreign key instance with the corresponding entity fromentities
, useful when attribute values have been changed in the referenced entity that must be reflected in the edit model.void
setDefaultValues()
Populates this edit model with default values.<T> void
setDefaultValueSupplier(Attribute<T> attribute, Supplier<T> valueProvider)
Sets the default value provider for the given attribute.void
setDeleteEnabled(boolean deleteEnabled)
void
setEntity(Entity entity)
void
setInsertEnabled(boolean insertEnabled)
void
setModifiedSupplier(Supplier<Boolean> modifiedSupplier)
Sets the 'modified' supplier for this edit model, which is responsible for providing the modified state of the underlying entity.void
setPersistValue(Attribute<?> attribute, boolean persistValue)
Specifies whether the value for the given attribute should be persisted when the model is cleared.void
setPostEditEvents(boolean postEditEvents)
Set to true if this edit model should post its insert, update and delete events on theEntityEditEvents
event busvoid
setReadOnly(boolean readOnly)
Makes this model read-only by disabling insert, update and deletevoid
setUpdateEnabled(boolean updateEnabled)
void
setWarnAboutUnsavedData(boolean warnAboutUnsavedData)
Entity
update()
Performs an update on the active entityList<Entity>
update(List<Entity> entities)
Updates the given entities.StateObserver
updateEnabledObserver()
void
validate()
Validates the current state of the entityvoid
validate(Attribute<?> attribute)
Validates the value associated with the given attribute, using the underlying validator.void
validate(Entity entity)
Validates the given entity, using the underlying validator.void
validate(Collection<Entity> entities)
Validates the given entities, using the underlying validator.EntityValidator
validator()
StateObserver
validObserver()
<T> Value<T>
value(Attribute<T> attribute)
Returns a Value based onattribute
in this edit model, note that subsequent calls for the same attribute return the same value instance.
-
-
-
Field Detail
-
PERSIST_FOREIGN_KEY_VALUES
static final PropertyValue<Boolean> PERSIST_FOREIGN_KEY_VALUES
Specifies whether foreign key values should persist when the UI is cleared or be reset to null
Value type: Boolean
Default value: true
-
WARN_ABOUT_UNSAVED_DATA
static final PropertyValue<Boolean> WARN_ABOUT_UNSAVED_DATA
Indicates whether the application should ask for confirmation when exiting if some data is unsaved
and whether it should warn when unsaved data is about to be lost, i.e. due to selection changes. Value type: Boolean
Default value: false
-
POST_EDIT_EVENTS
static final PropertyValue<Boolean> POST_EDIT_EVENTS
Specifies whether edit models post their insert, update and delete events toEntityEditEvents
Value type: Boolean
Default value: true
-
-
Method Detail
-
entityType
EntityType entityType()
- Returns:
- the type of the entity this edit model is based on
-
connectionProvider
EntityConnectionProvider connectionProvider()
- Returns:
- the connection provider used by this edit model
-
setDefaultValues
void setDefaultValues()
Populates this edit model with default values.
-
setEntity
void setEntity(Entity entity)
Copies the values from the givenEntity
into the underlyingEntity
being edited by this edit model. Ifentity
is null the effect is the same as callingsetDefaultValues()
.- Parameters:
entity
- the entity- See Also:
setDefaultValues()
-
refreshEntity
void refreshEntity()
Refreshes the active Entity from the database, discarding all changes. If the active Entity is new then calling this method has no effect.
-
entityCopy
Entity entityCopy()
- Returns:
- a deep copy of the active entity
- See Also:
Entity.copy()
-
isEntityNew
boolean isEntityNew()
Returns true if the active entity is new or false if it represents a row already persisted. By default, an entity is new if either its primary key or the original primary key are null. Basing the result of this function on a database query is not recommended since it is called very frequently, as in, every time an attribute value changes.- Returns:
- true if the active entity is new, that is, does not represent a persistent row
- See Also:
primaryKeyNullObserver()
,Key.isNull()
-
containsUnsavedData
boolean containsUnsavedData()
Returns true if an entity is selected and a value has been modified or if the entity is new and one or more non-default values have been entered- Returns:
- true if this edit model contains unsaved data
- See Also:
WARN_ABOUT_UNSAVED_DATA
-
isNull
boolean isNull(Attribute<?> attribute)
- Parameters:
attribute
- the attribute- Returns:
- true if the value of the given attribute is null
-
isNotNull
boolean isNotNull(Attribute<?> attribute)
- Parameters:
attribute
- the attribute- Returns:
- true if the value of the given attribute is not null
-
isNullable
boolean isNullable(Attribute<?> attribute)
- Parameters:
attribute
- the attribute- Returns:
- true if this value is allowed to be null in the underlying entity
-
put
<T> void put(Attribute<T> attribute, T value)
Sets the given value in the underlying Entity- Type Parameters:
T
- the value type- Parameters:
attribute
- the attribute to associate the given value withvalue
- the value to associate with the given attribute
-
remove
<T> T remove(Attribute<T> attribute)
Removes the given value from the underlying Entity- Type Parameters:
T
- the value type- Parameters:
attribute
- the attribute- Returns:
- the value, if any
-
get
<T> T get(Attribute<T> attribute)
Returns the value associated with the given attribute- Type Parameters:
T
- the value type- Parameters:
attribute
- the attribute- Returns:
- the value associated with the given attribute
-
getOptional
<T> Optional<T> getOptional(Attribute<T> attribute)
Returns the value associated with the given attribute- Type Parameters:
T
- the value type- Parameters:
attribute
- the attribute- Returns:
- the value associated with the given attribute, an empty Optional in case it is null
-
referencedEntity
Entity referencedEntity(ForeignKey foreignKey)
Returns the value associated with the given foreign key.- Parameters:
foreignKey
- the foreign key- Returns:
- the value assuming it is an
Entity
- Throws:
ClassCastException
- in case the value was not anEntity
-
value
<T> Value<T> value(Attribute<T> attribute)
Returns a Value based onattribute
in this edit model, note that subsequent calls for the same attribute return the same value instance.- Type Parameters:
T
- the value type- Parameters:
attribute
- the attribute- Returns:
- a Value based on the given edit model value
-
entities
Entities entities()
- Returns:
- the underlying domain entities
-
entityDefinition
EntityDefinition entityDefinition()
- Returns:
- the definition of the underlying entity
-
isReadOnly
boolean isReadOnly()
- Returns:
- true if this model is read only, that is if the insert, update and delete operations are not enabled
- See Also:
isInsertEnabled()
,isUpdateEnabled()
,isDeleteEnabled()
-
setReadOnly
void setReadOnly(boolean readOnly)
Makes this model read-only by disabling insert, update and delete- Parameters:
readOnly
- the read only status- See Also:
setInsertEnabled(boolean)
,setUpdateEnabled(boolean)
,setDeleteEnabled(boolean)
-
isWarnAboutUnsavedData
boolean isWarnAboutUnsavedData()
- Returns:
- true if this model warns about unsaved data
- See Also:
WARN_ABOUT_UNSAVED_DATA
-
setWarnAboutUnsavedData
void setWarnAboutUnsavedData(boolean warnAboutUnsavedData)
- Parameters:
warnAboutUnsavedData
- if true then this model warns about unsaved data- See Also:
WARN_ABOUT_UNSAVED_DATA
-
isInsertEnabled
boolean isInsertEnabled()
- Returns:
- true if this model should enable records to be inserted
-
setInsertEnabled
void setInsertEnabled(boolean insertEnabled)
- Parameters:
insertEnabled
- true if this model should enable inserts
-
isUpdateEnabled
boolean isUpdateEnabled()
- Returns:
- true if this model should enable records to be updated
-
setUpdateEnabled
void setUpdateEnabled(boolean updateEnabled)
- Parameters:
updateEnabled
- true if this model should enable records to be updated
-
isDeleteEnabled
boolean isDeleteEnabled()
- Returns:
- true if this model should allow records to be deleted
-
setDeleteEnabled
void setDeleteEnabled(boolean deleteEnabled)
- Parameters:
deleteEnabled
- true if this model should enable records to be deleted
-
isPostEditEvents
boolean isPostEditEvents()
Returns true if this edit model posts its insert, update and delete events on theEntityEditEvents
event bus- Returns:
- true if insert, update and delete events are posted on the edit event bus
-
setPostEditEvents
void setPostEditEvents(boolean postEditEvents)
Set to true if this edit model should post its insert, update and delete events on theEntityEditEvents
event bus- Parameters:
postEditEvents
- true if edit events should be posted
-
createForeignKeySearchModel
EntitySearchModel createForeignKeySearchModel(ForeignKey foreignKey)
Creates aEntitySearchModel
for looking up entities referenced by the given foreign key, using the search attributes defined for that entity type.- Parameters:
foreignKey
- the foreign key for which to create aEntitySearchModel
- Returns:
- a
EntitySearchModel
for looking up entities of the type referenced by the given foreign key attribute, - Throws:
IllegalStateException
- in case no searchable attributes can be found for the entity type referenced by the given foreign key
-
containsSearchModel
boolean containsSearchModel(ForeignKey foreignKey)
Returns true if this edit model contains aEntitySearchModel
for the given foreign key- Parameters:
foreignKey
- the foreign key- Returns:
- true if a
EntitySearchModel
has been initialized for the given foreign key
-
foreignKeySearchModel
EntitySearchModel foreignKeySearchModel(ForeignKey foreignKey)
- Parameters:
foreignKey
- the foreign key for which to retrieve theEntitySearchModel
- Returns:
- the
EntitySearchModel
associated with theforeignKey
, if no search model has been initialized for the given foreign key, a new one is created, associated with the foreign key and returned.
-
setDefaultValueSupplier
<T> void setDefaultValueSupplier(Attribute<T> attribute, Supplier<T> valueProvider)
Sets the default value provider for the given attribute. Used when the underlying value is not persistent. UsesetEntity(Entity)
with a null parameter to populate the model with the default values.- Type Parameters:
T
- the value type- Parameters:
attribute
- the attributevalueProvider
- the value provider- See Also:
isPersistValue(Attribute)
,setPersistValue(Attribute, boolean)
-
setModifiedSupplier
void setModifiedSupplier(Supplier<Boolean> modifiedSupplier)
Sets the 'modified' supplier for this edit model, which is responsible for providing the modified state of the underlying entity. The default supplier returnsEntity.isModified()
.- Parameters:
modifiedSupplier
- specifies whether the underlying entity is modified- See Also:
Entity.isModified()
,modifiedObserver()
-
isPersistValue
boolean isPersistValue(Attribute<?> attribute)
Returns true if the last available value for this attribute should be used when initializing a default entity. Override for selective reset of field values when the model is cleared. For foreign key attribute values this method by default returns the value of the attributePERSIST_FOREIGN_KEY_VALUES
.- Parameters:
attribute
- the attribute- Returns:
- true if the given field value should be reset when the model is cleared
- See Also:
PERSIST_FOREIGN_KEY_VALUES
-
setPersistValue
void setPersistValue(Attribute<?> attribute, boolean persistValue)
Specifies whether the value for the given attribute should be persisted when the model is cleared.- Parameters:
attribute
- the attributepersistValue
- true if this model should persist the value of the given attribute on clear- See Also:
PERSIST_FOREIGN_KEY_VALUES
-
insert
Entity insert() throws DatabaseException, ValidationException
Performs an insert on the active entity, sets the primary key values of the active entity according to the primary key of the inserted entity- Returns:
- the inserted entity
- Throws:
DatabaseException
- in case of a database exceptionValidationException
- in case validation failsIllegalStateException
- in case inserting is not enabled- See Also:
EntityValidator.validate(Entity)
-
insert
List<Entity> insert(List<Entity> entities) throws DatabaseException, ValidationException
Performs an insert on the given entities, returns silently on receiving an empty list.- Parameters:
entities
- the entities to insert- Returns:
- a list containing the inserted entities
- Throws:
DatabaseException
- in case of a database exceptionValidationException
- in case validation failsIllegalStateException
- in case inserting is not enabled- See Also:
addBeforeInsertListener(EventDataListener)
,addAfterInsertListener(EventDataListener)
,EntityValidator.validate(Entity)
-
update
Entity update() throws DatabaseException, ValidationException
Performs an update on the active entity- Returns:
- the updated entity
- Throws:
DatabaseException
- in case of a database exceptionRecordModifiedException
- in case an entity was modified by another userValidationException
- in case validation failsIllegalStateException
- in case updating is not enabledUpdateException
- in case the active entity is not modified- See Also:
EntityValidator.validate(Entity)
-
update
List<Entity> update(List<Entity> entities) throws DatabaseException, ValidationException
Updates the given entities. If the entities are unmodified or the list is empty this method returns silently.- Parameters:
entities
- the entities to update- Returns:
- the updated entities
- Throws:
DatabaseException
- in case of a database exceptionRecordModifiedException
- in case an entity was modified by another userValidationException
- in case validation failsIllegalStateException
- in case updating is not enabled- See Also:
addBeforeUpdateListener(EventDataListener)
,addAfterUpdateListener(EventDataListener)
,EntityValidator.validate(Entity)
-
delete
Entity delete() throws DatabaseException
Deletes the active entity- Returns:
- the deleted entity
- Throws:
DatabaseException
- in case of a database exceptionIllegalStateException
- in case deleting is not enabled- See Also:
addBeforeDeleteListener(EventDataListener)
,addAfterDeleteListener(EventDataListener)
-
delete
List<Entity> delete(List<Entity> entities) throws DatabaseException
Deletes the given entities, returns silently on receiving an empty list- Parameters:
entities
- the entities to delete- Returns:
- the deleted entities
- Throws:
DatabaseException
- in case of a database exceptionIllegalStateException
- in case deleting is not enabled- See Also:
addBeforeDeleteListener(EventDataListener)
,addAfterDeleteListener(EventDataListener)
-
refresh
void refresh()
Refreshes all data models used by this edit model, combo box models f.ex.
-
isModified
boolean isModified()
- Returns:
- true if the underlying Entity is modified
- See Also:
setModifiedSupplier(Supplier)
,modifiedObserver()
-
addForeignKeyValues
void addForeignKeyValues(ForeignKey foreignKey, Collection<Entity> entities)
Adds the inserted entities to all foreign key models based on that entity type- Parameters:
foreignKey
- the foreign keyentities
- the values
-
removeForeignKeyValues
void removeForeignKeyValues(ForeignKey foreignKey, Collection<Entity> entities)
Removes the given entities from all foreign key models based on that entity type and clears any foreign key values referencing them.- Parameters:
foreignKey
- the foreign keyentities
- the values
-
replaceForeignKeyValues
void replaceForeignKeyValues(ForeignKey foreignKey, Collection<Entity> entities)
For every field referencing the given foreign key values, replaces that foreign key instance with the corresponding entity fromentities
, useful when attribute values have been changed in the referenced entity that must be reflected in the edit model.- Parameters:
foreignKey
- the foreign keyentities
- the foreign key entities
-
validator
EntityValidator validator()
- Returns:
- the validator
-
validate
void validate(Attribute<?> attribute) throws ValidationException
Validates the value associated with the given attribute, using the underlying validator.- Parameters:
attribute
- the attribute the value is associated with- Throws:
ValidationException
- if the given value is not valid for the given attribute- See Also:
validator()
-
validate
void validate() throws ValidationException
Validates the current state of the entity- Throws:
ValidationException
- in case the entity is invalid
-
validate
void validate(Collection<Entity> entities) throws ValidationException
Validates the given entities, using the underlying validator. For entities of a type other than this edit model is based on, their respective validators are used.- Parameters:
entities
- the entities to validate- Throws:
ValidationException
- on finding the first invalid entity- See Also:
validator()
,EntityDefinition.validator()
-
validate
void validate(Entity entity) throws ValidationException
Validates the given entity, using the underlying validator. For entities of a type other than this edit model is based on, their respective validators are used.- Parameters:
entity
- the entity to validate- Throws:
ValidationException
- in case the entity is invalidNullPointerException
- in case the entity is null- See Also:
validator()
-
isValid
boolean isValid(Attribute<?> attribute)
Returns true if the value associated with the given attribute is valid, using thevalidate(Attribute)
method.- Parameters:
attribute
- the attribute the value is associated with- Returns:
- true if the value is valid
- See Also:
validate(Attribute)
,EntityValidator.validate(Entity)
-
isValid
boolean isValid()
- Returns:
- true if the underlying Entity contains only valid values
- See Also:
validObserver()
-
validObserver
StateObserver validObserver()
- Returns:
- a
StateObserver
indicating the valid status of the underlying Entity. - See Also:
validator()
,isValid()
-
modifiedObserver
StateObserver modifiedObserver()
Returns aStateObserver
responsible for indicating when and if any values in the underlying Entity have been modified.- Returns:
- a
StateObserver
indicating the modified state of this edit model - See Also:
isModified()
-
modifiedObserver
StateObserver modifiedObserver(Attribute<?> attribute)
Returns aStateObserver
instance indicating whether the value of the given attribute has been modified.- Parameters:
attribute
- the attribute- Returns:
- a
StateObserver
indicating the modified state of the value of the given attribute - Throws:
IllegalArgumentException
- in case attribute is not part of the underlying entity- See Also:
isModified()
-
nullObserver
StateObserver nullObserver(Attribute<?> attribute)
Returns aStateObserver
indicating whether the value of the given attribute is null.- Parameters:
attribute
- the attribute- Returns:
- a
StateObserver
indicating whether the value of the given attribute is null - Throws:
IllegalArgumentException
- in case attribute is not part of the underlying entity- See Also:
isNull(Attribute)
-
entityNewObserver
StateObserver entityNewObserver()
- Returns:
- a
StateObserver
indicating whether the active entity is new - See Also:
isEntityNew()
-
deleteEnabledObserver
StateObserver deleteEnabledObserver()
- Returns:
- the
StateObserver
used to determine if deleting should be enabled - See Also:
isDeleteEnabled()
,setDeleteEnabled(boolean)
-
primaryKeyNullObserver
StateObserver primaryKeyNullObserver()
- Returns:
- a
StateObserver
indicating whether the primary key of the active entity is null
-
updateEnabledObserver
StateObserver updateEnabledObserver()
- Returns:
- the
StateObserver
used to determine if updating should be enabled - See Also:
isUpdateEnabled()
,setUpdateEnabled(boolean)
-
insertEnabledObserver
StateObserver insertEnabledObserver()
- Returns:
- the
StateObserver
used to determine if inserting should be enabled - See Also:
isInsertEnabled()
,setInsertEnabled(boolean)
-
refreshingObserver
StateObserver refreshingObserver()
- Returns:
- a
StateObserver
which is active while data models are being refreshed
-
addRefreshingObserver
void addRefreshingObserver(StateObserver refreshingObserver)
Adds aStateObserver
instance to this edit models refreshing observer- Parameters:
refreshingObserver
- the refreshing observer to add- See Also:
refreshingObserver()
-
addEditListener
<T> void addEditListener(Attribute<T> attribute, EventDataListener<T> listener)
Adds a listener notified each time the value associated with the given attribute is edited viaput(Attribute, Object)
orremove(Attribute)
, note that this event is only fired if the value actually changes.- Type Parameters:
T
- the value type- Parameters:
attribute
- the attribute for which to monitor value editslistener
- a listener notified each time the value of the given attribute is edited via this model
-
removeEditListener
<T> void removeEditListener(Attribute<T> attribute, EventDataListener<T> listener)
Removes the given listener.- Type Parameters:
T
- the value type- Parameters:
attribute
- the attributelistener
- the listener to remove
-
addValueListener
<T> void addValueListener(Attribute<T> attribute, EventDataListener<T> listener)
Adds a listener notified each time the value associated with the given attribute changes, either via editing or when the active entity is set.- Type Parameters:
T
- the value type- Parameters:
attribute
- the attribute for which to monitor value changeslistener
- a listener notified each time the value of theattribute
changes- See Also:
setEntity(Entity)
-
removeValueListener
<T> void removeValueListener(Attribute<T> attribute, EventDataListener<T> listener)
Removes the given listener.- Type Parameters:
T
- the value type- Parameters:
attribute
- the attribute for which to remove the listenerlistener
- the listener to remove
-
addValueListener
void addValueListener(EventDataListener<Attribute<?>> listener)
- Parameters:
listener
- a listener notified each time a value changes
-
removeValueListener
void removeValueListener(EventDataListener<Attribute<?>> listener)
- Parameters:
listener
- the listener to remove
-
addEntityListener
void addEntityListener(EventDataListener<Entity> listener)
Notified each time the entity is set viasetEntity(Entity)
.- Parameters:
listener
- a listener notified each time the entity is set, possibly to null- See Also:
setEntity(Entity)
-
removeEntityListener
void removeEntityListener(EventDataListener<Entity> listener)
Removes the given listener.- Parameters:
listener
- the listener to remove
-
addBeforeInsertListener
void addBeforeInsertListener(EventDataListener<List<Entity>> listener)
- Parameters:
listener
- a listener to be notified before an insert is performed
-
removeBeforeInsertListener
void removeBeforeInsertListener(EventDataListener<List<Entity>> listener)
Removes the given listener.- Parameters:
listener
- a listener to remove
-
addAfterInsertListener
void addAfterInsertListener(EventDataListener<List<Entity>> listener)
- Parameters:
listener
- a listener to be notified each time insert has been performed
-
removeAfterInsertListener
void removeAfterInsertListener(EventDataListener<List<Entity>> listener)
Removes the given listener.- Parameters:
listener
- a listener to remove
-
addBeforeUpdateListener
void addBeforeUpdateListener(EventDataListener<Map<Key,Entity>> listener)
- Parameters:
listener
- a listener to be notified before an update is performed
-
removeBeforeUpdateListener
void removeBeforeUpdateListener(EventDataListener<Map<Key,Entity>> listener)
Removes the given listener.- Parameters:
listener
- a listener to remove
-
addAfterUpdateListener
void addAfterUpdateListener(EventDataListener<Map<Key,Entity>> listener)
- Parameters:
listener
- a listener to be notified each time an update has been performed, with the updated entities, mapped to their respective original primary keys, that is, the primary keys before the update was performed
-
removeAfterUpdateListener
void removeAfterUpdateListener(EventDataListener<Map<Key,Entity>> listener)
Removes the given listener.- Parameters:
listener
- a listener to remove
-
addBeforeDeleteListener
void addBeforeDeleteListener(EventDataListener<List<Entity>> listener)
- Parameters:
listener
- a listener to be notified before a delete is performed
-
removeBeforeDeleteListener
void removeBeforeDeleteListener(EventDataListener<List<Entity>> listener)
Removes the given listener.- Parameters:
listener
- a listener to remove
-
addAfterDeleteListener
void addAfterDeleteListener(EventDataListener<List<Entity>> listener)
- Parameters:
listener
- a listener to be notified each time delete has been performed
-
removeAfterDeleteListener
void removeAfterDeleteListener(EventDataListener<List<Entity>> listener)
Removes the given listener.- Parameters:
listener
- a listener to remove
-
addRefreshListener
void addRefreshListener(EventListener listener)
- Parameters:
listener
- a listener to be notified each time a refresh has been performed- See Also:
refresh()
-
removeRefreshListener
void removeRefreshListener(EventListener listener)
Removes the given listener.- Parameters:
listener
- a listener to remove
-
addEntitiesEditedListener
void addEntitiesEditedListener(EventListener listener)
- Parameters:
listener
- a listener to be notified each time an entity is edited via this model, updated, inserted or deleted
-
removeEntitiesEditedListener
void removeEntitiesEditedListener(EventListener listener)
Removes the given listener.- Parameters:
listener
- a listener to remove
-
addConfirmSetEntityObserver
void addConfirmSetEntityObserver(EventDataListener<State> listener)
- Parameters:
listener
- a listener notified each time the active entity is about to be set
-
removeConfirmSetEntityObserver
void removeConfirmSetEntityObserver(EventDataListener<State> listener)
Removes the given listener.- Parameters:
listener
- a listener to remove
-
-