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

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

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

mxGraph.cloneCells介绍

[英]Clones all cells in the given array. To clone all children in a cell and add them to another graph: graph2.addCells(graph.cloneCells(new Object[] { parent })); To clone all children in a graph layer if graph g1 and put them into the default parent (typically default layer) of another graph g2, the following code is used: g2.addCells(g1.cloneCells(g1.cloneCells(g1.getChildCells(g1.getDefaultParent()));
[中]克隆给定数组中的所有单元格。要克隆一个单元格中的所有子图形并将其添加到另一个图形中:graph2.addCells(graph.cloneCells(new Object[] { parent }));要克隆图形g1中图形层中的所有子图形并将其放入另一个图形g2的默认父图形(通常为默认层),请使用以下代码:g2.addCells(g1.cloneCells(g1.cloneCells(g1.getChildCells(g1.getDefaultParent()));

代码示例

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

  1. /**
  2. * Clones all cells in the given array. To clone all children in a cell and
  3. * add them to another graph:
  4. *
  5. * <code>
  6. * graph2.addCells(graph.cloneCells(new Object[] { parent }));
  7. * </code>
  8. *
  9. * To clone all children in a graph layer if graph g1 and put them into the
  10. * default parent (typically default layer) of another graph g2, the
  11. * following code is used:
  12. *
  13. * <code>
  14. * g2.addCells(g1.cloneCells(g1.cloneCells(g1.getChildCells(g1.getDefaultParent()));
  15. * </code>
  16. */
  17. public Object[] cloneCells(Object[] cells)
  18. {
  19. return cloneCells(cells, true);
  20. }

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

  1. /**
  2. * Clones all cells in the given array. To clone all children in a cell and
  3. * add them to another graph:
  4. *
  5. * <code>
  6. * graph2.addCells(graph.cloneCells(new Object[] { parent }));
  7. * </code>
  8. *
  9. * To clone all children in a graph layer if graph g1 and put them into the
  10. * default parent (typically default layer) of another graph g2, the
  11. * following code is used:
  12. *
  13. * <code>
  14. * g2.addCells(g1.cloneCells(g1.cloneCells(g1.getChildCells(g1.getDefaultParent()));
  15. * </code>
  16. */
  17. public Object[] cloneCells(Object[] cells)
  18. {
  19. return cloneCells(cells, true);
  20. }

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

  1. /**
  2. *
  3. */
  4. public mxGraphTransferable createGraphTransferable(
  5. mxGraphComponent graphComponent, Object[] cells,
  6. mxRectangle bounds, ImageIcon icon)
  7. {
  8. return new mxGraphTransferable(graphComponent.getGraph().cloneCells(
  9. cells), bounds, icon);
  10. }

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

  1. /**
  2. *
  3. */
  4. public mxGraphTransferable createGraphTransferable(
  5. mxGraphComponent graphComponent, Object[] cells,
  6. mxRectangle bounds, ImageIcon icon)
  7. {
  8. return new mxGraphTransferable(graphComponent.getGraph().cloneCells(
  9. cells), bounds, icon);
  10. }

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

  1. /**
  2. *
  3. */
  4. public Object createTargetVertex(MouseEvent e, Object source)
  5. {
  6. mxGraph graph = graphComponent.getGraph();
  7. Object clone = graph.cloneCells(new Object[] { source })[0];
  8. mxIGraphModel model = graph.getModel();
  9. mxGeometry geo = model.getGeometry(clone);
  10. if (geo != null)
  11. {
  12. mxPoint point = graphComponent.getPointForEvent(e);
  13. geo.setX(graph.snap(point.getX() - geo.getWidth() / 2));
  14. geo.setY(graph.snap(point.getY() - geo.getHeight() / 2));
  15. }
  16. return clone;
  17. }

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

  1. /**
  2. *
  3. */
  4. public Object createTargetVertex(MouseEvent e, Object source)
  5. {
  6. mxGraph graph = graphComponent.getGraph();
  7. Object clone = graph.cloneCells(new Object[] { source })[0];
  8. mxIGraphModel model = graph.getModel();
  9. mxGeometry geo = model.getGeometry(clone);
  10. if (geo != null)
  11. {
  12. mxPoint point = graphComponent.getPointForEvent(e);
  13. geo.setX(graph.snap(point.getX() - geo.getWidth() / 2));
  14. geo.setY(graph.snap(point.getY() - geo.getHeight() / 2));
  15. }
  16. return clone;
  17. }

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

  1. Object clone = graph.cloneCells(new Object[] { edge })[0];

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

  1. Object clone = graph.cloneCells(new Object[] { edge })[0];

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

  1. newEdge = cloneCells(new Object[] { edge })[0];

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

  1. newEdge = cloneCells(new Object[] { edge })[0];

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

  1. cells = cloneCells(cells, isCloneInvalidEdges());

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

  1. cells = cloneCells(cells, isCloneInvalidEdges());

相关文章

mxGraph类方法