Search code examples
gwtgxt

Auto-sizing height/width of north/west widgets on BorderLayoutContainer


It seems that NorthSouthContainer can ajust the height of north widget. Can BorderLayoutContainer do the same one?

(gxt version: 3.1.1)

public void onModuleLoad() {

    final BorderLayoutContainer cont = new BorderLayoutContainer();
    // final NorthSouthContainer cont = new NorthSouthContainer();

    final ToolBar bar = new ToolBar();
    bar.add(new TextButton("tool bar"));

    cont.setNorthWidget(bar);

    final ContentPanel panel = new ContentPanel();
    panel.setHeadingText("content panel");

    cont.setCenterWidget(panel);
    // cont.setSouthWidget(panel);

    final Viewport vp = new Viewport();
    vp.add(cont);
    RootPanel.get().add(vp);
}

NorthSouthContainer:

enter image description here

BorderLayoutContainer:

enter image description here


Solution

  • I know there are display bugs with that view. I'm not sure if it can be dynamically sized, we specifically set the height for it.

    final BorderLayoutData northData = new BorderLayoutData(<height>);
    cont.setNorthWidget(bar, northData);
    

    You may have to add the toolbar into another container that deals with size better, ours is a HorizontalLayoutContainer inside of a ContentPanel.