Class NotificationAction<T>

java.lang.Object
com.dlsc.gemsfx.infocenter.NotificationAction<T>
Type Parameters:
T - the type of the user object of the notification

public class NotificationAction<T> extends Object
Actions can be attached to notifications via Notification.getActions(). The UI will create a control (button or menu item) for each action so that the user can trigger the action. This allows for a quick response on incoming notifications, e.g. "open the mail".
  • Property Details

    • text

      public final javafx.beans.property.StringProperty textProperty
      The text that will be used in the UI when creating controls that will trigger the action.
      See Also:
  • Constructor Details

    • NotificationAction

      public NotificationAction(String text)
      Constructs a new action with the given text. The default action behaviour will be to remove the notification from its group. No additional application logic will be executed.
      Parameters:
      text - the text of the action as shown in the UI
    • NotificationAction

      public NotificationAction(String text, javafx.util.Callback<Notification<T>,Notification.OnClickBehaviour> onAction)
      Constructs a new action with the given text.
      Parameters:
      text - the text of the action as shown in the UI
      onAction - the application logic to perform when the user selects the action
  • Method Details

    • getText

      public final String getText()
      Gets the value of the text property.
      Property description:
      The text that will be used in the UI when creating controls that will trigger the action.
      Returns:
      the value of the text property
      See Also:
    • textProperty

      public final javafx.beans.property.StringProperty textProperty()
      The text that will be used in the UI when creating controls that will trigger the action.
      Returns:
      the text for the action
      See Also:
    • setText

      public final void setText(String text)
      Sets the value of the text property.
      Property description:
      The text that will be used in the UI when creating controls that will trigger the action.
      Parameters:
      text - the value for the text property
      See Also:
    • getOnAction

      public final javafx.util.Callback<Notification<T>,Notification.OnClickBehaviour> getOnAction()
      Returns the callback that will be invoked when the user selects the action in the UI.
      Returns:
      the callback to invoke when the user triggers the action
    • setOnAction

      public final void setOnAction(javafx.util.Callback<Notification<T>,Notification.OnClickBehaviour> onAction)
      Sets the callback that will be invoked when the user selects the action in the UI.
      Parameters:
      onAction - the callback to invoke when the user triggers the action