KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > adwt > TestTree


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.BeanContextTree;
14 import org.ejtools.adwt.BeanContextTreeModel;
15 import org.ejtools.adwt.service.AboutServiceProvider;
16 import org.ejtools.adwt.service.HistoryService;
17 import org.ejtools.adwt.service.HistoryServiceProvider;
18 import org.ejtools.adwt.service.SDIFrameServiceProvider;
19 import org.ejtools.beans.beancontext.CustomBeanContextServicesSupport;
20
21 /**
22  * Description of the Class
23  *
24  * @author Laurent Etiemble
25  * @version $Revision: 1.2 $
26  */

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

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