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;
}
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);
}
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());
}
}
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());
}
}
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);
}
}
Aggregations