primaryKeyNull
- Specified by:
primaryKeyNull
in interfaceEntityEditModel
- Returns:
- a
StateObserver
indicating whether the primary key of the active entity is null
EntityEditModel
SwingEntityEditModel
EntityEditModel
implementationEDIT_EVENTS, PERSIST_FOREIGN_KEYS, WARN_ABOUT_UNSAVED_DATA
protected
AbstractEntityEditModel(EntityType entityType,
EntityConnectionProvider connectionProvider)
AbstractEntityEditModel
based on the given entity type.final void
addAfterDeleteListener(Consumer<Collection<Entity>> listener)
final void
addAfterInsertListener(Consumer<Collection<Entity>> listener)
final void
addAfterUpdateListener(Consumer<Map<Entity.Key,Entity>> listener)
final void
addBeforeDeleteListener(Consumer<Collection<Entity>> listener)
final void
addBeforeInsertListener(Consumer<Collection<Entity>> listener)
final void
addBeforeUpdateListener(Consumer<Map<Entity.Key,Entity>> listener)
final void
addConfirmOverwriteListener(Consumer<State> listener)
final <T> void
addEditListener(Attribute<T> attribute,
Consumer<T> listener)
EntityEditModel.put(Attribute, Object)
or EntityEditModel.remove(Attribute)
, note that this event is only fired
if the value actually changes.final void
addEntityListener(Consumer<Entity> listener)
EntityEditModel.set(Entity)
or EntityEditModel.setDefaults()
.final void
addInsertUpdateOrDeleteListener(Runnable listener)
final void
addValueChangeListener(Consumer<Attribute<?>> listener)
final <T> void
addValueListener(Attribute<T> attribute,
Consumer<T> listener)
final EntityConnectionProvider
createForeignKeySearchModel(ForeignKey foreignKey)
EntitySearchModel
for looking up entities referenced by the given foreign key,
using the search attributes defined for that entity type.final void
delete()
final void
delete(Collection<Entity> entities)
protected void
delete(Collection<Entity> entities,
EntityConnection connection)
final State
final State
final Entities
entities()
final Entity
entity()
final EntityDefinition
final EntityType
final StateObserver
exists()
final EntitySearchModel
foreignKeySearchModel(ForeignKey foreignKey)
final <T> T
final Entity
insert()
final Collection<Entity>
insert(Collection<Entity> entities)
protected Collection<Entity>
insert(Collection<Entity> entities,
EntityConnection connection)
final State
final StateObserver
final StateObserver
final StateObserver
modified()
StateObserver
indicating when and if any values in the underlying Entity have been modified.final StateObserver
StateObserver
instance indicating whether the value of the given attribute has been modified.protected final void
notifyAfterDelete(Collection<Entity> deletedEntities)
protected final void
notifyAfterInsert(Collection<Entity> insertedEntities)
protected final void
notifyAfterUpdate(Map<Entity.Key,Entity> updatedEntities)
protected final void
notifyBeforeDelete(Collection<Entity> entitiesToDelete)
protected final void
notifyBeforeInsert(Collection<Entity> entitiesToInsert)
protected final void
notifyBeforeUpdate(Map<Entity.Key,Entity> entitiesToUpdate)
final boolean
final <T> Optional<T>
final State
final State
final StateObserver
final <T> T
final State
readOnly()
final Entity
referencedEntity(ForeignKey foreignKey)
final void
final <T> T
final void
removeAfterDeleteListener(Consumer<Collection<Entity>> listener)
final void
removeAfterInsertListener(Consumer<Collection<Entity>> listener)
final void
removeAfterUpdateListener(Consumer<Map<Entity.Key,Entity>> listener)
final void
removeBeforeDeleteListener(Consumer<Collection<Entity>> listener)
final void
removeBeforeInsertListener(Consumer<Collection<Entity>> listener)
final void
removeBeforeUpdateListener(Consumer<Map<Entity.Key,Entity>> listener)
final void
removeConfirmOverwriteListener(Consumer<State> listener)
final <T> void
removeEditListener(Attribute<T> attribute,
Consumer<T> listener)
final void
removeEntityListener(Consumer<Entity> listener)
final void
removeInsertUpdateOrDeleteListener(Runnable listener)
final void
removeValueChangeListener(Consumer<Attribute<?>> listener)
final <T> void
removeValueListener(Attribute<T> attribute,
Consumer<T> listener)
final void
replace(ForeignKey foreignKey,
Collection<Entity> entities)
entities
, useful when attribute
values have been changed in the referenced entity that must be reflected in the edit model.protected void
replaceForeignKey(ForeignKey foreignKey,
Collection<Entity> values)
values
, useful when attribute
values have been changed in the referenced entity that must be reflected in the edit model.final void
final <T> void
setDefault(Attribute<T> attribute,
Supplier<T> defaultValue)
final void
final String
toString()
final Entity
update()
final Collection<Entity>
update(Collection<Entity> entities)
protected Collection<Entity>
update(Collection<Entity> entities,
EntityConnection connection)
final State
protected final void
final State
final StateObserver
valid()
final StateObserver
final void
validate()
final void
void
final void
validate(Collection<Entity> entities)
protected final Value<EntityValidator>
final <T> Value<T>
attribute
in this edit model, note that
subsequent calls for the same attribute return the same value instance.clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
add, remove
AbstractEntityEditModel
based on the given entity type.entityType
- the type of the entity to base this AbstractEntityEditModel
onconnectionProvider
- the EntityConnectionProvider
instanceentities
in interface EntityEditModel
entityDefinition
in interface EntityEditModel
EntityEditModel
EntityEditModel.setDefaults()
or EntityEditModel.set(Entity)
with a null parameter to populate the model with the default values.setDefault
in interface EntityEditModel
T
- the value typeattribute
- the attributedefaultValue
- the default value supplieroverwriteWarning
in interface EntityEditModel
editEvents
in interface EntityEditModel
EntityEditEvents
event bus.EntityEditModel
persist
in interface EntityEditModel
attribute
- the attributeEntityEditModel
EntityEditModel.insertEnabled()
, EntityEditModel.updateEnabled()
and EntityEditModel.deleteEnabled()
to configure the enabled state of those specific actions.readOnly
in interface EntityEditModel
EntityEditModel
insertEnabled
in interface EntityEditModel
EntityEditModel
updateEnabled
in interface EntityEditModel
EntityEditModel
updateMultipleEnabled
in interface EntityEditModel
EntityEditModel
deleteEnabled
in interface EntityEditModel
exists
in interface EntityEditModel
StateObserver
indicating whether the active entity exists in the databaseprimaryKeyNull
in interface EntityEditModel
StateObserver
indicating whether the primary key of the active entity is nullEntityEditModel
Entity
into the underlying
Entity
being edited by this edit model. If entity
is null
the effect is the same as calling EntityEditModel.setDefaults()
.set
in interface EntityEditModel
entity
- the entityEntityEditModel
setDefaults
in interface EntityEditModel
entityType
in interface EntityEditModel
connectionProvider
in interface EntityEditModel
EntityEditModel
entities
, useful when attribute
values have been changed in the referenced entity that must be reflected in the edit model.replace
in interface EntityEditModel
foreignKey
- the foreign keyentities
- the foreign key entitiesentity
in interface EntityEditModel
Entity
instance being editedEntityEditModel
referencedEntity
in interface EntityEditModel
foreignKey
- the foreign keyEntityEditModel
StateObserver
indicating when and if any values in the underlying Entity have been modified.modified
in interface EntityEditModel
StateObserver
indicating the modified state of this edit modelEntityEditModel
StateObserver
instance indicating whether the value of the given attribute has been modified.modified
in interface EntityEditModel
attribute
- the attributeStateObserver
indicating the modified state of the value of the given attributeEntityEditModel
get
in interface EntityEditModel
T
- the value typeattribute
- the attributeEntityEditModel
optional
in interface EntityEditModel
T
- the value typeattribute
- the attributeEntityEditModel
put
in interface EntityEditModel
T
- the value typeattribute
- the attribute to associate the given value withvalue
- the value to associate with the given attributeEntityEditModel
remove
in interface EntityEditModel
T
- the value typeattribute
- the attributenullable
in interface EntityEditModel
attribute
- the attributeisNull
in interface EntityEditModel
attribute
- the attributeStateObserver
indicating whether the value of the given attribute is nullisNotNull
in interface EntityEditModel
attribute
- the attributeStateObserver
indicating whether the value of the given attribute is not nullvalid
in interface EntityEditModel
StateObserver
indicating the valid status of the underlying Entity.valid
in interface EntityEditModel
attribute
- the attributeStateObserver
indicating the valid status of the given attribute.EntityEditModel
validate
in interface EntityEditModel
attribute
- the attribute the value is associated withValidationException
- if the given value is not valid for the given attributeEntityEditModel
validate
in interface EntityEditModel
ValidationException
- in case the entity is invalidEntityEditModel
validate
in interface EntityEditModel
entities
- the entities to validateValidationException
- on finding the first invalid entityEntityEditModel
validate
in interface EntityEditModel
entity
- the entity to validateValidationException
- in case the entity is invalidEntityEditModel
insert
in interface EntityEditModel
DatabaseException
- in case of a database exceptionValidationException
- in case validation failsEntityEditModel
insert
in interface EntityEditModel
entities
- the entities to insertDatabaseException
- in case of a database exceptionValidationException
- in case validation failsEntityEditModel
update
in interface EntityEditModel
DatabaseException
- in case of a database exceptionRecordModifiedException
- in case the entity has been modified since it was loadedUpdateException
- in case the active entity is not modifiedValidationException
- in case validation failsEntityEditModel
update
in interface EntityEditModel
entities
- the entities to updateDatabaseException
- in case of a database exceptionRecordModifiedException
- in case an entity has been modified since it was loadedValidationException
- in case validation failsEntityEditModel
delete
in interface EntityEditModel
DatabaseException
- in case of a database exceptionEntityEditModel
delete
in interface EntityEditModel
entities
- the entities to deleteDatabaseException
- in case of a database exceptionEntityEditModel
refreshEntity
in interface EntityEditModel
EntityEditModel
EntitySearchModel
for looking up entities referenced by the given foreign key,
using the search attributes defined for that entity type.createForeignKeySearchModel
in interface EntityEditModel
foreignKey
- the foreign key for which to create a EntitySearchModel
EntitySearchModel
for looking up entities of the type referenced by the given foreign key attribute,foreignKeySearchModel
in interface EntityEditModel
foreignKey
- the foreign key for which to retrieve the EntitySearchModel
EntitySearchModel
associated with the foreignKey
, if no search model
has been initialized for the given foreign key, a new one is created, associated with the foreign key and returned.EntityEditModel
attribute
in this edit model, note that
subsequent calls for the same attribute return the same value instance.value
in interface EntityEditModel
T
- the value typeattribute
- the attributeEntityEditModel
removeEditListener
in interface EntityEditModel
T
- the value typeattribute
- the attributelistener
- the listener to removeEntityEditModel
EntityEditModel.put(Attribute, Object)
or EntityEditModel.remove(Attribute)
, note that this event is only fired
if the value actually changes.addEditListener
in interface EntityEditModel
T
- the value typeattribute
- the attribute for which to monitor value editslistener
- a listener notified each time the value of the given attribute is edited via this modelEntityEditModel
removeValueListener
in interface EntityEditModel
T
- the value typeattribute
- the attribute for which to remove the listenerlistener
- the listener to removeEntityEditModel
addValueListener
in interface EntityEditModel
T
- the value typeattribute
- the attribute for which to monitor value changeslistener
- a listener notified each time the value of the attribute
changesremoveValueChangeListener
in interface EntityEditModel
listener
- the listener to removeaddValueChangeListener
in interface EntityEditModel
listener
- a listener notified each time a value changes, providing the attributeEntityEditModel
removeEntityListener
in interface EntityEditModel
listener
- the listener to removeEntityEditModel
EntityEditModel.set(Entity)
or EntityEditModel.setDefaults()
.addEntityListener
in interface EntityEditModel
listener
- a listener notified each time the entity is set, possibly to nullEntityEditModel
removeBeforeInsertListener
in interface EntityEditModel
listener
- a listener to removeaddBeforeInsertListener
in interface EntityEditModel
listener
- a listener to be notified before an insert is performedEntityEditModel
removeAfterInsertListener
in interface EntityEditModel
listener
- a listener to removeaddAfterInsertListener
in interface EntityEditModel
listener
- a listener to be notified each time insert has been performedEntityEditModel
removeBeforeUpdateListener
in interface EntityEditModel
listener
- a listener to removeaddBeforeUpdateListener
in interface EntityEditModel
listener
- a listener to be notified before an update is performedEntityEditModel
removeAfterUpdateListener
in interface EntityEditModel
listener
- a listener to removeaddAfterUpdateListener
in interface EntityEditModel
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 performedaddBeforeDeleteListener
in interface EntityEditModel
listener
- a listener to be notified before a delete is performedEntityEditModel
removeBeforeDeleteListener
in interface EntityEditModel
listener
- a listener to removeEntityEditModel
removeAfterDeleteListener
in interface EntityEditModel
listener
- a listener to removeaddAfterDeleteListener
in interface EntityEditModel
listener
- a listener to be notified each time delete has been performedEntityEditModel
removeInsertUpdateOrDeleteListener
in interface EntityEditModel
listener
- a listener to removeaddInsertUpdateOrDeleteListener
in interface EntityEditModel
listener
- a listener notified each time one or more entities are updated, inserted or deleted via this modeladdConfirmOverwriteListener
in interface EntityEditModel
listener
- a listener notified each time the active entity is about to be setEntityEditModel
removeConfirmOverwriteListener
in interface EntityEditModel
listener
- a listener to removeentities
- the entities to insertconnection
- the connection to useDatabaseException
- in case of a database exceptionentities
- the entities to updateconnection
- the connection to useDatabaseException
- in case of a database exceptionentities
- the entities to deleteconnection
- the connection to useDatabaseException
- in case of a database exceptionvalues
, useful when attribute
values have been changed in the referenced entity that must be reflected in the edit model.foreignKey
- the foreign key attributevalues
- the foreign key entitiesentitiesToInsert
- the entities about to be insertedinsertedEntities
- the inserted entitiesentitiesToUpdate
- the entities about to be updatedupdatedEntities
- the updated entitiesentitiesToDelete
- the entities about to be deleteddeletedEntities
- the deleted entities