use of org.eclipse.scout.rt.client.ui.basic.table.TableEvent in project scout.rt by eclipse.
the class TableUserFilterManager method fireFilterRemoved.
private void fireFilterRemoved(IUserFilterState filter) {
TableEvent event = new TableEvent(m_table, TableEvent.TYPE_USER_FILTER_REMOVED);
event.setUserFilter(filter);
m_table.fireTableEventInternal(event);
}
use of org.eclipse.scout.rt.client.ui.basic.table.TableEvent in project scout.rt by eclipse.
the class TableUserFilterManager method fireFilterAdded.
private void fireFilterAdded(IUserFilterState filter) {
TableEvent event = new TableEvent(m_table, TableEvent.TYPE_USER_FILTER_ADDED);
event.setUserFilter(filter);
m_table.fireTableEventInternal(event);
}
use of org.eclipse.scout.rt.client.ui.basic.table.TableEvent in project scout.rt by eclipse.
the class JsonTable method processBufferedEvents.
@Override
public void processBufferedEvents() {
if (m_eventBuffer.isEmpty()) {
return;
}
preprocessBufferedEvents();
List<TableEvent> coalescedEvents = m_eventBuffer.consumeAndCoalesceEvents();
for (TableEvent event : coalescedEvents) {
processEvent(event);
}
}
use of org.eclipse.scout.rt.client.ui.basic.table.TableEvent in project scout.rt by eclipse.
the class JsonTable method bufferColumnStructureChanged.
protected void bufferColumnStructureChanged(TableEvent event) {
m_eventBuffer.add(event);
// Also necessary because column ids have changed.
if (getModel().getUserFilterManager() != null && getModel().getUserFilterManager().getFilters().size() > 0) {
m_eventBuffer.add(new TableEvent(getModel(), TableEvent.TYPE_USER_FILTER_ADDED));
}
// If a column got visible it is necessary to resend all rows to inform the gui about the new cells of the new column
m_eventBuffer.add(new TableEvent(getModel(), TableEvent.TYPE_ALL_ROWS_DELETED));
m_eventBuffer.add(new TableEvent(getModel(), TableEvent.TYPE_ROWS_INSERTED, getModel().getRows()));
}
use of org.eclipse.scout.rt.client.ui.basic.table.TableEvent in project scout.rt by eclipse.
the class TableEventFilter method filter.
@Override
public TableEvent filter(TableEvent event) {
for (TableEventFilterCondition condition : getConditions()) {
if (condition.getType() == event.getType()) {
if (condition.checkRows()) {
List<ITableRow> rows = new ArrayList<>(event.getRows());
rows.removeAll(condition.getRows());
if (rows.size() == 0) {
// Ignore event if no nodes remain (or if the event contained no nodes at all)
return null;
}
TableEvent newEvent = new TableEvent(m_jsonTable.getModel(), event.getType(), rows);
return newEvent;
}
if (condition.checkCheckedRows()) {
List<ITableRow> rows = new ArrayList<>(event.getRows());
List<ITableRow> checkedRows = new ArrayList<>();
List<ITableRow> uncheckedRows = new ArrayList<>();
for (ITableRow row : rows) {
if (row.isChecked()) {
checkedRows.add(row);
} else {
uncheckedRows.add(row);
}
}
if (CollectionUtility.equalsCollection(checkedRows, condition.getCheckedRows()) && CollectionUtility.equalsCollection(uncheckedRows, condition.getUncheckedRows())) {
// Ignore event if the checked and the unchecked rows have not changes
return null;
}
// Otherwise, send rows that a different checked state than before
checkedRows.removeAll(condition.getCheckedRows());
uncheckedRows.removeAll(condition.getUncheckedRows());
rows = CollectionUtility.combine(checkedRows, uncheckedRows);
TableEvent newEvent = new TableEvent(m_jsonTable.getModel(), event.getType(), rows);
return newEvent;
}
if (condition.checkColumns()) {
// Columns are not delivered by the event itself (at least not with COLUMN_ORDER_CHANGED) -> grab from table
if (CollectionUtility.equalsCollection(m_jsonTable.getColumnsInViewOrder(), condition.getColumns())) {
return null;
}
// Don't ignore if columns are different
return event;
}
if (condition.checkUserFilter()) {
if (condition.getUserFilter().equals(event.getUserFilter())) {
return null;
}
// Don't ignore if filters are different
return event;
}
// Ignore event if only type should be checked
return null;
}
}
return event;
}
Aggregations