Package frc.robot.utils
Class Elastic.Notification
java.lang.Object
frc.robot.utils.Elastic.Notification
- Enclosing class:
- Elastic
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Represents the possible levels of notifications for the Elastic dashboard. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new Notification with all default parameters.Notification
(Elastic.Notification.NotificationLevel notifLvl, String notifTitle, String notifDescription) Creates a new Notification with default display time and dimensions.Notification
(Elastic.Notification.NotificationLevel notifLvl, String notifTitle, String notifDescription, double notifWidth, double notifHeight) Creates a new Notification with specified dimensions and default display time.Notification
(Elastic.Notification.NotificationLevel notifLvl, String notifTitle, String notifDescription, int notifDisplayTimeMillis) Creates a new Notification with a specified display time and default dimensions.Notification
(Elastic.Notification.NotificationLevel notifLvl, String notifTitle, String notifDescription, int notifDisplayTimeMillis, double notifWidth, double notifHeight) Creates a new Notification with all properties specified. -
Method Summary
Modifier and TypeMethodDescriptionGets the description of this notification.int
Gets the display time of the notification in milliseconds.double
Gets the height of the notification.getLevel()
getTitle()
Gets the title of this notification.double
getWidth()
Gets the width of the notification.void
setDescription
(String notifDescription) Updates the description of this notification.void
setDisplayTimeMillis
(int notifDisplayTimeMillis) Updates the display time of the notification in milliseconds.void
setDisplayTimeSeconds
(double seconds) Updates the display time of the notification.void
setHeight
(double notifHeight) Updates the height of the notification.void
Updates the level of this notification.void
Updates the title of this notification.void
setWidth
(double notifWidth) Updates the width of the notification.Modifies the notification's height and returns itself to allow for method chaining.withDescription
(String notifDescription) Modifies the notification's description and returns itself to allow for method chaining.withDisplayMilliseconds
(int notifDisplayTimeMillis) Modifies the notification's display time and returns itself to allow for method chaining.withDisplaySeconds
(double seconds) Modifies the notification's display time and returns itself to allow for method chaining.withHeight
(double notifHeight) Modifies the notification's height and returns itself to allow for method chaining.Modifies the notification's level and returns itself to allow for method chaining.Modifies the notification to disable the auto dismiss behavior.Modifies the notification's title and returns itself to allow for method chaining.withWidth
(double notifWidth) Modifies the notification's width and returns itself to allow for method chaining.
-
Constructor Details
-
Notification
public Notification()Creates a new Notification with all default parameters. This constructor is intended to be used with the chainable decorator methodsTitle 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 notificationnotifDescription
- the descriptive text of the notificationnotifDisplayTimeMillis
- the time in ms for which the notification is displayednotifWidth
- the width of the notification display areanotifHeight
- 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 notificationnotifTitle
- the title text of the notificationnotifDescription
- 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 notificationnotifTitle
- the title text of the notificationnotifDescription
- the descriptive text of the notificationnotifDisplayTimeMillis
- 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 notificationnotifTitle
- the title text of the notificationnotifDescription
- the descriptive text of the notificationnotifWidth
- the width of the notification display areanotifHeight
- the height of the notification display area, inferred if below zero
-
-
Method Details
-
setLevel
Updates the level of this notification.- Parameters:
notifLvl
- the level to set the notification to
-
getLevel
- Returns:
- the level of this notification
-
setTitle
Updates the title of this notification.- Parameters:
notifTitle
- the title to set the notification to
-
getTitle
Gets the title of this notification.- Returns:
- the title of this notification
-
setDescription
Updates the description of this notification.- Parameters:
notifDescription
- the description to set the notification to
-
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
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
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
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
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
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
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
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
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
-