Interface Activity

All Superinterfaces:
Disableable, PropertyBean
All Known Subinterfaces:
FileBasedActivity
All Known Implementing Classes:
AbstractActivity, AbstractFileBasedActivity

public interface Activity extends Disableable, PropertyBean
Represents an activity that the user performs with an Application.

The life-cycle of an Activity is managed by an Application, it consists of the following steps:

  1. Creation
    The user invokes an Action that instantiates a new Activity for the Application, which is passed as an argument to the constructor of the Activity.
  2. Initialisation
    The Action adds the Activity to the Application.
    The Application invokes init().
    The Application retrieves Actions from the Activity and creates user interface elements for them. The Application retrieves the Node from the Activity and adds it to one of its scene graphs.
  3. Start
    The Application invokes start(), to inform the activity that it can start (or resume) execution.
  4. Stop
    The Application invokes stop(), to inform the activity that it should stop (or suspend) execution.
    The Application can invoke start() again, to resume execution.
  5. Destruction
    When the view is no longer needed, the Application ensures that the activity is destroyed.
    The Application invokes destroy().
    The Application removes the Node of the Activity from its scene graph.
    The Application sets the applicationProperty() to null.

An activity can be disabled. See Disableable.

Actions can store arbitrary transient data in the activity. This facility is provided by extending the interface PropertyBean.

Author:
Werner Randelshofer
  • Property Details

  • Field Details

  • Method Details

    • actionsProperty

      @NonNull javafx.beans.property.ReadOnlyMapProperty<String,Action> actionsProperty()
      Contains all Action objects that are managed by this Activity.
      Returns:
      the activities
      See Also:
    • getActions

      default @NonNull javafx.collections.ObservableMap<String,Action> getActions()
      Gets the value of the actions property.
      Property description:
      Contains all Action objects that are managed by this Activity.
      Returns:
      the value of the actions property
      See Also:
    • applicationProperty

      @NonNull javafx.beans.property.ObjectProperty<Application> applicationProperty()
      The application property is maintained by the Application that manages this activity.

      The value is set to the application before init() is called.

      The value is set to null after destroy() has been called.

      Returns:
      the property
      See Also:
    • disambiguationProperty

      @NonNull javafx.beans.property.IntegerProperty disambiguationProperty()
      Used by the application to display unique titles if multiple activities have the same title.
      Returns:
      the property
      See Also:
    • setApplication

      default void setApplication(@NonNull Application application)
      Sets the value of the application property.
      Property description:
      The application property is maintained by the Application that manages this activity.

      The value is set to the application before init() is called.

      The value is set to null after destroy() has been called.

      Parameters:
      application - the value for the application property
      See Also:
    • getApplication

      default @NonNull Application getApplication()
      Gets the value of the application property.
      Property description:
      The application property is maintained by the Application that manages this activity.

      The value is set to the application before init() is called.

      The value is set to null after destroy() has been called.

      Returns:
      the value of the application property
      See Also:
    • getDisambiguation

      default int getDisambiguation()
      Gets the value of the disambiguation property.
      Property description:
      Used by the application to display unique titles if multiple activities have the same title.
      Returns:
      the value of the disambiguation property
      See Also:
    • setDisambiguation

      default void setDisambiguation(int newValue)
      Sets the value of the disambiguation property.
      Property description:
      Used by the application to display unique titles if multiple activities have the same title.
      Parameters:
      newValue - the value for the disambiguation property
      See Also:
    • getNode

      javafx.scene.Node getNode()
      Returns a JavaFX node that provides a user interface for the activity.
      Returns:
      the node
    • getTitle

      default @Nullable String getTitle()
      Gets the value of the title property.
      Property description:
      The title of the activity as displayed in the title bars of the activity’s windows and in alert dialogs related to the activity.

      If the activity can be associated to a name, then the title should be that name. If the name has not been assigned yet, the title should be 'unnamed'.

      See FileBasedActivity.titleProperty().

      Returns:
      the value of the title property
      See Also:
    • setTitle

      default void setTitle(@Nullable String newValue)
      Sets the value of the title property.
      Property description:
      The title of the activity as displayed in the title bars of the activity’s windows and in alert dialogs related to the activity.

      If the activity can be associated to a name, then the title should be that name. If the name has not been assigned yet, the title should be 'unnamed'.

      See FileBasedActivity.titleProperty().

      Parameters:
      newValue - the value for the title property
      See Also:
    • init

      void init()
      Initializes the activity.

      See life-cycle in Activity.

    • start

      void start()
      Starts the activity.

      See life-cycle in Activity.

    • stop

      void stop()
      Stops the activity.

      See life-cycle in Activity.

    • destroy

      void destroy()
      Destroys the activity.

      See life-cycle in Activity.

    • titleProperty

      @NonNull javafx.beans.property.StringProperty titleProperty()
      The title of the activity as displayed in the title bars of the activity’s windows and in alert dialogs related to the activity.

      If the activity can be associated to a name, then the title should be that name. If the name has not been assigned yet, the title should be 'unnamed'.

      See FileBasedActivity.titleProperty().

      Returns:
      the title of the activity
      See Also: