1
2
3
4
5
6
7
8
9
10 package nl.tudelft.simulation.dsol.gui.windows;
11
12 import java.awt.Dimension;
13
14 import javax.naming.NamingException;
15 import javax.naming.event.EventContext;
16 import javax.swing.JFrame;
17 import javax.swing.JScrollPane;
18 import javax.swing.JTree;
19 import javax.swing.WindowConstants;
20
21 import nl.tudelft.simulation.logger.Logger;
22 import nl.tudelft.simulation.naming.context.ContextTreeModel;
23
24 /***
25 * The ContextFrame <br>
26 * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
27 * University of Technology </a>, the Netherlands. <br>
28 * See for project information <a
29 * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
30 * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
31 * License (GPL) </a>, no warranty <br>
32 *
33 * @version 1.0 18.10.2003 <br>
34 * @author <a href="http://www.simulation.tudelft.nl/people/jacobs.html">Peter
35 * Jacobs </a>
36 */
37 public class ContextFrame extends JFrame
38 {
39 /*** the context */
40 private EventContext context = null;
41
42 /***
43 * constructs a new ContextFrame
44 *
45 * @param context the context to see
46 */
47 public ContextFrame(final EventContext context)
48 {
49 super("ContextUtil: " + context);
50 this.context = context;
51 try
52 {
53 this.initialize();
54 } catch (NamingException namingException)
55 {
56 Logger.warning(this, "ContextFrame", namingException);
57 }
58 this.pack();
59 this.setVisible(true);
60 this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
61 }
62
63 /***
64 * initializes the contextframe
65 *
66 * @throws NamingException on failure
67 */
68 private void initialize() throws NamingException
69 {
70 this.setContentPane(new JScrollPane(new JTree(new ContextTreeModel(
71 this.context, null, true))));
72 ((JScrollPane) this.getContentPane()).setPreferredSize(new Dimension(
73 500, 500));
74 }
75 }