Package org.jeecgframework.core.common.model.json

Examples of org.jeecgframework.core.common.model.json.ComboTree


  }

  @SuppressWarnings("unchecked")
  public ComboTree tree(TSDepart depart, boolean recursive) {
    ComboTree tree = new ComboTree();
    tree.setId(oConvertUtils.getString(depart.getId()));
    tree.setText(depart.getDepartname());
    List<TSDepart> departsList = findByProperty(TSDepart.class, "TSPDepart.id", depart.getId());
    if (departsList != null && departsList.size() > 0) {
      tree.setState("closed");
      tree.setChecked(false);
      if (recursive) {// 递归查询子节点
        List<TSDepart> departList = new ArrayList<TSDepart>(departsList);
        //Collections.sort(departList, new SetListSort());// 排序
        List<ComboTree> children = new ArrayList<ComboTree>();
        for (TSDepart d : departList) {
          ComboTree t = tree(d, true);
          children.add(t);
        }
        tree.setChildren(children);
      }
    }
View Full Code Here


  }

  // 构建ComboTree
  private ComboTree comboTree(Object obj, ComboTreeModel comboTreeModel, List in, boolean recursive) {
    ComboTree tree = new ComboTree();
    Map<String, Object> attributes = new HashMap<String, Object>();
    ReflectHelper reflectHelper = new ReflectHelper(obj);
    String id = oConvertUtils.getString(reflectHelper.getMethodValue(comboTreeModel.getIdField()));
    tree.setId(id);
    tree.setText(oConvertUtils.getString(reflectHelper.getMethodValue(comboTreeModel.getTextField())));
    if (comboTreeModel.getSrcField() != null) {
      attributes.put("href", oConvertUtils.getString(reflectHelper.getMethodValue(comboTreeModel.getSrcField())));
      tree.setAttributes(attributes);
    }
    if (in == null) {
    } else {
      if (in.size() > 0) {
        for (Object inobj : in) {
          ReflectHelper reflectHelper2 = new ReflectHelper(inobj);
          String inId = oConvertUtils.getString(reflectHelper2.getMethodValue(comboTreeModel.getIdField()));
          if (inId == id) {
            tree.setChecked(true);
          }
        }
      }
    }
    List tsFunctions = (List) reflectHelper.getMethodValue(comboTreeModel.getChildField());
    if (tsFunctions != null && tsFunctions.size() > 0) {
      tree.setState("closed");
      tree.setChecked(false);
      /*
       * if (recursive) {// 递归查询子节点 List<TSFunction> functionList = new ArrayList<TSFunction>(tsFunctions); Collections.sort(functionList, new SetListSort());// 排序 List<ComboTree> children = new ArrayList<ComboTree>(); for (TSFunction f : functionList) { ComboTree t = comboTree(f,comboTreeModel,in, true); children.add(t); } tree.setChildren(children); }
       */
    }
    return tree;
View Full Code Here

TOP

Related Classes of org.jeecgframework.core.common.model.json.ComboTree

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.