/** * Resizes the parents recursively so that they contain the complete area * of the resized child cell. * * @param cell <mxCell> that has been resized. */ public void extendParent(Object cell) { if (cell != null) { Object parent = model.getParent(cell); mxGeometry p = model.getGeometry(parent); if (parent != null && p != null && !isCellCollapsed(parent)) { mxGeometry geo = model.getGeometry(cell); if (geo != null && (p.getWidth() < geo.getX() + geo.getWidth() || p .getHeight() < geo.getY() + geo.getHeight())) { p = (mxGeometry) p.clone(); p.setWidth(Math.max(p.getWidth(), geo.getX() + geo.getWidth())); p.setHeight(Math.max(p.getHeight(), geo.getY() + geo.getHeight())); cellsResized(new Object[] { parent }, new mxRectangle[] { p }); } } } }
/** * Resizes the parents recursively so that they contain the complete area * of the resized child cell. * * @param cell <mxCell> that has been resized. */ public void extendParent(Object cell) { if (cell != null) { Object parent = model.getParent(cell); mxGeometry p = model.getGeometry(parent); if (parent != null && p != null && !isCellCollapsed(parent)) { mxGeometry geo = model.getGeometry(cell); if (geo != null && (p.getWidth() < geo.getX() + geo.getWidth() || p .getHeight() < geo.getY() + geo.getHeight())) { p = (mxGeometry) p.clone(); p.setWidth(Math.max(p.getWidth(), geo.getX() + geo.getWidth())); p.setHeight(Math.max(p.getHeight(), geo.getY() + geo.getHeight())); cellsResized(new Object[] { parent }, new mxRectangle[] { p }); } } } }
public class Parallelogram extends mxBasicShape { public Shape createShape(mxGraphics2DCanvas canvas, mxCellState state){ mxCell cell = (mxCell)state.getCell(); Polygon polygon = new Polygon(); if(cell != null && cell.getGeometry() != null) { mxGeometry g = cell.getGeometry(); int dx = (int) (cell.getGeometry().getHeight()/4.0); polygon.addPoint((int)(g.getX()+dx), (int)g.getY()); polygon.addPoint((int)(g.getX()+g.getWidth()+dx), (int)g.getY()); polygon.addPoint((int)(g.getX()+g.getWidth()-dx), (int)(g.getY()+g.getHeight())); polygon.addPoint((int)((int)g.getX()-dx), (int)(g.getY()+g.getHeight())); } return polygon; }
/** * Swaps the x, y, width and height with the values stored in * alternateBounds and puts the previous values into alternateBounds as * a rectangle. This operation is carried-out in-place, that is, using the * existing geometry instance. If this operation is called during a graph * model transactional change, then the geometry should be cloned before * calling this method and setting the geometry of the cell using * mxGraphModel.setGeometry. */ public void swap() { if (alternateBounds != null) { mxRectangle old = new mxRectangle(getX(), getY(), getWidth(), getHeight()); x = alternateBounds.getX(); y = alternateBounds.getY(); width = alternateBounds.getWidth(); height = alternateBounds.getHeight(); alternateBounds = old; } }
/** * Swaps the x, y, width and height with the values stored in * alternateBounds and puts the previous values into alternateBounds as * a rectangle. This operation is carried-out in-place, that is, using the * existing geometry instance. If this operation is called during a graph * model transactional change, then the geometry should be cloned before * calling this method and setting the geometry of the cell using * mxGraphModel.setGeometry. */ public void swap() { if (alternateBounds != null) { mxRectangle old = new mxRectangle(getX(), getY(), getWidth(), getHeight()); x = alternateBounds.getX(); y = alternateBounds.getY(); width = alternateBounds.getWidth(); height = alternateBounds.getHeight(); alternateBounds = old; } }
clone.setWidth(getWidth()); clone.setHeight(getHeight()); clone.setRelative(isRelative());
/** * */ 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; }
resizeSwimlane(swimlane, geo.getWidth(), geo.getHeight(), parentHorizontal);
resizeSwimlane(swimlane, geo.getWidth(), geo.getHeight(), parentHorizontal);
+ bounds.getWidth() / 2 : bounds.getY() + bounds.getHeight() / 2;
+ bounds.getWidth() / 2 : bounds.getY() + bounds.getHeight() / 2;
double w = g.getWidth(); double h = g.getHeight();
double w = g.getWidth(); double h = g.getHeight();
mxRectangle size = new mxRectangle(0, 0, geo.getWidth(), geo.getHeight()); Object top = cells[i]; Object current = top;