Class Elastic.ElasticNotification

java.lang.Object
frc.alotobots.util.Elastic.ElasticNotification
Enclosing class:
Elastic

public static class Elastic.ElasticNotification extends Object
Represents a 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 alert is displayed on the dashboard.
  • Constructor Details

    • ElasticNotification

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

      Title and description fields are empty.

    • ElasticNotification

      public ElasticNotification(Elastic.ElasticNotification.NotificationLevel level, String title, String description, int displayTimeMillis, double width, double height)
      Creates a new ElasticNotification with all properties specified.
      Parameters:
      level - the level of the notification (e.g., INFO, WARNING, ERROR)
      title - the title text of the notification
      description - the descriptive text of the notification
      displayTimeMillis - the time in milliseconds for which the notification is displayed
      width - the width of the notification display area
      height - the height of the notification display area, inferred if below zero
    • ElasticNotification

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

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

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

    • setLevel

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

      Returns:
      the level of this notification
    • setTitle

      public void setTitle(String title)
      Updates the title of this notification
      Parameters:
      title - 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 description)
      Updates the description of this notification
      Parameters:
      description - the description to set the notification to
    • getDescription

      public String getDescription()
    • 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 displayTimeMillis)
      Updates the display time of the notification in milliseconds
      Parameters:
      displayTimeMillis - 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 width)
      Updates the width of the notification
      Parameters:
      width - 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 height)
      Updates the height of the notification

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

      Parameters:
      height - 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:
      level - the level to set the notification to
      Returns:
      the current notification
    • withTitle

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

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

      public Elastic.ElasticNotification 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.ElasticNotification withDisplayMilliseconds(int displayTimeMillis)
      Modifies the notification's display time and returns itself to allow for method chaining
      Parameters:
      displayTimeMillis - the number of milliseconds to display the notification for
      Returns:
      the current notification
    • withWidth

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

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

      public Elastic.ElasticNotification 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.ElasticNotification 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