layoutInsets = new Insets2D.Double();
Insets2D.Double insets = owner.get(DECORATOR_INSETS); if (insets != null) { insets.addTo(bounds);
add(attributeCompartment); Insets2D.Double insets = new Insets2D.Double(4, 8, 4, 8); nameCompartment.set(LAYOUT_INSETS, insets); attributeCompartment.set(LAYOUT_INSETS, insets);
@Override public Rectangle2D.Double calculateLayout(CompositeFigure layoutable, Point2D.Double anchor, Point2D.Double lead) { Insets2D.Double layoutInsets = layoutable.get(LAYOUT_INSETS); if (layoutInsets == null) { layoutInsets = new Insets2D.Double(0, 0, 0, 0); } Rectangle2D.Double layoutBounds = new Rectangle2D.Double(anchor.x, anchor.y, 0, 0); for (Figure child : layoutable.getChildren()) { if (child.isVisible()) { Dimension2DDouble preferredSize = child.getPreferredSize(); Insets2D.Double ins = getInsets(child); layoutBounds.width = Math.max(layoutBounds.width, preferredSize.width + ins.left + ins.right); layoutBounds.height += preferredSize.height + ins.top + ins.bottom; } } layoutBounds.width += layoutInsets.left + layoutInsets.right; layoutBounds.height += layoutInsets.top + layoutInsets.bottom; return layoutBounds; }
@Override public Insets2D.Double getInsets() { return new Insets2D.Double(); }
/** Creates a new instance. */ public NodeFigure() { RectangleFigure rf = new RectangleFigure(); setDecorator(rf); createConnectors(); set(DECORATOR_INSETS, new Insets2D.Double(6, 10, 6, 10)); ResourceBundleUtil labels = ResourceBundleUtil.getBundle("org.jhotdraw.samples.net.Labels"); setText(labels.getString("nodeDefaultName")); setAttributeEnabled(DECORATOR_INSETS, false); }
/** * Returns the insets used to draw text. */ @Override public Insets2D.Double getInsets() { double sw = (get(STROKE_COLOR) == null) ? 0 : Math.ceil(get(STROKE_WIDTH) / 2); Insets2D.Double insets = new Insets2D.Double(0, 0, 0, 0); return new Insets2D.Double(insets.top + sw, insets.left + sw, insets.bottom + sw, insets.right + sw); }
/** Creates a new instance with the specified presentation figure * and layout insets of [top=4,left=8,right=4,bottom=8]. */ public ListFigure(@Nullable Figure presentationFigure) { super(presentationFigure); setLayouter(new VerticalLayouter()); set(LAYOUT_INSETS, new Insets2D.Double(4,8,4,8)); } }
public Insets2D.Double getInsets(Figure child) { Insets2D.Double value = child.get(CompositeFigure.LAYOUT_INSETS); return (value == null) ? new Insets2D.Double() : (Insets2D.Double) value.clone(); } }
private Rectangle2D.Double getFieldBounds(TextHolderFigure figure) { Rectangle2D.Double r = figure.getDrawingArea(); Insets2D.Double insets = figure.getInsets(); insets.subtractTo(r); // FIXME - Find a way to determine the parameters for grow. //r.grow(1,2); //r.width += 16; r.x -= 1; r.y -= 2; r.width += 18; r.height += 4; return r; }
private Rectangle2D.Double getFieldBounds(TextHolderFigure figure) { Rectangle2D.Double r = figure.getDrawingArea(); Insets2D.Double insets = figure.getInsets(); insets.subtractTo(r); // FIXME - Find a way to determine the parameters for grow. //r.grow(1,2); //r.width += 16; r.x -= 1; r.y -= 2; r.width += 18; r.height += 4; return r; }
@Override public Insets2D.Double getInsets() { return new Insets2D.Double(); }
/** * Returns the insets used to draw text. */ @Override public Insets2D.Double getInsets() { double sw = Math.ceil(get(STROKE_WIDTH) / 2); Insets2D.Double insets = new Insets2D.Double(4, 4, 4, 4); return new Insets2D.Double(insets.top + sw, insets.left + sw, insets.bottom + sw, insets.right + sw); }