com.mxgraph.view.mxGraph.getDefaultParent()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(251)

本文整理了Java中com.mxgraph.view.mxGraph.getDefaultParent()方法的一些代码示例,展示了mxGraph.getDefaultParent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。mxGraph.getDefaultParent()方法的具体详情如下:
包路径:com.mxgraph.view.mxGraph
类名称:mxGraph
方法名:getDefaultParent

mxGraph.getDefaultParent介绍

[英]Returns the first child of the root in the model, that is, the first or default layer of the diagram.
[中]返回模型中根的第一个子级,即图表的第一层或默认层。

代码示例

代码示例来源:origin: Activiti/Activiti

  1. protected void layout(FlowElementsContainer flowElementsContainer) {
  2. graph = new mxGraph();
  3. cellParent = graph.getDefaultParent();
  4. graph.getModel().beginUpdate();
  5. layout.setDisableEdgeStyle(false);
  6. layout.setUseBoundingBox(true);
  7. layout.execute(graph.getDefaultParent());

代码示例来源:origin: Activiti/Activiti

  1. double y0 = x0;
  2. if (!moveTree || parent == graph.getDefaultParent() || parent == graph.getCurrentRoot()) {
  3. mxGeometry g = model.getGeometry(root);
  4. if (g.isRelative()) {
  5. if (model.getParent(node.cell) != graph.getCurrentRoot() && model.getParent(node.cell) != graph.getDefaultParent()) {
  6. moveNode(node, dx, dy);

代码示例来源:origin: stackoverflow.com

  1. public GraphEditor(String appTitle, mxGraphComponent component)
  2. {
  3. super(appTitle, component);
  4. final mxGraph graph = graphComponent.getGraph();
  5. graph.insertVertex(graph.getDefaultParent(), null, "Test", 100, 100, 200, 100);
  6. ...
  7. }

代码示例来源:origin: com.github.vlsi.mxgraph/jgraphx

  1. /**
  2. * Generates a GD text output with the cells in the graph.
  3. * The implementation only uses the cells located in the default parent.
  4. * @param graph Graph with the cells.
  5. * @return The GD document generated.
  6. */
  7. public static String encode(mxGraph graph)
  8. {
  9. StringBuilder builder = new StringBuilder();
  10. Object parent = graph.getDefaultParent();
  11. Object[] vertices = mxGraphModel.getChildCells(graph.getModel(), parent, true, false);
  12. builder.append("# Number of Nodes (0-" + String.valueOf(vertices.length - 1) + ")");
  13. builder.append(String.valueOf(vertices.length));
  14. // TODO
  15. return builder.toString();
  16. }
  17. }

代码示例来源:origin: org.tinyjee.jgraphx/jgraphx

  1. /**
  2. * Generates a GD text output with the cells in the graph.
  3. * The implementation only uses the cells located in the default parent.
  4. * @param graph Graph with the cells.
  5. * @return The GD document generated.
  6. */
  7. public static String encode(mxGraph graph)
  8. {
  9. StringBuilder builder = new StringBuilder();
  10. Object parent = graph.getDefaultParent();
  11. Object[] vertices = mxGraphModel.getChildCells(graph.getModel(), parent, true, false);
  12. builder.append("# Number of Nodes (0-" + String.valueOf(vertices.length - 1) + ")");
  13. builder.append(String.valueOf(vertices.length));
  14. // TODO
  15. return builder.toString();
  16. }
  17. }

代码示例来源:origin: org.opensingular/singular-server-commons

  1. private static void addStartTransition(mxGraph graph, STask<?> taskInicial, Map<String, Object> mapaVertice) {
  2. final Object v = graph.insertVertex(graph.getDefaultParent(), null, null, 20, 20, 20, 20);
  3. setStyle(v, "START");
  4. final Object destiny = mapaVertice.get(taskInicial.getAbbreviation());
  5. graph.insertEdge(graph.getDefaultParent(), null, null, v, destiny);
  6. }

代码示例来源:origin: org.opensingular/server-commons

  1. private static void addStartTransition(mxGraph graph, MTask<?> taskInicial, Map<String, Object> mapaVertice) {
  2. final Object v = graph.insertVertex(graph.getDefaultParent(), null, null, 20, 20, 20, 20);
  3. setStyle(v, "START");
  4. final Object destino = mapaVertice.get(taskInicial.getAbbreviation());
  5. graph.insertEdge(graph.getDefaultParent(), null, null, v, destino);
  6. }

代码示例来源:origin: org.opensingular/singular-requirement-commons

  1. private static void addStartTransition(mxGraph graph, STask<?> taskInicial, Map<String, Object> mapaVertice) {
  2. final Object v = graph.insertVertex(graph.getDefaultParent(), null, null, 20, 20, 20, 20);
  3. setStyle(v, "START");
  4. final Object destiny = mapaVertice.get(taskInicial.getAbbreviation());
  5. graph.insertEdge(graph.getDefaultParent(), null, null, v, destiny);
  6. }

代码示例来源:origin: org.opensingular/singular-requirement-module

  1. private static void addStartTransition(mxGraph graph, STask<?> taskInicial, Map<String, Object> mapaVertice) {
  2. final Object v = graph.insertVertex(graph.getDefaultParent(), null, null, 20, 20, 20, 20);
  3. setStyle(v, "START");
  4. final Object destiny = mapaVertice.get(taskInicial.getAbbreviation());
  5. graph.insertEdge(graph.getDefaultParent(), null, null, v, destiny);
  6. }

代码示例来源:origin: com.github.vlsi.mxgraph/jgraphx

  1. /**
  2. * @param graph
  3. * @param sourceVertex
  4. * @param targetVertex
  5. * @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.
  6. */
  7. public static boolean areConnected(mxAnalysisGraph aGraph, Object sourceVertex, Object targetVertex)
  8. {
  9. Object currEdges[] = aGraph.getEdges(sourceVertex, aGraph.getGraph().getDefaultParent(), true, true, false, true);
  10. List<Object> neighborList = Arrays.asList(aGraph.getOpposites(currEdges, sourceVertex, true, true));
  11. return neighborList.contains(targetVertex);
  12. };

代码示例来源:origin: org.tinyjee.jgraphx/jgraphx

  1. /**
  2. * @param graph
  3. * @param sourceVertex
  4. * @param targetVertex
  5. * @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.
  6. */
  7. public static boolean areConnected(mxAnalysisGraph aGraph, Object sourceVertex, Object targetVertex)
  8. {
  9. Object currEdges[] = aGraph.getEdges(sourceVertex, aGraph.getGraph().getDefaultParent(), true, true, false, true);
  10. List<Object> neighborList = Arrays.asList(aGraph.getOpposites(currEdges, sourceVertex, true, true));
  11. return neighborList.contains(targetVertex);
  12. };

代码示例来源:origin: org.tinyjee.jgraphx/jgraphx

  1. /**
  2. * @param aGraph
  3. * @param vertex
  4. * @return outdegree of <b>vertex</b>
  5. */
  6. public static int outdegree(mxAnalysisGraph aGraph, Object vertex)
  7. {
  8. if (mxGraphProperties.isDirected(aGraph.getProperties(), mxGraphProperties.DEFAULT_DIRECTED))
  9. {
  10. return aGraph.getEdges(vertex, aGraph.getGraph().getDefaultParent(), false, true, true, true).length;
  11. }
  12. else
  13. {
  14. return aGraph.getEdges(vertex, aGraph.getGraph().getDefaultParent(), true, true, true, true).length;
  15. }
  16. };

代码示例来源:origin: com.github.vlsi.mxgraph/jgraphx

  1. /**
  2. * @param aGraph
  3. * @param vertex
  4. * @return outdegree of <b>vertex</b>
  5. */
  6. public static int outdegree(mxAnalysisGraph aGraph, Object vertex)
  7. {
  8. if (mxGraphProperties.isDirected(aGraph.getProperties(), mxGraphProperties.DEFAULT_DIRECTED))
  9. {
  10. return aGraph.getEdges(vertex, aGraph.getGraph().getDefaultParent(), false, true, true, true).length;
  11. }
  12. else
  13. {
  14. return aGraph.getEdges(vertex, aGraph.getGraph().getDefaultParent(), true, true, true, true).length;
  15. }
  16. };

代码示例来源:origin: org.opensingular/singular-requirement-module

  1. private static void createTransition(mxGraph graph, STransition transition, String transitionName,
  2. Map<String, Object> mapNodes) {
  3. Object origin = mapNodes.get(transition.getOrigin().getAbbreviation());
  4. Object destiny = mapNodes.get(transition.getDestination().getAbbreviation());
  5. String name = transitionName;
  6. if (transition.getDestination().getName().equals(transitionName)) {
  7. name = null;
  8. }
  9. graph.insertEdge(graph.getDefaultParent(), null, formatName(name), origin, destiny);
  10. }

代码示例来源:origin: org.opensingular/singular-requirement-commons

  1. private static void createTransition(mxGraph graph, STransition transition, Map<String, Object> mapNodes) {
  2. final Object origin = mapNodes.get(transition.getOrigin().getAbbreviation());
  3. final Object destiny = mapNodes.get(transition.getDestination().getAbbreviation());
  4. String name = transition.getName();
  5. if (transition.getDestination().getName().equals(name)) {
  6. name = null;
  7. } else {
  8. name = formatName(name);
  9. }
  10. graph.insertEdge(graph.getDefaultParent(), null, name, origin, destiny);
  11. }

代码示例来源:origin: org.opensingular/singular-server-commons

  1. private static void createTransition(mxGraph graph, STransition transition, Map<String, Object> mapNodes) {
  2. final Object origin = mapNodes.get(transition.getOrigin().getAbbreviation());
  3. final Object destiny = mapNodes.get(transition.getDestination().getAbbreviation());
  4. String name = transition.getName();
  5. if (transition.getDestination().getName().equals(name)) {
  6. name = null;
  7. } else {
  8. name = formatName(name);
  9. }
  10. graph.insertEdge(graph.getDefaultParent(), null, name, origin, destiny);
  11. }

代码示例来源:origin: org.opensingular/server-commons

  1. private static void createTransition(mxGraph graph, MTransition transicao, Map<String, Object> mapaVertice) {
  2. final Object origem = mapaVertice.get(transicao.getOrigin().getAbbreviation());
  3. final Object destino = mapaVertice.get(transicao.getDestination().getAbbreviation());
  4. String nome = transicao.getName();
  5. if (transicao.getDestination().getName().equals(nome)) {
  6. nome = null;
  7. } else {
  8. nome = formatarNome(nome);
  9. }
  10. graph.insertEdge(graph.getDefaultParent(), null, nome, origem, destino);
  11. }

代码示例来源:origin: stackoverflow.com

  1. public static mxGraph makeHelloWorldGraph() {
  2. mxGraph graph = new mxGraph();
  3. Object parent = graph.getDefaultParent();
  4. graph.getModel().beginUpdate();
  5. try {
  6. Object v1 = graph.insertVertex(parent, null, "", 20, 20, 80,
  7. 30,"opacity=0");
  8. Object v2 = graph.insertVertex(parent, null, "World!", 240, 150,
  9. 80, 30);
  10. graph.insertEdge(parent, null, "Edge", v1, v2);
  11. } finally {
  12. graph.getModel().endUpdate();
  13. }
  14. return graph;
  15. }

代码示例来源:origin: org.gdl-lang.gdl-tools/gdl-graph

  1. public static void layout(mxGraphComponent graphComponent) {
  2. final mxGraph graph = graphComponent.getGraph();
  3. final mxHierarchicalLayout layout = new mxHierarchicalLayout(graph);
  4. graph.getModel().beginUpdate();
  5. try {
  6. layout.execute(graph.getDefaultParent());
  7. } finally {
  8. graph.getModel().endUpdate();
  9. }
  10. }

代码示例来源:origin: org.tinyjee.jgraphx/jgraphx

  1. /**
  2. * Creates a new edge value based on graph properties in mxAnalysisGraph. Used mostly when creating new edges during graph generation.
  3. * @param aGraph
  4. * @return
  5. */
  6. public Double getNewEdgeValue(mxAnalysisGraph aGraph)
  7. {
  8. if (getGeneratorFunction() != null)
  9. {
  10. mxGraph graph = aGraph.getGraph();
  11. return getGeneratorFunction().getCost(graph.getView().getState(graph.getDefaultParent()));
  12. }
  13. else
  14. {
  15. return null;
  16. }
  17. };

相关文章

mxGraph类方法