I have the following situation:
I have a Page (not a TablePage) in my Outline which contains a single form. On that form there is an upper group box containing a table and a lower group box containing a number of fields. I am assigning the lower group box a defined gridH which is large enough to fit all of the fields and set its vertical alignment to bottom.
I would now like for the upper group box and table to take up all the remaining space in the form, however, if I do not define a gridH on the table or group box it takes only the upper half of the form, leaving a lot of whitespace between the two group boxes. If I set a gridH, the upper box takes as much space as specified, but depending on the screen size that either still leaves a lot of white space (on large screens) or cuts into the lower box (on small screens).
+--------------------------------------------------------------+
| +----------------------------------------------------------+ |
| | UpperGroupBox | |
| | +------------------------------------------------------+ | |
| | | Table | | |
| | | | | |
| | | | | |
| | | this table shall use up | | |
| | | white space below | | |
| | | | | |
| | | | | |
| | | | | |
| | +------------------------------------------------------+ | |
| +----------------------------------------------------------+ |
| |
| |
| I want this space to be used by table |
| and upper group box |
| |
| |
| +----------------------------------------------------------+ |
| | LowerGroupBox | |
| | Field A [=======] Field B [==========================] | |
| | Field C [=======] Field D [==========================] | |
| | Field E [=======] Button 1 [=======] Button 2 [=======] | |
| +----------------------------------------------------------+ |
+--------------------------------------------------------------+
Our code roughly looks like this:
public class MyPage extends AbstractPage {
private MyForm form;
@Override
protected String getConfiguredTitle() {
return TEXTS.get("MY_PAGE");
}
@Override
protected void execPageActivated() throws ProcessingException {
form = new MyForm();
form.setDisplayHint(IForm.DISPLAY_HINT_VIEW);
form.setDisplayViewId(IForm.VIEW_ID_PAGE_TABLE);
form.startModify();
}
@Override
protected void execPageDeactivated() throws ProcessingException {
if (form != null) {
form.doClose();
form = null;
}
}
}
public class MyForm extends AbstractForm {
@Order(10.0)
public class MainBox extends AbstractGroupBox {
@Order(10.0)
public class UpperBox extends AbstractGroupBox {
@Override
protected boolean getConfiguredBorderVisible() {
return false;
}
@Order(10.0)
public class MyTableField extends AbstractTableField<MyTableField.Table> {
// TODO how do we configure this to use all remaining space?
// without this, the DetailBox & MyField use the upper 50% of the form
//@Override
//protected int getConfiguredGridH() {
// return 15;
//}
@Override
protected boolean getConfiguredLabelVisible() {
return false;
}
@Override
protected boolean getConfiguredTableStatusVisible() {
return true;
}
@Order(10.0)
public class Table extends AbstractTable {
@Order(10.0)
public class FirstColumn extends StringColumn {
}
@Order(20.0)
public class SecondColumn extends StringColumn {
}
}
}
}
@Order(100.0)
public class LowerBox extends AbstractGroupBox {
@Override
protected String getConfiguredLabel() {
return TEXTS.get("LowerBox");
}
@Override
protected int getConfiguredVerticalAlignment() {
return 1;
}
@Override
protected int getConfiguredGridH() {
return 3;
}
@Override
protected boolean getConfiguredFillVertical() {
return false;
}
@Order(10.0)
public class FirstField extends AbstractStringField {
}
@Order(20.0)
public class SecondField extends AbstractStringField {
}
@Order(30.0)
public class ThirdField extends AbstractStringField {
}
@Order(40.0)
public class FourthField extends AbstractStringField {
}
@Order(50.0)
public class FifthField extends AbstractStringField {
}
@Order(60.0)
public class SixthField extends AbstractStringField {
}
}
}
}