/** * */ 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 the x-coordinate of the center. * * @return Returns the x-coordinate of the center. */ public double getCenterX() { return getX() + getWidth() / 2; }
/** * Returns the x-coordinate of the center. * * @return Returns the x-coordinate of the center. */ public double getCenterX() { return getX() + getWidth() / 2; }
/** * Returns the scaled preferred size for the current graph. */ protected Dimension getScaledPreferredSizeForGraph() { mxRectangle bounds = graph.getGraphBounds(); int border = graph.getBorder(); return new Dimension( (int) Math.round(bounds.getX() + bounds.getWidth()) + border + 1, (int) Math.round(bounds.getY() + bounds.getHeight()) + border + 1); }
/** * Returns the scaled preferred size for the current graph. */ protected Dimension getScaledPreferredSizeForGraph() { mxRectangle bounds = graph.getGraphBounds(); int border = graph.getBorder(); return new Dimension( (int) Math.round(bounds.getX() + bounds.getWidth()) + border + 1, (int) Math.round(bounds.getY() + bounds.getHeight()) + border + 1); }
/** * Constructs a copy of the given rectangle. * * @param rect Rectangle to construct a copy of. */ public mxRectangle(mxRectangle rect) { this(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight()); }
/** * Constructs a copy of the given rectangle. * * @param rect Rectangle to construct a copy of. */ public mxRectangle(mxRectangle rect) { this(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight()); }
/** * */ 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 given object equals this rectangle. */ public boolean equals(Object obj) { if (obj instanceof mxRectangle) { mxRectangle rect = (mxRectangle) obj; return rect.getX() == getX() && rect.getY() == getY() && rect.getWidth() == getWidth() && rect.getHeight() == getHeight(); } return false; }
/** * * Returns true if the given object equals this rectangle. */ public boolean equals(Object obj) { if (obj instanceof mxRectangle) { mxRectangle rect = (mxRectangle) obj; return rect.getX() == getX() && rect.getY() == getY() && rect.getWidth() == getWidth() && rect.getHeight() == getHeight(); } return false; }
/** * */ public Object insertCell(mxRectangle bounds) { // FIXME: Clone prototype cell for insert return graphComponent.getGraph().insertVertex(null, null, "", bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(), style); }
/** * */ public Object insertCell(mxRectangle bounds) { // FIXME: Clone prototype cell for insert return graphComponent.getGraph().insertVertex(null, null, "", bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(), style); }
public Object drawLabel(String label, mxCellState state, boolean html) { mxRectangle bounds = state.getLabelBounds(); if (drawLabels && bounds != null) { int x = (int) bounds.getX() + translate.x; int y = (int) bounds.getY() + translate.y; int w = (int) bounds.getWidth(); int h = (int) bounds.getHeight(); Map<String, Object> style = state.getStyle(); return drawText(label, x, y, w, h, style); } return null; }
public Object drawLabel(String label, mxCellState state, boolean html) { mxRectangle bounds = state.getLabelBounds(); if (drawLabels && bounds != null) { int x = (int) bounds.getX() + translate.x; int y = (int) bounds.getY() + translate.y; int w = (int) bounds.getWidth(); int h = (int) bounds.getHeight(); Map<String, Object> style = state.getStyle(); return drawText(label, x, y, w, h, style); } return null; }
public Object drawLabel(String label, mxCellState state, boolean html) { mxRectangle bounds = state.getLabelBounds(); if (drawLabels && bounds != null) { int x = (int) bounds.getX() + translate.x; int y = (int) bounds.getY() + translate.y; int w = (int) bounds.getWidth(); int h = (int) bounds.getHeight(); Map<String, Object> style = state.getStyle(); return drawText(label, x, y, w, h, style); } return null; }
public Object drawLabel(String label, mxCellState state, boolean html) { mxRectangle bounds = state.getLabelBounds(); if (drawLabels && bounds != null) { int x = (int) (bounds.getX() + translate.getY()); int y = (int) (bounds.getY() + translate.getY()); int w = (int) bounds.getWidth(); int h = (int) bounds.getHeight(); Map<String, Object> style = state.getStyle(); return drawText(label, x, y, w, h, style); } return null; }
public Object drawLabel(String label, mxCellState state, boolean html) { mxRectangle bounds = state.getLabelBounds(); if (drawLabels && bounds != null) { int x = (int) (bounds.getX() + translate.getX()); int y = (int) (bounds.getY() + translate.getY()); int w = (int) bounds.getWidth(); int h = (int) bounds.getHeight(); Map<String, Object> style = state.getStyle(); return drawText(label, x, y, w, h, style); } return null; }
public Object drawLabel(String label, mxCellState state, boolean html) { mxRectangle bounds = state.getLabelBounds(); if (drawLabels && bounds != null) { int x = (int) (bounds.getX() + translate.getX()); int y = (int) (bounds.getY() + translate.getY()); int w = (int) bounds.getWidth(); int h = (int) bounds.getHeight(); Map<String, Object> style = state.getStyle(); return drawText(label, x, y, w, h, style); } return null; }
/** * */ public mxGraphTransferable createGraphTransferable( mxGraphComponent graphComponent, Object[] cells, ImageIcon icon) { mxGraph graph = graphComponent.getGraph(); mxPoint tr = graph.getView().getTranslate(); double scale = graph.getView().getScale(); mxRectangle bounds = graph.getPaintBounds(cells); // Removes the scale and translation from the bounds bounds.setX(bounds.getX() / scale - tr.getX()); bounds.setY(bounds.getY() / scale - tr.getY()); bounds.setWidth(bounds.getWidth() / scale); bounds.setHeight(bounds.getHeight() / scale); return createGraphTransferable(graphComponent, cells, bounds, icon); }