Search in sources :

Example 1 with ColumnUserFilterState

use of org.eclipse.scout.rt.client.ui.basic.table.userfilter.ColumnUserFilterState in project scout.rt by eclipse.

the class JsonColumnUserFilter method toJson.

@Override
public JSONObject toJson() {
    JSONObject json = super.toJson();
    ColumnUserFilterState filterState = getFilterState();
    IColumn modelColumn = filterState.getColumn();
    json.put("column", getJsonTable().getColumnId(modelColumn));
    json.put("selectedValues", new JSONArray(filterState.getSelectedValues()));
    return json;
}
Also used : JSONObject(org.json.JSONObject) IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn) ColumnUserFilterState(org.eclipse.scout.rt.client.ui.basic.table.userfilter.ColumnUserFilterState) JSONArray(org.json.JSONArray)

Example 2 with ColumnUserFilterState

use of org.eclipse.scout.rt.client.ui.basic.table.userfilter.ColumnUserFilterState 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)

Example 3 with ColumnUserFilterState

use of org.eclipse.scout.rt.client.ui.basic.table.userfilter.ColumnUserFilterState in project scout.rt by eclipse.

the class JsonColumnUserFilter method createFilterStateFromJson.

/**
 * This method creates a type specific filter-state model for the given column and JSON data. Sub-classes may
 * implement this method to return a different type. The default impl. returns a {@link ColumnUserFilterState}.
 *
 * @return
 */
public ColumnUserFilterState createFilterStateFromJson(IColumn<?> column, JSONObject json) {
    ColumnUserFilterState filterState = new ColumnUserFilterState(column);
    filterState.setSelectedValues(createSelectedValuesFromJson(json));
    return filterState;
}
Also used : ColumnUserFilterState(org.eclipse.scout.rt.client.ui.basic.table.userfilter.ColumnUserFilterState)

Aggregations

ColumnUserFilterState (org.eclipse.scout.rt.client.ui.basic.table.userfilter.ColumnUserFilterState)3 IColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)1 TableUserFilterManager (org.eclipse.scout.rt.client.ui.basic.table.userfilter.TableUserFilterManager)1 IUserFilterState (org.eclipse.scout.rt.client.ui.basic.userfilter.IUserFilterState)1 JSONArray (org.json.JSONArray)1 JSONObject (org.json.JSONObject)1