Class Elastic.Notification

java.lang.Object
frc.robot.utils.Elastic.Notification
Enclosing class:
Elastic

public static class Elastic.Notification extends Object
Represents an notification object to be sent to the Elastic dashboard. This object holds properties such as level, title, description, display time, and dimensions to control how the notification is displayed on the dashboard.
  • Constructor Details

    • Notification

      public Notification()
      Creates a new Notification with all default parameters. This constructor is intended to be used with the chainable decorator methods

      Title and description fields are empty.

    • Notification

      public Notification(Elastic.Notification.NotificationLevel notifLvl, String notifTitle, String notifDescription, int notifDisplayTimeMillis, double notifWidth, double notifHeight)
      Creates a new Notification with all properties specified.
      Parameters:
      notifLvl - the level of the notification (e.g., INFO, WARNING, ERROR)
      notifTitle - the title text of the notification
      notifDescription - the descriptive text of the notification
      notifDisplayTimeMillis - the time in ms for which the notification is displayed
      notifWidth - the width of the notification display area
      notifHeight - the height of the notification display area, inferred if below zero
    • Notification

      public Notification(Elastic.Notification.NotificationLevel notifLvl, String notifTitle, String notifDescription)
      Creates a new Notification with default display time and dimensions.
      Parameters:
      notifLvl - the level of the notification
      notifTitle - the title text of the notification
      notifDescription - the descriptive text of the notification
    • Notification

      public Notification(Elastic.Notification.NotificationLevel notifLvl, String notifTitle, String notifDescription, int notifDisplayTimeMillis)
      Creates a new Notification with a specified display time and default dimensions.
      Parameters:
      notifLvl - the level of the notification
      notifTitle - the title text of the notification
      notifDescription - the descriptive text of the notification
      notifDisplayTimeMillis - the display time in milliseconds
    • Notification

      public Notification(Elastic.Notification.NotificationLevel notifLvl, String notifTitle, String notifDescription, double notifWidth, double notifHeight)
      Creates a new Notification with specified dimensions and default display time. If the height is below zero, it is automatically inferred based on screen size.
      Parameters:
      notifLvl - the level of the notification
      notifTitle - the title text of the notification
      notifDescription - the descriptive text of the notification
      notifWidth - the width of the notification display area
      notifHeight - the height of the notification display area, inferred if below zero
  • Method Details

    • setLevel

      public void setLevel(Elastic.Notification.NotificationLevel notifLvl)
      Updates the level of this notification.
      Parameters:
      notifLvl - the level to set the notification to
    • getLevel

      Returns:
      the level of this notification
    • setTitle

      public void setTitle(String notifTitle)
      Updates the title of this notification.
      Parameters:
      notifTitle - the title to set the notification to
    • getTitle

      public String getTitle()
      Gets the title of this notification.
      Returns:
      the title of this notification
    • setDescription

      public void setDescription(String notifDescription)
      Updates the description of this notification.
      Parameters:
      notifDescription - the description to set the notification to
    • getDescription

      public String getDescription()
      Gets the description of this notification.
      Returns:
      the description of this notification
    • setDisplayTimeSeconds

      public void setDisplayTimeSeconds(double seconds)
      Updates the display time of the notification.
      Parameters:
      seconds - the number of seconds to display the notification for
    • setDisplayTimeMillis

      public void setDisplayTimeMillis(int notifDisplayTimeMillis)
      Updates the display time of the notification in milliseconds.
      Parameters:
      notifDisplayTimeMillis - the number of milliseconds to display the notification for
    • getDisplayTimeMillis

      public int getDisplayTimeMillis()
      Gets the display time of the notification in milliseconds.
      Returns:
      the number of milliseconds the notification is displayed for
    • setWidth

      public void setWidth(double notifWidth)
      Updates the width of the notification.
      Parameters:
      notifWidth - the width to set the notification to
    • getWidth

      public double getWidth()
      Gets the width of the notification.
      Returns:
      the width of the notification
    • setHeight

      public void setHeight(double notifHeight)
      Updates the height of the notification.

      If the height is set to -1, the height will be determined

      automatically by the dashboard

      Parameters:
      notifHeight - the height to set the notification to
    • getHeight

      public double getHeight()
      Gets the height of the notification.
      Returns:
      the height of the notification
    • withLevel

      Modifies the notification's level and returns itself to allow for method chaining.
      Parameters:
      notifLvl - the level to set the notification to
      Returns:
      the current notification
    • withTitle

      public Elastic.Notification withTitle(String notifTitle)
      Modifies the notification's title and returns itself to allow for method chaining.
      Parameters:
      notifTitle - the title to set the notification to
      Returns:
      the current notification
    • withDescription

      public Elastic.Notification withDescription(String notifDescription)
      Modifies the notification's description and returns itself to allow for method chaining.
      Parameters:
      notifDescription - the description to set the notification to
      Returns:
      the current notification
    • withDisplaySeconds

      public Elastic.Notification withDisplaySeconds(double seconds)
      Modifies the notification's display time and returns itself to allow for method chaining.
      Parameters:
      seconds - the number of seconds to display the notification for
      Returns:
      the current notification
    • withDisplayMilliseconds

      public Elastic.Notification withDisplayMilliseconds(int notifDisplayTimeMillis)
      Modifies the notification's display time and returns itself to allow for method chaining.
      Parameters:
      notifDisplayTimeMillis - the number of milliseconds to display the notification for
      Returns:
      the current notification
    • withWidth

      public Elastic.Notification withWidth(double notifWidth)
      Modifies the notification's width and returns itself to allow for method chaining.
      Parameters:
      notifWidth - the width to set the notification to
      Returns:
      the current notification
    • withHeight

      public Elastic.Notification withHeight(double notifHeight)
      Modifies the notification's height and returns itself to allow for method chaining.
      Parameters:
      notifHeight - the height to set the notification to
      Returns:
      the current notification
    • withAutomaticHeight

      public Elastic.Notification withAutomaticHeight()
      Modifies the notification's height and returns itself to allow for method chaining.

      This will set the height to -1 to have it automatically determined by the dashboard

      Returns:
      the current notification
    • withNoAutoDismiss

      public Elastic.Notification withNoAutoDismiss()
      Modifies the notification to disable the auto dismiss behavior.

      This sets the display time to 0 milliseconds

      The auto dismiss behavior can be re-enabled by setting the display time to a number greater than 0

      Returns:
      the current notification