Search in sources :

Example 41 with IColumn

use of org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn in project scout.rt by eclipse.

the class JsonTable method fireSortFromUi.

protected void fireSortFromUi(JSONObject data) {
    IColumn column = extractColumn(data);
    boolean sortingRemoved = data.optBoolean("sortingRemoved");
    // TODO [7.0] cgu: add filter for HEADER_UPDATE event with json data of column (execDecorateHeaderCell is called which may change other header properties (text etc)
    if (sortingRemoved) {
        getModel().getUIFacade().fireSortColumnRemovedFromUI(column);
    } else {
        boolean multiSort = data.optBoolean("multiSort");
        boolean sortAscending = data.getBoolean("sortAscending");
        getModel().getUIFacade().fireHeaderSortFromUI(column, multiSort, sortAscending);
    }
}
Also used : IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)

Example 42 with IColumn

use of org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn in project scout.rt by eclipse.

the class JsonTable method handleModelColumnHeadersUpdated.

protected void handleModelColumnHeadersUpdated(Collection<IColumn<?>> columns) {
    JSONObject jsonEvent = new JSONObject();
    Collection<IColumn<?>> visibleColumns = filterVisibleColumns(columns);
    // Ignore columns that are not currently attached. They will be later
    // attached with the event COLUMN_STRUCTURE_CHANGED.
    List<IColumn<?>> filteredColumns = filterAttachedColumns(visibleColumns);
    if (filteredColumns.isEmpty()) {
        return;
    }
    putProperty(jsonEvent, PROP_COLUMNS, columnsToJson(filteredColumns));
    addActionEvent(EVENT_COLUMN_HEADERS_UPDATED, jsonEvent);
}
Also used : JSONObject(org.json.JSONObject) IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)

Example 43 with IColumn

use of org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn in project scout.rt by eclipse.

the class JsonTable method handleModelColumnOrderChanged.

protected void handleModelColumnOrderChanged() {
    // Ignore columns that are not currently attached. They will be later
    // attached with the event COLUMN_STRUCTURE_CHANGED.
    List<IColumn<?>> filteredColumns = filterAttachedColumns(getColumnsInViewOrder());
    if (filteredColumns.isEmpty()) {
        return;
    }
    JSONObject jsonEvent = new JSONObject();
    putProperty(jsonEvent, PROP_COLUMN_IDS, columnIdsToJson(filteredColumns));
    addActionEvent(EVENT_COLUMN_ORDER_CHANGED, jsonEvent);
}
Also used : JSONObject(org.json.JSONObject) IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)

Example 44 with IColumn

use of org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn in project scout.rt by eclipse.

the class JsonTable method createFilterState.

protected IUserFilterState createFilterState(JSONObject data) {
    String filterType = data.getString("filterType");
    if ("column".equals(filterType)) {
        IColumn column = extractColumn(data);
        JsonColumn jsonColumn = m_jsonColumns.get(column);
        return jsonColumn.createFilterStateFromJson(data);
    } else if ("text".equals(filterType)) {
        String text = data.getString("text");
        return new TableTextUserFilterState(text);
    }
    return null;
}
Also used : IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn) TableTextUserFilterState(org.eclipse.scout.rt.client.ui.basic.table.userfilter.TableTextUserFilterState)

Example 45 with IColumn

use of org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn in project scout.rt by eclipse.

the class JsonTable method handleUiAppLinkAction.

protected void handleUiAppLinkAction(JsonEvent event) {
    IColumn column = extractColumn(event.getData());
    String ref = event.getData().getString("ref");
    if (column != null) {
        getModel().getUIFacade().setContextColumnFromUI(column);
    }
    getModel().getUIFacade().fireAppLinkActionFromUI(ref);
}
Also used : IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)

Aggregations

IColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)49 ArrayList (java.util.ArrayList)10 TreeMap (java.util.TreeMap)8 CompositeObject (org.eclipse.scout.rt.platform.util.CompositeObject)7 Test (org.junit.Test)6 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)5 JSONObject (org.json.JSONObject)5 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)4 IFormField (org.eclipse.scout.rt.client.ui.form.fields.IFormField)4 INumberColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.INumberColumn)3 HashMap (java.util.HashMap)2 IMenu (org.eclipse.scout.rt.client.ui.action.menu.IMenu)2 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 Method (java.lang.reflect.Method)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 TreeSet (java.util.TreeSet)1 ClientUIPreferences (org.eclipse.scout.rt.client.ui.ClientUIPreferences)1 IKeyStroke (org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke)1