@Order(10)
@LayoutSample
public class DockLayoutSample extends ResizeComposite implements SamplePanel {
public DockLayoutSample() {
final DockLayout dock = new DockLayout();
final HTML north = createHTML("North", "#cacaf7");
dock.addNorth(north, 100);
final HTML south = createHTML("South", "#ccffcc");
dock.addSouth(south, 100);
final HTML east = createHTML("East", "#ffcccc");
dock.addEast(east, 100);
final HTML west = createHTML("West", "#ffff99");
dock.addWest(west, 100);
FlowPanel buttons = new FlowPanel();
ToggleButton button = new ToggleButton("Hide North", "Show North");
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
dock.setWidgetVisible(north, !((ToggleButton) clickEvent.getSource()).isDown());
}
});
buttons.add(button);
button = new ToggleButton("Hide South", "Show South");
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
dock.setWidgetVisible(south, !((ToggleButton) clickEvent.getSource()).isDown());
}
});
buttons.add(button);
button = new ToggleButton("Hide West", "Show West");
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
dock.setWidgetVisible(west, !((ToggleButton) clickEvent.getSource()).isDown());
}
});
buttons.add(button);
button = new ToggleButton("Hide East", "Show East");
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
dock.setWidgetVisible(east, !((ToggleButton) clickEvent.getSource()).isDown());
}
});
buttons.add(button);
dock.add(buttons);
initWidget(dock);
}