Interface EntityApplicationModel<M extends EntityModel>

    • Field Detail

      • 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 or not 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
      • SCHEDULE_CONNECTION_VALIDATION

        static final PropertyValue<Boolean> SCHEDULE_CONNECTION_VALIDATION
        Specifies whether a periodic (30 sec) validity check of the underlying connection should be scheduled. Value type: Boolean
        Default value: true
    • Method Detail

      • logout

        void logout()
        Log out from this application model
      • login

        void login​(User user)
        Logs in the given user
        Parameters:
        user - the user to login
        Throws:
        NullPointerException - in case user is null
      • getUser

        User getUser()
        Returns:
        the current user
      • getConnectionProvider

        EntityConnectionProvider getConnectionProvider()
        Returns:
        the EntityConnectionProvider instance being used by this EntityApplicationModel
      • getConnectionValidObserver

        StateObserver getConnectionValidObserver()
        Returns a StateObserver which is active while the underlying application connection provider is connected. Note that this state is updated every 30 seconds if SCHEDULE_CONNECTION_VALIDATION is true
        Returns:
        a StateObserver indicating the validity of the underlying connection provider
        See Also:
        SCHEDULE_CONNECTION_VALIDATION
      • getDomain

        Domain getDomain()
        Returns:
        the underlying domain model
      • addEntityModels

        void addEntityModels​(M... entityModels)
        Adds the given entity models to this model.
        Parameters:
        entityModels - the entity models to add
      • addEntityModel

        M addEntityModel​(M entityModel)
        Adds the given entity model to this model
        Parameters:
        entityModel - the detail model
        Returns:
        the EntityModel model just 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​(String entityId)
        Parameters:
        entityId - the entity ID
        Returns:
        true if this model contains a EntityModel for the given entity ID
      • containsEntityModel

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

        void setWarnAboutUnsavedData​(boolean warnAboutUnsavedData)
        Parameters:
        warnAboutUnsavedData - if true then this model warns about unsaved data
        See Also:
        EntityEditModel.WARN_ABOUT_UNSAVED_DATA
      • 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 user preferences relating to this application model, remember to call super.savePreferences() when overriding
      • getEntityModels

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

        M getEntityModel​(Class<? extends M> modelClass)
        Parameters:
        modelClass - the model class
        Returns:
        the EntityModel of the given type
      • getEntityModel

        M getEntityModel​(String entityId)
        Parameters:
        entityId - the entity ID
        Returns:
        the EntityModel based on the given entityId