Class Notification<T>

java.lang.Object
com.dlsc.gemsfx.infocenter.Notification<T>
Type Parameters:
T - the type of the user object
All Implemented Interfaces:
Comparable<Notification<T>>
Direct Known Subclasses:
InfoCenterApp.CalendarNotification, InfoCenterApp.MailNotification, InfoCenterApp.SlackNotification

public class Notification<T> extends Object implements Comparable<Notification<T>>
A pure model object containing the data for a NotificationView. Notifications can be added to groups (NotificationGroup).
See Also:
  • Property Details

  • Field Details

  • Constructor Details

    • Notification

      public Notification(String title, String summary, ZonedDateTime dateTime)
      Constructs a new notification.
      Parameters:
      title - the title that will usually be shown in bold
      summary - a summary text of the noteworthy thing that happened
      dateTime - the date and time when the noteworthy thing happened
    • Notification

      public Notification(String title, String summary)
      Constructs a new notification.
      Parameters:
      title - the title that will usually be shown in bold
      summary - a summary text of the noteworthy thing that happened
  • Method Details

    • getGroup

      public final NotificationGroup getGroup()
      The group to which the notification belongs.
      Returns:
      the notification's parent
    • remove

      public final void remove()
      Convenience method to remove the notification from its group / its parent.
    • getTitle

      public final String getTitle()
      Gets the value of the title property.
      Property description:
      The title of the notification, e.g. "Purchase Order #123456" when this is the subject of an email for which the notification was created.
      Returns:
      the value of the title property
      See Also:
    • titleProperty

      public final javafx.beans.property.StringProperty titleProperty()
      The title of the notification, e.g. "Purchase Order #123456" when this is the subject of an email for which the notification was created.
      Returns:
      the title of the notification
      See Also:
    • setTitle

      public final void setTitle(String title)
      Sets the value of the title property.
      Property description:
      The title of the notification, e.g. "Purchase Order #123456" when this is the subject of an email for which the notification was created.
      Parameters:
      title - the value for the title property
      See Also:
    • getSummary

      public final String getSummary()
      Gets the value of the summary property.
      Property description:
      A short summary of the noteworthy thing that happened.
      Returns:
      the value of the summary property
      See Also:
    • summaryProperty

      public final javafx.beans.property.StringProperty summaryProperty()
      A short summary of the noteworthy thing that happened.
      Returns:
      the summary text
      See Also:
    • setSummary

      public final void setSummary(String summary)
      Sets the value of the summary property.
      Property description:
      A short summary of the noteworthy thing that happened.
      Parameters:
      summary - the value for the summary property
      See Also:
    • getDateTime

      public final ZonedDateTime getDateTime()
      Gets the value of the dateTime property.
      Property description:
      The time stamp for this notification.
      Returns:
      the value of the dateTime property
      See Also:
    • dateTimeProperty

      public final javafx.beans.property.ObjectProperty<ZonedDateTime> dateTimeProperty()
      The time stamp for this notification.
      Returns:
      the date and time
      See Also:
    • setDateTime

      public final void setDateTime(ZonedDateTime dateTime)
      Sets the value of the dateTime property.
      Property description:
      The time stamp for this notification.
      Parameters:
      dateTime - the value for the dateTime property
      See Also:
    • getActions

      public final javafx.collections.ObservableList<NotificationAction> getActions()
      A list of (optional) actions that the user can perform directly from within the notification.
      Returns:
      a list of possible actions
    • getUserObject

      public final T getUserObject()
      Gets the value of the userObject property.
      Property description:
      An (optional) user object for easy linking between the notification and the business object for which the notification was created, e.g. an email or a calendar entry.
      Returns:
      the value of the userObject property
      See Also:
    • userObjectProperty

      public final javafx.beans.property.ObjectProperty<T> userObjectProperty()
      An (optional) user object for easy linking between the notification and the business object for which the notification was created, e.g. an email or a calendar entry.
      Returns:
      the user object
      See Also:
    • setUserObject

      public final void setUserObject(T userObject)
      Sets the value of the userObject property.
      Property description:
      An (optional) user object for easy linking between the notification and the business object for which the notification was created, e.g. an email or a calendar entry.
      Parameters:
      userObject - the value for the userObject property
      See Also:
    • isExpanded

      public final boolean isExpanded()
      Gets the value of the expanded property.
      Property description:
      A flag that gets updated when the notification's group was expanded or collapsed.
      Returns:
      the value of the expanded property
      See Also:
    • expandedProperty

      public final javafx.beans.property.BooleanProperty expandedProperty()
      A flag that gets updated when the notification's group was expanded or collapsed.
      Returns:
      true if the notification's parent / group is currently expanded
      See Also:
    • setExpanded

      public final void setExpanded(boolean expanded)
      Sets the value of the expanded property.
      Property description:
      A flag that gets updated when the notification's group was expanded or collapsed.
      Parameters:
      expanded - the value for the expanded property
      See Also:
    • getOnClick

      public final javafx.util.Callback<Notification<T>,Notification.OnClickBehaviour> getOnClick()
      Gets the value of the onClick property.
      Property description:
      A callback that determines how the notification and the view will behave when the user clicks on it. The default behaviour is to hide the view and remove the notification from its group.
      Returns:
      the value of the onClick property
      See Also:
    • onClickProperty

      public final javafx.beans.property.ObjectProperty<javafx.util.Callback<Notification<T>,Notification.OnClickBehaviour>> onClickProperty()
      A callback that determines how the notification and the view will behave when the user clicks on it. The default behaviour is to hide the view and remove the notification from its group.
      Returns:
      the behaviour upon click (do nothing, remove the notification, hide the view, ....)
      See Also:
    • setOnClick

      public final void setOnClick(javafx.util.Callback<Notification<T>,Notification.OnClickBehaviour> onClick)
      Sets the value of the onClick property.
      Property description:
      A callback that determines how the notification and the view will behave when the user clicks on it. The default behaviour is to hide the view and remove the notification from its group.
      Parameters:
      onClick - the value for the onClick property
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(Notification<T> o)
      Specified by:
      compareTo in interface Comparable<T>