Exemplo n.º 1
0
    @Override
    public void onEvent(Event event) throws Exception {
      try {
        if (node == null) return;

        // 过滤不需要处理的节点
        Treechildren mytreechildren = treeitem.getTreechildren();
        // 无子节点或者是处于收缩状态的节点
        if (mytreechildren == null
            || mytreechildren.getChildren().size() > 0
            || treeitem.isOpen() == false) return;
        // 是监测器节点的情况
        if (INode.MONITOR.equals(node.getType())) {
          return;
        }

        List<EccTreeItem> sons = node.getChildRen();
        // 查找其儿子
        if (sons != null && sons.size() > 0) {

          for (EccTreeItem son : sons) {
            if (son == null) continue;
            // 如果是监视器 -- 页节点
            if (INode.ENTITY.equals(son.getType())) {
              if (this.tree.getMonitorType() != null) {
                //								MonitorInfo monitorinfo =
                // this.tree.getTreemodel().getView().getMonitorInfo(son.getValue());
                EntityInfo entityInfo =
                    this.tree.getTreemodel().getView().getEntityInfo(son.getValue());
                if (!this.tree.getMonitorType().equals(entityInfo.getType())) {
                  continue;
                }
              }
              BaseTreeitem tii = getTreeitem(son);
              tii.setParent(mytreechildren);
            } else {
              if (existChildren(son)) {
                // 如果存在儿子
                BaseTreeitem tii = getTreeitem(son);
                tii.setParent(mytreechildren);
                Treechildren newtreechildren = new Treechildren();
                tii.appendChild(newtreechildren); // 给以可以展开的属性
                tii.addEventListener(
                    Events.ON_OPEN, new TreeitemOpenListener(tii, this.tree)); // 添加展开事件
              }
            }
          }
        }
      } catch (Exception e) {
        e.printStackTrace();
        Messagebox.show(e.getMessage(), "错误", Messagebox.OK, Messagebox.ERROR);
      }
    }
Exemplo n.º 2
0
  public List<String> getAllMonitors(String monitortype, EccTreeModel treemodel, EccTreeItem node) {
    List<String> retlist = new ArrayList<String>();

    INode inode = node.getValue();
    if (inode != null && INode.ENTITY.equals(inode.getType())) {
      if (monitortype != null) {
        EntityInfo entityInfo = treemodel.getView().getEntityInfo(node.getValue());
        if (!monitortype.equals(entityInfo.getType())) {
          return retlist;
        }
      }
      retlist.add(node.getId());
      return retlist;
    }
    for (EccTreeItem son : node.getChildRen()) {
      retlist.addAll(getAllMonitors2(treemodel, son));
    }
    return retlist;
  }