DockPanel main = new DockPanel();
FlowPanel buttons = new FlowPanel();
buttons.setWidth("100%");
final SimpleToggleButton toggleLeftBtn = new SimpleToggleButton("Hide Left");
toggleLeftBtn.getDownFace().setText("Show Left");
DOM.setStyleAttribute(toggleLeftBtn.getElement(), "marginRight", "20px");
buttons.add(toggleLeftBtn);
final SimpleToggleButton toggleRightBtn = new SimpleToggleButton("Hide Right");
toggleRightBtn.getDownFace().setText("Show Right");
DOM.setStyleAttribute(toggleRightBtn.getElement(), "marginRight", "20px");
buttons.add(toggleRightBtn);
final SimpleToggleButton toggleBottomBtn = new SimpleToggleButton("Hide Bottom");
toggleBottomBtn.getDownFace().setText("Show Bottom");
buttons.add(toggleBottomBtn);
DOM.setStyleAttribute(toggleBottomBtn.getElement(), "marginRight", "20px");
final SimpleToggleButton toggleTopBtn = new SimpleToggleButton("Hide Top");
toggleTopBtn.getDownFace().setText("Show Top");
buttons.add(toggleTopBtn);
final DoubleHorizontalSplitPanel hsp = new DoubleHorizontalSplitPanel();
hsp.setSize("100%", "100%");
hsp.setLeftWidget(createContent("Left", "#CCFFCC"));
hsp.setCenterWidget(createContent("Center", "#FFC0CB"));
hsp.setRightWidget(createContent("Right", "#FFFBA3"));
final SimpleVerticalSplitPanel vsp = new SimpleVerticalSplitPanel();
vsp.setSize("100%", "100%");
vsp.setTopWidget(hsp);
vsp.setBottomWidget(createContent("Bottom", "#E6E6FA"));
vsp.setSplitPosition("70%");
vsp.setTopWidgetVisible(false);
toggleLeftBtn.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
hsp.setLeftWidgetVisible(!toggleLeftBtn.isDown());
}
});
toggleRightBtn.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
hsp.setRightWidgetVisible(!toggleRightBtn.isDown());
}
});
toggleBottomBtn.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
vsp.setBottomWidgetVisible(!toggleBottomBtn.isDown());
}
});
toggleTopBtn.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
vsp.setTopWidgetVisible(!toggleTopBtn.isDown());
}
});
toggleTopBtn.setDown(true);
main.add(buttons, DockPanel.NORTH);
main.add(vsp, DockPanel.CENTER);
main.setCellHeight(buttons, "30px");
main.setCellWidth(buttons, "100%");