Interface EntityTableModel<E extends EntityEditModel>

Type Parameters:
E - the type of EntityEditModel used by this EntityTableModel
All Superinterfaces:
FilterModel<Entity>
All Known Implementing Classes:
AbstractEntityTableModel, SwingEntityTableModel

public interface EntityTableModel<E extends EntityEditModel> extends FilterModel<Entity>
Specifies a table model containing Entity instances.
  • Field Details

  • Method Details

    • entityType

      EntityType entityType()
      Returns:
      the type of the entity this table model is based on
    • connectionProvider

      EntityConnectionProvider connectionProvider()
      Returns:
      the connection provider used by this table model
    • connection

      EntityConnection connection()
      Do not cache or keep the connection returned by this method in a long living field, since it may become invalid and thereby unusable.
      Returns:
      the connection used by this table model
    • entities

      Entities entities()
      Returns:
      the underlying domain entities
    • entityDefinition

      EntityDefinition entityDefinition()
      Returns:
      the definition of the underlying entity
    • editModel

      <C extends E> C editModel()
      Type Parameters:
      C - the edit model type Returns the EntityEditModel associated with this table model
      Returns:
      the edit model associated with this table model
    • replace

      void replace(ForeignKey foreignKey, Collection<Entity> foreignKeyValues)
      For every entity in this table model, replaces the foreign key instance bearing the primary key with the corresponding entity from foreignKeyValues, useful when attribute values have been changed in the referenced entity that must be reflected in the table model.
      Parameters:
      foreignKey - the foreign key
      foreignKeyValues - the foreign key entities
    • replace

      void replace(Collection<Entity> entities)
      Replaces the given entities in this table model
      Parameters:
      entities - the entities to replace
    • refresh

      void refresh(Collection<Entity.Key> keys)
      Refreshes the entities with the given keys by re-selecting them from the underlying database.
      Parameters:
      keys - the keys of the entities to refresh
    • editable

      State editable()
      Returns:
      the State controlling whether this table model is editable
    • deleteSelected

      Collection<Entity> deleteSelected() throws DatabaseException
      Deletes the selected entities
      Returns:
      the deleted entities
      Throws:
      DatabaseException - in case of a database exception
      CancelException - in case the user cancels the operation
      IllegalStateException - in case this table model has no edit model or if the edit model does not allow deleting
    • handleEditEvents

      State handleEditEvents()
      Returns:
      the State controlling whether this table model handles entity edit events, by replacing updated entities
      See Also:
    • onInsert

      Returns:
      the Value controlling the action to perform when entities are inserted via the associated edit model
      See Also:
    • removeDeleted

      State removeDeleted()
      Returns:
      the State controlling whether entities that are deleted via the associated edit model should be automatically removed from this table model
    • select

      void select(Collection<Entity.Key> keys)
      Selects entities according to the primary keys in primaryKeys
      Parameters:
      keys - the primary keys of the entities to select
    • selection

      Specified by:
      selection in interface FilterModel<E extends EntityEditModel>
      Returns:
      the MultiItemSelection instance
    • queryModel

      EntityQueryModel queryModel()
      Returns:
      the underlying query model