Example #1
0
  /** handle click on {@link PopupMenuButtonW this button} */
  void handleClick() {
    onClickAction();
    if (EuclidianStyleBarW.CURRENT_POP_UP != myPopup || !app.wasPopupJustClosed()) {
      if (EuclidianStyleBarW.CURRENT_POP_UP != null) {
        EuclidianStyleBarW.CURRENT_POP_UP.hide();
      }
      EuclidianStyleBarW.CURRENT_POP_UP = myPopup;

      app.registerPopup(myPopup);
      myPopup.showRelativeTo(getWidget());
      myPopup.getFocusPanel().getElement().focus();
    } else {
      myPopup.setVisible(false);
      EuclidianStyleBarW.CURRENT_POP_UP = null;
    }
  }
Example #2
0
  /**
   * @param newData icons
   * @param rows number of rows
   * @param columns number of columns
   * @param mode selection mode
   */
  private void createSelectionTable(
      ImageOrText[] newData,
      Integer rows,
      Integer columns,
      SelectionTable mode,
      boolean[] selected) {
    this.data = newData;

    myTable = new SelectionTableW(newData, rows, columns, mode, multiselectionEnabled);
    if (!multiselectionEnabled) {
      setSelectedIndex(0);
    } else {
      myTable.initSelectedItems(selected);
    }

    myTable.addClickHandler(
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            handlePopupActionEvent();
          }
        });

    myPopup.getPanel().add(myTable);
  }
Example #3
0
  /**
   * Pass a popup action event up to the button invoker. If the first button click triggered our
   * popup (the click was in the triangle region), then we must pass action events from the popup to
   * the invoker
   */
  public void handlePopupActionEvent() {
    if (popupHandler != null) {
      popupHandler.fireActionPerformed(this);
    } else {
      Log.debug("PopupMenubutton has null popupHandler");
    }

    updateGUI();
    if (!keepVisible) {
      myPopup.hide();
    }
  }
Example #4
0
  private void initSlider() {

    mySlider = new Slider(0, 100);
    mySlider.setMajorTickSpacing(25);
    mySlider.setMinorTickSpacing(5);
    mySlider.addChangeHandler(this);
    Slider.addInputHandler(mySlider.getElement(), this);

    sliderLabel = new Label();
    FlowPanel panel = new FlowPanel();
    panel.add(mySlider);
    panel.add(sliderLabel);
    sliderLabel.addStyleName("popupSliderLabel");
    panel.addStyleName("panelRow");
    myPopup.getPanel().add(panel);
  }
Example #5
0
  /** creates a new {@link ButtonPopupMenu} */
  private void createPopup() {
    myPopup =
        new ButtonPopupMenu(app.getPanel()) {
          @Override
          public void setVisible(boolean visible) {
            super.setVisible(visible);

            // if another button is pressed only the visibility is changed,
            // by firing the event we can react as if it was closed
            CloseEvent.fire(this, this, false);
          }

          @Override
          public void hide() {
            super.hide();
            if (EuclidianStyleBarW.CURRENT_POP_UP.equals(this)) {
              EuclidianStyleBarW.CURRENT_POP_UP = null;
            }
          }
        };
    myPopup.setAutoHideEnabled(true);
  }