com.lowagie.text
Class Rectangle

java.lang.Object
  extended bycom.lowagie.text.Rectangle
All Implemented Interfaces:
Element, MarkupAttributes
Direct Known Subclasses:
Cell, HeaderFooter, Image, PdfCell, PdfPCell, PdfTable, Table

public class Rectangle
extends Object
implements Element, MarkupAttributes

A Rectangle is the representation of a geometric figure.

See Also:
Element, Table, Cell, HeaderFooter

Field Summary
protected  Color background
          This is the color of the background of this rectangle.
protected  int border
          This represents the status of the 4 sides of the rectangle.
protected  float borderWidth
          This is the width of the border around this rectangle.
static int BOTTOM
          This represents one side of the border of the Rectangle.
static int BOX
          This represents a type of border.
protected  Color color
          This is the color of the border of this rectangle.
protected  float grayFill
          This is the grayscale value of the background of this rectangle.
static int LEFT
          This represents one side of the border of the Rectangle.
protected  float llx
          the lower left x-coordinate.
protected  float lly
          the lower left y-coordinate.
protected  Properties markupAttributes
          Contains extra markupAttributes
static int NO_BORDER
          This represents a rectangle without borders.
static int RIGHT
          This represents one side of the border of the Rectangle.
protected  int rotation
           
static int TOP
          This represents one side of the border of the Rectangle.
static int UNDEFINED
          This is the value that will be used as undefined.
protected  float urx
          the upper right x-coordinate.
protected  float ury
          the upper right y-coordinate.
 
Fields inherited from interface com.lowagie.text.Element
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, ANCHOR, ANNOTATION, AUTHOR, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CELL, CHAPTER, CHUNK, CREATIONDATE, CREATOR, GRAPHIC, HEADER, IMGRAW, IMGTEMPLATE, JPEG, KEYWORDS, LIST, LISTITEM, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE
 
Constructor Summary
Rectangle(float urx, float ury)
          Constructs a Rectangle-object starting from the origin (0, 0).
Rectangle(float llx, float lly, float urx, float ury)
          Constructs a Rectangle-object.
Rectangle(Rectangle rect)
          Constructs a Rectangle-object.
 
Method Summary
 Color backgroundColor()
          Gets the backgroundcolor.
 int border()
          Returns the exact type of the border.
 Color borderColor()
          Gets the color of the border.
 float borderWidth()
          Gets the borderwidth.
 float bottom()
          Returns the lower left y-coordinate.
 float bottom(float margin)
          Returns the lower left y-coordinate, considering a given margin.
 ArrayList getChunks()
          Gets all the chunks in this element.
 String getMarkupAttribute(String name)
          Returns the value of the specified attribute.
 Set getMarkupAttributeNames()
          Returns a Set of String attribute names for the MarkupAttributes implementor.
 Properties getMarkupAttributes()
          Return a Properties-object containing all the markupAttributes.
 int getRotation()
           
 float grayFill()
          Gets the grayscale.
 boolean hasBorder(int type)
          Indicates if the table has a some type of border.
 boolean hasBorders()
          Indicates if the table has borders.
 float height()
          Returns the height of the rectangle.
 float left()
          Returns the lower left x-coordinate.
 float left(float margin)
          Returns the lower left x-coordinate, considering a given margin.
 boolean process(ElementListener listener)
          Processes the element by adding it (or the different parts) to an ElementListener.
 Rectangle rectangle(float top, float bottom)
          Gets a Rectangle that is altered to fit on the page.
 float right()
          Returns the upper right x-coordinate.
 float right(float margin)
          Returns the upper right x-coordinate, considering a given margin.
 Rectangle rotate()
          Swaps the values of urx and ury and of lly and llx in order to rotate the rectangle.
 void setBackgroundColor(Color value)
          Sets the backgroundcolor of the rectangle.
 void setBorder(int value)
          Sets the border.
 void setBorderColor(Color value)
          Sets the color of the border.
 void setBorderWidth(float value)
          Sets the borderwidth of the table.
 void setBottom(float value)
          Sets the lower left y-coordinate.
 void setGrayFill(float value)
          Sets the grayscale of the rectangle.
 void setLeft(float value)
          Sets the lower left x-coordinate.
 void setMarkupAttribute(String name, String value)
          Sets the specified attribute.
 void setMarkupAttributes(Properties markupAttributes)
          Sets the markupAttributes.
 void setRight(float value)
          Sets the upper right x-coordinate.
 void setTop(float value)
          Sets the upper right y-coordinate.
 float top()
          Returns the upper right y-coordinate.
 float top(float margin)
          Returns the upper right y-coordinate, considering a given margin.
 int type()
          Gets the type of the text element.
 float width()
          Returns the width of the rectangle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.lowagie.text.Element
toString
 

Field Detail

UNDEFINED

public static final int UNDEFINED
This is the value that will be used as undefined.

See Also:
Constant Field Values

TOP

public static final int TOP
This represents one side of the border of the Rectangle.

See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
This represents one side of the border of the Rectangle.

See Also:
Constant Field Values

LEFT

public static final int LEFT
This represents one side of the border of the Rectangle.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
This represents one side of the border of the Rectangle.

See Also:
Constant Field Values

NO_BORDER

public static final int NO_BORDER
This represents a rectangle without borders.

See Also:
Constant Field Values

BOX

public static final int BOX
This represents a type of border.

See Also:
Constant Field Values

llx

protected float llx
the lower left x-coordinate.


lly

protected float lly
the lower left y-coordinate.


urx

protected float urx
the upper right x-coordinate.


ury

protected float ury
the upper right y-coordinate.


border

protected int border
This represents the status of the 4 sides of the rectangle.


borderWidth

protected float borderWidth
This is the width of the border around this rectangle.


color

protected Color color
This is the color of the border of this rectangle.


background

protected Color background
This is the color of the background of this rectangle.


grayFill

protected float grayFill
This is the grayscale value of the background of this rectangle.


rotation

protected int rotation

markupAttributes

protected Properties markupAttributes
Contains extra markupAttributes

Constructor Detail

Rectangle

public Rectangle(float llx,
                 float lly,
                 float urx,
                 float ury)
Constructs a Rectangle-object.

Parameters:
llx - lower left x
lly - lower left y
urx - upper right x
ury - upper right y

Rectangle

public Rectangle(float urx,
                 float ury)
Constructs a Rectangle-object starting from the origin (0, 0).

Parameters:
urx - upper right x
ury - upper right y

Rectangle

public Rectangle(Rectangle rect)
Constructs a Rectangle-object.

Parameters:
rect - another Rectangle
Method Detail

process

public boolean process(ElementListener listener)
Processes the element by adding it (or the different parts) to an ElementListener.

Specified by:
process in interface Element
Parameters:
listener - an ElementListener
Returns:
true if the element was processed successfully

type

public int type()
Gets the type of the text element.

Specified by:
type in interface Element
Returns:
a type

getChunks

public ArrayList getChunks()
Gets all the chunks in this element.

Specified by:
getChunks in interface Element
Returns:
an ArrayList

rectangle

public Rectangle rectangle(float top,
                           float bottom)
Gets a Rectangle that is altered to fit on the page.

Parameters:
top - the top position
bottom - the bottom position
Returns:
a Rectangle

rotate

public Rectangle rotate()
Swaps the values of urx and ury and of lly and llx in order to rotate the rectangle.

Returns:
a Rectangle

setLeft

public void setLeft(float value)
Sets the lower left x-coordinate.

Parameters:
value - the new value

setRight

public void setRight(float value)
Sets the upper right x-coordinate.

Parameters:
value - the new value

setTop

public void setTop(float value)
Sets the upper right y-coordinate.

Parameters:
value - the new value

setBottom

public void setBottom(float value)
Sets the lower left y-coordinate.

Parameters:
value - the new value

setBorder

public void setBorder(int value)
Sets the border.

Parameters:
value - the new value

setBorderWidth

public void setBorderWidth(float value)
Sets the borderwidth of the table.

Parameters:
value - the new value

setBorderColor

public void setBorderColor(Color value)
Sets the color of the border.

Parameters:
value - the new value

setBackgroundColor

public void setBackgroundColor(Color value)
Sets the backgroundcolor of the rectangle.

Parameters:
value - the new value

setGrayFill

public void setGrayFill(float value)
Sets the grayscale of the rectangle.

Parameters:
value - the new value

left

public float left()
Returns the lower left x-coordinate.

Returns:
the lower left x-coordinate

right

public float right()
Returns the upper right x-coordinate.

Returns:
the upper right x-coordinate

top

public float top()
Returns the upper right y-coordinate.

Returns:
the upper right y-coordinate

bottom

public float bottom()
Returns the lower left y-coordinate.

Returns:
the lower left y-coordinate

left

public float left(float margin)
Returns the lower left x-coordinate, considering a given margin.

Parameters:
margin - a margin
Returns:
the lower left x-coordinate

right

public float right(float margin)
Returns the upper right x-coordinate, considering a given margin.

Parameters:
margin - a margin
Returns:
the upper right x-coordinate

top

public float top(float margin)
Returns the upper right y-coordinate, considering a given margin.

Parameters:
margin - a margin
Returns:
the upper right y-coordinate

bottom

public float bottom(float margin)
Returns the lower left y-coordinate, considering a given margin.

Parameters:
margin - a margin
Returns:
the lower left y-coordinate

width

public float width()
Returns the width of the rectangle.

Returns:
a width

height

public float height()
Returns the height of the rectangle.

Returns:
a height

hasBorders

public boolean hasBorders()
Indicates if the table has borders.

Returns:
a boolean

hasBorder

public boolean hasBorder(int type)
Indicates if the table has a some type of border.

Parameters:
type - the type of border
Returns:
a boolean

border

public int border()
Returns the exact type of the border.

Returns:
a value

borderWidth

public float borderWidth()
Gets the borderwidth.

Returns:
a value

borderColor

public Color borderColor()
Gets the color of the border.

Returns:
a value

backgroundColor

public Color backgroundColor()
Gets the backgroundcolor.

Returns:
a value

grayFill

public float grayFill()
Gets the grayscale.

Returns:
a value

getRotation

public int getRotation()

setMarkupAttribute

public void setMarkupAttribute(String name,
                               String value)
Description copied from interface: MarkupAttributes
Sets the specified attribute.

Specified by:
setMarkupAttribute in interface MarkupAttributes
Parameters:
name - String attribute name.
value - String attribute value.
See Also:
MarkupAttributes.setMarkupAttribute(java.lang.String, java.lang.String)

setMarkupAttributes

public void setMarkupAttributes(Properties markupAttributes)
Description copied from interface: MarkupAttributes
Sets the markupAttributes.

Specified by:
setMarkupAttributes in interface MarkupAttributes
Parameters:
markupAttributes - a Properties-object containing markupattributes
See Also:
MarkupAttributes.setMarkupAttributes(java.util.Properties)

getMarkupAttribute

public String getMarkupAttribute(String name)
Description copied from interface: MarkupAttributes
Returns the value of the specified attribute.

Specified by:
getMarkupAttribute in interface MarkupAttributes
Parameters:
name - String attribute name.
Returns:
String.
See Also:
MarkupAttributes.getMarkupAttribute(java.lang.String)

getMarkupAttributeNames

public Set getMarkupAttributeNames()
Description copied from interface: MarkupAttributes
Returns a Set of String attribute names for the MarkupAttributes implementor.

Specified by:
getMarkupAttributeNames in interface MarkupAttributes
Returns:
Set.
See Also:
MarkupAttributes.getMarkupAttributeNames()

getMarkupAttributes

public Properties getMarkupAttributes()
Description copied from interface: MarkupAttributes
Return a Properties-object containing all the markupAttributes.

Specified by:
getMarkupAttributes in interface MarkupAttributes
Returns:
Properties
See Also:
MarkupAttributes.getMarkupAttributes()