use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.
the class OrganizeColumnsForm method execRemoveColumnAction.
/**
* Calls removeColumn() method of table-customizer, if table has a customizer and selected row is a custom column.
* Override this method if a different behavior is required.
*/
protected void execRemoveColumnAction() {
if (isCustomizable()) {
Table columnsTable = getColumnsTableField().getTable();
for (ITableRow selectedRow : columnsTable.getSelectedRows()) {
IColumn<?> selectedColumn = columnsTable.getKeyColumn().getValue(selectedRow);
if (selectedColumn instanceof ICustomColumn) {
m_organizedTable.getTableCustomizer().removeColumn((ICustomColumn) selectedColumn);
}
}
getColumnsTableField().reloadTableData();
}
}
use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.
the class JsonTable method handleModelRowsChecked.
protected void handleModelRowsChecked(Collection<ITableRow> modelRows) {
JSONArray jsonRows = new JSONArray();
for (ITableRow row : modelRows) {
if (!isRowAccepted(row)) {
continue;
}
JSONObject jsonRow = new JSONObject();
putProperty(jsonRow, "id", getTableRowId(row));
putProperty(jsonRow, "checked", row.isChecked());
jsonRows.put(jsonRow);
}
if (jsonRows.length() == 0) {
return;
}
JSONObject jsonEvent = new JSONObject();
putProperty(jsonEvent, PROP_ROWS, jsonRows);
addActionEvent(EVENT_ROWS_CHECKED, jsonEvent);
}
use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow 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.ITableRow in project scout.rt by eclipse.
the class JsonTable method jsonToCheckedInfo.
protected CheckedInfo jsonToCheckedInfo(JSONObject data) {
JSONArray jsonRows = data.optJSONArray("rows");
CheckedInfo checkInfo = new CheckedInfo();
for (int i = 0; i < jsonRows.length(); i++) {
JSONObject jsonObject = jsonRows.optJSONObject(i);
ITableRow row = optTableRow(jsonObject.getString("rowId"));
if (row != null) {
checkInfo.getAllRows().add(row);
if (jsonObject.optBoolean("checked")) {
checkInfo.getCheckedRows().add(row);
} else {
checkInfo.getUncheckedRows().add(row);
}
}
}
return checkInfo;
}
use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow 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