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

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


   * @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

        }
      }
      doInsert(rootWrapper, insert, 0, false, true);
      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

      } else {
        modelFastMap = new FastMap<TreeModel>();
        useKeyProvider = true;
      }
    }
    TreeModel wrapper = new BaseTreeModel();
    wrapper.set("id", String.valueOf(counter++));
    if (useKeyProvider) {
      modelFastMap.put(getKey(model), wrapper);
    } else {
      modelMap.put(model, wrapper);
    }
    wrapperMap.put(wrapper.<String> get("id"), model);
    return wrapper;
  }
View Full Code Here

      if (addChildren) {
        for (TreeModel sub : children) {
          M model = unwrap(sub);
          if (model instanceof TreeModel) {
            TreeModel treeSub = (TreeModel) model;
            List<TreeModel> insert = new ArrayList<TreeModel>();
            List<M> c = (List) treeSub.getChildren();
            for (M m : c) {
              insert.add(wrap(m));
            }
            doInsert(sub, insert, getChildCount(model), true, false);
            update(model);
View Full Code Here

  }

  private void filterTreeWrap(TreeModel wrap) {
    List<ModelData> children = wrap.getChildren();
    for (int i = 0, len = children.size(); i < len; i++) {
      TreeModel tm = (TreeModel) children.get(i);
      if (isOrDecendantSelected(tm, unwrap(tm))) {
        tm.set("filtered", "false");
      } else {
        tm.set("filtered", "true");
      }
      filterTreeWrap(tm);
    }
  }
View Full Code Here

    if (!isFiltered(model, filterProperty)) {
      return true;
    }
    List<ModelData> children = wrap.getChildren();
    for (int i = 0, len = children.size(); i < len; i++) {
      TreeModel tm = (TreeModel) children.get(i);
      boolean result = isOrDecendantSelected(tm, unwrap(tm));
      if (result) {
        return true;
      }
    }
View Full Code Here

  }

  protected void appendModel(ModelData p, List<ModelData> models, int index) {
    if (models.size() == 0) return;
    if (models.get(0) instanceof TreeModel) {
      TreeModel test = (TreeModel) models.get(0);
      // drop is in form from tree store
      if (test.getPropertyNames().contains("model")) {

        List<ModelData> children = new ArrayList<ModelData>();
        for (ModelData tm : models) {
          ModelData child = tm.get("model");
          children.add(child);
View Full Code Here

  }

  protected void appendModel(ModelData p, List<ModelData> models, int index) {
    if (models.size() == 0) return;
    if (models.get(0) instanceof TreeModel) {
      TreeModel test = (TreeModel) models.get(0);
      // drop is in form from tree store
      if (test.getPropertyNames().contains("model")) {

        List<ModelData> children = new ArrayList<ModelData>();
        for (ModelData tm : models) {
          ModelData child = tm.get("model");
          children.add(child);
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.