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

public Class InfoCenterView

extends Control
Class Inheritance
Imports
com.dlsc.gemsfx.skins.InfoCenterViewSkin, javafx.beans.InvalidationListener, .WeakInvalidationListener, javafx.beans.property.BooleanProperty, .DoubleProperty, .ObjectProperty, .SimpleBooleanProperty, .SimpleObjectProperty, javafx.collections.FXCollections, .ListChangeListener, .ObservableList, javafx.css.CssMetaData, .Styleable, .StyleableDoubleProperty, .StyleableProperty, javafx.css.converter.SizeConverter, javafx.scene.Node, javafx.scene.control.Control, .Label, .Skin, javafx.scene.layout.StackPane, javafx.scene.paint.Color, javafx.util.Duration, org.kordamp.ikonli.javafx.FontIcon, org.kordamp.ikonli.materialdesign.MaterialDesign, java.util.ArrayList, .Collections, .List, .Objects, java.util.function.Consumer, java.util.stream.Collectors

A view capable of displaying groups of different types of notifications. The user can choose to expand the groups or to stack all notifications of a group on top of each other. The view is intended to be used together with the InfoCenterPane, so that the visibility of the view is actively managed.
See Also
InfoCenterPane

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private BooleanProperty
private static final boolean
private static final Duration
private static final double
private static final Node
private static final Duration
private static final boolean
private ObjectProperty<Duration>
private final ObservableList<NotificationGroup<?, ?>>
private final ObservableList<Notification<?>>
private DoubleProperty
private final ObjectProperty<Consumer<NotificationGroup<?, ?>>>
private final ObservableList<NotificationGroup<?, ?>>
private final ObservableList<Notification<?>>
private ObjectProperty<Node>
private final ObjectProperty<Duration>
private final ObjectProperty<NotificationGroup<T, S extends Notification<T>>>
private ObjectProperty<Duration>
private static final String
private BooleanProperty
private final ObservableList<Notification<?>>
private final ObservableList<NotificationGroup<?, ?>>
private final ObservableList<Notification<?>>
private final ObservableList<NotificationGroup<?, ?>>
private final ObservableList<Notification<?>>
private final ObservableList<NotificationGroup<?, ?>>
private final ObservableList<Notification<?>>
private final InvalidationListener
private final InvalidationListener
private final WeakInvalidationListener
private final WeakInvalidationListener

Constructor Summary

AccessConstructor and Description
public
InfoCenterView()

Constructs a new view.

Method Summary

Modifier and TypeMethod and Description
public final BooleanProperty

Returns:

true if the group of a newly added notification should be automatically expanded
autoOpenGroupProperty
()

Groups can be opened automatically when a notification gets added to them.

public void
private static StackPane
protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control.

public final ObjectProperty<Duration>

Returns:

the expand / collapse animation duration
expandDurationProperty
()

The duration used for the expand / collapse animation when the view opens or closes a group.

public static List<CssMetaData<? extends Styleable, ?>>
getClassCssMetaData()

Hides javafx.scene.control.Control.getClassCssMetaData.

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

public List<CssMetaData<? extends Styleable, ?>>
getControlCssMetaData()

Overrides javafx.scene.control.Control.getControlCssMetaData.

Gets the unmodifiable list of the control's CSS-styleable properties.

public final Duration
public final ObservableList<NotificationGroup<?, ?>>

Returns:

the list of notification groups
getGroups
()

A list of groups of notifications that will be visualized by the view.

public final double
public final Consumer<NotificationGroup<?, ?>>
public final Node
public final Duration
public final NotificationGroup<T, S extends Notification<T>>
public final Duration
public final ObservableList<Notification<?>>

Returns:

a flattened list of all notifications
getUnmodifiableNotifications
()

A read-only list of all notifications of all groups currently added to the view.

public final ObservableList<NotificationGroup<?, ?>>

Returns:

the list of pinned groups
getUnmodifiablePinnedGroups
()

A read-only list of the currently pinned groups.

public final ObservableList<Notification<?>>

Returns:

a flattened list of all notifications inside pinned groups
getUnmodifiablePinnedNotifications
()

A read-only list of all notifications of all pinned groups currently added to the view.

public final ObservableList<NotificationGroup<?, ?>>

Returns:

the list of pinned groups
getUnmodifiableUnpinnedGroups
()

A read-only list of the currently unpinned groups.

public final ObservableList<Notification<?>>

Returns:

a flattened list of all notifications inside groups that are currently not pinned
getUnmodifiableUnpinnedNotifications
()

A read-only list of all notifications of all unpinned groups currently added to the view.

public String
getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method.

public final boolean
public final boolean
public final DoubleProperty

Returns:

the DoubleProperty that controls the spacing between notifications in the same group.
notificationSpacingProperty
()

Represents the spacing between individual notification views within the same notification group.

public final ObjectProperty<Consumer<NotificationGroup<?, ?>>>

Returns:

the callback that gets invoked when requesting to see all notifications of a group
onShowAllGroupNotificationsProperty
()

A callback that gets invoked when the user presses the "show all" button of a group that has more than the maximum number of notifications linked to it.

public final ObjectProperty<Node>

Returns:

the placeholder node
placeholderProperty
()

A placeholder node that is shown when the info is empty.

public final void
setAutoOpenGroup(boolean autoOpenGroup)

public final void
setExpandDuration(Duration expandDuration)

public final void
setNotificationSpacing(double notificationSpacing)

public final void
setOnShowAllGroupNotifications(Consumer<NotificationGroup<?, ?>> onShowAllGroupNotifications)

public final void
setPlaceholder(Node placeholder)

public final void
setShowAllFadeDuration(Duration showAllFadeDuration)

public final void
setShowAllGroup(NotificationGroup<T, S extends Notification<T>> showAllGroup)

public final void
setSlideInDuration(Duration slideInDuration)

public final void
setTransparent(boolean transparent)

public final ObjectProperty<Duration>

Returns:

the duration for the fade-in / fade-out animation used for toggling views
showAllFadeDurationProperty
()

The duration used for the animation when switching between the standard view and the "show all" view.

public final ObjectProperty<NotificationGroup<T, S extends Notification<T>>>

Returns:

the group for which all notifications are shown in a list view
showAllGroupProperty
()

The group that is currently being shown in the "show all" view of the control.

public final ObjectProperty<Duration>

Returns:

the slide-in duration of a new notification
slideInDurationProperty
()

The duration used for animating the slide-in / slide-out of a notification.

public final BooleanProperty

Returns:

true if the control is not transparent
transparentProperty
()

Determines whether the control will be transparent or not.

private void
private void
private void
Inherited from javafx.scene.control.Control:
computeMaxHeightcomputeMaxWidthcomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthcontextMenuPropertyexecuteAccessibleActiongetBaselineOffsetgetContextMenugetCssMetaDatagetInitialFocusTraversablegetSkingetTooltipisResizablelayoutChildrenqueryAccessibleAttributesetContextMenusetSkinsetTooltipskinPropertytooltipProperty

Field Detail

autoOpenGroupback to summary
private BooleanProperty autoOpenGroup
DEFAULT_AUTO_OPEN_GROUPback to summary
private static final boolean DEFAULT_AUTO_OPEN_GROUP
DEFAULT_EXPAND_DURATIONback to summary
private static final Duration DEFAULT_EXPAND_DURATION
DEFAULT_NOTIFICATION_SPACINGback to summary
private static final double DEFAULT_NOTIFICATION_SPACING
DEFAULT_PLACEHOLDERback to summary
private static final Node DEFAULT_PLACEHOLDER
DEFAULT_SLIDE_IN_DURATIONback to summary
private static final Duration DEFAULT_SLIDE_IN_DURATION
DEFAULT_TRANSPARENTback to summary
private static final boolean DEFAULT_TRANSPARENT
expandDurationback to summary
private ObjectProperty<Duration> expandDuration
groupsback to summary
private final ObservableList<NotificationGroup<?, ?>> groups
notificationsback to summary
private final ObservableList<Notification<?>> notifications
notificationSpacingback to summary
private DoubleProperty notificationSpacing
onShowAllGroupNotificationsback to summary
private final ObjectProperty<Consumer<NotificationGroup<?, ?>>> onShowAllGroupNotifications
pinnedGroupsback to summary
private final ObservableList<NotificationGroup<?, ?>> pinnedGroups
pinnedNotificationsback to summary
private final ObservableList<Notification<?>> pinnedNotifications
placeholderback to summary
private ObjectProperty<Node> placeholder
showAllFadeDurationback to summary
private final ObjectProperty<Duration> showAllFadeDuration
showAllGroupback to summary
private final ObjectProperty<NotificationGroup<T, S extends Notification<T>>> showAllGroup
slideInDurationback to summary
private ObjectProperty<Duration> slideInDuration
TRANSPARENTback to summary
private static final String TRANSPARENT
transparentback to summary
private BooleanProperty transparent
unmodifiableNotificationsback to summary
private final ObservableList<Notification<?>> unmodifiableNotifications
unmodifiablePinnedGroupsback to summary
private final ObservableList<NotificationGroup<?, ?>> unmodifiablePinnedGroups
unmodifiablePinnedNotificationsback to summary
private final ObservableList<Notification<?>> unmodifiablePinnedNotifications
unmodifiableUnpinnedGroupsback to summary
private final ObservableList<NotificationGroup<?, ?>> unmodifiableUnpinnedGroups
unmodifiableUnpinnedNotificationsback to summary
private final ObservableList<Notification<?>> unmodifiableUnpinnedNotifications
unpinnedGroupsback to summary
private final ObservableList<NotificationGroup<?, ?>> unpinnedGroups
unpinnedNotificationsback to summary
private final ObservableList<Notification<?>> unpinnedNotifications
updateNotificationsListenerback to summary
private final InvalidationListener updateNotificationsListener
updatePinnedGroupsListenerback to summary
private final InvalidationListener updatePinnedGroupsListener
weakUpdateNotificationsListenerback to summary
private final WeakInvalidationListener weakUpdateNotificationsListener
weakUpdatePinnedGroupsListenerback to summary
private final WeakInvalidationListener weakUpdatePinnedGroupsListener

Constructor Detail

InfoCenterViewback to summary
public InfoCenterView()

Constructs a new view.

Method Detail

autoOpenGroupPropertyback to summary
public final BooleanProperty autoOpenGroupProperty()

Groups can be opened automatically when a notification gets added to them. The default is false.

Returns:BooleanProperty

true if the group of a newly added notification should be automatically expanded

clearAllback to summary
public void clearAll()
createDefaultPlaceholderback to summary
private static StackPane createDefaultPlaceholder()
createDefaultSkinback to summary
protected Skin<?> createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Doc from javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).

Annotations
@Override
expandDurationPropertyback to summary
public final ObjectProperty<Duration> expandDurationProperty()

The duration used for the expand / collapse animation when the view opens or closes a group.

Returns:ObjectProperty<Duration>

the expand / collapse animation duration

getClassCssMetaDataback to summary
public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData()

Hides javafx.scene.control.Control.getClassCssMetaData.

Doc from javafx.scene.control.Control.getClassCssMetaData.

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

getControlCssMetaDataback to summary
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData()

Overrides javafx.scene.control.Control.getControlCssMetaData.

Doc from javafx.scene.control.Control.getControlCssMetaData.

Gets the unmodifiable list of the control's CSS-styleable properties.

Annotations
@Override
getExpandDurationback to summary
public final Duration getExpandDuration()
getGroupsback to summary
public final ObservableList<NotificationGroup<?, ?>> getGroups()

A list of groups of notifications that will be visualized by the view. Every notification has to be a member of a group.

Returns:ObservableList<NotificationGroup<?, ?>>

the list of notification groups

getNotificationSpacingback to summary
public final double getNotificationSpacing()
getOnShowAllGroupNotificationsback to summary
public final Consumer<NotificationGroup<?, ?>> getOnShowAllGroupNotifications()
getPlaceholderback to summary
public final Node getPlaceholder()
getShowAllFadeDurationback to summary
public final Duration getShowAllFadeDuration()
getShowAllGroupback to summary
public final NotificationGroup<T, S extends Notification<T>> getShowAllGroup()
getSlideInDurationback to summary
public final Duration getSlideInDuration()
getUnmodifiableNotificationsback to summary
public final ObservableList<Notification<?>> getUnmodifiableNotifications()

A read-only list of all notifications of all groups currently added to the view.

Returns:ObservableList<Notification<?>>

a flattened list of all notifications

getUnmodifiablePinnedGroupsback to summary
public final ObservableList<NotificationGroup<?, ?>> getUnmodifiablePinnedGroups()

A read-only list of the currently pinned groups.

Returns:ObservableList<NotificationGroup<?, ?>>

the list of pinned groups

getUnmodifiablePinnedNotificationsback to summary
public final ObservableList<Notification<?>> getUnmodifiablePinnedNotifications()

A read-only list of all notifications of all pinned groups currently added to the view.

Returns:ObservableList<Notification<?>>

a flattened list of all notifications inside pinned groups

getUnmodifiableUnpinnedGroupsback to summary
public final ObservableList<NotificationGroup<?, ?>> getUnmodifiableUnpinnedGroups()

A read-only list of the currently unpinned groups.

Returns:ObservableList<NotificationGroup<?, ?>>

the list of pinned groups

getUnmodifiableUnpinnedNotificationsback to summary
public final ObservableList<Notification<?>> getUnmodifiableUnpinnedNotifications()

A read-only list of all notifications of all unpinned groups currently added to the view.

Returns:ObservableList<Notification<?>>

a flattened list of all notifications inside groups that are currently not pinned

getUserAgentStylesheetback to summary
public String getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

Doc from javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method. These styles are used in addition to whatever user-agent stylesheets are in use. This provides a mechanism for third parties to introduce styles for custom controls.

The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL does not have a [scheme:] component, the URL is considered to be the [path] component only. Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to the root of the application's classpath.

Subclasses overriding this method should not assume any particular implementation approach as to the number and frequency with which it is called. For this reason, attempting any kind of dynamic implementation (i.e. returning different user agent stylesheet values) based on some state change is highly discouraged, as there is no guarantee when, or even if, this method will be called. Some JavaFX CSS implementations may choose to cache this response for an indefinite period of time, and therefore there should be no expectation around when this method is called.



package com.example.javafx.app;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class MyApp extends Application {

    @Override public void start(Stage stage) {
        Scene scene = new Scene(new Group());
        scene.getStylesheets().add("/com/example/javafx/app/mystyles.css");
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
For additional information about using CSS with the scene graph, see the CSS Reference Guide.
Annotations
@Override
isAutoOpenGroupback to summary
public final boolean isAutoOpenGroup()
isTransparentback to summary
public final boolean isTransparent()
notificationSpacingPropertyback to summary
public final DoubleProperty notificationSpacingProperty()

Represents the spacing between individual notification views within the same notification group. This property allows adjustment of the vertical gap depending on the layout of the notification container. The default value is 10.0.

Returns:DoubleProperty

the DoubleProperty that controls the spacing between notifications in the same group.

onShowAllGroupNotificationsPropertyback to summary
public final ObjectProperty<Consumer<NotificationGroup<?, ?>>> onShowAllGroupNotificationsProperty()

A callback that gets invoked when the user presses the "show all" button of a group that has more than the maximum number of notifications linked to it. The default callback will switch to a list view control which will then be able to show all notifications of that group. Applications can choose to display the notifications in a different place, e.g. in a dialog.

Returns:ObjectProperty<Consumer<NotificationGroup<?, ?>>>

the callback that gets invoked when requesting to see all notifications of a group

placeholderPropertyback to summary
public final ObjectProperty<Node> placeholderProperty()

A placeholder node that is shown when the info is empty.

Returns:ObjectProperty<Node>

the placeholder node

setAutoOpenGroupback to summary
public final void setAutoOpenGroup(boolean autoOpenGroup)
setExpandDurationback to summary
public final void setExpandDuration(Duration expandDuration)
setNotificationSpacingback to summary
public final void setNotificationSpacing(double notificationSpacing)
setOnShowAllGroupNotificationsback to summary
public final void setOnShowAllGroupNotifications(Consumer<NotificationGroup<?, ?>> onShowAllGroupNotifications)
setPlaceholderback to summary
public final void setPlaceholder(Node placeholder)
setShowAllFadeDurationback to summary
public final void setShowAllFadeDuration(Duration showAllFadeDuration)
setShowAllGroupback to summary
public final void setShowAllGroup(NotificationGroup<T, S extends Notification<T>> showAllGroup)
setSlideInDurationback to summary
public final void setSlideInDuration(Duration slideInDuration)
setTransparentback to summary
public final void setTransparent(boolean transparent)
showAllFadeDurationPropertyback to summary
public final ObjectProperty<Duration> showAllFadeDurationProperty()

The duration used for the animation when switching between the standard view and the "show all" view.

Returns:ObjectProperty<Duration>

the duration for the fade-in / fade-out animation used for toggling views

showAllGroupPropertyback to summary
public final ObjectProperty<NotificationGroup<T, S extends Notification<T>>> showAllGroupProperty()

The group that is currently being shown in the "show all" view of the control.

Returns:ObjectProperty<NotificationGroup<T, S extends Notification<T>>>

the group for which all notifications are shown in a list view

slideInDurationPropertyback to summary
public final ObjectProperty<Duration> slideInDurationProperty()

The duration used for animating the slide-in / slide-out of a notification.

Returns:ObjectProperty<Duration>

the slide-in duration of a new notification

transparentPropertyback to summary
public final BooleanProperty transparentProperty()

Determines whether the control will be transparent or not. By default, a semi-transparent black background is showing.

Returns:BooleanProperty

true if the control is not transparent

updateNotificationsListback to summary
private void updateNotificationsList()
updatePinnedAndUnpinnedGroupsListback to summary
private void updatePinnedAndUnpinnedGroupsList()
updateStyleback to summary
private void updateStyle()
com.dlsc.gemsfx.infocenter back to summary

private Class InfoCenterView.StyleableProperties

extends Object
Class Inheritance
  • java.lang.Object
  • com.dlsc.gemsfx.infocenter.InfoCenterView.StyleableProperties

Field Summary

Modifier and TypeField and Description
private static final CssMetaData<InfoCenterView, Number>
private static final List<CssMetaData<? extends Styleable, ?>>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

NOTIFICATION_SPACINGback to summary
private static final CssMetaData<InfoCenterView, Number> NOTIFICATION_SPACING
STYLEABLESback to summary
private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES

Constructor Detail

StyleablePropertiesback to summary
private StyleableProperties()