/** * Arranges the contents of the block, with no constraints, and returns * the block size. * * @param g2 the graphics device. * * @return The block size (in Java2D units, never {@code null}). */ public Size2D arrange(Graphics2D g2) { return arrange(g2, RectangleConstraint.NONE); }
/** * Returns a clone of the container. * * @return A clone. * * @throws CloneNotSupportedException if there is a problem cloning. */ public Object clone() throws CloneNotSupportedException { BlockContainer clone = (BlockContainer) super.clone(); // TODO : complete this return clone; }
return false; return super.equals(obj);
/** * Arranges the contents of the block, within the given constraints, and * returns the block size. * * @param g2 the graphics device. * @param constraint the constraint ({@code null} not permitted). * * @return The block size (in Java2D units, never {@code null}). */ public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) { Size2D base = new Size2D(getWidth(), getHeight()); return constraint.calculateConstrainedSize(base); }
/** * Returns a constraint for the content of this block that will result in * the bounds of the block matching the specified constraint. * * @param c the outer constraint ({@code null} not permitted). * * @return The content constraint. */ protected RectangleConstraint toContentConstraint(RectangleConstraint c) { Args.nullNotPermitted(c, "c"); if (c.equals(RectangleConstraint.NONE)) { return c; } double w = c.getWidth(); Range wr = c.getWidthRange(); double h = c.getHeight(); Range hr = c.getHeightRange(); double ww = trimToContentWidth(w); double hh = trimToContentHeight(h); Range wwr = trimToContentWidth(wr); Range hhr = trimToContentHeight(hr); return new RectangleConstraint(ww, wwr, c.getWidthConstraintType(), hh, hhr, c.getHeightConstraintType()); }
/** * Sets the border for the block (use {@link BlockBorder#NONE} for * no border). * * @param border the border (<code>null</code> not permitted). * * @see #getBorder() * * @deprecated Use {@link #setFrame(BlockFrame)} instead. */ public void setBorder(BlockBorder border) { setFrame(border); }
private Range trimToContentWidth(Range r) { if (r == null) { return null; } double lowerBound = 0.0; double upperBound = Double.POSITIVE_INFINITY; if (r.getLowerBound() > 0.0) { lowerBound = trimToContentWidth(r.getLowerBound()); } if (r.getUpperBound() < Double.POSITIVE_INFINITY) { upperBound = trimToContentWidth(r.getUpperBound()); } return new Range(lowerBound, upperBound); }
/** * Sets the padding. * * @param top the top padding. * @param left the left padding. * @param bottom the bottom padding. * @param right the right padding. */ public void setPadding(double top, double left, double bottom, double right) { setPadding(new RectangleInsets(top, left, bottom, right)); }
/** * Sets the margin. * * @param top the top margin. * @param left the left margin. * @param bottom the bottom margin. * @param right the right margin. * * @see #getMargin() */ public void setMargin(double top, double left, double bottom, double right) { setMargin(new RectangleInsets(top, left, bottom, right)); }
private Range trimToContentHeight(Range r) { if (r == null) { return null; } double lowerBound = 0.0; double upperBound = Double.POSITIVE_INFINITY; if (r.getLowerBound() > 0.0) { lowerBound = trimToContentHeight(r.getLowerBound()); } if (r.getUpperBound() < Double.POSITIVE_INFINITY) { upperBound = trimToContentHeight(r.getUpperBound()); } return new Range(lowerBound, upperBound); }
/** * Arranges the contents of the block, within the given constraints, and * returns the block size. * * @param g2 the graphics device. * @param constraint the constraint (<code>null</code> not permitted). * * @return The block size (in Java2D units, never <code>null</code>). */ public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) { Size2D base = new Size2D(getWidth(), getHeight()); return constraint.calculateConstrainedSize(base); }
/** * Returns a constraint for the content of this block that will result in * the bounds of the block matching the specified constraint. * * @param c the outer constraint (<code>null</code> not permitted). * * @return The content constraint. */ protected RectangleConstraint toContentConstraint(RectangleConstraint c) { if (c == null) { throw new IllegalArgumentException("Null 'c' argument."); } if (c.equals(RectangleConstraint.NONE)) { return c; } double w = c.getWidth(); Range wr = c.getWidthRange(); double h = c.getHeight(); Range hr = c.getHeightRange(); double ww = trimToContentWidth(w); double hh = trimToContentHeight(h); Range wwr = trimToContentWidth(wr); Range hhr = trimToContentHeight(hr); return new RectangleConstraint( ww, wwr, c.getWidthConstraintType(), hh, hhr, c.getHeightConstraintType() ); }
/** * Sets a black border with the specified line widths. * * @param top the top border line width. * @param left the left border line width. * @param bottom the bottom border line width. * @param right the right border line width. */ public void setBorder(double top, double left, double bottom, double right) { setFrame(new BlockBorder(top, left, bottom, right)); }
private Range trimToContentWidth(Range r) { if (r == null) { return null; } double lowerBound = 0.0; double upperBound = Double.POSITIVE_INFINITY; if (r.getLowerBound() > 0.0) { lowerBound = trimToContentWidth(r.getLowerBound()); } if (r.getUpperBound() < Double.POSITIVE_INFINITY) { upperBound = trimToContentWidth(r.getUpperBound()); } return new Range(lowerBound, upperBound); }
/** * Sets the padding. * * @param top the top padding. * @param left the left padding. * @param bottom the bottom padding. * @param right the right padding. */ public void setPadding(double top, double left, double bottom, double right) { setPadding(new RectangleInsets(top, left, bottom, right)); }
/** * Sets the margin. * * @param top the top margin. * @param left the left margin. * @param bottom the bottom margin. * @param right the right margin. * * @see #getMargin() */ public void setMargin(double top, double left, double bottom, double right) { setMargin(new RectangleInsets(top, left, bottom, right)); }
private Range trimToContentHeight(Range r) { if (r == null) { return null; } double lowerBound = 0.0; double upperBound = Double.POSITIVE_INFINITY; if (r.getLowerBound() > 0.0) { lowerBound = trimToContentHeight(r.getLowerBound()); } if (r.getUpperBound() < Double.POSITIVE_INFINITY) { upperBound = trimToContentHeight(r.getUpperBound()); } return new Range(lowerBound, upperBound); }
/** * Returns a clone of this {@code LabelBlock} instance. * * @return A clone. * * @throws CloneNotSupportedException if there is a problem cloning. */ @Override public Object clone() throws CloneNotSupportedException { return super.clone(); }
return false; return super.equals(obj);
/** * Sets a black border with the specified line widths. * * @param top the top border line width. * @param left the left border line width. * @param bottom the bottom border line width. * @param right the right border line width. */ public void setBorder(double top, double left, double bottom, double right) { setFrame(new BlockBorder(top, left, bottom, right)); }