- java.lang.Object
-
- com.gluonhq.charm.glisten.control.Message
-
public abstract class Message extends Object
Message provide lightweight feedback about an operation. They are displayed at the bottom of the screen and disappear automatically. Developers are advised to use a duration of eitherLENGTH_SHORT
orLENGTH_LONG
which corresponds to 2 and 3.5 seconds respectively.There are two types of Message:
-
-
Property Summary
Properties Type Property Description ObjectProperty<Duration>
duration
The time the Message is shown.StringProperty
id
The id of thisMessage
.StringProperty
message
The message to display.
-
Field Summary
Fields Modifier and Type Field Description static Duration
LENGTH_LONG
A long amount of time to display the message - 3500 ms.static Duration
LENGTH_SHORT
A short amount of time to display the message - 2000 ms.
-
Constructor Summary
Constructors Constructor Description Message()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
cancel()
If the Message is currently showing, calling this method will hide it immediately and show the next Message in queue.ObjectProperty<Duration>
durationProperty()
The time the Message is shown.Duration
getDuration()
Gets the value of the property duration.String
getId()
Gets the value of the property id.String
getMessage()
Gets the value of the property message.StringProperty
idProperty()
The id of thisMessage
.StringProperty
messageProperty()
The message to display.void
setDuration(Duration duration)
Sets the value of the property duration.void
setId(String id)
Sets the value of the property id.void
setMessage(String text)
Sets the value of the property message.abstract void
show()
Shows the Message immediately, if no other message is showing.
-
-
-
Property Detail
-
message
public final StringProperty messageProperty
The message to display.- See Also:
getMessage()
,setMessage(String)
-
duration
public final ObjectProperty<Duration> durationProperty
The time the Message is shown.- See Also:
getDuration()
,setDuration(Duration)
-
id
public final StringProperty idProperty
The id of thisMessage
. This simple string identifier is useful for finding a specific Message within the scene graph. While the id of a notification should be unique within the scene graph, this uniqueness is not enforced. This is analogous to the "id" attribute on an HTML element (CSS ID Specification).For example, if a notification is given the id of "myId", then the lookup method can be used to find this notification as follows:
scene.lookup("#myId");
.- Default value:
- null
- See Also:
getId()
,setId(String)
-
-
Method Detail
-
setMessage
public final void setMessage(String text)
Sets the value of the property message.- Property description:
- The message to display.
-
getMessage
public final String getMessage()
Gets the value of the property message.- Property description:
- The message to display.
-
messageProperty
public final StringProperty messageProperty()
The message to display.- See Also:
getMessage()
,setMessage(String)
-
setDuration
public final void setDuration(Duration duration)
Sets the value of the property duration.- Property description:
- The time the Message is shown.
-
getDuration
public final Duration getDuration()
Gets the value of the property duration.- Property description:
- The time the Message is shown.
-
durationProperty
public final ObjectProperty<Duration> durationProperty()
The time the Message is shown.- See Also:
getDuration()
,setDuration(Duration)
-
idProperty
public final StringProperty idProperty()
The id of thisMessage
. This simple string identifier is useful for finding a specific Message within the scene graph. While the id of a notification should be unique within the scene graph, this uniqueness is not enforced. This is analogous to the "id" attribute on an HTML element (CSS ID Specification).For example, if a notification is given the id of "myId", then the lookup method can be used to find this notification as follows:
scene.lookup("#myId");
.- Default value:
- null
- See Also:
getId()
,setId(String)
-
setId
public final void setId(String id)
Sets the value of the property id.- Property description:
- The id of this
Message
. This simple string identifier is useful for finding a specific Message within the scene graph. While the id of a notification should be unique within the scene graph, this uniqueness is not enforced. This is analogous to the "id" attribute on an HTML element (CSS ID Specification).For example, if a notification is given the id of "myId", then the lookup method can be used to find this notification as follows:
scene.lookup("#myId");
. - Default value:
- null
-
getId
public final String getId()
Gets the value of the property id.- Property description:
- The id of this
Message
. This simple string identifier is useful for finding a specific Message within the scene graph. While the id of a notification should be unique within the scene graph, this uniqueness is not enforced. This is analogous to the "id" attribute on an HTML element (CSS ID Specification).For example, if a notification is given the id of "myId", then the lookup method can be used to find this notification as follows:
scene.lookup("#myId");
. - Default value:
- null
-
show
public abstract void show()
Shows the Message immediately, if no other message is showing. If a message is already showing, it gets added to the waiting queue and will show when its turn arrives.
-
cancel
public abstract void cancel()
If the Message is currently showing, calling this method will hide it immediately and show the next Message in queue. If the Message is waiting in the queue, calling this method removes the Message from the queue and the Message is never shown.
-
-