public class DeckLayoutSample extends ResizeComposite implements SamplePanel {
public DeckLayoutSample() {
LayoutPanel panel = new LayoutPanel();
final DeckLayout deck = new DeckLayout();
deck.setAnimationEnabled(true);
panel.add(deck);
panel.setWidgetLeftRight(deck, 50, Style.Unit.PX, 50, Style.Unit.PX);
panel.setWidgetTopBottom(deck, 50, Style.Unit.PX, 50, Style.Unit.PX);
FlowPanel buttons = new FlowPanel();
DockLayout main = new DockLayout();
main.addNorth(buttons, 50);
main.add(panel);
createHTML(buttons, deck, "Red", "#ff9999");
createHTML(buttons, deck, "Green", "#ccffcc");
createHTML(buttons, deck, "Blue", "#cacaf7");
createHTML(buttons, deck, "Yellow", "#ffcc66");
Button clearButton = new Button("Clear Selection", new ClickHandler() {
public void onClick(ClickEvent event) {
deck.clearSelection();
}
});
clearButton.getElement().getStyle().setMarginLeft(10, Style.Unit.PX);
buttons.add(clearButton);
SimpleToggleButton enableDisableButton = new SimpleToggleButton("Disable Animation");
enableDisableButton.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
deck.setAnimationEnabled(!deck.isAnimationEnabled());
}
});
enableDisableButton.getElement().getStyle().setMarginLeft(10, Style.Unit.PX);
buttons.add(enableDisableButton);