Exemplo 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);
  }
Exemplo n.º 2
0
  private void displayPicker() {
    if (picker == null) {
      picker = new Picker();
      picker.setHideOnMaskTap(true);
      picker.setDoneButton(false);
      picker.setCancelButton(false);
      picker.setUseTitles(true);

      ToolBar toolbar = new ToolBar();
      toolbar.add(pickerCancelButton);
      toolbar.add(new Spacer());
      toolbar.add(pickerDoneButton);

      picker.setToolBar(toolbar);

      List<PickerSlot> pickerSlots = new ArrayList<PickerSlot>();
      PickerSlot slot = new PickerSlot();
      slot.setTitle("Hour");
      slot.setName("hour");
      slot.setData(getHourSlot());

      pickerSlots.add(slot);

      slot = new PickerSlot();
      slot.setTitle("Minute");
      slot.setName("minutes");
      slot.setData(getMinutesSlot());

      pickerSlots.add(slot);
      picker.setSlots(pickerSlots);

      add(picker);
    }

    picker.show();
  }