コード例 #1
0
  @Override
  public void release() {
    for (MenuItemPresenter menuItem : menuItems) {
      menuItem.release();
    }

    for (HandlerRegistration handler : handlers) {
      handler.removeHandler();
    }
    handlers.clear();
  }
コード例 #2
0
  @Override
  public void bind() {
    for (MenuItemPresenter menuItem : menuItems) {
      menuItem.bind();
    }
    handlers.add(
        display
            .getLabel()
            .addClickHandler(
                new ClickHandler() {

                  @Override
                  public void onClick(ClickEvent event) {
                    display.setPopupVisible(!display.isPopupVisible());
                  }
                }));
  }
コード例 #3
0
  public void addMenuItem(
      final String label, final ImageResource icon, boolean disabled, final Runnable operation) {
    MenuItemPresenter item = menuItemProvider.get();
    item.setContent(
        label,
        icon,
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            display.setPopupVisible(false);
            if (operation != null) {
              operation.run();
            }
          }
        });
    item.setDisabled(disabled);
    menuItems.add(item);
    display.add(item.getDisplay());
  }