use of org.eclipse.scout.rt.client.ui.form.fields.IFormField 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();
}
use of org.eclipse.scout.rt.client.ui.form.fields.IFormField in project scout.rt by eclipse.
the class AbstractColumn method execPrepareEdit.
/**
* Prepares the editing of a cell in the table.
* <p>
* Cell editing is canceled (normally by typing escape) or saved (normally by clicking another cell, typing enter).
* <p>
* When saved, the method {@link #completeEdit(ITableRow, IFormField)} /
* {@link #interceptCompleteEdit(ITableRow, IFormField)} is called on this column.
* <p>
* Subclasses can override this method. The default returns an appropriate field based on the column data type.
* <p>
* The mapping from the cell value to the field value is achieved using {@link #cellToEditField(Object, String,
* IMultiStatus, IFormField))}
*
* @param row
* on which editing occurs
* @return a field for editing.
*/
@ConfigOperation
@Order(61)
protected IFormField execPrepareEdit(ITableRow row) {
IFormField f = prepareEditInternal(row);
if (f != null) {
f.setLabelVisible(false);
cellValueToEditor(row, f);
f.markSaved();
}
return f;
}
use of org.eclipse.scout.rt.client.ui.form.fields.IFormField in project scout.rt by eclipse.
the class ColumnMandatoryTest method testFieldNotMandatoryInColumn.
/**
* Tests, if a field is not mandatory in a non-mandatory column
*/
@Test
public void testFieldNotMandatoryInColumn() {
MandatoryTestTable testTable = new MandatoryTestTable();
testTable.addRowByArray(getTestRow());
IColumn col = testTable.getNonMandatoryTestColumn();
IFormField field = col.prepareEdit(testTable.getRow(0));
assertFalse(col.isMandatory());
assertFalse(field.isMandatory());
}
use of org.eclipse.scout.rt.client.ui.form.fields.IFormField in project scout.rt by eclipse.
the class ColumnMandatoryTest method testMandatoryErrorIfNoValue.
/**
* Tests, if a field is mandatory by setting value
*/
@Test
public void testMandatoryErrorIfNoValue() {
MandatoryTestTable testTable = new MandatoryTestTable();
testTable.addRowByArray(getTestRow());
IColumn mandatoryCol = testTable.getMandatoryTestColumn();
IFormField field = mandatoryCol.prepareEdit(testTable.getRow(0));
assertTrue(mandatoryCol.isMandatory());
assertTrue(field.isMandatory());
assertTrue(field.isContentValid());
}
use of org.eclipse.scout.rt.client.ui.form.fields.IFormField in project scout.rt by eclipse.
the class RadioButtonGroupGrid method validate.
@Override
public void validate(ICompositeField compositeField) {
// reset
m_group = compositeField;
m_gridColumns = 0;
m_gridRows = 0;
ArrayList<IFormField> list = new ArrayList<IFormField>();
// filter
for (IFormField f : m_group.getFields()) {
if (f.isVisible()) {
list.add(f);
} else {
GridData data = GridDataBuilder.createFromHints(f, 1);
f.setGridDataInternal(data);
}
}
m_fields = list.toArray(new IFormField[list.size()]);
applyGridData();
}
Aggregations