Package frc.alotobots.util
Class Elastic.ElasticNotification
java.lang.Object
frc.alotobots.util.Elastic.ElasticNotification
- Enclosing class:
- Elastic
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Represents the possible levels of notifications for the Elastic dashboard. -
Constructor Summary
ConstructorDescriptionCreates a new ElasticNotification with all default parameters.ElasticNotification
(Elastic.ElasticNotification.NotificationLevel level, String title, String description) Creates a new ElasticNotification with default display time and dimensions.ElasticNotification
(Elastic.ElasticNotification.NotificationLevel level, String title, String description, double width, double height) Creates a new ElasticNotification with specified dimensions and default display time.ElasticNotification
(Elastic.ElasticNotification.NotificationLevel level, String title, String description, int displayTimeMillis) Creates a new ElasticNotification with a specified display time and default dimensions.ElasticNotification
(Elastic.ElasticNotification.NotificationLevel level, String title, String description, int displayTimeMillis, double width, double height) Creates a new ElasticNotification with all properties specified. -
Method Summary
Modifier and TypeMethodDescriptionint
Gets the display time of the notification in millisecondsdouble
Gets the height of the notificationgetLevel()
getTitle()
Gets the title of this notificationdouble
getWidth()
Gets the width of the notificationvoid
setDescription
(String description) Updates the description of this notificationvoid
setDisplayTimeMillis
(int displayTimeMillis) Updates the display time of the notification in millisecondsvoid
setDisplayTimeSeconds
(double seconds) Updates the display time of the notificationvoid
setHeight
(double height) Updates the height of the notificationvoid
Updates the level of this notificationvoid
Updates the title of this notificationvoid
setWidth
(double width) Updates the width of the notificationModifies the notification's height and returns itself to allow for method chainingwithDescription
(String description) Modifies the notification's description and returns itself to allow for method chainingwithDisplayMilliseconds
(int displayTimeMillis) Modifies the notification's display time and returns itself to allow for method chainingwithDisplaySeconds
(double seconds) Modifies the notification's display time and returns itself to allow for method chainingwithHeight
(double height) Modifies the notification's height and returns itself to allow for method chainingModifies the notification's level and returns itself to allow for method chainingModifies the notification to disable the auto dismiss behaviorModifies the notification's title and returns itself to allow for method chainingwithWidth
(double width) Modifies the notification's width and returns itself to allow for method chaining
-
Constructor Details
-
ElasticNotification
public ElasticNotification()Creates a new ElasticNotification with all default parameters. This constructor is intended to be used with the chainable decorator methodsTitle 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 notificationdescription
- the descriptive text of the notificationdisplayTimeMillis
- the time in milliseconds for which the notification is displayedwidth
- the width of the notification display areaheight
- 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 notificationtitle
- the title text of the notificationdescription
- 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 notificationtitle
- the title text of the notificationdescription
- the descriptive text of the notificationdisplayTimeMillis
- 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 notificationtitle
- the title text of the notificationdescription
- the descriptive text of the notificationwidth
- the width of the notification display areaheight
- the height of the notification display area, inferred if below zero
-
-
Method Details
-
setLevel
Updates the level of this notification- Parameters:
level
- the level to set the notification to
-
getLevel
- Returns:
- the level of this notification
-
setTitle
Updates the title of this notification- Parameters:
title
- 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:
description
- the description to set the notification to
-
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 notificationIf 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
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
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
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:
displayTimeMillis
- 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:
width
- 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:
height
- the height to set the notification to- Returns:
- the current notification
-
withAutomaticHeight
Modifies the notification's height and returns itself to allow for method chainingThis 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 behaviorThis 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
-