public class SwingEntityEditModel extends DefaultEntityEditModel
EntityEditModel
.DefaultEntityEditModel.DefaultDeleteEvent, DefaultEntityEditModel.DefaultInsertEvent, DefaultEntityEditModel.DefaultUpdateEvent
EntityEditModel.DeleteEvent, EntityEditModel.InsertEvent, EntityEditModel.UpdateEvent
COMBO_BOX_NULL_VALUE_ITEM, PERSIST_FOREIGN_KEY_VALUES, WARN_ABOUT_UNSAVED_DATA
Constructor and Description |
---|
SwingEntityEditModel(java.lang.String entityId,
EntityConnectionProvider connectionProvider)
Instantiates a new
SwingEntityEditModel based on the entity identified by entityId . |
SwingEntityEditModel(java.lang.String entityId,
EntityConnectionProvider connectionProvider,
Entity.Validator validator)
Instantiates a new
SwingEntityEditModel based on the entity identified by entityId . |
Modifier and Type | Method and Description |
---|---|
void |
addForeignKeyValues(java.util.List<Entity> values)
Adds the inserted entities to all foreign key models based on that entity type
|
void |
clear()
Clears all data from this refreshable instance
|
void |
clearComboBoxModels()
Clears all combobox models
|
boolean |
containsComboBoxModel(java.lang.String propertyId) |
PropertyComboBoxModel |
createComboBoxModel(ColumnProperty property)
Creates a combo box model containing the current values of the given property.
|
EntityComboBoxModel |
createForeignKeyComboBoxModel(ForeignKeyProperty foreignKeyProperty)
Creates a default
EntityComboBoxModel for the given property, override to provide
a specific EntityComboBoxModel (filtered for example) for properties. |
PropertyComboBoxModel |
getComboBoxModel(java.lang.String propertyId)
Returns a
PropertyComboBoxModel for the given property, |
EntityComboBoxModel |
getForeignKeyComboBoxModel(ForeignKeyProperty foreignKeyProperty)
Returns a
EntityComboBoxModel for the given foreign key property. |
EntityComboBoxModel |
getForeignKeyComboBoxModel(java.lang.String foreignKeyPropertyId)
Returns a
EntityComboBoxModel for the given foreign key property. |
void |
refreshComboBoxModels()
Refreshes all combobox models
|
protected void |
refreshDataModels() |
void |
removeForeignKeyValues(java.util.List<Entity> values)
Removes the deleted entities from all foreign key models based on that entity type
todo set foreign key values referencing the deleted entity to null
|
void |
replaceForeignKeyValues(java.lang.String foreignKeyEntityId,
java.util.Collection<Entity> foreignKeyValues)
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. |
addAfterDeleteListener, addAfterInsertListener, addAfterRefreshListener, addAfterUpdateListener, addBeforeDeleteListener, addBeforeInsertListener, addBeforeRefreshListener, addBeforeUpdateListener, addConfirmSetEntityObserver, addEntitiesChangedListener, addEntitySetListener, addValueListener, addValueSetListener, containsLookupModel, containsUnsavedData, createForeignKeyLookupModel, delete, delete, doDelete, doInsert, doUpdate, fireAfterDeleteEvent, fireAfterInsertEvent, fireAfterUpdateEvent, fireBeforeDeleteEvent, fireBeforeInsertEvent, fireBeforeUpdateEvent, get, getAllowDeleteObserver, getAllowInsertObserver, getAllowUpdateObserver, getConnectionProvider, getDefaultEntity, getDefaultValue, getDomain, getEntity, getEntityCopy, getEntityCopy, getEntityDefinition, getEntityId, getEntityNewObserver, getForeignKey, getForeignKeyLookupModel, getForeignKeyLookupModel, getModifiedEntities, getModifiedObserver, getPrimaryKeyNullObserver, getValueObserver, getValueProvider, insert, insert, isDeleteAllowed, isEntityNew, isInsertAllowed, isLookupAllowed, isModified, isNotNull, isNull, isReadOnly, isUpdateAllowed, isValuePersistent, isWarnAboutUnsavedData, put, refresh, refreshEntity, remove, removeAfterDeleteListener, removeAfterInsertListener, removeAfterRefreshListener, removeAfterUpdateListener, removeBeforeDeleteListener, removeBeforeInsertListener, removeBeforeRefreshListener, removeBeforeUpdateListener, removeConfirmSetEntityObserver, removeEntitiesChangedListener, removeEntitySetListener, removeValueListener, removeValueSetListener, setDeleteAllowed, setEntity, setForeignKeyValues, setInsertAllowed, setReadOnly, setUpdateAllowed, setValuePersistent, setWarnAboutUnsavedData, toString, update, update, value
addValueListener, addValueSetListener, get, getValidator, getValidObserver, getValueMap, getValueObserver, getValueObserver, isNotNull, isNull, isNullable, isValid, isValid, put, remove, removeValueListener, removeValueSetListener, validate, validate, validate, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addValueListener, addValueSetListener, get, getValidator, getValidObserver, getValueObserver, getValueObserver, isNotNull, isNull, isNullable, isValid, isValid, put, remove, removeValueListener, removeValueSetListener, validate, validate, validate, validate
public SwingEntityEditModel(java.lang.String entityId, EntityConnectionProvider connectionProvider)
SwingEntityEditModel
based on the entity identified by entityId
.entityId
- the ID of the entity to base this DefaultEntityEditModel
onconnectionProvider
- the EntityConnectionProvider
instancepublic SwingEntityEditModel(java.lang.String entityId, EntityConnectionProvider connectionProvider, Entity.Validator validator)
SwingEntityEditModel
based on the entity identified by entityId
.entityId
- the ID of the entity to base this DefaultEntityEditModel
onconnectionProvider
- the EntityConnectionProvider
instancevalidator
- the validator to usepublic final void replaceForeignKeyValues(java.lang.String foreignKeyEntityId, java.util.Collection<Entity> foreignKeyValues)
foreignKeyValues
, useful when property
values have been changed in the referenced entity that must be reflected in the edit model.replaceForeignKeyValues
in interface EntityEditModel
replaceForeignKeyValues
in class DefaultEntityEditModel
foreignKeyEntityId
- the entity ID of the foreign key valuesforeignKeyValues
- the new foreign key entitiesprotected void refreshDataModels()
refreshDataModels
in class DefaultEntityEditModel
public void clear()
public final void refreshComboBoxModels()
public final void clearComboBoxModels()
public final EntityComboBoxModel getForeignKeyComboBoxModel(java.lang.String foreignKeyPropertyId)
EntityComboBoxModel
for the given foreign key property. If one does not exist it is created.foreignKeyPropertyId
- the ID of the foreign key propertyEntityComboBoxModel
based on the entity referenced by the given foreign key propertycreateForeignKeyComboBoxModel(ForeignKeyProperty)
public final EntityComboBoxModel getForeignKeyComboBoxModel(ForeignKeyProperty foreignKeyProperty)
EntityComboBoxModel
for the given foreign key property. If one does not exist it is created.foreignKeyProperty
- the foreign key propertyEntityComboBoxModel
based on the entity referenced by the given foreign key propertycreateForeignKeyComboBoxModel(ForeignKeyProperty)
public final PropertyComboBoxModel getComboBoxModel(java.lang.String propertyId)
PropertyComboBoxModel
for the given property,propertyId
- the property IDPropertyComboBoxModel
for the given propertypublic final boolean containsComboBoxModel(java.lang.String propertyId)
propertyId
- the ID of the propertypublic EntityComboBoxModel createForeignKeyComboBoxModel(ForeignKeyProperty foreignKeyProperty)
EntityComboBoxModel
for the given property, override to provide
a specific EntityComboBoxModel
(filtered for example) for properties.
This method is called when creating a EntityComboBoxModel
for entity properties, both
for the edit fields used when editing a single record and the edit field used
when updating multiple records.
This default implementation returns a sorted EntityComboBoxModel
with the default nullValueItem
if the underlying property is nullableforeignKeyProperty
- the foreign key property for which to create a EntityComboBoxModel
EntityComboBoxModel
for the given propertyEntityEditModel.COMBO_BOX_NULL_VALUE_ITEM
,
Property.isNullable()
public PropertyComboBoxModel createComboBoxModel(ColumnProperty property)
PropertyComboBoxModel
with the default nullValueItem
if the underlying property is nullableproperty
- the propertypublic final void addForeignKeyValues(java.util.List<Entity> values)
values
- the valuespublic final void removeForeignKeyValues(java.util.List<Entity> values)
values
- the values