View Javadoc

1   /*
2    * @(#) SortingObjectTableModel.java Apr 15, 2004
3    * 
4    * Copyright (c) 2003 Delft University of Technology Jaffalaan 5, 2628 BX Delft,
5    * the Netherlands All rights reserved.
6    * 
7    * This software is proprietary information of Delft University of Technology
8    * The code is published under the General Public License
9    */
10  package nl.tudelft.simulation.introspection.gui;
11  
12  import javax.swing.table.TableModel;
13  
14  import nl.tudelft.simulation.introspection.Introspector;
15  import nl.tudelft.simulation.introspection.Property;
16  import nl.tudelft.simulation.introspection.sortable.SortingTableModel;
17  
18  /***
19   * The sortingObjectTableModel. Can act as a delegate for an instance of {see
20   * nl.tudelft.simulation.introspection.gui.IntrospectingTableModelInterface}.
21   * <p>
22   * (c) copyright 2003-2004 <a href="http://www.simulation.tudelft.nl">Delft
23   * University of Technology </a>, the Netherlands. <br>
24   * See for project information <a
25   * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
26   * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
27   * License (GPL) </a>, no warranty <br>
28   * 
29   * @author <a
30   *         href="http://web.eur.nl/fbk/dep/dep1/Introduction/Staff/People/Lang">Niels
31   *         Lang </a><a
32   *         href="http://www.tbm.tudelft.nl/webstaf/peterja/index.htm">Peter
33   *         Jacobs </a>
34   * @version 1.1 Apr 15, 2004
35   * @since 1.4
36   */
37  public class SortingObjectTableModel extends SortingTableModel implements
38  		IntrospectingTableModelInterface
39  {
40  	/***
41  	 * constructs a new SortingObjectTableModel
42  	 * 
43  	 * @param source the source of this tableModel
44  	 */
45  	public SortingObjectTableModel(final TableModel source)
46  	{
47  		super(source);
48  	}
49  
50  	/***
51  	 * @see nl.tudelft.simulation.introspection.gui.IntrospectingTableModelInterface
52  	 *      #getIntrospector()
53  	 */
54  	public Introspector getIntrospector()
55  	{
56  		if (!(this.source instanceof IntrospectingTableModelInterface))
57  		{
58  			return null;
59  		}
60  		return ((IntrospectingTableModelInterface) this.source)
61  				.getIntrospector();
62  	}
63  
64  	/***
65  	 * @see nl.tudelft.simulation.introspection.gui.
66  	 *      IntrospectingTableModelInterface#getProperty(java.lang.String)
67  	 */
68  	public Property getProperty(final String propertyName)
69  	{
70  		if (!(this.source instanceof IntrospectingTableModelInterface))
71  		{
72  			return null;
73  		}
74  		return ((IntrospectingTableModelInterface) this.source)
75  				.getProperty(propertyName);
76  	}
77  
78  	/***
79  	 * @see nl.tudelft.simulation.introspection.gui.IntrospectingTableModelInterface
80  	 *      #getTypeAt(int,int)
81  	 */
82  	public Class getTypeAt(final int rowIndex, final int columnIndex)
83  	{
84  		if (!(this.source instanceof IntrospectingTableModelInterface))
85  		{
86  			return null;
87  		}
88  		return ((IntrospectingTableModelInterface) this.source).getTypeAt(
89  				this.expandedIndex[rowIndex].intValue(), columnIndex);
90  	}
91  
92  	/***
93  	 * @see nl.tudelft.simulation.introspection.gui.IntrospectingTableModelInterface
94  	 *      #getModelManager()
95  	 */
96  	public ModelManager getModelManager()
97  	{
98  		if (!(this.source instanceof IntrospectingTableModelInterface))
99  		{
100 			return null;
101 		}
102 		return ((IntrospectingTableModelInterface) this.source)
103 				.getModelManager();
104 	}
105 }