Exemple #1
0
  private MenuItem findItem(Element hItem) {
    for (int i = 0; i < items.size(); ++i) {
      final MenuItem item = items.get(i);
      if (DOM.isOrHasChild(item.getElement(), hItem)) {
        return item;
      }
    }

    return null;
  }
Exemple #2
0
  /**
   * Adds a menu item to the bar.
   *
   * @param item the item to be added
   */
  public void addItem(MenuItem item) {
    Element tr;
    if (vertical) {
      tr = DOM.createTR();
      DOM.appendChild(body, tr);
    } else {
      tr = DOM.getChild(body, 0);
    }

    DOM.appendChild(tr, item.getElement());

    item.setParentMenu(this);
    item.setSelectionStyle(false);
    items.add(item);
  }