I have the following layout and want to dynamically show and hide the west panel:
<g:DockLayoutPanel ui:field="dock">
<g:west><g:Label text="west" ui:field="west"/></g:west>
<g:east><g:ToggleButton text="toggle"/></g:east>
<g:center>center</g:center>
</g:DockLayoutPanel>
For show/hide I defined a toggle button. It executes:
@UiField
Label west;
@UiField
DockLayoutPanel dock;
dock.remove(west);
//or
dock.addWest(west);
I want to keep the content in the center element. When I hide west
, everything works fine an the center
content resizes accordingly to take the free space.
When I again hit the ToggleButton
and execute the addWest()
method, I get following exception:
com.google.gwt.event.shared.UmbrellaException: Exception caught: No widget may be added after the CENTER widget
How can I add/show the west content again, and make the center content resize accordingly?