Interface EntityApplicationModel<M extends EntityModel<M,E,T>,E extends EntityEditModel,T extends EntityTableModel<E>>

Type Parameters:
M - the type of EntityModel this application model is based on
E - the type of EntityEditModel used by this EntityModel
T - the type of EntityTableModel used by this EntityModel
All Known Implementing Classes:
DefaultEntityApplicationModel, SwingEntityApplicationModel

public interface EntityApplicationModel<M extends EntityModel<M,E,T>,E extends EntityEditModel,T extends EntityTableModel<E>>
A central application model class.
  • Field Details

    • USERNAME_PREFIX

      static final PropertyValue<String> USERNAME_PREFIX
      Specifies a string to prepend to the username field in the login dialog
      Value type: String
      Default value: [empty string]
    • AUTHENTICATION_REQUIRED

      static final PropertyValue<Boolean> AUTHENTICATION_REQUIRED
      Specifies whether user authentication is required
      Value type: Boolean
      Default value: true
    • SAVE_DEFAULT_USERNAME

      static final PropertyValue<Boolean> SAVE_DEFAULT_USERNAME
      Specifies whether the client saves the last successful login username,
      which is then displayed as the default username the next time the application is started
      Value type: Boolean
      Default value: true
  • Method Details

    • user

      User user()
      Returns:
      the current user
    • connectionProvider

      EntityConnectionProvider connectionProvider()
      Returns:
      the EntityConnectionProvider instance being used by this EntityApplicationModel
    • 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 application model
    • version

      Optional<Version> version()
      Returns:
      the application version, an empty Optional in case no version information is available
    • entities

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

      void addEntityModels(M... entityModels)
      Adds the given entity models to this model.
      Parameters:
      entityModels - the entity models to add
      Throws:
      IllegalArgumentException - in case any of the models has already been added
    • addEntityModel

      void addEntityModel(M entityModel)
      Adds the given entity model to this model
      Parameters:
      entityModel - the detail model
      Throws:
      IllegalArgumentException - in case the model has already been added
    • containsEntityModel

      boolean containsEntityModel(Class<? extends M> modelClass)
      Parameters:
      modelClass - the application model class
      Returns:
      true if this model contains a EntityModel instance of the given class
    • containsEntityModel

      boolean containsEntityModel(EntityType entityType)
      Parameters:
      entityType - the entityType
      Returns:
      true if this model contains a EntityModel for the given entityType
    • containsEntityModel

      boolean containsEntityModel(M entityModel)
      Parameters:
      entityModel - the entity model
      Returns:
      true if this model contains the given EntityModel
    • warnAboutUnsavedData

      State warnAboutUnsavedData()
      Returns:
      the State controlling whether this model warns about unsaved data
      See Also:
    • containsUnsavedData

      boolean containsUnsavedData()
      Returns:
      true if any edit model associated with this application model contains modified and unsaved data, that is, existing entities that have been modified but not saved
    • savePreferences

      void savePreferences()
      Saves any user preferences. Note that if EntityModel.USE_CLIENT_PREFERENCES is set to 'false', calling this method has no effect. Remember to call super.savePreferences() when overriding.
    • entityModels

      List<M> entityModels()
      Returns:
      an unmodifiable List containing the EntityModel instances contained in this EntityApplicationModel
    • entityModel

      <C extends M> C entityModel(Class<C> modelClass)
      Type Parameters:
      C - the model type
      Parameters:
      modelClass - the model class
      Returns:
      the EntityModel of the given type
    • entityModel

      <C extends M> C entityModel(EntityType entityType)
      Type Parameters:
      C - the model type
      Parameters:
      entityType - the entityType
      Returns:
      the EntityModel based on the given entityType
    • refresh

      void refresh()
      Refreshes all data models contained in this application model