01: package com.xoetrope.xbb.appmgr;
02:
03: import javax.swing.SwingUtilities;
04: import net.xoetrope.swing.XList;
05: import net.xoetrope.xui.XPage;
06:
07: /**
08: * A class for managing log information
09: * <p> Copyright (c) Xoetrope Ltd., 2001-2007, This software is licensed under
10: * the GNU Public License (GPL), please see license.txt for more details. If
11: * you make commercial use of this software you must purchase a commercial
12: * license from Xoetrope.</p>
13: * @author luano
14: */
15: public class Logger extends XPage {
16: private XList messageList;
17:
18: /** Creates a new instance of Logger */
19: public Logger() {
20: }
21:
22: public void pageCreated() {
23: messageList = (XList) findComponent("messageList");
24: rootModel.set("Logger", this );
25: }
26:
27: public void addMessage(String msg) {
28: final String newMessage = msg;
29: // This isn't very efficient'
30: SwingUtilities.invokeLater(new Runnable() {
31: public void run() {
32: messageList.addItem(newMessage);
33: messageList.select(newMessage);
34: }
35: });
36: }
37: }
|