|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.table.AbstractTableModel
stella.jview.SensorTableModel
public class SensorTableModel
A class that represents a table model for sensor data events. The data
events received are stored in a hidden data map, which is queried from
the getValueAt(int, int) method. As sensor tables should be small, there
are always only four columns active, the sensor name, the current value,
the minimum and the maximum value in the sampling period.
The active set can be changed
with a call to setActiveSource(int). To allow color-coding of the
sensor readings (i.e. to define clear/bad sensors), the state of the
sensor can be queried with getSensorState(int).
The table also implements the RmiDataCollecting interface to
allow updates of the sensor readings from the outside.
| Field Summary | |
|---|---|
private long |
average
The sampling interval of the table. |
private List |
columns
The list of parameters. |
private Object[][] |
data
The displayable data, a rowxcolumns array. |
private static int |
EXPORTPORT
The port where we want to export ourself. |
private List |
rows
The list of sensor names. |
private int |
source
The index of the first data column that is active. |
private int[] |
state
The current state of the sensor. |
private String[] |
units
The unit strings, filled on sensor data delivery. |
| Fields inherited from class javax.swing.table.AbstractTableModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
SensorTableModel(List sensors,
List values)
Constructs a new table model. |
|
| Method Summary | |
|---|---|
int |
getActiveSource()
Returns the active source. |
Class |
getColumnClass(int col)
Returns the class object of the given column. |
int |
getColumnCount()
Returns the number of columns to display. |
String |
getColumnName(int col)
Returns the name of the sensor if column equal zero, otherwise the column label with offset source. |
int |
getRowCount()
Returns the number of currently available targets. |
int |
getSensorState(int row)
Returns the state of the sensor. |
Object |
getValueAt(int row,
int col)
Returns the value to display on the given row number. |
void |
init()
Init simply assigns the data array. |
long |
rmiGetInterval()
Returns the previously set sampling period. |
void |
rmiProcessData(Map readings,
boolean weather)
This method is called after the stella.sensor.ShortAverageRepository collected
some data. |
void |
setActiveSource(int src)
Sets the refresh interval. |
void |
setPeriod(long sample)
Sets the averaging period of this table. |
void |
setValueAt(Object val,
int row,
int col)
Sets the table value at the given index. |
void |
update(Map values)
This method is called by the repository if the table's data should be updated. |
| Methods inherited from class javax.swing.table.AbstractTableModel |
|---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private List columns
private List rows
private Object[][] data
private String[] units
private int[] state
private long average
private int source
private static final int EXPORTPORT
| Constructor Detail |
|---|
public SensorTableModel(List sensors,
List values)
throws RemoteException
RemoteException| Method Detail |
|---|
public void init()
init in interface Initializablepublic int getColumnCount()
getColumnCount in interface TableModelpublic int getRowCount()
update(java.util.Map).
getRowCount in interface TableModelpublic String getColumnName(int col)
source.
getColumnName in interface TableModelgetColumnName in class AbstractTableModelpublic Class getColumnClass(int col)
getColumnClass in interface TableModelgetColumnClass in class AbstractTableModel
public Object getValueAt(int row,
int col)
getValueAt in interface TableModel
public void setValueAt(Object val,
int row,
int col)
rmiProcessData(java.util.Map, boolean). This method also fires a
AbstractTableModel.fireTableDataChanged().
setValueAt in interface TableModelsetValueAt in class AbstractTableModelpublic int getActiveSource()
public void setActiveSource(int src)
public int getSensorState(int row)
public void setPeriod(long sample)
RmiDataCollecting.
public long rmiGetInterval()
throws RemoteException
rmiGetInterval in interface RmiDataCollectingRemoteException
public void rmiProcessData(Map readings,
boolean weather)
throws RemoteException
RmiDataCollectingstella.sensor.ShortAverageRepository collected
some data. In the argument, all sensors that have at least once in the
liftime of the repository delivered data are mapped against the
average DataEvent
of all data events sent during the
averaging period. Note that it is in principle possible that the
sensor mapped has not produced a single data event in the last
averaging period and therfore is mapped to null.
This version is the remote counterpart to
DataCollecting. It should be used with data
collectors that reside in a different VM than the repository
rmiProcessData in interface RmiDataCollectingRemoteExceptionpublic void update(Map values)
AbstractTableModel.fireTableDataChanged().
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||