/** * Returns the list that exclusively contains <code>view</code>. */ protected List getParentList(Object cell) { List list = null; if (cell instanceof DefaultMutableTreeNode) { Object parent = ((DefaultMutableTreeNode) cell).getParent(); if (parent instanceof DefaultGraphCell) list = ((DefaultGraphCell) parent).getChildren(); else list = roots; } return list; }
public GraphRelationship[] getRelationships(){ Vector v=new Vector(); Iterator ports=dgc.getChildren().iterator(); while (ports.hasNext()){ Object port=ports.next(); Iterator it=graph.getModel().edges(port); while (it.hasNext()){ org.jgraph.graph.Edge current= (org.jgraph.graph.Edge)it.next(); DefaultGraphCell extr=this.getExtreme(current); ingenias.editor.entities.NAryEdgeEntity nary= (ingenias.editor.entities.NAryEdgeEntity)extr.getUserObject(); v.add(nary); } } GraphRelationship[] result=new GraphRelationship[v.size()]; for (int k=0;k<result.length;k++){ result[k]=new GraphRelationshipImp((NAryEdgeEntity)v.elementAt(k),graph,ids); } return result; }
private HashSet<GraphRelationship> getRelationshipsFromAGraph(ingenias.editor.ModelJGraph graph){ HashSet<GraphRelationship> v=new HashSet<GraphRelationship>(); Enumeration dgcs=this.getCells(graph).elements(); while (dgcs.hasMoreElements()){ DefaultGraphCell dgc=(DefaultGraphCell)dgcs.nextElement(); if (dgc!=null && dgc.getChildren()!=null){ Iterator ports=dgc.getChildren().iterator(); while (ports.hasNext()){ Object port=ports.next(); Iterator it=graph.getModel().edges(port); while (it.hasNext()){ org.jgraph.graph.Edge current= (org.jgraph.graph.Edge)it.next(); DefaultGraphCell extr=this.getExtreme(current); ingenias.editor.entities.NAryEdgeEntity nary= (ingenias.editor.entities.NAryEdgeEntity)extr.getUserObject(); v.add(new GraphRelationshipImp(nary,graph,ids)); } } } } return v; }
@Override public GraphRelationship[] getRelationships(String type) { Vector v=new Vector(); Iterator ports=dgc.getChildren().iterator(); while (ports.hasNext()){ Object port=ports.next(); Iterator it=graph.getModel().edges(port); while (it.hasNext()){ org.jgraph.graph.Edge current= (org.jgraph.graph.Edge)it.next(); DefaultGraphCell extr=this.getExtreme(current); ingenias.editor.entities.NAryEdgeEntity nary= (ingenias.editor.entities.NAryEdgeEntity)extr.getUserObject(); if (nary.getType().equalsIgnoreCase(type)) v.add(nary); } } GraphRelationship[] result=new GraphRelationship[v.size()]; for (int k=0;k<result.length;k++){ result[k]=new GraphRelationshipImp((NAryEdgeEntity)v.elementAt(k),graph,ids); } return result; }
private boolean evaluateIfDefaultGraphCellHasToBeHighlighted( DefaultGraphCell dgc, boolean found, DefaultGraphCell toPaint) { if (dgc.getChildCount() > 0) { for (Object objectport : dgc.getChildren()) { if (objectport instanceof DefaultPort) { DefaultPort port = (DefaultPort) objectport; Iterator<DefaultEdge> edges = graph.getModel().edges(port); while (edges.hasNext() && !found) { DefaultEdge next = edges.next(); found = found || ((DefaultPort) (next.getTarget())) .getParent().equals(toPaint) || ((DefaultPort) (next.getSource())) .getParent().equals(toPaint); } } } } return found; }
if (userObject instanceof ingenias.editor.entities.NAryEdgeEntity) { DefaultGraphCell dgc = (DefaultGraphCell) vertex; Iterator ports = dgc.getChildren().iterator(); while (ports.hasNext()) { Object port = ports.next();