/** * Resets attributes that would affect rendering if the * {@link #installAttributes(CellView)} is not being called, which is the * case if the view is a group and it's groupOpaque attribute is set to * false. */ protected void resetAttributes() { super.resetAttributes(); shape = CellConstants.getVertexShape(view.getAllAttributes()); isRichText = false; valueComponent = null; }
/** * Returns a cell handle for the view, if the graph and the view are * sizeable. */ public CellHandle getHandle(GraphContext context) { if (GraphConstants.isSizeable(getAllAttributes()) && !GraphConstants.isAutoSize(getAllAttributes()) && context.getGraph().isSizeable()) return new SizeHandle(this, context); return null; }
double height = bottom - top; if (isConstrainedSizeEvent(event) || GraphConstants.isConstrained(vertex.getAllAttributes())) { if (index == 3 || index == 4 || index == 5) height = width;
public Point2D getPerimeterPoint(VertexView view, Point2D source, Point2D p) { int shape = SVGGraphConstants .getShape(view.getAllAttributes()); if (shape == SVGGraphConstants.SHAPE_ELLIPSE) { return getEllipsePerimeterPoint(view, source, p); } return super.getPerimeterPoint(view, source, p); }
public SizeHandle(VertexView vertexview, GraphContext ctx) { graph = ctx.getGraph(); vertex = vertexview; editing = graph.getEditingCell() == vertex.getCell(); int sizeableAxis = GraphConstants.getSizeableAxis(vertex .getAllAttributes()); if (sizeableAxis == GraphConstants.X_AXIS) cursors = xCursors; else if (sizeableAxis == GraphConstants.Y_AXIS) cursors = yCursors; else cursors = defaultCursors; // PortView Preview portViews = ctx.createTemporaryPortViews(); initialBounds = (Rectangle2D) vertex.getBounds().clone(); context = ctx; for (int i = 0; i < r.length; i++) r[i] = new Rectangle2D.Double(); invalidate(); }
/** * Overrides the parent's implementation to return the perimeter points for * non-rectangular shapes, namely diamonds and circles. The source point is * typically ignored and the center point is used instead. * * @param view * The view to return the perimeter point for. * @param source * The location of the start point of the line to be intersected * with the boundaries. * @param p * The location of the end point of the line to be intersected * with the boundaries. */ public Point2D getPerimeterPoint(VertexView view, Point2D source, Point2D p) { int shape = CellConstants.getVertexShape(view .getAllAttributes()); if (shape == SHAPE_DIAMOND) { return getDiamondPerimeterPoint(view, source, p); } else if (shape == SHAPE_CIRCLE) { return getCirclePerimeterPoint(view, source, p); } else if (shape == SHAPE_TRIANGLE) { return getTrianglePerimeterPoint(view, source, p); } return super.getPerimeterPoint(view, source, p); }