use of org.eclipse.scout.rt.client.ui.basic.userfilter.IUserFilterState in project scout.rt by eclipse.
the class TableUserFilterManager method getSerializedData.
/**
* Get the serialized data of the UserFilterManager for further processing (e.g. storing a bookmark)
*/
public byte[] getSerializedData() {
byte[] data = null;
try {
// Create array list because m_filterMap.values() is not serializable
Collection<IUserFilterState> filterStates = new ArrayList<>(m_filterMap.values());
data = SerializationUtility.createObjectSerializer().serialize(filterStates);
} catch (Exception t) {
throw new ProcessingException("Failed creating user filter data.", t);
}
return data;
}
use of org.eclipse.scout.rt.client.ui.basic.userfilter.IUserFilterState in project scout.rt by eclipse.
the class JsonTable method handleModelUserFilterChange.
protected void handleModelUserFilterChange(TableEvent event) {
Collection<IUserFilterState> filters = getModel().getUserFilterManager().getFilters();
JSONObject jsonEvent = new JSONObject();
jsonEvent.put(PROP_FILTERS, filtersToJson(filters));
addActionEvent(EVENT_FILTERS_CHANGED, jsonEvent);
}
use of org.eclipse.scout.rt.client.ui.basic.userfilter.IUserFilterState in project scout.rt by eclipse.
the class JsonTable method filtersToJson.
protected JSONArray filtersToJson(Collection<IUserFilterState> filters) {
JSONArray jsonFilters = new JSONArray();
for (IUserFilterState filter : filters) {
JsonTableUserFilter jsonFilter = (JsonTableUserFilter) MainJsonObjectFactory.get().createJsonObject(filter);
jsonFilter.setJsonTable(this);
if (jsonFilter.isValid()) {
jsonFilters.put(jsonFilter.toJson());
} else {
LOG.info("Filter is not valid, maybe column is invisible. {}", jsonFilter);
}
}
return jsonFilters;
}
use of org.eclipse.scout.rt.client.ui.basic.userfilter.IUserFilterState in project scout.rt by eclipse.
the class JsonTable method handleUiFilterRemoved.
protected void handleUiFilterRemoved(JsonEvent event) {
IUserFilterState filter = getFilterState(event.getData());
TableEventFilterCondition condition = addTableEventFilterCondition(TableEvent.TYPE_USER_FILTER_REMOVED);
condition.setUserFilter(filter);
getModel().getUIFacade().fireFilterRemovedFromUI(filter);
}
use of org.eclipse.scout.rt.client.ui.basic.userfilter.IUserFilterState in project scout.rt by eclipse.
the class AbstractTable method linkColumnFilters.
private void linkColumnFilters() {
TableUserFilterManager filterManager = getUserFilterManager();
if (filterManager == null) {
return;
}
for (IColumn<?> col : getColumns()) {
IUserFilterState filter = getUserFilterManager().getFilter(col.getColumnId());
if (filter == null) {
continue;
}
if (!(filter instanceof ColumnUserFilterState)) {
throw new IllegalStateException("Unexpected filter state" + filter.getClass());
}
((ColumnUserFilterState) filter).setColumn(col);
}
}
Aggregations