Question

Ok, i have a centralHTML that was put inside the <g:center> of mySplitLayoutPanel.

In UiBinder:

<g:SplitLayoutPanel ui:field="mySplitLayoutPanel">
   <g:west size="200">
       <g:HTMLPanel ui:field="westHTML" />
   </g:west>
   <g:center>
       <g:HTMLPanel ui:field="centralHTML" />
   </g:center>
</g:SplitLayoutPanel>

This code works fine mySplitLayoutPanel.setWidgetSize(westHTML,200)

Ok, suppose the users drag the splitter to the right so that centralHTML becomes invisible. Then, to make the centralWidget visible we have to use :

mySplitLayoutPanel.setWidgetSize(centralHTML,200) // but this doesn't work

Some people say just set the size of the west Widget & the central one will automatically show up. But i don't want to do that, instead i just want to set the widget size of the central widget only. So,

How to "setWidgetSize" for Central Widget in SplitLayoutPanel?

Was it helpful?

Solution

You cannot set the size of the center area in SplitLayoutPanel or in DockLayoutPanel, you can only set sizes of the edge children, from the javadoc:

A panel that lays its child widgets out "docked" at its outer edges, and allows its last widget to take up the remaining space in its center.

This behavior makes sense, otherwise the dock-layout panel must have a way to select edge widgets to reduce their size and this could be worst.

I would use an onResize handler to know when a widget is resized and restore sizes someway.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top