Search in sources :

Example 1 with IColumn

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

the class InternalTableRow method validateValue.

/*
 * Implementation of ICellObserver
 */
@Override
public Object validateValue(ICell cell, Object value) {
    Object oldValue = cell.getValue();
    if (ObjectUtility.equals(oldValue, value)) {
        // no change in value
        return value;
    } else {
        // validate value
        if (getTable() != null) {
            int colIndex = -1;
            for (int i = 0; i < m_cells.size(); i++) {
                if (getCell(i) == cell) {
                    colIndex = i;
                    break;
                }
            }
            if (colIndex >= 0) {
                IColumn column = getTable().getColumnSet().getColumn(colIndex);
                value = column.parseValue(this, value);
            }
        }
        return value;
    }
}
Also used : IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)

Example 2 with IColumn

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

the class JsonTable method handleUiRowAction.

protected void handleUiRowAction(JsonEvent event) {
    ITableRow tableRow = extractTableRow(event.getData());
    IColumn column = extractColumn(event.getData());
    getModel().getUIFacade().setContextColumnFromUI(column);
    getModel().getUIFacade().fireRowActionFromUI(tableRow);
}
Also used : IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow)

Example 3 with IColumn

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

the class JsonTable method handleUiColumnOrganizeAction.

protected void handleUiColumnOrganizeAction(JsonEvent event) {
    JSONObject data = event.getData();
    String action = data.getString("action");
    IColumn column = extractColumn(data);
    switch(action) {
        case "add":
            getModel().getUIFacade().fireOrganizeColumnAddFromUI(column);
            break;
        case "remove":
            getModel().getUIFacade().fireOrganizeColumnRemoveFromUI(column);
            break;
        case "modify":
            getModel().getUIFacade().fireOrganizeColumnModifyFromUI(column);
            break;
        default:
            throw new IllegalArgumentException();
    }
}
Also used : JSONObject(org.json.JSONObject) IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)

Example 4 with IColumn

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

the class JsonTable method fireGroupFromUi.

protected void fireGroupFromUi(JSONObject data) {
    IColumn column = extractColumn(data);
    boolean groupingRemoved = data.optBoolean("groupingRemoved");
    if (groupingRemoved) {
        getModel().getUIFacade().fireGroupColumnRemovedFromUI(column);
    } else {
        boolean multiGroup = data.optBoolean("multiGroup");
        boolean groupAscending = data.getBoolean("groupAscending");
        getModel().getUIFacade().fireHeaderGroupFromUI(column, multiGroup, groupAscending);
    }
}
Also used : IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)

Example 5 with IColumn

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

the class JsonTable method handleUiPrepareCellEdit.

protected void handleUiPrepareCellEdit(JsonEvent event) {
    ITableRow row = extractTableRow(event.getData());
    if (row == null) {
        LOG.info("Requested table-row doesn't exist anymore. Skip prepareCellEdit event");
        return;
    }
    IColumn column = extractColumn(event.getData());
    IFormField field = getModel().getUIFacade().prepareCellEditFromUI(row, column);
    if (field == null) {
        // caused the initially editable cell to be become non-editable.
        return;
    }
    IJsonAdapter<?> jsonField = attachAdapter(field);
    LOG.debug("Created new field adapter for cell editing. Adapter: {}", jsonField);
    JSONObject json = new JSONObject();
    json.put("columnId", event.getData().getString(PROP_COLUMN_ID));
    json.put("rowId", event.getData().getString(PROP_ROW_ID));
    json.put("fieldId", jsonField.getId());
    addActionEvent(EVENT_START_CELL_EDIT, json).protect();
}
Also used : IFormField(org.eclipse.scout.rt.client.ui.form.fields.IFormField) JSONObject(org.json.JSONObject) IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow)

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