public class SortedResultSet
extends javax.swing.table.AbstractTableModel
AbstractTableModel
The model required that the ResultSet returns the Instance ID in the first column. If this is not the case, the Model will abort the work and thrown an Exception
Modifier and Type | Class and Description |
---|---|
protected class |
SortedResultSet.Comparator_DT_BOOLEAN |
protected class |
SortedResultSet.Comparator_DT_BYTE |
protected class |
SortedResultSet.Comparator_DT_DATE |
protected class |
SortedResultSet.Comparator_DT_DOUBLE |
protected class |
SortedResultSet.Comparator_DT_ENUM |
protected class |
SortedResultSet.Comparator_DT_FLOAT |
protected class |
SortedResultSet.Comparator_DT_LONG |
protected class |
SortedResultSet.Comparator_DT_LONGLONG |
protected class |
SortedResultSet.Comparator_DT_SHORT |
protected class |
SortedResultSet.Comparator_DT_STRING |
protected class |
SortedResultSet.TableHeaderRenderer
A Custom Tablehead Renderer to set the sorting indicator icon and the color if the column is a relation
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
ascending |
protected int |
attrsnumber |
protected java.lang.String[] |
colNames |
protected NameValueSeqUnitId[] |
colValues
An array where the data is stored from the ResultSet
|
protected ResultSetExt |
elemRes
The Resultset on which this Object's data is based.
|
protected EnumerationDefinition[] |
enumDefs
An array of enumeration definitions
|
protected java.util.HashMap<java.lang.Integer,java.lang.String>[] |
enumMaps |
protected int |
filtercolumn |
protected java.lang.Integer[] |
idx
An index array to keep the index when sorting
|
protected int |
sortedColumn |
Constructor and Description |
---|
SortedResultSet(ApplicationStructure asObj,
ResultSetExt rs)
The standard constructor for this class.
|
Modifier and Type | Method and Description |
---|---|
protected static java.lang.String |
dateToString(java.lang.String date)
method to convert an ODS-conform date String into a more understandable format
|
int |
getColumnCount() |
java.lang.String |
getColumnName(int column) |
DataType |
getDataType(int column)
Returns the datatype of a column in the model.
|
int |
getRowCount() |
ElemId |
getRowElemId(int row)
Returns the ElemId of the instance element in the given row.
|
java.lang.Object |
getValueAt(int row,
int column) |
void |
modifyTable(javax.swing.JTable tabl)
Modifies the Table.
|
void |
setValueAt(java.lang.Object aValue,
int rowIndex,
int columnIndex) |
void |
sort(int column,
boolean ascending)
The sorting function for the resultset sorter.
|
protected static java.lang.String |
stringtoDate(java.lang.String date)
Helper method to convert a human readable date into an ODS Date String
|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener
protected ResultSetExt elemRes
protected java.lang.Integer[] idx
protected NameValueSeqUnitId[] colValues
protected EnumerationDefinition[] enumDefs
protected java.util.HashMap<java.lang.Integer,java.lang.String>[] enumMaps
protected java.lang.String[] colNames
protected int sortedColumn
protected int attrsnumber
protected int filtercolumn
protected boolean ascending
public SortedResultSet(ApplicationStructure asObj, ResultSetExt rs)
rs
- The ResulstSet that holds the data for the Tablenumberofattrs
- Number of attributes in the resultsetpublic void modifyTable(javax.swing.JTable tabl)
tabl
- The Table this listener should be bound to.public java.lang.Object getValueAt(int row, int column)
public int getColumnCount()
public java.lang.String getColumnName(int column)
getColumnName
in interface javax.swing.table.TableModel
getColumnName
in class javax.swing.table.AbstractTableModel
public int getRowCount()
public ElemId getRowElemId(int row)
This method REQUIRES that the model has been given a ResultSet which contains the ID Attribute of the Instances in the first column!
row
- the row indexprotected static java.lang.String dateToString(java.lang.String date)
date
- the date stringprotected static java.lang.String stringtoDate(java.lang.String date)
date
- the date stringpublic DataType getDataType(int column)
column
- The column for the datatypepublic 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 void sort(int column, boolean ascending)
column
- The column that has to be sortedascending
- The sorting order