Top Description Fields Constructors Methods
com.dlsc.gemsfx.infocenter

public Class NotificationAction<T>

extends Object
Class Inheritance
Type Parameters
<T>
the type of the user object of the notification
Imports
com.dlsc.gemsfx.infocenter.Notification.OnClickBehaviour, javafx.beans.property.SimpleStringProperty, .StringProperty, javafx.util.Callback, java.util.Objects

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".

Field Summary

Modifier and TypeField and Description
private Callback<Notification<T>, Notification.OnClickBehaviour>
private final StringProperty

Constructor Summary

AccessConstructor and Description
public
NotificationAction(String
the text of the action as shown in the UI
text
)

Constructs a new action with the given text.

public
NotificationAction(String
the text of the action as shown in the UI
text
,
Callback<Notification<T>, Notification.OnClickBehaviour>
the application logic to perform when the user selects the action
onAction
)

Constructs a new action with the given text.

Method Summary

Modifier and TypeMethod and Description
public final Callback<Notification<T>, Notification.OnClickBehaviour>

Returns:

the callback to invoke when the user triggers the action
getOnAction
()

Returns the callback that will be invoked when the user selects the action in the UI.

public final String
public final void
setOnAction(Callback<Notification<T>, Notification.OnClickBehaviour>
the callback to invoke when the user triggers the action
onAction
)

Sets the callback that will be invoked when the user selects the action in the UI.

public final void
public final StringProperty

Returns:

the text for the action
textProperty
()

The text that will be used in the UI when creating controls that will trigger the action.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

onActionback to summary
private Callback<Notification<T>, Notification.OnClickBehaviour> onAction
textback to summary
private final StringProperty text

Constructor Detail

NotificationActionback to summary
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:String

the text of the action as shown in the UI

NotificationActionback to summary
public NotificationAction(String text, Callback<Notification<T>, Notification.OnClickBehaviour> onAction)

Constructs a new action with the given text.

Parameters
text:String

the text of the action as shown in the UI

onAction:Callback<Notification<T>, Notification.OnClickBehaviour>

the application logic to perform when the user selects the action

Method Detail

getOnActionback to summary
public final Callback<Notification<T>, Notification.OnClickBehaviour> getOnAction()

Returns the callback that will be invoked when the user selects the action in the UI.

Returns:Callback<Notification<T>, Notification.OnClickBehaviour>

the callback to invoke when the user triggers the action

getTextback to summary
public final String getText()
setOnActionback to summary
public final void setOnAction(Callback<Notification<T>, Notification.OnClickBehaviour> onAction)

Sets the callback that will be invoked when the user selects the action in the UI.

Parameters
onAction:Callback<Notification<T>, Notification.OnClickBehaviour>

the callback to invoke when the user triggers the action

setTextback to summary
public final void setText(String text)
textPropertyback to summary
public final StringProperty textProperty()

The text that will be used in the UI when creating controls that will trigger the action.

Returns:StringProperty

the text for the action