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

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

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

mxGraph.addCell介绍

[英]Adds the cell to the default parent. This is a shortcut method.
[中]将单元格添加到默认父级。这是一种快捷方式。

代码示例

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

  1. protected void handleBoundaryEvents() {
  2. for (BoundaryEvent boundaryEvent : boundaryEvents) {
  3. mxGeometry geometry = new mxGeometry(0.8, 1.0, eventSize, eventSize);
  4. geometry.setOffset(new mxPoint(-(eventSize / 2), -(eventSize / 2)));
  5. geometry.setRelative(true);
  6. mxCell boundaryPort = new mxCell(null, geometry, "shape=ellipse;perimter=ellipsePerimeter");
  7. boundaryPort.setId("boundary-event-" + boundaryEvent.getId());
  8. boundaryPort.setVertex(true);
  9. Object portParent = null;
  10. if (boundaryEvent.getAttachedToRefId() != null) {
  11. portParent = generatedVertices.get(boundaryEvent.getAttachedToRefId());
  12. } else if (boundaryEvent.getAttachedToRef() != null) {
  13. portParent = generatedVertices.get(boundaryEvent.getAttachedToRef().getId());
  14. } else {
  15. throw new RuntimeException("Could not generate DI: boundaryEvent '" + boundaryEvent.getId() + "' has no attachedToRef");
  16. }
  17. graph.addCell(boundaryPort, portParent);
  18. generatedVertices.put(boundaryEvent.getId(), boundaryPort);
  19. }
  20. }

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

  1. /**
  2. * Adds the cell to the default parent. This is a shortcut method.
  3. *
  4. * @param cell Cell to be inserted.
  5. * @return Returns the cell that was added.
  6. */
  7. public Object addCell(Object cell)
  8. {
  9. return addCell(cell, null);
  10. }

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

  1. /**
  2. * Adds the cell to the parent. This is a shortcut method.
  3. *
  4. * @param cell Cell tobe inserted.
  5. * @param parent Object that represents the new parent. If no parent is
  6. * given then the default parent is used.
  7. * @return Returns the cell that was added.
  8. */
  9. public Object addCell(Object cell, Object parent)
  10. {
  11. return addCell(cell, parent, null, null, null);
  12. }

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

  1. /**
  2. * Adds the cell to the parent. This is a shortcut method.
  3. *
  4. * @param cell Cell tobe inserted.
  5. * @param parent Object that represents the new parent. If no parent is
  6. * given then the default parent is used.
  7. * @return Returns the cell that was added.
  8. */
  9. public Object addCell(Object cell, Object parent)
  10. {
  11. return addCell(cell, parent, null, null, null);
  12. }

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

  1. /**
  2. * Adds the cell to the default parent. This is a shortcut method.
  3. *
  4. * @param cell Cell to be inserted.
  5. * @return Returns the cell that was added.
  6. */
  7. public Object addCell(Object cell)
  8. {
  9. return addCell(cell, null);
  10. }

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

  1. /**
  2. * Adds the edge to the parent and connects it to the given source and
  3. * target terminals. This is a shortcut method.
  4. *
  5. * @param edge Edge to be inserted into the given parent.
  6. * @param parent Object that represents the new parent. If no parent is
  7. * given then the default parent is used.
  8. * @param source Optional cell that represents the source terminal.
  9. * @param target Optional cell that represents the target terminal.
  10. * @param index Optional index to insert the cells at. Default is to append.
  11. * @return Returns the edge that was added.
  12. */
  13. public Object addEdge(Object edge, Object parent, Object source,
  14. Object target, Integer index)
  15. {
  16. return addCell(edge, parent, index, source, target);
  17. }

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

  1. /**
  2. * Adds the edge to the parent and connects it to the given source and
  3. * target terminals. This is a shortcut method.
  4. *
  5. * @param edge Edge to be inserted into the given parent.
  6. * @param parent Object that represents the new parent. If no parent is
  7. * given then the default parent is used.
  8. * @param source Optional cell that represents the source terminal.
  9. * @param target Optional cell that represents the target terminal.
  10. * @param index Optional index to insert the cells at. Default is to append.
  11. * @return Returns the edge that was added.
  12. */
  13. public Object addEdge(Object edge, Object parent, Object source,
  14. Object target, Integer index)
  15. {
  16. return addCell(edge, parent, index, source, target);
  17. }

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

  1. /**
  2. * Adds a new vertex into the given parent using value as the user object
  3. * and the given coordinates as the geometry of the new vertex. The id and
  4. * style are used for the respective properties of the new cell, which is
  5. * returned.
  6. *
  7. * @param parent Cell that specifies the parent of the new vertex.
  8. * @param id Optional string that defines the Id of the new vertex.
  9. * @param value Object to be used as the user object.
  10. * @param x Integer that defines the x coordinate of the vertex.
  11. * @param y Integer that defines the y coordinate of the vertex.
  12. * @param width Integer that defines the width of the vertex.
  13. * @param height Integer that defines the height of the vertex.
  14. * @param style Optional string that defines the cell style.
  15. * @param relative Specifies if the geometry should be relative.
  16. * @return Returns the new vertex that has been inserted.
  17. */
  18. public Object insertVertex(Object parent, String id, Object value,
  19. double x, double y, double width, double height, String style,
  20. boolean relative)
  21. {
  22. Object vertex = createVertex(parent, id, value, x, y, width, height,
  23. style, relative);
  24. return addCell(vertex, parent);
  25. }

代码示例来源:origin: net.kieker-monitoring/kieker

  1. private final Map<String, mxCell> createOutputPorts(final MIPlugin plugin, final mxCell vertex, final boolean reader) {
  2. final Map<String, mxCell> port2graph = new HashMap<String, mxCell>(); // NOPMD (no concurrent access)
  3. final String[] portNames = KaxVizFrame.getAllOutputPortNames(plugin);
  4. for (int i = 0; i < portNames.length; i++) {
  5. final mxGeometry portGeometry = new mxGeometry((i + 1d) / (portNames.length + 1), 1.06, 10, 10);
  6. portGeometry.setOffset(new mxPoint(0, -10));
  7. portGeometry.setRelative(true);
  8. final String fillcolor = reader ? STYLE_READER_COLOR : STYLE_FILTER_COLOR; // NOPMD NOCS (?:)
  9. final mxCell port = new mxCell(portNames[i], portGeometry,
  10. STYLE_PORT + "verticalLabelPosition=top;portConstraint=south;" + fillcolor);
  11. port.setVertex(true);
  12. this.graph.addCell(port, vertex);
  13. port2graph.put(portNames[i], port);
  14. }
  15. return port2graph;
  16. }

代码示例来源:origin: net.kieker-monitoring/kieker

  1. private final Map<String, mxCell> createInputPorts(final MIFilter plugin, final mxCell vertex) {
  2. final Map<String, mxCell> port2graph = new HashMap<String, mxCell>(); // NOPMD (no concurrent access)
  3. final String[] portNames = KaxVizFrame.getAllInputPortNames(plugin);
  4. for (int i = 0; i < portNames.length; i++) {
  5. final mxGeometry portGeometry = new mxGeometry((i + 1d) / (portNames.length + 1), -0.06, 10, 10);
  6. portGeometry.setOffset(new mxPoint(0, 0));
  7. portGeometry.setRelative(true);
  8. final mxCell port = new mxCell(
  9. portNames[i],
  10. portGeometry,
  11. STYLE_PORT + "spacingTop=3;verticalLabelPosition=bottom;portConstraint=north;" + STYLE_FILTER_COLOR);
  12. port.setVertex(true);
  13. this.graph.addCell(port, vertex);
  14. port2graph.put(portNames[i], port);
  15. }
  16. return port2graph;
  17. }

代码示例来源:origin: kieker-monitoring/kieker

  1. private final Map<String, mxCell> createOutputPorts(final MIPlugin plugin, final mxCell vertex, final boolean reader) {
  2. final Map<String, mxCell> port2graph = new HashMap<>(); // NOPMD (no concurrent access)
  3. final String[] portNames = KaxVizFrame.getAllOutputPortNames(plugin);
  4. for (int i = 0; i < portNames.length; i++) {
  5. final mxGeometry portGeometry = new mxGeometry((i + 1d) / (portNames.length + 1), 1.06, 10, 10);
  6. portGeometry.setOffset(new mxPoint(0, -10));
  7. portGeometry.setRelative(true);
  8. final String fillcolor = reader ? STYLE_READER_COLOR : STYLE_FILTER_COLOR; // NOPMD NOCS (?:)
  9. final mxCell port = new mxCell(portNames[i], portGeometry,
  10. STYLE_PORT + "verticalLabelPosition=top;portConstraint=south;" + fillcolor);
  11. port.setVertex(true);
  12. this.graph.addCell(port, vertex);
  13. port2graph.put(portNames[i], port);
  14. }
  15. return port2graph;
  16. }

代码示例来源:origin: kieker-monitoring/kieker

  1. private final Map<String, mxCell> createInputPorts(final MIFilter plugin, final mxCell vertex) {
  2. final Map<String, mxCell> port2graph = new HashMap<>(); // NOPMD (no concurrent access)
  3. final String[] portNames = KaxVizFrame.getAllInputPortNames(plugin);
  4. for (int i = 0; i < portNames.length; i++) {
  5. final mxGeometry portGeometry = new mxGeometry((i + 1d) / (portNames.length + 1), -0.06, 10, 10);
  6. portGeometry.setOffset(new mxPoint(0, 0));
  7. portGeometry.setRelative(true);
  8. final mxCell port = new mxCell(
  9. portNames[i],
  10. portGeometry,
  11. STYLE_PORT + "spacingTop=3;verticalLabelPosition=bottom;portConstraint=north;" + STYLE_FILTER_COLOR);
  12. port.setVertex(true);
  13. this.graph.addCell(port, vertex);
  14. port2graph.put(portNames[i], port);
  15. }
  16. return port2graph;
  17. }

代码示例来源:origin: net.kieker-monitoring/kieker

  1. private final mxCell createFilter(final MIFilter plugin, final int c) {
  2. final mxCell vertex = new mxCell("<<Filter>>\n" + plugin.getName() + " : " + KaxVizFrame.getShortClassName(plugin),
  3. new mxGeometry(FILTER_SPACE, FILTER_SPACE + (c * (FILTER_HEIGHT + FILTER_SPACE)),
  4. FILTER_WIDTH, FILTER_HEIGHT), STYLE_FILTER);
  5. vertex.setVertex(true);
  6. this.graph.addCell(vertex);
  7. return vertex;
  8. }

代码示例来源:origin: net.kieker-monitoring/kieker

  1. private final mxCell createRepository(final MIRepository repository, final int c) {
  2. final mxCell vertex = new mxCell("<<Repository>>\n" + repository.getName() + " : " + KaxVizFrame.getShortClassName(repository),
  3. new mxGeometry(FILTER_SPACE, FILTER_SPACE + (c * (FILTER_HEIGHT + FILTER_SPACE)),
  4. FILTER_WIDTH, FILTER_HEIGHT), STYLE_REPOSITORY);
  5. vertex.setVertex(true);
  6. this.graph.addCell(vertex);
  7. return vertex;
  8. }

代码示例来源:origin: kieker-monitoring/kieker

  1. private final mxCell createRepository(final MIRepository repository, final int c) {
  2. final mxCell vertex = new mxCell("<<Repository>>\n" + repository.getName() + " : " + KaxVizFrame.getShortClassName(repository),
  3. new mxGeometry(FILTER_SPACE, FILTER_SPACE + (c * (FILTER_HEIGHT + FILTER_SPACE)),
  4. FILTER_WIDTH, FILTER_HEIGHT),
  5. STYLE_REPOSITORY);
  6. vertex.setVertex(true);
  7. this.graph.addCell(vertex);
  8. return vertex;
  9. }

代码示例来源:origin: net.kieker-monitoring/kieker

  1. private final mxCell createReader(final MIReader reader, final int c) {
  2. final mxCell vertex = new mxCell("<<Reader>>\n" + reader.getName() + " : " + KaxVizFrame.getShortClassName(reader),
  3. new mxGeometry(FILTER_SPACE, FILTER_SPACE + (c * (FILTER_HEIGHT + FILTER_SPACE)),
  4. FILTER_WIDTH, FILTER_HEIGHT), STYLE_READER);
  5. vertex.setVertex(true);
  6. this.graph.addCell(vertex);
  7. return vertex;
  8. }

代码示例来源:origin: kieker-monitoring/kieker

  1. private final mxCell createReader(final MIReader reader, final int c) {
  2. final mxCell vertex = new mxCell("<<Reader>>\n" + reader.getName() + " : " + KaxVizFrame.getShortClassName(reader),
  3. new mxGeometry(FILTER_SPACE, FILTER_SPACE + (c * (FILTER_HEIGHT + FILTER_SPACE)),
  4. FILTER_WIDTH, FILTER_HEIGHT),
  5. STYLE_READER);
  6. vertex.setVertex(true);
  7. this.graph.addCell(vertex);
  8. return vertex;
  9. }

代码示例来源:origin: kieker-monitoring/kieker

  1. private final mxCell createFilter(final MIFilter plugin, final int c) {
  2. final mxCell vertex = new mxCell("<<Filter>>\n" + plugin.getName() + " : " + KaxVizFrame.getShortClassName(plugin),
  3. new mxGeometry(FILTER_SPACE, FILTER_SPACE + (c * (FILTER_HEIGHT + FILTER_SPACE)),
  4. FILTER_WIDTH, FILTER_HEIGHT),
  5. STYLE_FILTER);
  6. vertex.setVertex(true);
  7. this.graph.addCell(vertex);
  8. return vertex;
  9. }

代码示例来源:origin: com.bbossgroups.activiti/activiti-bpmn-layout

  1. protected void handleBoundaryEvents() {
  2. for (BoundaryEvent boundaryEvent : boundaryEvents) {
  3. mxGeometry geometry = new mxGeometry(0.8, 1.0, eventSize, eventSize);
  4. geometry.setOffset(new mxPoint(-(eventSize/2), -(eventSize/2)));
  5. geometry.setRelative(true);
  6. mxCell boundaryPort = new mxCell(null, geometry, "shape=ellipse;perimter=ellipsePerimeter");
  7. boundaryPort.setId("boundary-event-" + boundaryEvent.getId());
  8. boundaryPort.setVertex(true);
  9. Object portParent = null;
  10. if (boundaryEvent.getAttachedToRefId() != null) {
  11. portParent = generatedVertices.get(boundaryEvent.getAttachedToRefId());
  12. } else if (boundaryEvent.getAttachedToRef() != null) {
  13. portParent = generatedVertices.get(boundaryEvent.getAttachedToRef().getId());
  14. } else {
  15. throw new RuntimeException("Could not generate DI: boundaryEvent '" + boundaryEvent.getId() + "' has no attachedToRef");
  16. }
  17. graph.addCell(boundaryPort, portParent);
  18. generatedVertices.put(boundaryEvent.getId(), boundaryPort);
  19. }
  20. }

代码示例来源:origin: org.flowable/flowable-bpmn-layout

  1. protected void handleBoundaryEvents() {
  2. for (BoundaryEvent boundaryEvent : boundaryEvents) {
  3. mxGeometry geometry = new mxGeometry(0.8, 1.0, eventSize, eventSize);
  4. geometry.setOffset(new mxPoint(-(eventSize / 2), -(eventSize / 2)));
  5. geometry.setRelative(true);
  6. mxCell boundaryPort = new mxCell(null, geometry, "shape=ellipse;perimeter=ellipsePerimeter");
  7. boundaryPort.setId("boundary-event-" + boundaryEvent.getId());
  8. boundaryPort.setVertex(true);
  9. Object portParent = null;
  10. if (boundaryEvent.getAttachedToRefId() != null) {
  11. portParent = generatedVertices.get(boundaryEvent.getAttachedToRefId());
  12. } else if (boundaryEvent.getAttachedToRef() != null) {
  13. portParent = generatedVertices.get(boundaryEvent.getAttachedToRef().getId());
  14. } else {
  15. throw new RuntimeException("Could not generate DI: boundaryEvent '" + boundaryEvent.getId() + "' has no attachedToRef");
  16. }
  17. graph.addCell(boundaryPort, portParent);
  18. generatedVertices.put(boundaryEvent.getId(), boundaryPort);
  19. }
  20. }

相关文章

mxGraph类方法