View Javadoc

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