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