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

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

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

mxGraph.getModel介绍

[英]Returns the graph model that contains the graph data.
[中]返回包含图形数据的图形模型。

代码示例

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

  1. /**
  2. * Returns a boolean indicating if the given <em>mxCell</em> should be ignored as a vertex. This returns true if the cell has no connections.
  3. *
  4. * @param vertex
  5. * Object that represents the vertex to be tested.
  6. * @return Returns true if the vertex should be ignored.
  7. */
  8. public boolean isVertexIgnored(Object vertex) {
  9. return super.isVertexIgnored(vertex) || graph.isSwimlane(vertex) || graph.getModel().getGeometry(vertex).isRelative() || graph.getConnections(vertex).length == 0;
  10. }

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

  1. mxIGraphModel model = graph.getModel();
  2. if (cell != null && !visited.contains(cell) && (!isVertexIgnored(cell) || isBoundaryEvent(cell))) {
  3. visited.add(cell);

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

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

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

  1. /**
  2. *
  3. */
  4. protected mxRectangle apply(TreeNode node, mxRectangle bounds) {
  5. mxRectangle g = graph.getModel().getGeometry(node.cell);
  6. if (node.cell != null && g != null) {
  7. if (isVertexMovable(node.cell)) {
  8. g = setVertexLocation(node.cell, node.x, node.y);
  9. }
  10. if (bounds == null) {
  11. bounds = new mxRectangle(g.getX(), g.getY(), g.getWidth(), g.getHeight());
  12. } else {
  13. bounds = new mxRectangle(Math.min(bounds.getX(), g.getX()), Math.min(bounds.getY(), g.getY()), Math.max(bounds.getX() + bounds.getWidth(), g.getX() + g.getWidth()), Math.max(bounds.getY()
  14. + bounds.getHeight(), g.getY() + g.getHeight()));
  15. }
  16. }
  17. return bounds;
  18. }

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

  1. public void execute(Object parent) {
  2. mxIGraphModel model = graph.getModel();
  3. List<Object> roots = graph.findTreeRoots(parent, true, invert);

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

  1. /**
  2. *
  3. * @param edge
  4. * @param isSource
  5. * @return
  6. */
  7. public Object getTerminal(Object edge, boolean isSource)
  8. {
  9. return graph.getModel().getTerminal(edge, isSource);
  10. };

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

  1. /**
  2. * Returns the terminal to be used for a given port. This implementation
  3. * always returns the parent cell.
  4. *
  5. * @param cell Cell that represents the port.
  6. * @param source If the cell is the source or target port.
  7. * @return Returns the terminal to be used for the given port.
  8. */
  9. public Object getTerminalForPort(Object cell, boolean source)
  10. {
  11. return getModel().getParent(cell);
  12. }

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

  1. /**
  2. * Validates the graph by validating each descendant of the given cell or
  3. * the root of the model. Context is an object that contains the validation
  4. * state for the complete validation run. The validation errors are attached
  5. * to their cells using <setWarning>. This function returns true if no
  6. * validation errors exist in the graph.
  7. */
  8. public String validateGraph()
  9. {
  10. return validateGraph(graph.getModel().getRoot(),
  11. new Hashtable<Object, Object>());
  12. }

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

  1. /**
  2. * Returns true if the parent of the given cell should be extended if the
  3. * child has been resized so that it overlaps the parent. This
  4. * implementation returns ExtendParents if cell is not an edge.
  5. *
  6. * @param cell Cell that has been resized.
  7. */
  8. public boolean isExtendParent(Object cell)
  9. {
  10. return !getModel().isEdge(cell) && isExtendParents();
  11. }

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

  1. /**
  2. * Returns true if the given vertex has no connected edges.
  3. *
  4. * @param vertex Object that represents the vertex to be tested.
  5. * @return Returns true if the vertex should be ignored.
  6. */
  7. public boolean isVertexIgnored(Object vertex)
  8. {
  9. return !graph.getModel().isVertex(vertex)
  10. || !graph.isCellVisible(vertex);
  11. }

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

  1. /**
  2. * Returns true if the given vertex has no connected edges.
  3. *
  4. * @param vertex Object that represents the vertex to be tested.
  5. * @return Returns true if the vertex should be ignored.
  6. */
  7. public boolean isVertexIgnored(Object vertex)
  8. {
  9. return !graph.getModel().isVertex(vertex)
  10. || !graph.isCellVisible(vertex);
  11. }

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

  1. /**
  2. * Checks the type of the given value.
  3. */
  4. public boolean checkTerminal(mxGraph graph, Object terminal, Object edge)
  5. {
  6. Object userObject = graph.getModel().getValue(terminal);
  7. return checkType(graph, userObject, type, attr, value);
  8. }

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

  1. /**
  2. * Returns true if the parent of the given cell should be extended if the
  3. * child has been resized so that it overlaps the parent. This
  4. * implementation returns ExtendParents if cell is not an edge.
  5. *
  6. * @param cell Cell that has been resized.
  7. */
  8. public boolean isExtendParent(Object cell)
  9. {
  10. return !getModel().isEdge(cell) && isExtendParents();
  11. }

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

  1. /**
  2. * Draws the graph onto the given canvas.
  3. *
  4. * @param canvas Canvas onto which the graph should be drawn.
  5. */
  6. public void drawGraph(mxICanvas canvas)
  7. {
  8. drawCell(canvas, getModel().getRoot());
  9. }

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

  1. /**
  2. * Returns true if the given cell is not the current root or the root in
  3. * the model. This can be overridden to not render certain cells in the
  4. * graph display.
  5. */
  6. protected boolean isCellDisplayable(Object cell)
  7. {
  8. return cell != graph.getView().getCurrentRoot()
  9. && cell != graph.getModel().getRoot();
  10. }

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

  1. /**
  2. *
  3. */
  4. public boolean isStateHandled(mxCellState state)
  5. {
  6. return graphComponent.getGraph().getModel().isVertex(state.getCell());
  7. }

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

  1. /**
  2. * Returns a boolean indicating if the given <mxCell> should be ignored as a vertex. This returns true if the cell has no connections.
  3. *
  4. * @param vertex
  5. * Object that represents the vertex to be tested.
  6. * @return Returns true if the vertex should be ignored.
  7. */
  8. @Override
  9. public boolean isVertexIgnored(Object vertex) {
  10. return super.isVertexIgnored(vertex) || graph.isSwimlane(vertex) || graph.getModel().getGeometry(vertex).isRelative() || graph.getConnections(vertex).length == 0;
  11. }

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

  1. /**
  2. * First validates all bounds and then validates all points recursively on
  3. * all visible cells.
  4. */
  5. public void validate()
  6. {
  7. mxRectangle graphBounds = getBoundingBox(validateCellState(validateCell((currentRoot != null) ? currentRoot
  8. : graph.getModel().getRoot())));
  9. setGraphBounds((graphBounds != null) ? graphBounds : new mxRectangle());
  10. }

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

  1. /**
  2. * Returns true if the label bounds of the state should be used for the
  3. * editor.
  4. */
  5. protected boolean useLabelBounds(mxCellState state)
  6. {
  7. mxIGraphModel model = state.getView().getGraph().getModel();
  8. mxGeometry geometry = model.getGeometry(state.getCell());
  9. return ((geometry != null && geometry.getOffset() != null
  10. && !geometry.isRelative() && (geometry.getOffset().getX() != 0 || geometry
  11. .getOffset().getY() != 0)) || model.isEdge(state.getCell()));
  12. }

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

  1. /**
  2. * Returns true if the label bounds of the state should be used for the
  3. * editor.
  4. */
  5. protected boolean useLabelBounds(mxCellState state)
  6. {
  7. mxIGraphModel model = state.getView().getGraph().getModel();
  8. mxGeometry geometry = model.getGeometry(state.getCell());
  9. return ((geometry != null && geometry.getOffset() != null
  10. && !geometry.isRelative() && (geometry.getOffset().getX() != 0 || geometry
  11. .getOffset().getY() != 0)) || model.isEdge(state.getCell()));
  12. }

相关文章

mxGraph类方法