/** * 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. * * @param vertex * Object that represents the vertex to be tested. * @return Returns true if the vertex should be ignored. */ public boolean isVertexIgnored(Object vertex) { return super.isVertexIgnored(vertex) || graph.isSwimlane(vertex) || graph.getModel().getGeometry(vertex).isRelative() || graph.getConnections(vertex).length == 0; }
TreeNode tmp = dfs(target, parent, visited); if (tmp != null && model.getGeometry(target) != null) { if (prev == null) { node.child = tmp;
/** * */ protected mxRectangle apply(TreeNode node, mxRectangle bounds) { mxRectangle g = graph.getModel().getGeometry(node.cell); if (node.cell != null && g != null) { if (isVertexMovable(node.cell)) { g = setVertexLocation(node.cell, node.x, node.y); } if (bounds == null) { bounds = new mxRectangle(g.getX(), g.getY(), g.getWidth(), g.getHeight()); } else { 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() + bounds.getHeight(), g.getY() + g.getHeight())); } } return bounds; }
mxGeometry g = model.getGeometry(root); if (g.isRelative()) { g = model.getGeometry(model.getParent(root)); mxGeometry g = model.getGeometry(parent);
/** * Returns the geometry for the given cell. * * @param cell Cell whose geometry should be returned. * @return Returns the geometry of the cell. */ public mxGeometry getCellGeometry(Object cell) { return model.getGeometry(cell); }
/** * Returns the geometry for the given cell. * * @param cell Cell whose geometry should be returned. * @return Returns the geometry of the cell. */ public mxGeometry getCellGeometry(Object cell) { return model.getGeometry(cell); }
/** * Returns true if the given cell may not be moved, sized, bended, * disconnected, edited or selected. This implementation returns true for * all vertices with a relative geometry if cellsLocked is false. * * @param cell Cell whose locked state should be returned. * @return Returns true if the given cell is locked. */ public boolean isCellLocked(Object cell) { mxGeometry geometry = model.getGeometry(cell); return isCellsLocked() || (geometry != null && model.isVertex(cell) && geometry .isRelative()); }
/** * Returns true if the given cell may not be moved, sized, bended, * disconnected, edited or selected. This implementation returns true for * all vertices with a relative geometry if cellsLocked is false. * * @param cell Cell whose locked state should be returned. * @return Returns true if the given cell is locked. */ public boolean isCellLocked(Object cell) { mxGeometry geometry = model.getGeometry(cell); return isCellsLocked() || (geometry != null && model.isVertex(cell) && geometry .isRelative()); }
/** * Resets the control points of the given edge. */ public Object resetEdge(Object edge) { mxGeometry geo = model.getGeometry(edge); if (geo != null) { // Resets the control points List<mxPoint> points = geo.getPoints(); if (points != null && !points.isEmpty()) { geo = (mxGeometry) geo.clone(); geo.setPoints(null); model.setGeometry(edge, geo); } } return edge; }
/** * Resets the control points of the given edge. */ public Object resetEdge(Object edge) { mxGeometry geo = model.getGeometry(edge); if (geo != null) { // Resets the control points List<mxPoint> points = geo.getPoints(); if (points != null && !points.isEmpty()) { geo = (mxGeometry) geo.clone(); geo.setPoints(null); model.setGeometry(edge, geo); } } return edge; }
/** * Returns a boolean indicating if the given <mxCell> should be ignored as a vertex. This returns true if the cell has no connections. * * @param vertex * Object that represents the vertex to be tested. * @return Returns true if the vertex should be ignored. */ @Override public boolean isVertexIgnored(Object vertex) { return super.isVertexIgnored(vertex) || graph.isSwimlane(vertex) || graph.getModel().getGeometry(vertex).isRelative() || graph.getConnections(vertex).length == 0; }
/** * Returns a boolean indicating if the given <mxCell> should be ignored as a vertex. This returns true if the cell * has no connections. * * @param vertex * Object that represents the vertex to be tested. * @return Returns true if the vertex should be ignored. */ public boolean isVertexIgnored(Object vertex) { return super.isVertexIgnored(vertex) || graph.isSwimlane(vertex) || graph.getModel().getGeometry(vertex).isRelative() || graph.getConnections(vertex).length == 0; }
private void setVertexStyle(final mxICell vertex, final String colorstr) { String targetStyle = vertex.getStyle(); targetStyle = mxStyleUtils.removeAllStylenames(targetStyle); targetStyle = mxStyleUtils.setStyle(targetStyle , mxConstants.STYLE_STROKECOLOR, colorstr ); // Style specifics int width, height; if (globalStyle.equals(SIMPLE_STYLE_NAME)) { targetStyle = mxStyleUtils.setStyle(targetStyle, mxConstants.STYLE_FILLCOLOR, colorstr); width = DEFAULT_CELL_HEIGHT; height = width; } else { targetStyle = mxStyleUtils.setStyle(targetStyle, mxConstants.STYLE_FILLCOLOR, "white"); width = DEFAULT_CELL_WIDTH; height = DEFAULT_CELL_HEIGHT; } targetStyle = globalStyle + ";" + targetStyle; graphx.getModel().setStyle(vertex, targetStyle); graphx.getModel().getGeometry(vertex).setWidth(width); graphx.getModel().getGeometry(vertex).setHeight(height); }
public mxPoint getParentOffset(Object parent) { mxPoint result = new mxPoint(); if (parent != null && parent != this.parent) { mxIGraphModel model = graph.getModel(); if (model.isAncestor(this.parent, parent)) { mxGeometry parentGeo = model.getGeometry(parent); while (parent != this.parent) { result.setX(result.getX() + parentGeo.getX()); result.setY(result.getY() + parentGeo.getY()); parent = model.getParent(parent);; parentGeo = model.getGeometry(parent); } } } return result; }
/** * */ protected mxRectangle apply(TreeNode node, mxRectangle bounds) { mxRectangle g = graph.getModel().getGeometry(node.cell); if (node.cell != null && g != null) { if (isVertexMovable(node.cell)) { g = setVertexLocation(node.cell, node.x, node.y); } if (bounds == null) { bounds = new mxRectangle(g.getX(), g.getY(), g.getWidth(), g.getHeight()); } else { 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() + bounds.getHeight(), g.getY() + g.getHeight())); } } return bounds; }
/** * */ protected mxRectangle apply(TreeNode node, mxRectangle bounds) { mxRectangle g = graph.getModel().getGeometry(node.cell); if (node.cell != null && g != null) { if (isVertexMovable(node.cell)) { g = setVertexLocation(node.cell, node.x, node.y); } if (bounds == null) { bounds = new mxRectangle(g.getX(), g.getY(), g.getWidth(), g.getHeight()); } else { 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() + bounds.getHeight(), g.getY() + g.getHeight())); } } return bounds; }
/** * Returns true if the label bounds of the state should be used for the * editor. */ protected boolean useLabelBounds(mxCellState state) { mxIGraphModel model = state.getView().getGraph().getModel(); mxGeometry geometry = model.getGeometry(state.getCell()); return ((geometry != null && geometry.getOffset() != null && !geometry.isRelative() && (geometry.getOffset().getX() != 0 || geometry .getOffset().getY() != 0)) || model.isEdge(state.getCell())); }
/** * Returns true if the label bounds of the state should be used for the * editor. */ protected boolean useLabelBounds(mxCellState state) { mxIGraphModel model = state.getView().getGraph().getModel(); mxGeometry geometry = model.getGeometry(state.getCell()); return ((geometry != null && geometry.getOffset() != null && !geometry.isRelative() && (geometry.getOffset().getX() != 0 || geometry .getOffset().getY() != 0)) || model.isEdge(state.getCell())); }
/** * */ public Object createTargetVertex(MouseEvent e, Object source) { mxGraph graph = graphComponent.getGraph(); Object clone = graph.cloneCells(new Object[] { source })[0]; mxIGraphModel model = graph.getModel(); mxGeometry geo = model.getGeometry(clone); if (geo != null) { mxPoint point = graphComponent.getPointForEvent(e); geo.setX(graph.snap(point.getX() - geo.getWidth() / 2)); geo.setY(graph.snap(point.getY() - geo.getHeight() / 2)); } return clone; }
/** * */ public Object createTargetVertex(MouseEvent e, Object source) { mxGraph graph = graphComponent.getGraph(); Object clone = graph.cloneCells(new Object[] { source })[0]; mxIGraphModel model = graph.getModel(); mxGeometry geo = model.getGeometry(clone); if (geo != null) { mxPoint point = graphComponent.getPointForEvent(e); geo.setX(graph.snap(point.getX() - geo.getWidth() / 2)); geo.setY(graph.snap(point.getY() - geo.getHeight() / 2)); } return clone; }