use of org.eclipse.scout.rt.client.ui.form.fields.IFormField in project scout.rt by eclipse.
the class VerticalGridMatrix method computeGridData.
@Override
public boolean computeGridData(List<IFormField> fields) {
int i = 0;
for (IFormField field : fields) {
m_formFieldIndexes.put(field, i++);
GridData gridData = AbstractGroupBoxBodyGrid.getGridDataFromHints(field, m_cursor.columnCount);
if (add(field, gridData)) {
m_fieldGridDatas.put(field, gridData);
} else {
return false;
}
}
return true;
}
use of org.eclipse.scout.rt.client.ui.form.fields.IFormField in project scout.rt by eclipse.
the class FindFieldByFormDataIdVisitorTest method testGetFirstFieldWithoutForm.
/* --------------------------------------------------------------------------
* first field
* --------------------------------------------------------------------------
*/
@Test
public void testGetFirstFieldWithoutForm() throws Exception {
FindFieldByFormDataIdVisitor visitor = new FindFieldByFormDataIdVisitor(FIRST_FIELD_DATA_ID);
m_mainForm.visitFields(visitor);
IFormField field = visitor.getField();
assertNotNull(field);
assertSame(m_mainForm.getFirstField(), field);
}
use of org.eclipse.scout.rt.client.ui.form.fields.IFormField in project scout.rt by eclipse.
the class FindFieldByFormDataIdVisitorTest method testGetFirstFieldOnMainForm.
@Test
public void testGetFirstFieldOnMainForm() throws Exception {
FindFieldByFormDataIdVisitor visitor = new FindFieldByFormDataIdVisitor(FIRST_FIELD_DATA_ID, m_mainForm);
m_mainForm.visitFields(visitor);
IFormField field = visitor.getField();
assertNotNull(field);
assertSame(m_mainForm.getFirstField(), field);
}
use of org.eclipse.scout.rt.client.ui.form.fields.IFormField in project scout.rt by eclipse.
the class FindFieldByFormDataIdVisitorTest method testGetThirdFieldOnInnerForm.
@Test
public void testGetThirdFieldOnInnerForm() throws Exception {
InnerForm innerForm = m_mainForm.getWrappedFormField().getInnerForm();
FindFieldByFormDataIdVisitor visitor = new FindFieldByFormDataIdVisitor(THIRD_FIELD_DATA_ID, innerForm);
innerForm.visitFields(visitor);
IFormField field = visitor.getField();
assertNotNull(field);
assertSame(innerForm.getWrappedFormField().getInnerForm().getThirdField(), field);
}
use of org.eclipse.scout.rt.client.ui.form.fields.IFormField in project scout.rt by eclipse.
the class JsonAdapterUtility method findChildAdapter.
/**
* Resolves the adapter for the given formField, even when it is not a direct child adapter of the given
* parentJsonAdapter (but the child adapter of a child adapter). If the formField does not belong to the adapter/field
* hierarchy of the given parent, <code>null</code> is returned.
*/
public static IJsonAdapter<?> findChildAdapter(IJsonAdapter<?> parentJsonAdapter, IFormField formField) {
// Find all parent model fields of the given formField (ordered from top to bottom)
List<IFormField> fieldHierarchy = getFieldHierarchy(formField);
// Starting from the given parent adapter, resolve the corresponding adapters for all fields in
// the hierarchy. Eventually, we should find the adapter that corresponds to the given formField.
IJsonAdapter<?> formFieldAdapter = parentJsonAdapter;
for (IFormField field : fieldHierarchy) {
if (formFieldAdapter != null) {
formFieldAdapter = formFieldAdapter.getAdapter(field);
}
}
return formFieldAdapter;
}
Aggregations