- All Known Implementing Classes:
DefaultNotificationBuilder
public interface NotificationBuilder
Builder for notifications.
Notifications are a lightweight alternative to
Notifications are a lightweight alternative to
Alerts.
While the latter are Dialogs, tentackle notifications
come as Parent nodes, that can be used in any container,
i.e. a Popup, Dialog, part of scenegraph
or whatever.
Not to be mixed up with Notes.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumControls when and how the close button is displayed.static enumThe notification type. -
Method Summary
Modifier and TypeMethodDescriptionjavafx.scene.Parentbuild()Creates the notification.Adds a button.closeButton(NotificationBuilder.CloseButtonMode closeButtonMode) Sets the close button mode.content(javafx.scene.Node content) Sets a node as an alternative to details.Applies a CSS stylesheet.
Overrides the default stylesheetorg/tentackle/fx/notification.css.Sets the detail message.
A stacktrace, for example.duration(long duration) Sets a duration to close the notification automatically.
Ignored if there is no hide action.fadeIn(long fadeIn) Sets a fadein effect to show the notification smoothly.fadeOut(long fadeOut) Sets a fadeout effect to close the notification smoothly.
Ignored if there is no hide action.getTitle()Returns the title of the notification.
It depends on the implementation whether the title is already part of the node or of a window title or not visible at all.graphic(javafx.scene.Node graphic) Sets the graphic.Sets the hide action when a button is pressed.Sets the text message.Sets the title.type(NotificationBuilder.Type type) Sets the notification type.
-
Method Details
-
type
Sets the notification type.- Parameters:
type- the type- Returns:
- the builder
-
graphic
Sets the graphic.- Parameters:
graphic- the graphic- Returns:
- the builder
-
title
Sets the title.- Parameters:
title- the title- Returns:
- the builder
-
text
Sets the text message.- Parameters:
text- the message- Returns:
- the builder
-
details
Sets the detail message.
A stacktrace, for example.Notice that details are ignored if
content(Node)is set.- Parameters:
details- the details- Returns:
- the builder
-
content
Sets a node as an alternative to details.- Parameters:
content- the content node- Returns:
- the builder
-
fadeIn
Sets a fadein effect to show the notification smoothly.- Parameters:
fadeIn- the time to fade in [ms]- Returns:
- the builder
-
duration
Sets a duration to close the notification automatically.
Ignored if there is no hide action.- Parameters:
duration- the time the dialog should be visible [ms]- Returns:
- the builder
-
fadeOut
Sets a fadeout effect to close the notification smoothly.
Ignored if there is no hide action.- Parameters:
fadeOut- the time to fade out [ms]- Returns:
- the builder
-
button
NotificationBuilder button(String text, javafx.scene.Node graphic, boolean isDefault, Runnable action) Adds a button.- Parameters:
text- the button's textgraphic- the button's graphicisDefault- true if this is the default buttonaction- the action to perform when clicked- Returns:
- the builder
-
closeButton
Sets the close button mode.- Parameters:
closeButtonMode- the close button mode- Returns:
- the builder
-
hide
Sets the hide action when a button is pressed.- Parameters:
hide- the action to close or hide the notification- Returns:
- the builder
-
css
Applies a CSS stylesheet.
Overrides the default stylesheetorg/tentackle/fx/notification.css.- Parameters:
css- the stylesheet- Returns:
- the builder
-
build
javafx.scene.Parent build()Creates the notification.- Returns:
- the notification
-
getTitle
String getTitle()Returns the title of the notification.
It depends on the implementation whether the title is already part of the node or of a window title or not visible at all.- Returns:
- the title
-