textBuffer.append("<ul>");
Iterator<MessageInfo> messageIter = mNewMessageMap.get(folderId).iterator();
int counter = 0;
while (messageIter.hasNext()) {
try {
MessageInfo messageInfo = messageIter.next();
String messageUri = "mailopen://" + folderId + "/" + counter++;
textBuffer.append("<li><a href = \"" + messageUri + "\">");
messageMap.put(messageUri, messageInfo);
textBuffer.append("From: " + messageInfo.getMessageProperty("From") + ", Subj: " + messageInfo.getMessageProperty("Subject"));
textBuffer.append("</a></li>");
} catch (Exception e) {
textBuffer.append("<li>Error: " + e.getMessage() + "</li>");
}
}
textBuffer.append("</ul>");
textBuffer.append("</li>");
}
textBuffer.append("</ul>");
} else {
textBuffer.append("No new messages.");
}
textBuffer.append("</body></html>");
final HashMap<String, MessageInfo> fMessageMap = messageMap;
//JTextArea pookaMessage = new JTextArea(createStatusMessage());
JTextPane pookaMessage = new JTextPane();
pookaMessage.setContentType("text/html");
pookaMessage.setText(textBuffer.toString());
messageBox.add(pookaMessage);
final JDialog dialog = new JDialog();
pookaMessage.setEditable(false);
//dialog.add(pookaMessage);
dialog.add(messageBox);
dialog.setUndecorated(true);
dialog.pack();
/*
pookaMessage.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent me) {
dialog.setVisible(false);
dialog.dispose();
messageDisplaying = false;
}
});
*/
closeButton.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
dialog.setVisible(false);
dialog.dispose();
messageDisplaying = false;
}
});
pookaMessage.addHyperlinkListener(new HyperlinkListener() {
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
//System.err.println("hyperlinkEvent: " + e);
java.net.URL url = e.getURL();
//System.err.println("url = " + url);
//System.err.println("description = " + e.getDescription());
if (e.getDescription().startsWith("close")) {
dialog.setVisible(false);
dialog.dispose();
messageDisplaying = false;
} else if (e.getDescription().startsWith("mailopen://")) {
MessageInfo openMessage = fMessageMap.get(e.getDescription());
try {
MessageProxy proxy = openMessage.getMessageProxy();
MessageUI mui = Pooka.getUIFactory().createMessageUI(proxy, new NewMessageFrame(new NewMessageProxy(new net.suberic.pooka.NewMessageInfo(new javax.mail.internet.MimeMessage(Pooka.getDefaultSession())))));
mui.openMessageUI();
// and if that works, remove it from the new message map.
removeFromNewMessages(openMessage);
} catch (Exception ex) {