void show() {
    if (popup != null) {
      popup.hide();
      popup = null;
      return;
    }

    final PopupPanel p = new PopupPanel(true);
    p.setStyleName(style.popup());
    p.addAutoHidePartner(activatingButton.getElement());
    p.addCloseHandler(
        new CloseHandler<PopupPanel>() {
          @Override
          public void onClose(CloseEvent<PopupPanel> event) {
            if (popup == p) {
              popup = null;
            }
          }
        });
    p.add(this);
    p.showRelativeTo(activatingButton);
    GlobalKey.dialog(p);
    message.setFocus(true);
    popup = p;
  }
  public void createRefreshToggleButton(final Button refreshIntervalSelector) {

    refreshIntervalSelector.setToggle(true);
    refreshIntervalSelector.setIcon(IconType.COG);
    refreshIntervalSelector.setTitle(Constants.INSTANCE.AutoRefresh());
    refreshIntervalSelector.setSize(ButtonSize.MINI);

    popup.getElement().getStyle().setZIndex(Integer.MAX_VALUE);
    popup.addAutoHidePartner(refreshIntervalSelector.getElement());
    popup.addCloseHandler(
        new CloseHandler<PopupPanel>() {
          public void onClose(CloseEvent<PopupPanel> popupPanelCloseEvent) {
            if (popupPanelCloseEvent.isAutoClosed()) {
              refreshIntervalSelector.setActive(false);
            }
          }
        });

    refreshIntervalSelector.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (!refreshIntervalSelector.isActive()) {
              showSelectRefreshIntervalPopup(
                  refreshIntervalSelector.getAbsoluteLeft()
                      + refreshIntervalSelector.getOffsetWidth(),
                  refreshIntervalSelector.getAbsoluteTop()
                      + refreshIntervalSelector.getOffsetHeight(),
                  refreshIntervalSelector);
            } else {
              popup.hide(false);
            }
          }
        });
  }
Esempio n. 3
0
  private void setupSavedSearches() {
    savedSearchesPanel.add(savedSearchesGrid);
    savedSearchesPanel.setStyleName("savedSearchesPanel");
    savedSearchesGrid.addStyleName("savedSearchesPanel");

    // panel position will be re-calculated on down-arrow click
    savedSearchesPanel.show();
    savedSearchesPanel.hide();

    SavedSearchesEventHandler handler = new SavedSearchesEventHandler();
    savedSearchesPanel.addCloseHandler(handler);
    savedSearchesGrid.setSavedSearchSelectionHandler(handler);
  }
Esempio n. 4
0
  /**
   * Create a new date box.
   *
   * @param date the default date.
   * @param picker the picker to drop down from the date box
   * @param format to use to parse and format dates
   */
  public DateBox(DatePicker picker, Date date, Format format) {
    this.picker = picker;
    this.popup = new PopupPanel(true);
    assert format != null : "You may not construct a date box with a null format";
    this.format = format;

    popup.addAutoHidePartner(box.getElement());
    popup.setWidget(picker);
    popup.setStyleName("dateBoxPopup");

    initWidget(box);
    setStyleName(DEFAULT_STYLENAME);

    handler = new DateBoxHandler();
    picker.addValueChangeHandler(handler);
    box.addFocusHandler(handler);
    box.addBlurHandler(handler);
    box.addClickHandler(handler);
    box.addKeyDownHandler(handler);
    box.setDirectionEstimator(false);
    popup.addCloseHandler(handler);
    setValue(date);
  }
Esempio n. 5
0
  public void showPopupMenu(Event event) {
    m_Label.addStyleName("popped");
    final PopupPanel popupPanel = new PopupPanel(true);
    popupPanel.setAnimationEnabled(true);
    MenuBar popupMenuBar = new MenuBar(true);

    MenuItem editItem =
        new MenuItem(
            "Edit Album",
            true,
            new Command() {

              @Override
              public void execute() {
                m_Container.doDialog(
                    "index.php/form/edit/albums/" + m_ID,
                    new HttpDialogHandler() {
                      @Override
                      public void success(String aResult) {
                        refresh();
                      }
                    });
                popupPanel.hide();
              }
            });

    MenuItem addAlbum =
        new MenuItem(
            "Add Album",
            true,
            new Command() {

              @Override
              public void execute() {
                m_Container.doDialog(
                    "index.php/form/add/albums/" + m_ID + "?type=album",
                    new HttpDialogHandler() {
                      @Override
                      public void success(String aResult) {
                        expand();
                        m_View.getCurrentAlbum().select();
                      }
                    });

                popupPanel.hide();
              }
            });

    MenuItem userPermissions =
        new MenuItem(
            "User Permissions",
            true,
            new Command() {
              @Override
              public void execute() {
                m_Container.doDialog(
                    "index.php/permissions/browse/" + m_ID,
                    new HttpDialogHandler() {
                      @Override
                      public void success(String aResult) {}
                    });

                popupPanel.hide();
              }
            });

    popupPanel.setStyleName("popup");
    editItem.addStyleName("popup-item");
    addAlbum.addStyleName("popup-item");
    userPermissions.addStyleName("popup-item");

    if (m_Container.isUploadEnabled()) {
      MenuItem uploadPhotos =
          new MenuItem(
              "Upload Photos",
              true,
              new Command() {

                @Override
                public void execute() {
                  uploadFiles();
                  popupPanel.hide();
                }
              });
      uploadPhotos.addStyleName("popup-item");
      popupMenuBar.addItem(uploadPhotos);
    }

    popupMenuBar.addItem(editItem);
    popupMenuBar.addItem(addAlbum);
    popupMenuBar.addItem(userPermissions);

    popupMenuBar.setVisible(true);
    popupPanel.add(popupMenuBar);

    int x = DOM.eventGetClientX(event);
    int y = DOM.eventGetClientY(event);
    popupPanel.setPopupPosition(x, y);
    popupPanel.addCloseHandler(
        new CloseHandler<PopupPanel>() {

          @Override
          public void onClose(CloseEvent<PopupPanel> event) {

            m_Label.removeStyleName("popped");
          }
        });

    popupPanel.show();
  }
Esempio n. 6
0
 public void addCloseHandler(CloseHandler handler) {
   popupPanel.addCloseHandler(handler);
 }