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;
}
}
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);
}
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();
}
}
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);
}
}
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();
}
Aggregations