org.jfree.ui
Class RectangleInsets

java.lang.Object
  extended byorg.jfree.ui.RectangleInsets
All Implemented Interfaces:
java.io.Serializable

public class RectangleInsets
extends java.lang.Object
implements java.io.Serializable

Represents the insets for a rectangle, specified in absolute or relative terms. This class is immutable.

See Also:
Serialized Form

Constructor Summary
RectangleInsets(UnitType unitType, double top, double bottom, double left, double right)
          Creates a new instance.
 
Method Summary
 double calculateBottomMargin(double height)
          Returns the bottom margin.
 double calculateLeftMargin(double width)
          Returns the left margin.
 double calculateRightMargin(double width)
          Returns the right margin.
 double calculateTopMargin(double height)
          Returns the top margin.
 java.awt.geom.Rectangle2D createInsetRectangle(java.awt.geom.Rectangle2D base)
          Creates an 'inset' rectangle.
 java.awt.geom.Rectangle2D createInsetRectangle(java.awt.geom.Rectangle2D base, boolean horizontal, boolean vertical)
          Creates an 'inset' rectangle.
 java.awt.geom.Rectangle2D createOutsetRectangle(java.awt.geom.Rectangle2D base)
          Creates an outset rectangle.
 java.awt.geom.Rectangle2D createOutsetRectangle(java.awt.geom.Rectangle2D base, boolean horizontal, boolean vertical)
          Creates an outset rectangle.
 boolean equals(java.lang.Object object)
          Tests this instance for equality with an arbitrary object.
 double getBottom()
          Returns the bottom insets.
 double getLeft()
          Returns the left insets.
 double getRight()
          Returns the right insets.
 double getTop()
          Returns the top insets.
 UnitType getUnitType()
          Returns the unit type (absolute or relative).
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RectangleInsets

public RectangleInsets(UnitType unitType,
                       double top,
                       double bottom,
                       double left,
                       double right)
Creates a new instance.

Parameters:
unitType - absolute or relative units (null not permitted).
top - the top insets.
bottom - the bottom insets.
left - the left insets.
right - the right insets.
Method Detail

getUnitType

public UnitType getUnitType()
Returns the unit type (absolute or relative). This specifies whether the insets are measured as Java2D units or percentages.

Returns:
The unit type (never null).

getTop

public double getTop()
Returns the top insets.

Returns:
The top insets.

getBottom

public double getBottom()
Returns the bottom insets.

Returns:
The bottom insets.

getLeft

public double getLeft()
Returns the left insets.

Returns:
The left insets.

getRight

public double getRight()
Returns the right insets.

Returns:
The right insets.

equals

public boolean equals(java.lang.Object object)
Tests this instance for equality with an arbitrary object.

Parameters:
object - the object (null permitted).
Returns:
A boolean.

createInsetRectangle

public java.awt.geom.Rectangle2D createInsetRectangle(java.awt.geom.Rectangle2D base)
Creates an 'inset' rectangle.

Parameters:
base - the base rectangle (null not permitted).
Returns:
The inset rectangle.

createInsetRectangle

public java.awt.geom.Rectangle2D createInsetRectangle(java.awt.geom.Rectangle2D base,
                                                      boolean horizontal,
                                                      boolean vertical)
Creates an 'inset' rectangle.

Parameters:
base - the base rectangle (null not permitted).
horizontal - apply horizontal insets?
vertical - apply vertical insets?
Returns:
The inset rectangle.

createOutsetRectangle

public java.awt.geom.Rectangle2D createOutsetRectangle(java.awt.geom.Rectangle2D base)
Creates an outset rectangle.

Parameters:
base - the base rectangle (null not permitted).
Returns:
An outset rectangle.

createOutsetRectangle

public java.awt.geom.Rectangle2D createOutsetRectangle(java.awt.geom.Rectangle2D base,
                                                       boolean horizontal,
                                                       boolean vertical)
Creates an outset rectangle.

Parameters:
base - the base rectangle (null not permitted).
horizontal - apply horizontal insets?
vertical - apply vertical insets?
Returns:
An outset rectangle.

calculateTopMargin

public double calculateTopMargin(double height)
Returns the top margin.

Parameters:
height - the height of the base rectangle.
Returns:
The top margin (in Java2D units).

calculateBottomMargin

public double calculateBottomMargin(double height)
Returns the bottom margin.

Parameters:
height - the height of the base rectangle.
Returns:
The bottom margin (in Java2D units).

calculateLeftMargin

public double calculateLeftMargin(double width)
Returns the left margin.

Parameters:
width - the width of the base rectangle.
Returns:
The left margin (in Java2D units).

calculateRightMargin

public double calculateRightMargin(double width)
Returns the right margin.

Parameters:
width - the width of the base rectangle.
Returns:
The right margin (in Java2D units).