Search in sources :

Example 11 with GridData

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

the class AbstractColumn method prepareEdit.

@Override
public final IFormField prepareEdit(ITableRow row) {
    ITable table = getTable();
    if (table == null || !this.isCellEditable(row)) {
        return null;
    }
    IFormField f = interceptPrepareEdit(row);
    if (f != null) {
        f.setLabelVisible(false);
        GridData gd = f.getGridDataHints();
        gd.weightY = 1;
        f.setGridDataHints(gd);
    }
    return f;
}
Also used : IFormField(org.eclipse.scout.rt.client.ui.form.fields.IFormField) GridData(org.eclipse.scout.rt.client.ui.form.fields.GridData) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable)

Example 12 with GridData

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

the class AbstractColumn method mapGridDataToField.

/**
 * apply horizontal alignment of column to respective editor field
 */
protected void mapGridDataToField(IFormField f) {
    GridData gd = f.getGridDataHints();
    gd.horizontalAlignment = getHorizontalAlignment();
    f.setGridDataHints(gd);
}
Also used : GridData(org.eclipse.scout.rt.client.ui.form.fields.GridData)

Example 13 with GridData

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

the class MobileDeviceTransformer method makeFieldScalable.

/**
 * Makes sure weightX is set to 1 which makes the field scalable.
 * <p>
 * Reason:<br>
 * The width of the field should be adjusted according to the display width, otherwise it may be too big to be
 * displayed. <br>
 * Additionally, since we use a one column layout, setting weightX to 0 might destroy the layout because it affects
 * all the fields in the groupBox.
 */
protected void makeFieldScalable(IFormField field) {
    // Since a sequencebox contains several fields it's very risky to modify the gridData because it could make the fields too big or too small.
    if (field.getParentField() instanceof ISequenceBox) {
        return;
    }
    // Make sure weightX is set to 1 so the field grows and shrinks and does not break the 1 column layout
    GridData gridDataHints = field.getGridDataHints();
    if (gridDataHints.weightX == 0) {
        gridDataHints.weightX = 1;
        field.setGridDataHints(gridDataHints);
        markGridDataDirty(field.getForm());
    }
}
Also used : ISequenceBox(org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox) GridData(org.eclipse.scout.rt.client.ui.form.fields.GridData)

Example 14 with GridData

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

the class MobileDeviceTransformer method transformSequenceBox.

/**
 * Make the sequence box use its UI height. This is necessary if the labels of the containing fields are moved to top
 * because in that case a logical row height of 1 is not sufficient anymore.
 */
protected void transformSequenceBox(ISequenceBox box) {
    if (!getDeviceTransformationConfig().isTransformationEnabled(MobileDeviceTransformation.SET_SEQUENCEBOX_UI_HEIGHT, box)) {
        return;
    }
    GridData gridDataHints = box.getGridDataHints();
    if (!gridDataHints.useUiHeight) {
        gridDataHints.useUiHeight = true;
        box.setGridDataHints(gridDataHints);
        markGridDataDirty(box.getForm());
    }
}
Also used : GridData(org.eclipse.scout.rt.client.ui.form.fields.GridData)

Example 15 with GridData

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

the class AbstractGroupBoxBodyGrid method validate.

@Override
public void validate(IGroupBox groupBox) {
    // reset old state
    setGridRows(0);
    // STEP 0: column count
    setGridColumns(computGridColumnCount(groupBox));
    int containingGridXYCount = 0;
    int notContainingGridXYCount = 0;
    // build
    List<IFormField> fieldsExceptProcessButtons = new ArrayList<IFormField>();
    for (IFormField formField : groupBox.getFields()) {
        if (formField.isVisible()) {
            if (!isProcessButton(formField)) {
                fieldsExceptProcessButtons.add(formField);
                GridData hints = formField.getGridDataHints();
                if (hints.x >= 0 && hints.y >= 0) {
                    containingGridXYCount++;
                } else {
                    notContainingGridXYCount++;
                }
            }
        } else {
            GridData data = GridDataBuilder.createFromHints(formField, 1);
            formField.setGridDataInternal(data);
        }
    }
    boolean isContainingXAndY = (containingGridXYCount > 0 && notContainingGridXYCount == 0);
    if (isContainingXAndY) {
        layoutAllStatic(fieldsExceptProcessButtons);
    } else {
        layoutAllDynamic(fieldsExceptProcessButtons);
    }
}
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)

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