Search in sources :

Example 21 with GridData

use of org.eclipse.scout.rt.client.ui.form.fields.GridData in project scout.rt by eclipse.

the class RadioButtonGroupGrid method applyGridData.

/**
 * Sets GridData on each button (= field) of the group.
 */
protected void applyGridData() {
    GridData parentData = m_group.getGridData();
    if (parentData.h <= 0) {
        LOG.error("{} has gridData.h={}; expected value>0", m_group.getClass().getName(), parentData.h);
        m_gridRows = 1;
    } else if (m_fields.length <= 0) {
        LOG.error("{} has fieldCount={}; expected value>0", m_group.getClass().getName(), m_fields.length);
        m_gridRows = 1;
    } else {
        m_gridRows = Math.min(parentData.h, m_fields.length);
    }
    m_gridColumns = (m_fields.length + m_gridRows - 1) / m_gridRows;
    int i = 0;
    for (int r = 0; r < m_gridRows; r++) {
        for (int c = 0; c < m_gridColumns; c++) {
            if (i < m_fields.length) {
                GridData data = GridDataBuilder.createFromHints(m_fields[i], 1);
                data.x = c;
                data.y = r;
                data.w = 1;
                data.h = 1;
                m_fields[i].setGridDataInternal(data);
                i++;
            } else {
                break;
            }
        }
    }
}
Also used : GridData(org.eclipse.scout.rt.client.ui.form.fields.GridData)

Example 22 with GridData

use of org.eclipse.scout.rt.client.ui.form.fields.GridData in project scout.rt by eclipse.

the class SequenceBoxGrid method layoutStatic.

private void layoutStatic(List<IFormField> fields) {
    int x = 0;
    for (IFormField field : fields) {
        GridData data = GridDataBuilder.createFromHints(field, 1);
        data.x = x;
        data.y = 0;
        if (data.weightX < 0) {
            if (field instanceof IButton) {
                data.useUiWidth = true;
                data.weightX = 0;
            } else {
                data.weightX = data.w;
            }
        }
        field.setGridDataInternal(data);
        x = x + data.w;
        m_gridRows = Math.max(m_gridRows, data.h);
    }
    m_gridColumns = x;
}
Also used : IFormField(org.eclipse.scout.rt.client.ui.form.fields.IFormField) IButton(org.eclipse.scout.rt.client.ui.form.fields.button.IButton) GridData(org.eclipse.scout.rt.client.ui.form.fields.GridData)

Example 23 with GridData

use of org.eclipse.scout.rt.client.ui.form.fields.GridData in project scout.rt by eclipse.

the class SequenceBoxGrid method validate.

@Override
public void validate(ISequenceBox sequenceBox) {
    // reset
    m_gridColumns = 0;
    m_gridRows = 0;
    List<IFormField> list = new ArrayList<IFormField>();
    // filter
    for (IFormField f : sequenceBox.getFields()) {
        if (f.isVisible()) {
            list.add(f);
        } else {
            GridData data = GridDataBuilder.createFromHints(f, 1);
            f.setGridDataInternal(data);
        }
    }
    layoutStatic(list);
}
Also used : IFormField(org.eclipse.scout.rt.client.ui.form.fields.IFormField) ArrayList(java.util.ArrayList) GridData(org.eclipse.scout.rt.client.ui.form.fields.GridData)

Example 24 with GridData

use of org.eclipse.scout.rt.client.ui.form.fields.GridData in project scout.rt by eclipse.

the class TabBoxGrid method layoutStatic.

private void layoutStatic() {
    for (int i = 0; i < m_fields.length; i++) {
        GridData data = GridDataBuilder.createFromHints(m_fields[i], 1);
        m_gridRows = Math.max(m_gridRows, data.h);
        m_gridColumns = Math.max(m_gridColumns, data.w);
    }
    for (int i = 0; i < m_fields.length; i++) {
        GridData data = GridDataBuilder.createFromHints(m_fields[i], m_gridColumns);
        data.x = 0;
        data.y = 0;
        m_fields[i].setGridDataInternal(data);
    }
}
Also used : GridData(org.eclipse.scout.rt.client.ui.form.fields.GridData)

Aggregations

GridData (org.eclipse.scout.rt.client.ui.form.fields.GridData)24 IFormField (org.eclipse.scout.rt.client.ui.form.fields.IFormField)12 ArrayList (java.util.ArrayList)7 IButton (org.eclipse.scout.rt.client.ui.form.fields.button.IButton)3 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)1 VerticalGridMatrix (org.eclipse.scout.rt.client.ui.form.fields.groupbox.internal.matrix.VerticalGridMatrix)1 ISequenceBox (org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox)1