Esempio n. 1
0
 private void get_special_hide_dept_ids(int uid) {
   Integer did = findDidByUid(uid);
   DeptMaskItem deptMaskItem = null;
   while (did != null && did != 0) {
     special_hide_dept_ids.add(did);
     deptMaskItem = IMOApp.getApp().deptInfoMap.get(did);
     if (deptMaskItem == null) return;
     did = deptMaskItem.getParent_dept_id();
   }
 }
Esempio n. 2
0
  @Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {

    if (isFinishing()) {
      return true;
    }

    if (keyCode == KeyEvent.KEYCODE_MENU) {}

    if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
      LogFactory.d(TAG, "KEYCODE_BACK has clicked .");

      if (mStructNavView.getViewGroupChildCount() == 2) {
        mStructNavView.removeAllItemView();
        adapter.showChildNodes(rootNodeDept);
      } else {
        Node node = mStructNavView.getLastChildNode();
        if (node != null) {
          adapter.showChildNodes(node);
        } else {
          boolean keepOnline =
              (Boolean)
                  PreferenceManager.get(
                      Globe.SP_FILE, new Object[] {LoginActivity.LOGIN_KEEPONLINE, false});
          if (!keepOnline) {
            DialogFactory.promptExit(mContext).show();
          } else {
            IMOApp.getApp().hasRunInBackground = true;
            NoticeManager.updateRecoverAppNotice(notificationManager);
            Functions.backToDesk(this);
          }
        }
      }
      return true;
    }

    if (keyCode == KeyEvent.KEYCODE_SEARCH) {}

    return super.onKeyDown(keyCode, event);
  }
Esempio n. 3
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);
  }