public abstract class TableModel
extends javax.swing.table.AbstractTableModel
implements javax.swing.event.TableModelListener
Modifier and Type | Field and Description |
---|---|
protected java.util.Vector<java.lang.String> |
columnTitles
The column titles
|
protected java.lang.Object |
latestChangedValue
The old value of the last changed table cell
|
protected javax.swing.JTable |
myJTable |
protected DataModel |
parentDataModel
The parent ChartDataModel this ChartTableModel is part of.
|
protected TableModelDataVector |
tableModelDataVector
The table data
|
Constructor and Description |
---|
TableModel() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addEmptyRow(javax.swing.JTable jTable)
Adds a new empty row to the table model.
|
abstract void |
addSeries(DataSeries newSeries)
Add a data series to the table model
|
abstract void |
exchangeSeries(int seriesIndex,
DataSeries newSeries)
Exchanges the specified data series with a new data series.
|
int |
getColumnCount() |
java.lang.String |
getColumnName(int column) |
protected java.util.Vector<java.lang.Integer> |
getColumnWidths()
Creates a vector containing the current width of all table columns
|
java.util.HashSet<java.lang.Number> |
getKeyHashSetFromDataSeries(DataSeries dataSeries)
Returns a hash set that contains the keys of a DataSeries .
|
java.lang.Object |
getLatestChangedValue()
Gets the latest changed value.
|
java.util.Vector<java.lang.Number> |
getRow(int rowIndex)
Returns the row specified by the index
|
int |
getRowCount() |
int |
getRowIndexByKey(java.lang.Number key)
Returns the index of the row with the given key / x value, or -1 if the
time stamp does not exist in the table.
|
java.util.Vector<java.util.Vector<java.lang.Object>> |
getTableDataAsObjectVector(boolean addHeaders)
Converts the table data to a Vector of Object Vectors
|
java.util.Vector<java.util.Vector<java.lang.Object>> |
getTableDataAsObjectVector(boolean addHeaders,
boolean isTimeSeriesData)
Converts the table data to a Vector of Object Vectors
|
TableModelDataVector |
getTableModelDataVector()
Gets the table model data vector.
|
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex) |
java.lang.Float |
getValueByKey(int seriesIndex,
java.lang.Number key)
Gets the value with the specified key / x value from the series with the specified index
|
abstract void |
initilizeTabelModel()
Initialises the local table model and (re)sets the local values
for
columnTitles and tableModelDataVector , . |
boolean |
isEmptyTableModelRow(int rowIndex)
Checks if a row, given by it's index is empty.
|
boolean |
isEmptyTableModelRow(java.util.Vector<java.lang.Number> rowVector)
Checks if a given row is empty.
|
abstract void |
rebuildTableModel()
Rebuilds the current table model.
|
void |
removeEmptyRows()
Removes empty rows from the table model.
|
abstract void |
removeRow(javax.swing.JTable jTable)
Removes the row.
|
void |
removeRowByKey(java.lang.Number key)
Remove the table row with the given key / x value.
|
abstract void |
removeSeries(int seriesIndex)
Removes the data series from table model.
|
protected void |
setColumnWidths(java.util.Vector<java.lang.Integer> columnWidths)
Sets the width of the table columns according to the integer array
|
void |
setLatestChangedValue(java.lang.Object latestChangedValue)
Sets the latest changed value.
|
abstract void |
setSeriesLabel(int seriesIndex,
java.lang.String label)
Sets the label for the table column containing the data series with the given index.
|
void |
setValueAt(java.lang.Object aValue,
int rowIndex,
int columnIndex) |
void |
setXColumnLabel(java.lang.String label)
Sets the label for the first table column containing the keys / x values
|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener
protected javax.swing.JTable myJTable
protected java.util.Vector<java.lang.String> columnTitles
protected TableModelDataVector tableModelDataVector
protected java.lang.Object latestChangedValue
protected DataModel parentDataModel
public abstract void initilizeTabelModel()
columnTitles
and tableModelDataVector
, .public abstract void rebuildTableModel()
public TableModelDataVector getTableModelDataVector()
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
public int getRowCount()
getRowCount
in interface javax.swing.table.TableModel
public java.util.Vector<java.lang.Number> getRow(int rowIndex)
public java.lang.Object getValueAt(int rowIndex, int columnIndex)
getValueAt
in interface javax.swing.table.TableModel
public void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
setValueAt
in interface javax.swing.table.TableModel
setValueAt
in class javax.swing.table.AbstractTableModel
public java.lang.String getColumnName(int column)
getColumnName
in interface javax.swing.table.TableModel
getColumnName
in class javax.swing.table.AbstractTableModel
public abstract void setSeriesLabel(int seriesIndex, java.lang.String label) throws NoSuchSeriesException
seriesIndex
- The series indexlabel
- The labelNoSuchSeriesException
- Thrown if there is no series with this indexpublic void setXColumnLabel(java.lang.String label)
label
- The labelpublic java.lang.Object getLatestChangedValue()
public void setLatestChangedValue(java.lang.Object latestChangedValue)
latestChangedValue
- the latestChangedValue to setpublic abstract void addEmptyRow(javax.swing.JTable jTable)
jTable
- the current JTablepublic abstract void removeRow(javax.swing.JTable jTable)
jTable
- the j tablepublic abstract void addSeries(DataSeries newSeries)
newSeries
- public abstract void removeSeries(int seriesIndex) throws NoSuchSeriesException
seriesIndex
- the series indexNoSuchSeriesException
- the no such series exceptionpublic abstract void exchangeSeries(int seriesIndex, DataSeries newSeries) throws NoSuchSeriesException
seriesIndex
- the series indexnewSeries
- the new seriesNoSuchSeriesException
public int getRowIndexByKey(java.lang.Number key)
key
- the keypublic java.lang.Float getValueByKey(int seriesIndex, java.lang.Number key) throws NoSuchSeriesException
seriesIndex
- The index of the series to get the value fromkey
- The key / x value of the desired valueNoSuchSeriesException
- Will be thrown if there is no series with the specified indexpublic void removeRowByKey(java.lang.Number key)
key
- The key / x valuepublic boolean isEmptyTableModelRow(int rowIndex)
rowIndex
- the row indexpublic boolean isEmptyTableModelRow(java.util.Vector<java.lang.Number> rowVector)
rowVector
- the row vectorpublic void removeEmptyRows()
public java.util.HashSet<java.lang.Number> getKeyHashSetFromDataSeries(DataSeries dataSeries)
dataSeries
- the data seriespublic java.util.Vector<java.util.Vector<java.lang.Object>> getTableDataAsObjectVector(boolean addHeaders)
addHeaders
- If true, an additional vector containing the column headers will be addedpublic java.util.Vector<java.util.Vector<java.lang.Object>> getTableDataAsObjectVector(boolean addHeaders, boolean isTimeSeriesData)
addHeaders
- If true, an additional vector containing the column headers will be addedisTimeSeriesData
- If true, the first column is interpreted as timestamps and converted to a time formatprotected java.util.Vector<java.lang.Integer> getColumnWidths()
protected void setColumnWidths(java.util.Vector<java.lang.Integer> columnWidths)
columnWidths
- Array containing the widths to set