org.jfree.chart.block
Class RectangleConstraint
java.lang.Object
org.jfree.chart.block.RectangleConstraint
A description of a constraint for resizing a rectangle. Constraints are
immutable.
RectangleConstraint
public RectangleConstraint(double w,
double h)
Creates a new "fixed width and height" instance.
w
- the fixed width.h
- the fixed height.
RectangleConstraint
public RectangleConstraint(double w,
Range h)
Creates a new constraint with a fixed width and a range for
the height.
w
- the fixed width.h
- the height range.
RectangleConstraint
public RectangleConstraint(double w,
Range widthRange,
LengthConstraintType widthConstraintType,
double h,
Range heightRange,
LengthConstraintType heightConstraintType)
Creates a new constraint.
w
- the fixed or maximum width.widthRange
- the width range.widthConstraintType
- the width type.h
- the fixed or maximum height.heightRange
- the height range.heightConstraintType
- the height type.
RectangleConstraint
public RectangleConstraint(Range w,
double h)
Creates a new constraint with a range for the width and a
fixed height.
w
- the width range.h
- the fixed height.
RectangleConstraint
public RectangleConstraint(Range w,
Range h)
Creates a new "range width and height" instance.
w
- the width range.h
- the height range.
calculateConstrainedSize
public Size2D calculateConstrainedSize(Size2D base)
Returns the new size that reflects the constraints defined by this
instance.
getHeight
public double getHeight()
Returns the fixed height.
getHeightRange
public Range getHeightRange()
Returns the width range.
- The range (possibly
null
).
getWidth
public double getWidth()
Returns the fixed width.
getWidthRange
public Range getWidthRange()
Returns the width range.
- The range (possibly
null
).
toFixedHeight
public RectangleConstraint toFixedHeight(double height)
Returns a constraint that matches this one on the width attributes,
but has a fixed height constraint.
height
- the fixed height.
toFixedWidth
public RectangleConstraint toFixedWidth(double width)
Returns a constraint that matches this one on the height attributes,
but has a fixed width constraint.
toRangeHeight
public RectangleConstraint toRangeHeight(Range range)
Returns a constraint that matches this one on the width attributes,
but has a range height constraint.
range
- the height range (null
not permitted).
toRangeWidth
public RectangleConstraint toRangeWidth(Range range)
Returns a constraint that matches this one on the height attributes,
but has a range width constraint.
range
- the width range (null
not permitted).
toString
public String toString()
Returns a string representation of this instance, mostly used for
debugging purposes.