|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.table.AbstractTableModel com.jstatcom.ts.TSTableModel
public final class TSTableModel
A table model to be used with the TSTable
component for
representing merged time series data. The model takes an array of time series
with possibly different time ranges but equal sub periodicities and merges
the series to a common time range, which includes all ranges.
Constructor Summary | |
---|---|
TSTableModel()
TSTableModel default constructor. |
Method Summary | |
---|---|
int[] |
findRowIndexOf(java.lang.Double val,
int startIndex)
Finds the index of the row, where the given Double value
appears first, starting from a given row index. |
java.lang.Class<java.lang.String> |
getColumnClass(int col)
Gets column class. |
int |
getColumnCount()
Gets number of displayed TS . |
java.lang.String |
getColumnName(int col)
Gets the name of the TS displayed in a certain column. |
double |
getDoubleValueAt(int row,
int col)
Gets underlying observation for a given row and column as a double value. |
int |
getRowCount()
Gets number of displayed observations in time range of all TS . |
javax.swing.JViewport |
getRowHeader(javax.swing.JTable table)
Gets a JViewport that can be used as row header for a
scrollpane. |
TSDate |
getStartTSDate()
Gets the TSDate where the very first observation in the
model occurs. |
java.lang.Object |
getValueAt(int row,
int col)
Gets underlying observation for a given row and column. |
boolean |
isCellEditable(int row,
int col)
Gets whether given cell can be edited. |
void |
setTS(TS[] tsArray)
Sets the TS to be held by the model. |
void |
setValueAt(java.lang.Object obj,
int row,
int col)
Sets data at a given position and displays an error message if input cannot be parsed to a double. |
Methods inherited from class javax.swing.table.AbstractTableModel |
---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TSTableModel()
TSTableModel
default constructor.
Method Detail |
---|
public int[] findRowIndexOf(java.lang.Double val, int startIndex)
Double
value
appears first, starting from a given row index. It also gives back the
row with the closest match for val
. In case of an exact
match, both values are the same. In case of no exact match, the first
value is -1
and the second the index of the row containing
the value that is closest to val
.
val
- the value to search forstartIndex
- index to start from, if out of range start from 0
int[0]
row index of 1st exact match or
-1
if no exact match or if
val == null
int[1]
row index of closest match or
-1
if val == null
java.lang.IllegalStateException
- if (getRowCount() == 0)
public java.lang.Class<java.lang.String> getColumnClass(int col)
String.class
,
to make sure that the string editor is choosen.
getColumnClass
in interface javax.swing.table.TableModel
getColumnClass
in class javax.swing.table.AbstractTableModel
col
- does not matter
public int getColumnCount()
TS
.
public java.lang.String getColumnName(int col)
TS
displayed in a certain column.
getColumnName
in interface javax.swing.table.TableModel
getColumnName
in class javax.swing.table.AbstractTableModel
col
- column index
public double getDoubleValueAt(int row, int col)
double
value.
public int getRowCount()
TS
.
public javax.swing.JViewport getRowHeader(javax.swing.JTable table)
JViewport
that can be used as row header for a
scrollpane. This contains the time axis that can be shown with the table
together with an index for the current row. Use the method with the
JScrollPane
that encloses a TSTable
using
this model.
table
- the JTable to synchronize selection with
JScrollPane
public TSDate getStartTSDate()
TSDate
where the very first observation in the
model occurs.
public java.lang.Object getValueAt(int row, int col)
row
- index for rowcol
- index for column
public boolean isCellEditable(int row, int col)
editable
property.
isCellEditable
in interface javax.swing.table.TableModel
isCellEditable
in class javax.swing.table.AbstractTableModel
row
- index for rowcol
- index for column
public void setTS(TS[] tsArray)
TS
to be held by the model. It merges the series
and creates the data and names arrays.
tsArray
- an array of TS
objects with the same sub
periodicitypublic void setValueAt(java.lang.Object obj, int row, int col)
setValueAt
in interface javax.swing.table.TableModel
setValueAt
in class javax.swing.table.AbstractTableModel
obj
- Object that the method tries to parse to a Double
row
- index for rowcol
- index for column
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |