private void addVertices(Collection<Vertex> vertices) { for(Vertex vertex : vertices) { if (vertex.getNamespace() == null || vertex.getId() == null) { LoggerFactory.getLogger(this.getClass()).warn("Discarding invalid vertex: {}", vertex); continue; } LoggerFactory.getLogger(this.getClass()).trace("Adding vertex: {}", vertex); m_vertexMap.put(vertex.getId(), vertex); } }
private void addVertices(Collection<Vertex> vertices) { for(Vertex vertex : vertices) { if (vertex.getNamespace() == null || vertex.getId() == null) { LoggerFactory.getLogger(this.getClass()).warn("Discarding invalid vertex: {}", vertex); continue; } LoggerFactory.getLogger(this.getClass()).trace("Adding vertex: {}", vertex); m_vertexMap.put(vertex.getId(), vertex); } }
private void addVertices(Collection<Vertex> vertices) { for(Vertex vertex : vertices) { if (vertex.getNamespace() == null || vertex.getId() == null) { LoggerFactory.getLogger(this.getClass()).warn("Discarding invalid vertex: {}", vertex); continue; } LoggerFactory.getLogger(this.getClass()).trace("Adding vertex: {}", vertex); m_vertexMap.put(vertex.getId(), vertex); } }
private String createIconKey(Vertex vertex) { return String.format("%s.%s", vertex.getNamespace(), vertex.getId()); }
private String createIconKey(Vertex vertex) { return String.format("%s.%s", vertex.getNamespace(), vertex.getId()); }
public AbstractEdge(String namespace, String id, Vertex source, Vertex target) { super(namespace, id); if (source == null) { throw new IllegalArgumentException("Source is null"); } else if (target == null) { throw new IllegalArgumentException("Target is null"); } m_source = new SimpleConnector(namespace, id + "::" + source.getId(), source.getLabel() + " Connector", source, this); m_target = new SimpleConnector(namespace, id + "::" + target.getId(), target.getLabel() + " Connector", target, this); m_styleName = "edge"; }
@Override public void execute(List<VertexRef> targets, OperationContext operationContext) { GraphProvider graphProvider = operationContext.getGraphContainer().getBaseTopology(); Map<String, WrappedVertex> idMap = new HashMap<String, WrappedVertex>(); // first create all the vertices; List<WrappedVertex> vertices = new ArrayList<WrappedVertex>(); for(Vertex vertex : graphProvider.getVertices()) { WrappedVertex wrappedVertex = WrappedVertex.create(vertex); vertices.add(wrappedVertex); idMap.put(vertex.getId(), wrappedVertex); } // then set the parents for each for(Vertex vertex : graphProvider.getVertices()) { Vertex parent = graphProvider.getParent(vertex); if (parent != null) { WrappedVertex wrappedVertex = idMap.get(vertex.getId()); WrappedVertex wrappedParent = idMap.get(parent.getId()); wrappedVertex.parent = wrappedParent; } } // then create the edges List<WrappedEdge> edges = new ArrayList<WrappedEdge>(); for(Edge edge : graphProvider.getEdges()) { WrappedVertex wrappedSource = idMap.get(edge.getSource().getVertex().getId()); WrappedVertex wrappedTarget = idMap.get(edge.getTarget().getVertex().getId()); edges.add(new WrappedEdge(edge, wrappedSource, wrappedTarget)); } WrappedGraph graph = new WrappedGraph(graphProvider.getVertexNamespace(), vertices, edges); JAXB.marshal(graph, new File("/tmp/saved-graph.xml")); }
for (Vertex eachDisplayableVertex : graph.getDisplayVertices()) { if (eachDisplayableVertex.getNamespace().equals(eachSelectedVertex.getNamespace()) && eachDisplayableVertex.getId().equals(eachSelectedVertex.getId())) { newSelectedVertexRefs.add(eachSelectedVertex); break;
@Override public void execute(List<VertexRef> targets, OperationContext operationContext) { GraphProvider graphProvider = operationContext.getGraphContainer().getBaseTopology(); Map<String, WrappedVertex> idMap = new HashMap<String, WrappedVertex>(); // first create all the vertices; List<WrappedVertex> vertices = new ArrayList<WrappedVertex>(); for(Vertex vertex : graphProvider.getVertices()) { WrappedVertex wrappedVertex = WrappedVertex.create(vertex); vertices.add(wrappedVertex); idMap.put(vertex.getId(), wrappedVertex); } // then set the parents for each for(Vertex vertex : graphProvider.getVertices()) { Vertex parent = graphProvider.getParent(vertex); if (parent != null) { WrappedVertex wrappedVertex = idMap.get(vertex.getId()); WrappedVertex wrappedParent = idMap.get(parent.getId()); wrappedVertex.parent = wrappedParent; } } // then create the edges List<WrappedEdge> edges = new ArrayList<WrappedEdge>(); for(Edge edge : graphProvider.getEdges()) { WrappedVertex wrappedSource = idMap.get(edge.getSource().getVertex().getId()); WrappedVertex wrappedTarget = idMap.get(edge.getTarget().getVertex().getId()); edges.add(new WrappedEdge(edge, wrappedSource, wrappedTarget)); } WrappedGraph graph = new WrappedGraph(graphProvider.getVertexNamespace(), vertices, edges); JAXB.marshal(graph, new File("/tmp/saved-graph.xml")); }
for (Vertex eachDisplayableVertex : graph.getDisplayVertices()) { if (eachDisplayableVertex.getNamespace().equals(eachSelectedVertex.getNamespace()) && eachDisplayableVertex.getId().equals(eachSelectedVertex.getId())) { newSelectedVertexRefs.add(eachSelectedVertex); break;
final Collection<Vertex> vertices = graph.getDisplayVertices(); for (Vertex vertex : vertices) { PointEntity pointEntity = layoutEntity.getPosition(vertex.getNamespace(), vertex.getId()); layout.setLocation(vertex, new Point(pointEntity.getX(), pointEntity.getY()));
final Collection<Vertex> vertices = graph.getDisplayVertices(); for (Vertex vertex : vertices) { PointEntity pointEntity = layoutEntity.getPosition(vertex.getNamespace(), vertex.getId()); layout.setLocation(vertex, new Point(pointEntity.getX(), pointEntity.getY()));