Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » [mars] how to let a table or groupbox take all remaining space
[mars] how to let a table or groupbox take all remaining space [message #1749962] Wed, 14 December 2016 13:53 Go to next message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 565
Registered: October 2012
Location: Bern, Switzerland
Senior Member
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 {
      }
    }
  }
}
Re: [mars] how to let a table or groupbox take all remaining space [message #1750464 is a reply to message #1749962] Wed, 21 December 2016 10:23 Go to previous message
Andre Wegmueller is currently offline Andre WegmuellerFriend
Messages: 31
Registered: September 2012
Location: Baden-D├Ąttwil, Switzerla...
Member
Hi Urs. Great ASCII Art Wink

Have you tried to set the properties fillVertical=true and weightY=1 on both the TableField and the surrounding UpperBox?
Previous Topic:File upload widget
Next Topic:[neon] Questions about AbstractPage
Goto Forum:
  


Current Time: Fri Jul 28 19:12:18 GMT 2017

Powered by FUDForum. Page generated in 0.01881 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software