java.lang.Object
io.github.palexdev.materialfx.controls.MFXSimpleNotification
- All Implemented Interfaces:
INotification
Simple implementation of
INotification.
By default the INotification.getTimeToStringConverter() function is set to use StringUtils.timeToHumanReadable(long).
By default the INotification.setOnUpdateElapsed(BiConsumer) function is set to do nothing.
Offers a Builder to build a notification with fluent design.-
Property Summary
PropertiesTypePropertyDescriptionSpecifies the notification's read state. -
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonggetState()longgetTime()Specifies the notification's read state.protected voidsetContent(Region content) voidSets the value of the property notificationState.voidsetOnUpdateElapsed(BiConsumer<Long, String> elapsedConsumer) This action is automatically called byINotification.updateElapsed(), use this to inform "someone" that the elapsed time should be updated.voidsetTimeToStringConverter(Function<Long, String> converter) Sets the function used to convert a time in seconds to String.voidShould be called by a periodic task to inform "someone" that the elapsed time should be updated
-
Property Details
-
notificationState
- Specified by:
notificationStatePropertyin interfaceINotification- See Also:
-
-
Constructor Details
-
MFXSimpleNotification
protected MFXSimpleNotification() -
MFXSimpleNotification
-
-
Method Details
-
getContent
- Specified by:
getContentin interfaceINotification- Returns:
- the notification's content
-
setContent
-
getState
- Specified by:
getStatein interfaceINotification
-
notificationStateProperty
Description copied from interface:INotificationSpecifies the notification's read state.- Specified by:
notificationStatePropertyin interfaceINotification- See Also:
-
setNotificationState
Sets the value of the property notificationState.- Specified by:
setNotificationStatein interfaceINotification- Property description:
-
getTime
public long getTime()- Specified by:
getTimein interfaceINotification- Returns:
- the created time as a long value, the number of seconds from the Java epoch
-
getElapsedTime
public long getElapsedTime()- Specified by:
getElapsedTimein interfaceINotification- Returns:
- the difference between the current number of seconds from the Java epoch and the created time
-
getTimeToStringConverter
- Specified by:
getTimeToStringConverterin interfaceINotification- Returns:
- the function used to convert a time in seconds to String
-
setTimeToStringConverter
Description copied from interface:INotificationSets the function used to convert a time in seconds to String.- Specified by:
setTimeToStringConverterin interfaceINotification
-
updateElapsed
public void updateElapsed()Description copied from interface:INotificationShould be called by a periodic task to inform "someone" that the elapsed time should be updated- Specified by:
updateElapsedin interfaceINotification
-
setOnUpdateElapsed
Description copied from interface:INotificationThis action is automatically called byINotification.updateElapsed(), use this to inform "someone" that the elapsed time should be updated. The action is aBiConsumerand the inputs are the elapsed seconds as a long value and the elapsed seconds converted to a String by using theINotification.getTimeToStringConverter().- Specified by:
setOnUpdateElapsedin interfaceINotification
-