Esempio n. 1
0
  private void initialize() {

    actionButton = new Button("Action Sheet", UI.ROUND);
    actionButton.setMargin(10);

    overlayButton = new Button("Overlay", UI.ROUND);
    overlayButton.setMargin(10);

    alertButton = new Button("Alert", UI.ROUND);
    alertButton.setMargin(10);

    promptButton = new Button("Prompt", UI.ROUND);
    promptButton.setMargin(10);

    confirmButton = new Button("Confirm", UI.ROUND);
    confirmButton.setMargin(10);

    pickerButton = new Button("Picker", UI.ROUND);
    pickerButton.setMargin(10);

    pickerCancelButton = new Button("Cancel");
    pickerDoneButton = new Button("Done");

    /** Action Sheet */
    overlayPanel = new ModalPanel();
    overlayPanel.setCentered(true);
    overlayPanel.setSize(300, 200);
    overlayPanel.setStyleHtmlContent(true);
    Scroller scroller = new Scroller();
    scroller.setDirection(Direction.BOTH);
    overlayPanel.setScrollable(scroller);
    overlayPanel.setHideOnMaskTap(true);
    overlayPanel.setModal(true);
    overlayPanel.setHtml(
        "<p>This is a modal, centered and floating mainContainer. "
            + "hideOnMaskTap is true by default so we can tap anywhere outside the overlay to hide it.<br/></p>");

    ToolBar toolBar = new ToolBar();
    toolBar.setDocked(Dock.TOP);
    toolBar.setTitle("Overlay Title");

    overlayPanel.add(toolBar);

    add(overlayPanel);
    overlayPanel.hide();

    add(actionButton);
    add(overlayButton);
    add(alertButton);
    add(promptButton);
    add(confirmButton);
    add(pickerButton);
  }