use of org.pentaho.di.ui.core.dialog.EnterConditionDialog in project pentaho-kettle by pentaho.
the class TableView method setFilter.
// Filtering...
public void setFilter() {
if (condition == null) {
condition = new Condition();
}
RowMetaInterface f = getRowWithoutValues();
EnterConditionDialog ecd = new EnterConditionDialog(parent.getShell(), SWT.NONE, f, condition);
Condition cond = ecd.open();
if (cond != null) {
ArrayList<Integer> tokeep = new ArrayList<Integer>();
// Apply the condition to the TableView...
int nr = table.getItemCount();
for (int i = nr - 1; i >= 0; i--) {
RowMetaAndData r = getRow(i);
boolean keep = cond.evaluate(r.getRowMeta(), r.getData());
if (keep) {
tokeep.add(Integer.valueOf(i));
}
}
int[] sels = new int[tokeep.size()];
for (int i = 0; i < sels.length; i++) {
sels[i] = (tokeep.get(i)).intValue();
}
table.setSelection(sels);
}
}
Aggregations