Package com.extjs.gxt.ui.client.data

Examples of com.extjs.gxt.ui.client.data.TreeModel


  public void clearFilters() {
    if (isFiltered()) {
      filtersEnabled = false;
      snapshot = null;
      for (M m : all) {
        TreeModel wrap = findWrapper(m);
        wrap.remove("filtered");
      }
      fireEvent(Filter, createStoreEvent());
    }
  }
View Full Code Here


   */
  public M getChild(M parent, int index) {
    if (parent == null) {
      return getFilteredChildren(rootWrapper).get(index);
    }
    TreeModel p = findWrapper(parent);
    if (p != null) {
      return getFilteredChildren(p).get(index);
    }
    return null;
  }
View Full Code Here

   */
  public int getChildCount(M parent) {
    if (parent == null) {
      return getChildCount();
    } else {
      TreeModel p = findWrapper(parent);
      if (p != null) {
        return getFilteredChildren(p).size();
      }
      return -1;
    }
View Full Code Here

   * @param parent the parent
   * @param deep true to return all children recursively
   * @return the children or null if parent not found in the store
   */
  public List<M> getChildren(M parent, boolean deep) {
    TreeModel p = findWrapper(parent);
    if (p != null) {
      if (deep) {
        List<M> temp = new ArrayList<M>();
        List<M> children = getFilteredChildren(p);
        for (M child : children) {
View Full Code Here

   *
   * @param item the item
   * @return the item's parent
   */
  public M getParent(M item) {
    TreeModel child = findWrapper(item);
    if (child != null) {
      TreeModel p = child.getParent();
      if (p != null) {
        return unwrap(p);
      }
    }
    return null;
View Full Code Here

   */
  public boolean hasChildren(M parent) {
    if (parent == null) {
      return rootWrapper.getChildCount() > 0;
    } else {
      TreeModel p = findWrapper(parent);
      if (p != null) {
        for (ModelData child : p.getChildren()) {
          if (!isFiltered((TreeModel) child)) {
            return true;
          }
        }
      }
View Full Code Here

   * @param children the children
   * @param index the insert index
   * @param addChildren true to recursively add all children
   */
  public void insert(M parent, List<M> children, int index, boolean addChildren) {
    TreeModel wrapper = findWrapper(parent);
    if (wrapper != null) {
      List<TreeModel> insert = new ArrayList<TreeModel>();
      for (M model : children) {
        insert.add(wrap(model));
      }
View Full Code Here

   *
   * @param parent the parent model
   * @param child the child model
   */
  public void remove(M parent, M child) {
    TreeModel p = findWrapper(parent);
    TreeModel c = findWrapper(child);
    if (p != null && c != null) {
      remove(p, c, false);
    }
  }
View Full Code Here

   * Removes all the parent's children.
   *
   * @param parent the parent
   */
  public void removeAll(M parent) {
    TreeModel p = findWrapper(parent);
    if (p != null) {
      List<M> children = getChildren(parent);
      for (M m : children) {
        TreeModel child = findWrapper(m);
        if (child != null) {
          remove(p, child, false);
        }
      }
    }
View Full Code Here

        applyFilters(filterProperty);
      } else {
        fireEvent(DataChanged, new TreeStoreEvent(this));
      }
    } else {
      TreeModel wrapper = findWrapper((M) le.parent);
      if (wrapper != null) {
        if (wrapper.getChildren().size() > 0) {
          removeAll((M) le.parent);
        }
        List<TreeModel> insert = new ArrayList<TreeModel>();
        List<M> list = (List<M>) le.getData();
        for (M model : list) {
View Full Code Here

TOP

Related Classes of com.extjs.gxt.ui.client.data.TreeModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.