示例#1
0
 /** build Empty Tree */
 private void buildEmptyTree() {
   mGlobal.rootNodeContact.setDept(true);
   mGlobal.rootNodeInner.setDept(true);
   mGlobal.rootNodeOuter.setDept(true);
   NodeManager.addChildNode(mGlobal.rootNodeContact, mGlobal.rootNodeInner);
   NodeManager.addChildNode(mGlobal.rootNodeContact, mGlobal.rootNodeOuter);
 }
示例#2
0
  /**
   * build Outer Contact Tree
   *
   * <p>flag = 0x40
   */
  private void buildOuterContactTree() {

    NodeManager.clearChildNode(mGlobal.rootNodeOuter);

    for (Integer groupId : mGlobal.outerGroupIdMap.keySet()) {

      OuterContactorItem item = mGlobal.outerGroupIdMap.get(groupId);
      Node outerGroupNode = new Node(new NodeData(item.getGroupName(), ""));
      outerGroupNode.setId(item.getGroupID());
      outerGroupNode.setDept(true);
      NodeManager.addChildNode(mGlobal.rootNodeOuter, outerGroupNode);

      ArrayList<OuterContactItem> outerContact_ID_Items = mGlobal.outerGroupContactMap.get(groupId);

      if (outerContact_ID_Items != null) {
        for (int i = 0; i < outerContact_ID_Items.size(); i++) {
          int uid = outerContact_ID_Items.get(i).getUid();
          OuterContactBasicInfo info = mGlobal.outerContactInfoMap.get(uid);

          String cropName = "";
          if (info != null) {
            cropName = mGlobal.outerContactCorpMap.get(info.getCid());
          }

          if (cropName == null || cropName.trim().equals("")) {
            cropName = "";
          } else {
            cropName = " — " + cropName;
          }

          if (info != null) {
            Node contactNode =
                new Node(new NodeData(isBoy(info.getGender()), (info.getName() + cropName)));
            contactNode.setCid(info.getCid());
            contactNode.setId(info.getUid());
            contactNode.setNeedShow(isNeedShow(groupId, uid));
            mGlobal.mNodeMap.put(contactNode.getId(), contactNode);
            NodeManager.addChildNode(outerGroupNode, contactNode);
          } else {
            LogFactory.d(TAG, " OuterContactInfoItem == null");
          }
        }
      } else {
        LogFactory.d(TAG, "outer groupId = " + groupId + " is Empty...");
      }
    }
  }
示例#3
0
  /** build Inner Contact Tree */
  private void buildInnerContactTree() {
    NodeManager.clearChildNode(mGlobal.rootNodeInner);
    // /根据数据Map构建Node对象,添加到AllNodeList中去。只是添加分组Node
    for (Integer groupId : mGlobal.innerGroupIdMap.keySet()) { // //mGlobal.
      // 使用全局数据
      InnerContactorItem item = mGlobal.innerGroupIdMap.get(groupId);
      Node innerGroupNode = new Node(new NodeData(item.getGroupName(), ""));
      innerGroupNode.setId(item.getGroupID());
      innerGroupNode.setDept(true);
      NodeManager.addChildNode(mGlobal.rootNodeInner, innerGroupNode);

      ArrayList<EmployeeInfoItem> employeeInfoItems = mGlobal.mInnerGroupContactMap.get(groupId);

      if (employeeInfoItems != null) {
        for (int i = 0; i < employeeInfoItems.size(); i++) {
          EmployeeInfoItem info = employeeInfoItems.get(i);
          String sign = "";
          if (info != null) {
            sign = mGlobal.innerContactWorkSignMap.get(info.getUid());
          }
          if (sign == null || sign.trim().equals("")) {
            sign = "";
          } else {
            sign = " — " + sign;
          }

          if (info != null) {
            Node contactNode =
                new Node(new NodeData(isBoy(info.getGender()), (info.getName() + sign)));
            contactNode.setId(info.getUid());
            NodeManager.addChildNode(innerGroupNode, contactNode);
          } else {
            LogFactory.d(TAG, " EmployeeInfoItem == null");
          }
        }
      } else {
        LogFactory.d(TAG, "groupId = " + groupId + " is Empty...");
      }
    }
  }
示例#4
0
  /**
   * @param parentNode 部门节点
   * @param curEmployeeInfo 当前的用户信息
   * @param deptUserInfoMap 部门UserInfoMap
   */
  private EmployeeInfoItem addUserNode(
      Node parentNode,
      EmployeeInfoItem curEmployeeInfo,
      HashMap<Integer, EmployeeInfoItem> deptUserInfoMap,
      HashMap<Integer, Integer> deptUserSiblingMapItem) {

    curEmployeeInfo.getUid();

    int siblingId = deptUserSiblingMapItem.get(curEmployeeInfo.getUid());

    EmployeeInfoItem employeeInfoItem = null;

    if (siblingId != -1) {

      // LogFactory.d("siblingId", "siblingId= " + siblingId);

      employeeInfoItem = deptUserInfoMap.get(siblingId); // /nullpoint
      // employeeInfoItem
      // = null

      boolean isBoy = isBoy(employeeInfoItem.getGender());

      String nodeName = employeeInfoItem.getName();

      Node leafNode = new Node(new NodeData(isBoy, nodeName));
      if (mGlobal.userStateMap != null) {
        leafNode.setOnLineState(mGlobal.userStateMap.get(employeeInfoItem.getUid()));
      }

      leafNode.setId(employeeInfoItem.getUid());

      NodeManager.addChildNode(parentNode, leafNode);

      // userNodeMapItem.put(curEmployeeInfo.getUid(), leafNode);//////

      this.curNode = leafNode;
    }
    return employeeInfoItem;
  }
示例#5
0
  private void addDeptUser(Node deptNode, DeptMaskItem deptMaskItem) {

    int dept_first_userId = deptMaskItem.getFfirst_user();

    if (dept_first_userId != -1) { // ////////

      // userNodeMapItem = new HashMap<Integer, Node>();//////

      EmployeeInfoItem curEmployeeInfo =
          mGlobal.deptUserInfoMap.get(deptMaskItem.getDept_id()).get(dept_first_userId);

      // build the first user node
      Node curNode =
          new Node(new NodeData(isBoy(curEmployeeInfo.getGender()), curEmployeeInfo.getName()));
      curNode.setId(curEmployeeInfo.getUid()); // ====
      curNode.setOnLineState(mGlobal.userStateMap.get(curEmployeeInfo.getUid()));
      NodeManager.addChildNode(deptNode, curNode);

      // userNodeMapItem.put(curEmployeeInfo.getUid(), curNode);//////

      // 添加单个部门的员工UserInfo Map
      HashMap<Integer, EmployeeInfoItem> userInfoMap =
          mGlobal.deptUserInfoMap.get(deptMaskItem.getDept_id());

      HashMap<Integer, Integer> deptUserSiblingMapItem =
          mGlobal.deptUserSiblingMap.get(deptMaskItem.getDept_id());

      // 在该部门中依次添加用户节点
      for (int j = 0; j < mGlobal.deptUserIdsMap.get(deptMaskItem.getDept_id()).length - 1; j++) {
        curEmployeeInfo =
            addUserNode(deptNode, curEmployeeInfo, userInfoMap, deptUserSiblingMapItem);
        if (curEmployeeInfo == null) {
          break;
        }
      }

      // userNodeMap.put(deptNode.getId(), userNodeMapItem);//////
    }
  }
示例#6
0
  /** 使用递归实现DeptNode的排序 */
  public void sortDeptNode(Node node) {
    // ArrayList<Node> childNodes = node.getChildNodes();
    ArrayList<Node> tempNodes = new ArrayList<Node>();
    // //实现排序
    int deptId = node.getId();
    int firstChildId = mGlobal.deptInfoMap.get(deptId).getFirst_child();
    Node curDeptNode1 = nodeMap.get(firstChildId);
    while (curDeptNode1 != null) {
      tempNodes.add(curDeptNode1);
      int nextId = deptNodeNextSiblingMap.get(curDeptNode1.getId());
      curDeptNode1 = nodeMap.get(nextId);
    }
    node.setChildNodes(tempNodes);

    for (int i = 0; i < tempNodes.size(); i++) {
      Node tempNode = tempNodes.get(i);
      if (NodeManager.isLeaf(tempNode)) {
        continue;
      } else {
        sortDeptNode(tempNode);
      }
    }
  }
示例#7
0
  /** 构建组织架构部门树 */
  private void buildOrganizeTree() {
    // 1-构建DeptNode
    if (mGlobal.deptid == null) {
      return;
    }

    for (int i = 0; i < mGlobal.deptid.length; i++) {
      int id = mGlobal.deptid[i];

      DeptMaskItem deptInfo = mGlobal.deptInfoMap.get(id);
      if (deptInfo == null) {
        IMOApp.getApp().turn2LoginForLogout();
        return;
      }
      Node deptNode = null;
      if (deptInfo.getDept_id() == 0) {
        deptNode = new Node(new NodeData("组织结构"));
      } else {
        deptNode = new Node(new NodeData(deptInfo.getName()));
      }
      deptNode.setId(deptInfo.getDept_id());
      deptNode.setDept(true);
      // if (currentDeptNeedHide(id))
      // deptNode.setNeedShow(false);
      nodeMap.put(deptInfo.getDept_id(), deptNode);
      deptNodeNextSiblingMap.put(deptInfo.getDept_id(), deptInfo.getNext_sibling());
      deptIdList.add(deptInfo.getDept_id());
    }

    for (int i = 0; i < mGlobal.deptid.length; i++) {
      int id = mGlobal.deptid[i];
      Node curDeptNode = nodeMap.get(id);
      if (id != 0) {
        DeptMaskItem deptInfo = mGlobal.deptInfoMap.get(id);

        int parentId = deptInfo.getParent_dept_id();
        Node parentNode = nodeMap.get(parentId);

        if (parentNode != null) {
          NodeManager.addChildNode(parentNode, curDeptNode);
        }

        int firstChildId = deptInfo.getFirst_child();
        if (firstChildId != -1) {
          // 添加child
          Node firstChildNode = nodeMap.get(firstChildId);
          NodeManager.addChildNode(curDeptNode, firstChildNode);
        }
      }
    }
    // 隐藏部门
    for (Integer did : IMOApp.getApp().hide_dept_ids) {
      if (nodeMap == null) break;
      Node node = nodeMap.get(did);
      if (node == null) continue;
      node.setNeedShow(false);
      ArrayList<Node> nodes = node.getChildNodes();
      for (Node node1 : nodes) {
        node1.setNeedShow(false);
      }
    }
    // 显示自己
    System.out.println("显示部门列表:" + Arrays.toString(special_hide_dept_ids.toArray()));
    for (Integer did : special_hide_dept_ids) {
      if (nodeMap == null) break;
      Node node = nodeMap.get(did);
      if (node == null) continue;
      node.setNeedShow(true);
    }

    Node rootNode = nodeMap.get(0);
    sortDeptNode(rootNode);
  }