Example #1
0
  /**
   * Expands an item.
   *
   * @param itemId the item id.
   * @param sendChildTree flag to indicate if client needs subtree or not (may be cached)
   * @return True if the expand operation succeeded
   */
  private boolean expandItem(Object itemId, boolean sendChildTree) {

    // Succeeds if the node is already expanded
    if (isExpanded(itemId)) {
      return true;
    }

    // Nodes that can not have children are not expandable
    if (!areChildrenAllowed(itemId)) {
      return false;
    }

    // Expands
    expanded.add(itemId);

    expandedItemId = itemId;
    if (initialPaint) {
      markAsDirty();
    } else if (sendChildTree) {
      requestPartialRepaint();
    }
    fireExpandEvent(itemId);

    return true;
  }