Beispiel #1
0
        public void messagesAdded(MessageCountEvent e) {
          try {
            // I don't think it matters where we put the new messages, but for the sanity of users
            // who don't sort, and because it's the cheapest option, we'll bung them at the end.
            Message[] newMessages = e.getMessages();

            // Work out where the new items will appear.
            final int firstNewRow = messages.size();
            final int lastNewRow = firstNewRow + newMessages.length - 1;

            // Actually insert the new items, and notify the listeners.
            messages.addAll(Arrays.asList(newMessages));
            fireTableRowsInserted(firstNewRow, lastNewRow);
          } catch (Exception ex) {
            ex.printStackTrace();
          }
        }
Beispiel #2
0
 public void messagesRemoved(MessageCountEvent e) {
   // We'll have removed messages from the table before we remove them from the server.
   // If another client is accessing the mailbox concurrently, though, messages might
   // disappear under us.
   removeMessages(e.getMessages());
 }