protected void layout(FlowElementsContainer flowElementsContainer) { graph = new mxGraph(); cellParent = graph.getDefaultParent(); graph.getModel().beginUpdate(); layout.setDisableEdgeStyle(false); layout.setUseBoundingBox(true); layout.execute(graph.getDefaultParent());
double y0 = x0; if (!moveTree || parent == graph.getDefaultParent() || parent == graph.getCurrentRoot()) { mxGeometry g = model.getGeometry(root); if (g.isRelative()) { if (model.getParent(node.cell) != graph.getCurrentRoot() && model.getParent(node.cell) != graph.getDefaultParent()) { moveNode(node, dx, dy);
public GraphEditor(String appTitle, mxGraphComponent component) { super(appTitle, component); final mxGraph graph = graphComponent.getGraph(); graph.insertVertex(graph.getDefaultParent(), null, "Test", 100, 100, 200, 100); ... }
/** * Generates a GD text output with the cells in the graph. * The implementation only uses the cells located in the default parent. * @param graph Graph with the cells. * @return The GD document generated. */ public static String encode(mxGraph graph) { StringBuilder builder = new StringBuilder(); Object parent = graph.getDefaultParent(); Object[] vertices = mxGraphModel.getChildCells(graph.getModel(), parent, true, false); builder.append("# Number of Nodes (0-" + String.valueOf(vertices.length - 1) + ")"); builder.append(String.valueOf(vertices.length)); // TODO return builder.toString(); } }
/** * Generates a GD text output with the cells in the graph. * The implementation only uses the cells located in the default parent. * @param graph Graph with the cells. * @return The GD document generated. */ public static String encode(mxGraph graph) { StringBuilder builder = new StringBuilder(); Object parent = graph.getDefaultParent(); Object[] vertices = mxGraphModel.getChildCells(graph.getModel(), parent, true, false); builder.append("# Number of Nodes (0-" + String.valueOf(vertices.length - 1) + ")"); builder.append(String.valueOf(vertices.length)); // TODO return builder.toString(); } }
private static void addStartTransition(mxGraph graph, STask<?> taskInicial, Map<String, Object> mapaVertice) { final Object v = graph.insertVertex(graph.getDefaultParent(), null, null, 20, 20, 20, 20); setStyle(v, "START"); final Object destiny = mapaVertice.get(taskInicial.getAbbreviation()); graph.insertEdge(graph.getDefaultParent(), null, null, v, destiny); }
private static void addStartTransition(mxGraph graph, MTask<?> taskInicial, Map<String, Object> mapaVertice) { final Object v = graph.insertVertex(graph.getDefaultParent(), null, null, 20, 20, 20, 20); setStyle(v, "START"); final Object destino = mapaVertice.get(taskInicial.getAbbreviation()); graph.insertEdge(graph.getDefaultParent(), null, null, v, destino); }
private static void addStartTransition(mxGraph graph, STask<?> taskInicial, Map<String, Object> mapaVertice) { final Object v = graph.insertVertex(graph.getDefaultParent(), null, null, 20, 20, 20, 20); setStyle(v, "START"); final Object destiny = mapaVertice.get(taskInicial.getAbbreviation()); graph.insertEdge(graph.getDefaultParent(), null, null, v, destiny); }
private static void addStartTransition(mxGraph graph, STask<?> taskInicial, Map<String, Object> mapaVertice) { final Object v = graph.insertVertex(graph.getDefaultParent(), null, null, 20, 20, 20, 20); setStyle(v, "START"); final Object destiny = mapaVertice.get(taskInicial.getAbbreviation()); graph.insertEdge(graph.getDefaultParent(), null, null, v, destiny); }
/** * @param graph * @param sourceVertex * @param targetVertex * @return Returns true if the two vertices are connected directly by an edge. If directed, the result is true if they are connected by an edge that points from source to target, if false direction isn't takein into account, just connectivity. */ public static boolean areConnected(mxAnalysisGraph aGraph, Object sourceVertex, Object targetVertex) { Object currEdges[] = aGraph.getEdges(sourceVertex, aGraph.getGraph().getDefaultParent(), true, true, false, true); List<Object> neighborList = Arrays.asList(aGraph.getOpposites(currEdges, sourceVertex, true, true)); return neighborList.contains(targetVertex); };
/** * @param graph * @param sourceVertex * @param targetVertex * @return Returns true if the two vertices are connected directly by an edge. If directed, the result is true if they are connected by an edge that points from source to target, if false direction isn't takein into account, just connectivity. */ public static boolean areConnected(mxAnalysisGraph aGraph, Object sourceVertex, Object targetVertex) { Object currEdges[] = aGraph.getEdges(sourceVertex, aGraph.getGraph().getDefaultParent(), true, true, false, true); List<Object> neighborList = Arrays.asList(aGraph.getOpposites(currEdges, sourceVertex, true, true)); return neighborList.contains(targetVertex); };
/** * @param aGraph * @param vertex * @return outdegree of <b>vertex</b> */ public static int outdegree(mxAnalysisGraph aGraph, Object vertex) { if (mxGraphProperties.isDirected(aGraph.getProperties(), mxGraphProperties.DEFAULT_DIRECTED)) { return aGraph.getEdges(vertex, aGraph.getGraph().getDefaultParent(), false, true, true, true).length; } else { return aGraph.getEdges(vertex, aGraph.getGraph().getDefaultParent(), true, true, true, true).length; } };
/** * @param aGraph * @param vertex * @return outdegree of <b>vertex</b> */ public static int outdegree(mxAnalysisGraph aGraph, Object vertex) { if (mxGraphProperties.isDirected(aGraph.getProperties(), mxGraphProperties.DEFAULT_DIRECTED)) { return aGraph.getEdges(vertex, aGraph.getGraph().getDefaultParent(), false, true, true, true).length; } else { return aGraph.getEdges(vertex, aGraph.getGraph().getDefaultParent(), true, true, true, true).length; } };
private static void createTransition(mxGraph graph, STransition transition, String transitionName, Map<String, Object> mapNodes) { Object origin = mapNodes.get(transition.getOrigin().getAbbreviation()); Object destiny = mapNodes.get(transition.getDestination().getAbbreviation()); String name = transitionName; if (transition.getDestination().getName().equals(transitionName)) { name = null; } graph.insertEdge(graph.getDefaultParent(), null, formatName(name), origin, destiny); }
private static void createTransition(mxGraph graph, STransition transition, Map<String, Object> mapNodes) { final Object origin = mapNodes.get(transition.getOrigin().getAbbreviation()); final Object destiny = mapNodes.get(transition.getDestination().getAbbreviation()); String name = transition.getName(); if (transition.getDestination().getName().equals(name)) { name = null; } else { name = formatName(name); } graph.insertEdge(graph.getDefaultParent(), null, name, origin, destiny); }
private static void createTransition(mxGraph graph, STransition transition, Map<String, Object> mapNodes) { final Object origin = mapNodes.get(transition.getOrigin().getAbbreviation()); final Object destiny = mapNodes.get(transition.getDestination().getAbbreviation()); String name = transition.getName(); if (transition.getDestination().getName().equals(name)) { name = null; } else { name = formatName(name); } graph.insertEdge(graph.getDefaultParent(), null, name, origin, destiny); }
private static void createTransition(mxGraph graph, MTransition transicao, Map<String, Object> mapaVertice) { final Object origem = mapaVertice.get(transicao.getOrigin().getAbbreviation()); final Object destino = mapaVertice.get(transicao.getDestination().getAbbreviation()); String nome = transicao.getName(); if (transicao.getDestination().getName().equals(nome)) { nome = null; } else { nome = formatarNome(nome); } graph.insertEdge(graph.getDefaultParent(), null, nome, origem, destino); }
public static mxGraph makeHelloWorldGraph() { mxGraph graph = new mxGraph(); Object parent = graph.getDefaultParent(); graph.getModel().beginUpdate(); try { Object v1 = graph.insertVertex(parent, null, "", 20, 20, 80, 30,"opacity=0"); Object v2 = graph.insertVertex(parent, null, "World!", 240, 150, 80, 30); graph.insertEdge(parent, null, "Edge", v1, v2); } finally { graph.getModel().endUpdate(); } return graph; }
public static void layout(mxGraphComponent graphComponent) { final mxGraph graph = graphComponent.getGraph(); final mxHierarchicalLayout layout = new mxHierarchicalLayout(graph); graph.getModel().beginUpdate(); try { layout.execute(graph.getDefaultParent()); } finally { graph.getModel().endUpdate(); } }
/** * Creates a new edge value based on graph properties in mxAnalysisGraph. Used mostly when creating new edges during graph generation. * @param aGraph * @return */ public Double getNewEdgeValue(mxAnalysisGraph aGraph) { if (getGeneratorFunction() != null) { mxGraph graph = aGraph.getGraph(); return getGeneratorFunction().getCost(graph.getView().getState(graph.getDefaultParent())); } else { return null; } };