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.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `UIMessages.Message` Represents a single UI message with a unique identifier.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UIMessages(int maxSize)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `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 all
    `void` | `clearThrough(int id)` clear all up to and including this id
    `int` | `getLastMessageID()` 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.
    `boolean` | `isEmpty()` Check if there are any messages.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### UIMessages

          public UIMessages(int maxSize)

      Parameters:
        `maxSize` - the maximum number of messages to keep

  - ### 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

    - #### clear

          public void clear()

      clear all

    - #### clearThrough

          public void clearThrough(int id)

      clear all up to and including this 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 (cached)

    - #### isEmpty

          public boolean isEmpty()

      Check if there are any messages.