Search in sources :

Example 46 with IFormField

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;
}
Also used : IFormField(org.eclipse.scout.rt.client.ui.form.fields.IFormField) GridData(org.eclipse.scout.rt.client.ui.form.fields.GridData)

Example 47 with IFormField

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);
}
Also used : IFormField(org.eclipse.scout.rt.client.ui.form.fields.IFormField) Test(org.junit.Test)

Example 48 with IFormField

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);
}
Also used : IFormField(org.eclipse.scout.rt.client.ui.form.fields.IFormField) Test(org.junit.Test)

Example 49 with IFormField

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);
}
Also used : IFormField(org.eclipse.scout.rt.client.ui.form.fields.IFormField) Test(org.junit.Test)

Example 50 with IFormField

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;
}
Also used : IFormField(org.eclipse.scout.rt.client.ui.form.fields.IFormField)

Aggregations

IFormField (org.eclipse.scout.rt.client.ui.form.fields.IFormField)60 Test (org.junit.Test)19 ArrayList (java.util.ArrayList)13 GridData (org.eclipse.scout.rt.client.ui.form.fields.GridData)12 IButton (org.eclipse.scout.rt.client.ui.form.fields.button.IButton)5 PlatformError (org.eclipse.scout.rt.platform.exception.PlatformError)5 PropertyChangeEvent (java.beans.PropertyChangeEvent)4 PropertyChangeListener (java.beans.PropertyChangeListener)4 HashMap (java.util.HashMap)4 HashSet (java.util.HashSet)4 IColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)4 IGroupBox (org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox)4 IExtensibleObject (org.eclipse.scout.rt.shared.extension.IExtensibleObject)4 Map (java.util.Map)3 PlatformExceptionTranslator (org.eclipse.scout.rt.platform.exception.PlatformExceptionTranslator)3 LinkedList (java.util.LinkedList)2 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)2 ICompositeField (org.eclipse.scout.rt.client.ui.form.fields.ICompositeField)2 IValueField (org.eclipse.scout.rt.client.ui.form.fields.IValueField)2 FindFieldByFormDataIdVisitor (org.eclipse.scout.rt.client.ui.form.internal.FindFieldByFormDataIdVisitor)2