View Javadoc

1   /*
2    * @(#) StatisticsObject.java Sep 21, 2003
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.jstats.statistics;
11  
12  import java.awt.Container;
13  import java.rmi.RemoteException;
14  
15  import javax.swing.JScrollPane;
16  import javax.swing.JTable;
17  import javax.swing.table.TableModel;
18  
19  import nl.tudelft.simulation.event.EventProducer;
20  import nl.tudelft.simulation.jstats.Swingable;
21  
22  /***
23   * The StatisticsObject class defines a statistics object. This abstract class
24   * is used to create general table representations for the Counter, the Tally
25   * and the Persistent.
26   * <p>
27   * (c) copyright 2003-2004 <a href="http://www.simulation.tudelft.nl">Delft
28   * University of Technology </a>, the Netherlands. <br>
29   * See for project information <a
30   * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
31   * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
32   * License (GPL) </a>, no warranty <br>
33   * 
34   * @author <a href="http://www.simulation.tudelft.nl/people/jacobs.html">Peter
35   *         Jacobs </a>
36   * @version 1.7, 2004-03-18
37   * @since 1.2
38   */
39  public abstract class StatisticsObject extends EventProducer implements
40  		Swingable
41  {
42  	/***
43  	 * constructs a new StatisticsObject
44  	 */
45  	public StatisticsObject()
46  	{
47  		super();
48  	}
49  
50  	/***
51  	 * represents the statistics object as Table.
52  	 * 
53  	 * @return TableModel the result
54  	 * @throws RemoteException on network failure
55  	 */
56  	public abstract TableModel getTable() throws RemoteException;
57  
58  	/***
59  	 * represents this statisticsObject as Container.
60  	 * 
61  	 * @return Container the result
62  	 * @throws RemoteException on network failure
63  	 */
64  	public Container getSwingPanel() throws RemoteException
65  	{
66  		JTable table = new JTable(this.getTable());
67  		table.setEnabled(false);
68  		return new JScrollPane(table);
69  	}
70  }