Search in sources :

Example 16 with GridData

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

the class AbstractGroupBoxBodyGrid method getGridDataFromHints.

/**
 * if grid w greater than group box column count. Grid w will be set to group box column count.
 */
public static GridData getGridDataFromHints(IFormField field, int groupBoxColumnCount) {
    GridData data = GridDataBuilder.createFromHints(field, groupBoxColumnCount);
    data.w = Math.min(groupBoxColumnCount, data.w);
    return data;
}
Also used : GridData(org.eclipse.scout.rt.client.ui.form.fields.GridData)

Example 17 with GridData

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

the class GroupBoxProcessButtonGrid method validate.

public void validate() {
    // reset
    List<IButton> buttonList = new ArrayList<IButton>();
    if (m_includeCustomButtons) {
        buttonList.addAll(m_groupBox.getCustomProcessButtons());
    }
    if (m_includeSystemButtons) {
        buttonList.addAll(m_groupBox.getSystemProcessButtons());
    }
    // filter
    for (Iterator it = buttonList.iterator(); it.hasNext(); ) {
        IButton b = (IButton) it.next();
        if (!b.isVisible()) {
            GridData data = GridDataBuilder.createFromHints(b, 1);
            b.setGridDataInternal(data);
            it.remove();
        }
    }
    m_buttons = buttonList;
    layoutStatic();
}
Also used : IButton(org.eclipse.scout.rt.client.ui.form.fields.button.IButton) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) GridData(org.eclipse.scout.rt.client.ui.form.fields.GridData)

Example 18 with GridData

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

the class VerticalSmartGroupBoxBodyGrid method layoutAllDynamic.

@Override
protected void layoutAllDynamic(List<IFormField> fields) {
    // calculate the used cells
    int cellCount = 0;
    for (IFormField f : fields) {
        GridData hints = getGridDataFromHints(f, getGridColumnCount());
        cellCount += hints.w * hints.h;
    }
    int rowCount = (cellCount + getGridColumnCount() - 1) / getGridColumnCount();
    VerticalGridMatrix matrix = new VerticalGridMatrix(getGridColumnCount(), rowCount);
    while (!matrix.computeGridData(fields)) {
        matrix.resetAll(getGridColumnCount(), ++rowCount);
    }
    // setGridData
    for (IFormField f : fields) {
        GridData data = matrix.getGridData(f);
        f.setGridDataInternal(data);
    }
    setGridRows(matrix.getRowCount());
}
Also used : IFormField(org.eclipse.scout.rt.client.ui.form.fields.IFormField) VerticalGridMatrix(org.eclipse.scout.rt.client.ui.form.fields.groupbox.internal.matrix.VerticalGridMatrix) GridData(org.eclipse.scout.rt.client.ui.form.fields.GridData)

Example 19 with GridData

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

the class HorizontalGridMatrix method computeGridData.

@Override
public boolean computeGridData(List<IFormField> fields) {
    for (IFormField f : fields) {
        GridData hints = GridDataBuilder.createFromHints(f, m_columnCount);
        GridData gridData = new GridData(hints);
        gridData.w = Math.min(hints.w, m_columnCount);
        add(f, hints, gridData);
        f.setGridDataInternal(gridData);
    }
    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 20 with GridData

use of org.eclipse.scout.rt.client.ui.form.fields.GridData 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)

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