private void showSelectRefreshIntervalPopup(
      final int left, final int top, final Button refreshIntervalSelector) {
    VerticalPanel popupContent = new VerticalPanel();

    // int configuredSeconds = presenter.getAutoRefreshSeconds();
    int configuredSeconds = view.getRefreshValue();
    if (configuredSeconds > 0) {
      updateRefreshInterval(true, configuredSeconds);
    } else {
      updateRefreshInterval(false, 0);
    }

    RadioButton oneMinuteRadioButton =
        createTimeSelectorRadioButton(
            60, "1 Minute", configuredSeconds, refreshIntervalSelector, popupContent);
    RadioButton fiveMinuteRadioButton =
        createTimeSelectorRadioButton(
            300, "5 Minutes", configuredSeconds, refreshIntervalSelector, popupContent);
    RadioButton tenMinuteRadioButton =
        createTimeSelectorRadioButton(
            600, "10 Minutes", configuredSeconds, refreshIntervalSelector, popupContent);

    popupContent.add(oneMinuteRadioButton);
    popupContent.add(fiveMinuteRadioButton);
    popupContent.add(tenMinuteRadioButton);

    Button resetButton = new Button("Disable Autorefresh");
    resetButton.setSize(ButtonSize.MINI);
    resetButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            updateRefreshInterval(false, 0);
            view.saveRefreshValue(0);
            refreshIntervalSelector.setActive(false);
            popup.hide();
          }
        });

    popupContent.add(resetButton);

    popup.setWidget(popupContent);
    popup.show();
    int finalLeft = left - popup.getOffsetWidth();
    popup.setPopupPosition(finalLeft, top);
  }
Exemple #2
0
 /** Center the inner popup in the window. */
 public void center() {
   int offsetWidth = child.getOffsetWidth();
   int offsetHeight = child.getOffsetHeight();
   center(offsetWidth, offsetHeight);
 }