Package net.i2p.util
Class UIMessages
java.lang.Object
net.i2p.util.UIMessages
A queue of messages, where each has an ID number.
Provide the ID back to the clear call, so you don't
erase messages you haven't seen yet.
Thread-safe.
- Since:
- 0.9.33 adapted from SnarkManager
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
addMessage
(String message) Will remove an old message if over the max size.int
addMessageNoEscape
(String message) Use if it includes a link.void
clear()
clear allvoid
clearThrough
(int id) clear all up to and including this idint
The ID of the last message added, or -1 if never.Newest last, or empty list.Newest last, or empty list.boolean
isEmpty()
-
Constructor Details
-
UIMessages
public UIMessages(int maxSize) - Parameters:
maxSize
-
-
-
Method Details
-
addMessage
Will remove an old message if over the max size. Use if it does not include a link. Escapes '<' and '>' before queueing- Returns:
- the message id
-
addMessageNoEscape
Use if it includes a link. Does not escape '<' and '>' before queueing- Returns:
- the message id
-
getLastMessageID
public int getLastMessageID()The ID of the last message added, or -1 if never. -
getMessages
Newest last, or empty list. Provide id of last one back to clearThrough().- Returns:
- a copy
-
getMessageStrings
Newest last, or empty list.- Returns:
- a copy
- Since:
- 0.9.46
-
clear
public void clear()clear all -
clearThrough
public void clearThrough(int id) clear all up to and including this id -
isEmpty
public boolean isEmpty()- Since:
- 0.9.46
-