KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > adwt > TestTreePanel


1 /*
2  * EJTools, the Enterprise Java Tools
3  *
4  * Distributable under LGPL license.
5  * See terms of license at www.gnu.org.
6  */

7 package test.adwt;
8
9 import java.awt.event.WindowAdapter JavaDoc;
10 import java.awt.event.WindowEvent JavaDoc;
11 import java.net.URL JavaDoc;
12
13 import org.ejtools.adwt.BeanContextTreePanel;
14 import org.ejtools.adwt.service.AboutServiceProvider;
15 import org.ejtools.adwt.service.HistoryService;
16 import org.ejtools.adwt.service.HistoryServiceProvider;
17 import org.ejtools.adwt.service.SDIFrameServiceProvider;
18 import org.ejtools.beans.beancontext.CustomBeanContextServicesSupport;
19
20 /**
21  * Description of the Class
22  *
23  * @author Laurent Etiemble
24  * @version $Revision: 1.2 $
25  */

26 public class TestTreePanel extends CustomBeanContextServicesSupport
27 {
28    /** Constructor for the TestTree object */
29    public TestTreePanel()
30    {
31       SDIFrameServiceProvider frameService = new SDIFrameServiceProvider();
32       HistoryServiceProvider historyProvider = new HistoryServiceProvider(
33          new HistoryService.Holder()
34          {
35             public void loadResource(URL JavaDoc url, Object JavaDoc context)
36             {
37             }
38          }, 4);
39       AboutServiceProvider aboutProvider = new AboutServiceProvider();
40
41       // Add a window hook
42
frameService.addWindowListener(
43          new WindowAdapter JavaDoc()
44          {
45             public void windowClosing(WindowEvent JavaDoc e)
46             {
47                super.windowClosing(e);
48                System.exit(0);
49             }
50          });
51
52       BeanContextTreePanel panel = new BeanContextTreePanel(this);
53       frameService.setContent(panel);
54
55       this.add(frameService);
56       this.add(aboutProvider);
57       this.add(historyProvider);
58    }
59
60
61    /**
62     * The main program for the TestTree class
63     *
64     * @param args The command line arguments
65     * @exception Exception Description of the Exception
66     */

67    public static void main(String JavaDoc[] args)
68       throws Exception JavaDoc
69    {
70       final TestTreePanel test = new TestTreePanel();
71
72       Thread JavaDoc t =
73          new Thread JavaDoc()
74          {
75             public void run()
76             {
77                try
78                {
79                   for (int i = 0; i < 10; i++)
80                   {
81                      Thread.sleep(1000);
82                      test.add(new AboutServiceProvider());
83                   }
84                }
85                catch (Exception JavaDoc e)
86                {
87                }
88             }
89          };
90       t.start();
91    }
92 }
93
Popular Tags