Search in sources :

Example 1 with IUserFilterState

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;
}
Also used : IUserFilterState(org.eclipse.scout.rt.client.ui.basic.userfilter.IUserFilterState) ArrayList(java.util.ArrayList) IOException(java.io.IOException) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException)

Example 2 with IUserFilterState

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);
}
Also used : IUserFilterState(org.eclipse.scout.rt.client.ui.basic.userfilter.IUserFilterState) JSONObject(org.json.JSONObject)

Example 3 with IUserFilterState

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;
}
Also used : IUserFilterState(org.eclipse.scout.rt.client.ui.basic.userfilter.IUserFilterState) JSONArray(org.json.JSONArray) JsonTableUserFilter(org.eclipse.scout.rt.ui.html.json.table.userfilter.JsonTableUserFilter)

Example 4 with IUserFilterState

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);
}
Also used : IUserFilterState(org.eclipse.scout.rt.client.ui.basic.userfilter.IUserFilterState)

Example 5 with IUserFilterState

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);
    }
}
Also used : IUserFilterState(org.eclipse.scout.rt.client.ui.basic.userfilter.IUserFilterState) ColumnUserFilterState(org.eclipse.scout.rt.client.ui.basic.table.userfilter.ColumnUserFilterState) TableUserFilterManager(org.eclipse.scout.rt.client.ui.basic.table.userfilter.TableUserFilterManager)

Aggregations

IUserFilterState (org.eclipse.scout.rt.client.ui.basic.userfilter.IUserFilterState)8 IOException (java.io.IOException)2 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)2 JSONObject (org.json.JSONObject)2 ArrayList (java.util.ArrayList)1 ColumnUserFilterState (org.eclipse.scout.rt.client.ui.basic.table.userfilter.ColumnUserFilterState)1 TableUserFilterManager (org.eclipse.scout.rt.client.ui.basic.table.userfilter.TableUserFilterManager)1 JsonTableUserFilter (org.eclipse.scout.rt.ui.html.json.table.userfilter.JsonTableUserFilter)1 JSONArray (org.json.JSONArray)1