View Javadoc

1   /*
2    * @(#) ContextTreeModel.java Oct 26, 2003
3    * 
4    * Copyright (c) 2003 Delft University of Technology Jaffalaan 5, 2628 BX Delft,
5    * the Netherlands
6    * 
7    * All rights reserved. This software is proprietary information of Delft
8    * University of Technology The code is published under the General Public
9    * License
10   */
11  package nl.tudelft.simulation.naming.context;
12  
13  import javax.naming.NamingException;
14  import javax.naming.event.EventContext;
15  import javax.swing.tree.DefaultTreeModel;
16  
17  /***
18   * The ContextTreeModel defines the inner structure of the context.
19   * <p>
20   * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
21   * University of Technology </a>, the Netherlands. <br>
22   * See for project information <a href="http://www.simulation.tudelft.nl">
23   * www.simulation.tudelft.nl </a> <br>
24   * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
25   * License (GPL) </a>, no warranty <br>
26   * 
27   * @author <a href="http://www.simulation.tudelft.nl/people/jacobs.html">Peter
28   *         Jacobs </a>
29   * @version 1.2 2004-03-24
30   * @since 1.0
31   */
32  public class ContextTreeModel extends DefaultTreeModel
33  {
34  	/***
35  	 * constructs a new ContextTreeModel
36  	 * 
37  	 * @param context the context
38  	 * @throws NamingException on failure
39  	 */
40  	public ContextTreeModel(final EventContext context) throws NamingException
41  	{
42  		this(context, null, true);
43  	}
44  
45  	/***
46  	 * constructs a new ContextTreeModel
47  	 * 
48  	 * @param context the context
49  	 * @param displayClasses the set of classes to display as children
50  	 * @param displayFields should we display them?
51  	 * @throws NamingException on failure
52  	 */
53  	public ContextTreeModel(final EventContext context,
54  			final Class[] displayClasses, final boolean displayFields)
55  			throws NamingException
56  	{
57  		super(null);
58  		this.setRoot(new ContextNode(this, "/", context, displayClasses,
59  				displayFields));
60  	}
61  
62  	/***
63  	 * @see javax.swing.tree.DefaultTreeModel#fireTreeStructureChanged(
64  	 *      java.lang.Object, java.lang.Object[], int[], java.lang.Object[])
65  	 */
66  	protected void fireTreeStructureChanged(final Object arg0,
67  			final Object[] arg1, final int[] arg2, final Object[] arg3)
68  	{
69  		super.fireTreeStructureChanged(arg0, arg1, arg2, arg3);
70  	}
71  
72  }