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

public Class NotificationView<T, S extends Notification<T>>

extends StackPane
Class Inheritance
Type Parameters
<T>
the type of the business object
<S>
the type of the notification
Imports
com.dlsc.gemsfx.infocenter.Notification.OnClickBehaviour, com.dlsc.gemsfx.util.ResourceBundleManager, javafx.animation.FadeTransition, javafx.beans.InvalidationListener, .Observable, .WeakInvalidationListener, javafx.beans.binding.Bindings, .BooleanBinding, javafx.beans.property.BooleanProperty, .ObjectProperty, .SimpleBooleanProperty, .SimpleObjectProperty, javafx.collections.MapChangeListener, javafx.css.PseudoClass, javafx.geometry.Insets, .Pos, javafx.scene.Node, .Parent, javafx.scene.control.Button, .Label, .Tooltip, javafx.scene.layout.BorderPane, .HBox, .Priority, .Region, .StackPane, .VBox, javafx.util.Callback, .StringConverter, org.kordamp.ikonli.javafx.FontIcon, java.text.MessageFormat, java.time.Duration, .ZonedDateTime, java.time.format.DateTimeFormatter, .FormatStyle, java.util.List, .Objects, .Optional

A view used for visualizing a notification

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class

Field Summary

Modifier and TypeField and Description
private final ObjectProperty<Node>
private final NotificationView<T, S>.ContentPane
private static final StringConverter<ZonedDateTime>
private final ObjectProperty<Node>
private final S
private static final PseudoClass
private static final DateTimeFormatter
private final BooleanProperty
private final BooleanProperty
private final StackPane
private final StackPane
private ObjectProperty<StringConverter<ZonedDateTime>>

Constructor Summary

AccessConstructor and Description
public
NotificationView(S
the notification
notification
)

Constructs a new view for the given notification.

Method Summary

Modifier and TypeMethod and Description
protected double
computeMaxHeight(double width)

Overrides javafx.scene.layout.Region.computeMaxHeight.

Computes the maximum height of this region.

protected double
computeMinHeight(double width)

Overrides javafx.scene.layout.StackPane.computeMinHeight.

Computes the minimum height of this region.

protected double
computePrefHeight(double width)

Overrides javafx.scene.layout.StackPane.computePrefHeight.

Computes the preferred height of this region for the given width; Region subclasses should override this method to return an appropriate value based on their content and layout strategy.

public final ObjectProperty<Node>

Returns:

the optional graphic
contentProperty
()

An (optional) detailed UI that can be revealed interactively by the user.

public final Node
public final Node
public final S

Returns:

the notification
getNotification
()

The notification for which the view was created.

public final StringConverter<ZonedDateTime>
public final ObjectProperty<Node>

Returns:

the graphic / the icon
graphicProperty
()

An (optional) node that will be used as the notification's graphic object / icon on the left-hand side.

public final boolean
protected void
layoutChildren()

Overrides javafx.scene.layout.StackPane.layoutChildren.

Invoked during the layout pass to layout the children in this Parent.

public final void
setContent(Node content)

public final void
setGraphic(Node graphic)

public final void
setShowContent(boolean showContent)

public final void
public final BooleanProperty
public final ObjectProperty<StringConverter<ZonedDateTime>>

Returns:

the time converter
timeConverterProperty
()

A converter that is used to convert the date and time of the notification into a human-readable text.

public void
updateDateAndTimeLabel()

Updates the date and time label with a human-readable text that is relative to the current time, e.g. "now", "yesterday".

private void
updateStyle(S notification)

private void
Inherited from javafx.scene.layout.StackPane:
alignmentPropertyclearConstraintscomputeMinWidthcomputePrefWidthgetAlignmentgetAlignmentgetClassCssMetaDatagetContentBiasgetCssMetaDatagetMarginrequestLayoutsetAlignmentsetAlignmentsetMargin

Field Detail

contentback to summary
private final ObjectProperty<Node> content
contentPaneback to summary
private final NotificationView<T, S>.ContentPane contentPane
DEFAULT_TIME_CONVERTERback to summary
private static final StringConverter<ZonedDateTime> DEFAULT_TIME_CONVERTER
graphicback to summary
private final ObjectProperty<Node> graphic
notificationback to summary
private final S notification
PSEUDO_CLASS_EXPANDEDback to summary
private static final PseudoClass PSEUDO_CLASS_EXPANDED
SHORT_TIME_FORMATTERback to summary
private static final DateTimeFormatter SHORT_TIME_FORMATTER
showContentback to summary
private final BooleanProperty showContent
stackingEnabledback to summary
private final BooleanProperty stackingEnabled
stackNotification1back to summary
private final StackPane stackNotification1
stackNotification2back to summary
private final StackPane stackNotification2
timeConverterback to summary
private ObjectProperty<StringConverter<ZonedDateTime>> timeConverter

Constructor Detail

NotificationViewback to summary
public NotificationView(S notification)

Constructs a new view for the given notification.

Parameters
notification:S

the notification

Method Detail

computeMaxHeightback to summary
protected double computeMaxHeight(double width)

Overrides javafx.scene.layout.Region.computeMaxHeight.

Doc from javafx.scene.layout.Region.computeMaxHeight.

Computes the maximum height of this region. Returns Double.MAX_VALUE by default. Region subclasses may override this method to return a different value based on their content and layout strategy. If the subclass doesn't have a HORIZONTAL content bias, then the width parameter can be ignored.

Annotations
@Override
computeMinHeightback to summary
protected double computeMinHeight(double width)

Overrides javafx.scene.layout.StackPane.computeMinHeight.

Doc from javafx.scene.layout.Region.computeMinHeight.

Computes the minimum height of this region. Returns the sum of the top and bottom insets by default. Region subclasses should override this method to return an appropriate value based on their content and layout strategy. If the subclass doesn't have a HORIZONTAL content bias, then the width parameter can be ignored.

Annotations
@Override
computePrefHeightback to summary
protected double computePrefHeight(double width)

Overrides javafx.scene.layout.StackPane.computePrefHeight.

Doc from javafx.scene.layout.Region.computePrefHeight.

Computes the preferred height of this region for the given width; Region subclasses should override this method to return an appropriate value based on their content and layout strategy. If the subclass doesn't have a HORIZONTAL content bias, then the width parameter can be ignored.

Annotations
@Override
contentPropertyback to summary
public final ObjectProperty<Node> contentProperty()

An (optional) detailed UI that can be revealed interactively by the user. Example: a map view that shows the location of a meeting scheduled in a calendar.

Returns:ObjectProperty<Node>

the optional graphic

getContentback to summary
public final Node getContent()
getGraphicback to summary
public final Node getGraphic()
getNotificationback to summary
public final S getNotification()

The notification for which the view was created.

Returns:S

the notification

getTimeConverterback to summary
public final StringConverter<ZonedDateTime> getTimeConverter()
graphicPropertyback to summary
public final ObjectProperty<Node> graphicProperty()

An (optional) node that will be used as the notification's graphic object / icon on the left-hand side.

Returns:ObjectProperty<Node>

the graphic / the icon

isShowContentback to summary
public final boolean isShowContent()
layoutChildrenback to summary
protected void layoutChildren()

Overrides javafx.scene.layout.StackPane.layoutChildren.

Doc from javafx.scene.Parent.layoutChildren.

Invoked during the layout pass to layout the children in this Parent. By default it will only set the size of managed, resizable content to their preferred sizes and does not do any node positioning.

Subclasses should override this function to layout content as needed.

Annotations
@Override
setContentback to summary
public final void setContent(Node content)
setGraphicback to summary
public final void setGraphic(Node graphic)
setShowContentback to summary
public final void setShowContent(boolean showContent)
setTimeConverterback to summary
public final void setTimeConverter(StringConverter<ZonedDateTime> timeConverter)
showContentPropertyback to summary
public final BooleanProperty showContentProperty()
timeConverterPropertyback to summary
public final ObjectProperty<StringConverter<ZonedDateTime>> timeConverterProperty()

A converter that is used to convert the date and time of the notification into a human-readable text. The default converter creates a text like "now", "yesterday", "2 days ago", etc...

Returns:ObjectProperty<StringConverter<ZonedDateTime>>

the time converter

updateDateAndTimeLabelback to summary
public void updateDateAndTimeLabel()

Updates the date and time label with a human-readable text that is relative to the current time, e.g. "now", "yesterday".

updateStyleback to summary
private void updateStyle(S notification)
updateStyleClassback to summary
private void updateStyleClass()
com.dlsc.gemsfx.infocenter back to summary

public Class NotificationView.ContentPane

extends HBox
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final StackPane
private FadeTransition
private final Label
private final InvalidationListener
private final WeakInvalidationListener

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
layoutChildren()

Overrides javafx.scene.layout.HBox.layoutChildren.

Invoked during the layout pass to layout the children in this Parent.

private void
updateActions(HBox actionsBox)

private void
private void
private void
Inherited from javafx.scene.layout.HBox:
alignmentPropertyclearConstraintscomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthfillHeightPropertygetAlignmentgetBaselineOffsetgetClassCssMetaDatagetContentBiasgetCssMetaDatagetHgrowgetMargingetSpacingisFillHeightrequestLayoutsetAlignmentsetFillHeightsetHgrowsetMarginsetSpacingspacingProperty

Field Detail

closeIconWrapperback to summary
private final StackPane closeIconWrapper
fadeTransitionback to summary
private FadeTransition fadeTransition
timeLabelback to summary
private final Label timeLabel
updateStackClassListenerback to summary
private final InvalidationListener updateStackClassListener
weakUpdateStackClassListenerback to summary
private final WeakInvalidationListener weakUpdateStackClassListener

Constructor Detail

ContentPaneback to summary
public ContentPane()

Method Detail

layoutChildrenback to summary
protected void layoutChildren()

Overrides javafx.scene.layout.HBox.layoutChildren.

Doc from javafx.scene.Parent.layoutChildren.

Invoked during the layout pass to layout the children in this Parent. By default it will only set the size of managed, resizable content to their preferred sizes and does not do any node positioning.

Subclasses should override this function to layout content as needed.

Annotations
@Override
updateActionsback to summary
private void updateActions(HBox actionsBox)
Annotations
@SuppressWarnings:rawtypes, unchecked
updateCenterNodeback to summary
private void updateCenterNode(VBox center)
updateDateAndTimeLabelback to summary
private void updateDateAndTimeLabel()
updateStackStyleback to summary
private void updateStackStyle()