C
cm
I want to use the TableSorter from Suns Tutorial and an additional
TableFilter, who works as an Decorator for a JTable as well.(Both are
tableModels, that overrite functions of the underlying TableModel, to
filter and sort the view of the Model)
simple Example code looks like this:
----------------------------
// making Model
TableModel tm = new TableModel(MyDataVector);
// give it to Filter
TableFilter tf = new TableFilterer(tm);
TableRowFilter filter = new TableRowFilter(3,"x",1);
tf.addRowFilter(filter);
// give Filter to Sorter
TableSorter ts = new TableSorter(tf);
// give Sorter to Table
JTable myTable = new JTable(ts);
ts.setTableHeader(myTable.getTableHeader());
myTable.getTableHeader().setToolTipText("Click to sort!");
// if event occures:
tf.removeAllRowFilters();
TableRowFilter filter2 = new TableRowFilter(3,"y",1);
tf.addRowFilter(filter2);
// then do not know how to fire the Event, thats the Problem!
tf.fireTableDataChanged();
ts.fireTableDataChanged();
myTableModel.fireTableDataChanged();
----------------------------
How do I coordinate the fireTableDataChanged() Events, with this tree
nested TableModels?
The Problem is simply, that when I switch the Filter, the Table do not
show Data, which defnitly is still in the Modell, and which in fact
has to go through the Filter.
Please Help!
TableFilter, who works as an Decorator for a JTable as well.(Both are
tableModels, that overrite functions of the underlying TableModel, to
filter and sort the view of the Model)
simple Example code looks like this:
----------------------------
// making Model
TableModel tm = new TableModel(MyDataVector);
// give it to Filter
TableFilter tf = new TableFilterer(tm);
TableRowFilter filter = new TableRowFilter(3,"x",1);
tf.addRowFilter(filter);
// give Filter to Sorter
TableSorter ts = new TableSorter(tf);
// give Sorter to Table
JTable myTable = new JTable(ts);
ts.setTableHeader(myTable.getTableHeader());
myTable.getTableHeader().setToolTipText("Click to sort!");
// if event occures:
tf.removeAllRowFilters();
TableRowFilter filter2 = new TableRowFilter(3,"y",1);
tf.addRowFilter(filter2);
// then do not know how to fire the Event, thats the Problem!
tf.fireTableDataChanged();
ts.fireTableDataChanged();
myTableModel.fireTableDataChanged();
----------------------------
How do I coordinate the fireTableDataChanged() Events, with this tree
nested TableModels?
The Problem is simply, that when I switch the Filter, the Table do not
show Data, which defnitly is still in the Modell, and which in fact
has to go through the Filter.
Please Help!