private Map<String, String> getServerByNodeId(String id) { Map<String, String> map = new LinkedHashMap<String, String>(); INode node = view.getNode(id); if (node == null) return map; if (INode.MONITOR.equals(node.getType())) { return map; } if (INode.ENTITY.equals(node.getType())) { EntityInfo entityinfo = view.getEntityInfo(node); if (entityinfo.getDeviceType() != null) { if ("_win".equals(entityinfo.getDeviceType()) || "_unix".equals(entityinfo.getDeviceType())) { map.put( entityinfo.getSvId(), entityinfo.getName() + "(" + entityinfo.getDeviceType() + ")"); return map; } } } IForkNode f = (IForkNode) node; List<String> ids = f.getSonList(); for (String newid : ids) { map.putAll(this.getServerByNodeId(newid)); } return map; }
public INode getSelectedNode() { Treeitem item = getSelectTree().getSelectedItem(); if (item == null) return null; EccTreeItem itemNode = (EccTreeItem) item.getValue(); INode node = itemNode.getValue(); if (!node.getType().equals(INode.MONITOR)) return null; return node; }
public static List<String> getAllMonitors2(EccTreeModel treemodel, EccTreeItem node) { List<String> retlist = new ArrayList<String>(); INode inode = node.getValue(); if (inode == null) return retlist; if (INode.ENTITY.equals(inode.getType())) { retlist.add(node.getId()); return retlist; } for (EccTreeItem son : node.getChildRen()) { retlist.addAll(getAllMonitors2(treemodel, son)); } return retlist; }
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; }