Package net.i2p.util
Class UIMessages
- java.lang.Object
-
- net.i2p.util.UIMessages
-
public class UIMessages extends Object
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
Nested Classes Modifier and Type Class Description static classUIMessages.Message
-
Constructor Summary
Constructors Constructor Description UIMessages(int maxSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddMessage(String message)Will remove an old message if over the max size.intaddMessageNoEscape(String message)Use if it includes a link.voidclear()clear allvoidclearThrough(int id)clear all up to and including this idintgetLastMessageID()The ID of the last message added, or -1 if never.List<UIMessages.Message>getMessages()Newest last, or empty list.List<String>getMessageStrings()Newest last, or empty list.booleanisEmpty()
-
-
-
Method Detail
-
addMessage
public int addMessage(String message)
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
public int addMessageNoEscape(String message)
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
public List<UIMessages.Message> getMessages()
Newest last, or empty list. Provide id of last one back to clearThrough().- Returns:
- a copy
-
getMessageStrings
public List<String> 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
-
-