|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--table.model.EnvelopeTableModel
EnvelopeTableModel incapsulates another TableModel and gives possibility to perform reordering and grouping of data without changing original data. It also allows to set group functions for grouped data.
Field Summary | |
static int |
GROUP_FUNCTION_AVG
|
static int |
GROUP_FUNCTION_COUNT
|
static int |
GROUP_FUNCTION_EMPTY
|
static int |
GROUP_FUNCTION_MAX
|
static int |
GROUP_FUNCTION_MIN
|
static int |
GROUP_FUNCTION_SUM
|
protected int[] |
groupColumnIndexes
Group columns. |
protected Grouper |
grouper
Data grouper. |
protected int[] |
groupFunctions
Group functions attached to columns. |
protected boolean[] |
groupOrders
Sort orders for each column from groupColumnIndexes. |
protected java.util.ArrayList |
listenersList
List of attached TableModelListeners. |
protected java.util.ArrayList |
modelData
Containes model's rows. |
protected javax.swing.table.TableModel |
originalModel
Original (incapsulated) model. |
protected int[] |
sortColumnIndexes
Sort columns. |
protected Sorter |
sorter
Data sorter. |
protected boolean[] |
sortOrders
Sort orders for each column from sortColumnIndexes. |
Constructor Summary | |
EnvelopeTableModel(javax.swing.table.TableModel source)
Constructs a new instance with specified original TableModel. |
Method Summary | |
void |
addTableModelListener(javax.swing.event.TableModelListener l)
Adds a listener to the list that is notified each time a change to the data model occurs. |
void |
fireTableDataChanged()
Noifies all table model listeners about data changes. |
void |
fireTableModelEvent(javax.swing.event.TableModelEvent event)
Noifies all table model listeners about data changes. |
java.lang.Class |
getColumnClass(int columnIndex)
Returns the most specific superclass for all the cell values in the column. |
int |
getColumnCount()
Returns the number of columns in the model. |
java.lang.String |
getColumnName(int columnIndex)
Returns the name of the column at columnIndex. |
int[] |
getGroupColumns()
Gets group columns. |
int |
getGroupFunction(int columnIndex)
Gets group function assotiated with specified column. |
int |
getGroupLevel(int columnIndex)
Gets level of grouped data. |
boolean[] |
getGroupOrders()
Gets group orders. |
RowContainer |
getGroupRoot()
Gets root of grouped data (the last row in grouped table). |
javax.swing.table.TableModel |
getOriginalModel()
Gets original TableModel |
protected int |
getOriginalRowNumber(int rowNumber)
Gets originnal row number for specified row. |
RowContainer |
getRow(int rowIndex)
Gets row data for specified row index. |
int |
getRowCount()
Returns the number of rows in the model. |
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex)
Returns the value for the cell at columnIndex and
rowIndex . |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Returns true if the cell at rowIndex and
columnIndex
is editable. |
void |
refreshGroup()
Refresh grouping. |
void |
refreshSort()
Refresh sort. |
void |
removeTableModelListener(javax.swing.event.TableModelListener l)
Removes a listener from the list that is notified each time a change to the data model occurs. |
void |
reset()
Restores original data order. |
void |
setGroup(int[] groupColumnIndexes,
boolean[] groupOrders)
Sets group regim. |
void |
setGroupFunction(int columnIndex,
int groupFunction)
Sets group function for specified column. |
protected void |
setGroupFunctionAVG(int columnIndex)
Sets group function AVG to specified column. |
protected void |
setGroupFunctionCOUNT(int columnIndex)
Sets group function COUNT to specified column. |
protected void |
setGroupFunctionEMPTY(int columnIndex)
Sets group function EMPTY to specified column. |
protected void |
setGroupFunctionMAX(int columnIndex)
Sets group function MAX to specified column. |
protected void |
setGroupFunctionMIN(int columnIndex)
Sets group function MIN to specified column. |
protected void |
setGroupFunctionSUM(int columnIndex)
Sets group function SUM to specified column. |
void |
setSort(int[] sortColumnIndexes,
boolean[] sortOrders)
Sets sort regim. |
void |
setValueAt(java.lang.Object aValue,
int rowIndex,
int columnIndex)
Sets the value in the cell at columnIndex and
rowIndex to aValue . |
void |
tableChanged(javax.swing.event.TableModelEvent e)
When original model is changed we have to refresh data. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int GROUP_FUNCTION_EMPTY
public static final int GROUP_FUNCTION_COUNT
public static final int GROUP_FUNCTION_MAX
public static final int GROUP_FUNCTION_MIN
public static final int GROUP_FUNCTION_SUM
public static final int GROUP_FUNCTION_AVG
protected javax.swing.table.TableModel originalModel
protected java.util.ArrayList listenersList
protected int[] sortColumnIndexes
protected boolean[] sortOrders
protected int[] groupColumnIndexes
protected boolean[] groupOrders
protected int[] groupFunctions
protected java.util.ArrayList modelData
protected Sorter sorter
protected Grouper grouper
Constructor Detail |
public EnvelopeTableModel(javax.swing.table.TableModel source)
source
- original TableModel.Method Detail |
public javax.swing.table.TableModel getOriginalModel()
public int getRowCount()
getRowCount
in interface javax.swing.table.TableModel
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
public java.lang.String getColumnName(int columnIndex)
getColumnName
in interface javax.swing.table.TableModel
columnIndex
- the index of the column
public java.lang.Class getColumnClass(int columnIndex)
getColumnClass
in interface javax.swing.table.TableModel
columnIndex
- the index of the column
public boolean isCellEditable(int rowIndex, int columnIndex)
rowIndex
and
columnIndex
is editable. Otherwise, setValueAt
on the cell will not
change the value of that cell.
isCellEditable
in interface javax.swing.table.TableModel
rowIndex
- the row whose value to be queriedcolumnIndex
- the column whose value to be queried
public java.lang.Object getValueAt(int rowIndex, int columnIndex)
columnIndex
and
rowIndex
.
getValueAt
in interface javax.swing.table.TableModel
rowIndex
- the row whose value is to be queriedcolumnIndex
- the column whose value is to be queried
public void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
columnIndex
and
rowIndex
to aValue
.
setValueAt
in interface javax.swing.table.TableModel
aValue
- the new valuerowIndex
- the row whose value is to be changedcolumnIndex
- the column whose value is to be changedpublic void addTableModelListener(javax.swing.event.TableModelListener l)
addTableModelListener
in interface javax.swing.table.TableModel
l
- the TableModelListenerpublic void removeTableModelListener(javax.swing.event.TableModelListener l)
removeTableModelListener
in interface javax.swing.table.TableModel
l
- the TableModelListenerpublic void tableChanged(javax.swing.event.TableModelEvent e)
tableChanged
in interface javax.swing.event.TableModelListener
e
- change event.protected int getOriginalRowNumber(int rowNumber)
rowNumber
- number of model's row.
public void setSort(int[] sortColumnIndexes, boolean[] sortOrders) throws SortException
sortColumnIndexes
- sort column indexes.sortOrders
- sort orders.
SortException
public void setGroup(int[] groupColumnIndexes, boolean[] groupOrders) throws GroupException
groupColumnIndexes
- group column indexes.groupOrders
- orders for grouped columns.
GroupException
public int getGroupFunction(int columnIndex)
columnIndex
- index of column.
public void setGroupFunction(int columnIndex, int groupFunction) throws GroupException
columnIndex
- index of column.groupFunction
- group function.
GroupException
protected void setGroupFunctionEMPTY(int columnIndex)
columnIndex
- index of column.protected void setGroupFunctionCOUNT(int columnIndex)
columnIndex
- index of column.protected void setGroupFunctionMAX(int columnIndex)
columnIndex
- index of column.protected void setGroupFunctionMIN(int columnIndex)
columnIndex
- index of column.protected void setGroupFunctionSUM(int columnIndex)
columnIndex
- index of column.protected void setGroupFunctionAVG(int columnIndex)
columnIndex
- index of column.public void reset()
public void refreshGroup()
public void refreshSort()
public RowContainer getGroupRoot()
public RowContainer getRow(int rowIndex)
rowIndex
- index of row.
public int[] getGroupColumns()
public boolean[] getGroupOrders()
public int getGroupLevel(int columnIndex)
columnIndex
- index of grouped column.
public void fireTableDataChanged()
public void fireTableModelEvent(javax.swing.event.TableModelEvent event)
event
- changes event.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |