com.lowagie.text
Class Rectangle

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

public class Rectangle
extends Object
implements Element

A Rectangle is the representation of a geometric figure. Rectangles support constant width borders using setBorderWidth(float)and setBorder(int). They also support borders that vary in width/color on each side using methods like setBorderWidthLeft(float)or setBorderColorLeft(java.awt.Color).

See Also:
Element, Table, Cell, HeaderFooter

Field Summary
static int BOTTOM
          This represents one side of the border of the Rectangle.
static int BOX
          This represents a type of border.
static int LEFT
          This represents one side of the border of the Rectangle.
static int NO_BORDER
          This represents a rectangle without borders.
static int RIGHT
          This represents one side of the border of the Rectangle.
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 .
 
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, HEADER, IMGRAW, IMGTEMPLATE, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE, YMARK
 
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
 void cloneNonPositionParameters(Rectangle rect)
          Copies all of the parameters from a Rectangle object except the position.
 void disableBorderSide(int side)
          Disables the border on the specified side.
 void enableBorderSide(int side)
          Enables the border on the specified side.
 Color getBackgroundColor()
          Gets the backgroundcolor.
 int getBorder()
          Returns the exact type of the border.
 Color getBorderColor()
          Gets the color of the border.
 Color getBorderColorBottom()
          Gets the color of a border.
 Color getBorderColorLeft()
          Gets the color of a border.
 Color getBorderColorRight()
          Gets the color of a border.
 Color getBorderColorTop()
          Gets the color of a border.
 float getBorderWidth()
          Gets the borderwidth.
 float getBorderWidthBottom()
          Gets the width of a border.
 float getBorderWidthLeft()
          Gets the width of a border.
 float getBorderWidthRight()
          Gets the width of a border.
 float getBorderWidthTop()
          Gets the width of a border.
 float getBottom()
          Returns the lower left y-coordinate.
 float getBottom(float margin)
          Returns the lower left y-coordinate, considering a given margin.
 ArrayList getChunks()
          Gets all the chunks in this element.
 float getGrayFill()
          Gets the grayscale.
 float getHeight()
          Returns the height of the rectangle.
 float getLeft()
          Returns the lower left x-coordinate.
 float getLeft(float margin)
          Returns the lower left x-coordinate, considering a given margin.
 float getRight()
          Returns the upper right x-coordinate.
 float getRight(float margin)
          Returns the upper right x-coordinate, considering a given margin.
 int getRotation()
          Gets the rotation of the rectangle
 float getTop()
          Returns the upper right y-coordinate.
 float getTop(float margin)
          Returns the upper right y-coordinate, considering a given margin.
 float getWidth()
          Returns the width of the rectangle.
 boolean hasBorder(int type)
          Indicates if the table has a some type of border.
 boolean hasBorders()
          Indicates if the table has borders.
 boolean isContent()
          Checks if this element is a content object.
 boolean isNestable()
          Checks if this element is nestable.
 boolean isUseVariableBorders()
          Indicates whether variable width borders are being used.
 void normalize()
          Switches lowerleft with upperright
 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.
 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)
          Enables/Disables the border on the specified sides.
 void setBorderColor(Color value)
          Sets the color of the border.
 void setBorderColorBottom(Color value)
          Sets the value of the border color
 void setBorderColorLeft(Color value)
          Sets the value of the border color
 void setBorderColorRight(Color value)
          Sets the value of the border color
 void setBorderColorTop(Color value)
          Sets the value of the border color
 void setBorderWidth(float value)
          Sets the borderwidth of the table.
 void setBorderWidthBottom(float borderWidthBottom)
          Sets the width of a border
 void setBorderWidthLeft(float borderWidthLeft)
          Sets the width of a border
 void setBorderWidthRight(float borderWidthRight)
          Sets the width of a border
 void setBorderWidthTop(float borderWidthTop)
          Sets the width of a border
 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 setRight(float value)
          Sets the upper right x-coordinate.
 void setTop(float value)
          Sets the upper right y-coordinate.
 void setUseVariableBorders(boolean useVariableBorders)
          Sets a parameter indicating if the rectangle has variable borders
 void softCloneNonPositionParameters(Rectangle rect)
          Copies all of the parameters from a Rectangle object except the position.
 String toString()
          Gets the content of the text element.
 int type()
          Gets the type of the text element.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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
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

isContent

public boolean isContent()
Description copied from interface: Element
Checks if this element is a content object. If not, it's a metadata object.

Specified by:
isContent in interface Element
Returns:
true if this is a 'content' element; false if this is a 'metadata' element
Since:
iText 2.0.8
See Also:
Element.isContent()

isNestable

public boolean isNestable()
Description copied from interface: Element
Checks if this element is nestable.

Specified by:
isNestable in interface Element
Returns:
true if this element can be nested inside other elements.
Since:
iText 2.0.8
See Also:
Element.isNestable()

setLeft

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

Parameters:
value - the new value

getLeft

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

Returns:
the lower left x-coordinate

getLeft

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

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

setRight

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

Parameters:
value - the new value

getRight

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

Returns:
the upper right x-coordinate

getRight

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

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

getWidth

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

Returns:
a width

setTop

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

Parameters:
value - the new value

getTop

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

Returns:
the upper right y-coordinate

getTop

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

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

setBottom

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

Parameters:
value - the new value

getBottom

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

Returns:
the lower left y-coordinate

getBottom

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

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

getHeight

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

Returns:
a height

normalize

public void normalize()
Switches lowerleft with upperright


getRotation

public int getRotation()
Gets the rotation of the rectangle

Returns:
a rotation value

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

getBorder

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

Returns:
a value

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

setBorder

public void setBorder(int value)
Enables/Disables the border on the specified sides. The border is specified as an integer bitwise combination of the constants: LEFT, RIGHT, TOP, BOTTOM.

Parameters:
value - the new value
See Also:
enableBorderSide(int), disableBorderSide(int)

enableBorderSide

public void enableBorderSide(int side)
Enables the border on the specified side.

Parameters:
side - the side to enable. One of LEFT, RIGHT, TOP, BOTTOM

disableBorderSide

public void disableBorderSide(int side)
Disables the border on the specified side.

Parameters:
side - the side to disable. One of LEFT, RIGHT, TOP, BOTTOM

getBorderWidth

public float getBorderWidth()
Gets the borderwidth.

Returns:
a value

setBorderWidth

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

Parameters:
value - the new value

getBorderColor

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

Returns:
a value

setBorderColor

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

Parameters:
value - the new value

getBackgroundColor

public Color getBackgroundColor()
Gets the backgroundcolor.

Returns:
a value

setBackgroundColor

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

Parameters:
value - the new value

getGrayFill

public float getGrayFill()
Gets the grayscale.

Returns:
a value

setGrayFill

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

Parameters:
value - the new value

isUseVariableBorders

public boolean isUseVariableBorders()
Indicates whether variable width borders are being used. Returns true if setBorderWidthLeft, setBorderWidthRight, setBorderWidthTop, or setBorderWidthBottom has been called.

Returns:
true if variable width borders are in use

setUseVariableBorders

public void setUseVariableBorders(boolean useVariableBorders)
Sets a parameter indicating if the rectangle has variable borders

Parameters:
useVariableBorders - indication if the rectangle has variable borders

getBorderWidthLeft

public float getBorderWidthLeft()
Gets the width of a border.

Returns:
a width

setBorderWidthLeft

public void setBorderWidthLeft(float borderWidthLeft)
Sets the width of a border

Parameters:
borderWidthLeft - a width

getBorderWidthRight

public float getBorderWidthRight()
Gets the width of a border.

Returns:
a width

setBorderWidthRight

public void setBorderWidthRight(float borderWidthRight)
Sets the width of a border

Parameters:
borderWidthRight - a width

getBorderWidthTop

public float getBorderWidthTop()
Gets the width of a border.

Returns:
a width

setBorderWidthTop

public void setBorderWidthTop(float borderWidthTop)
Sets the width of a border

Parameters:
borderWidthTop - a width

getBorderWidthBottom

public float getBorderWidthBottom()
Gets the width of a border.

Returns:
a width

setBorderWidthBottom

public void setBorderWidthBottom(float borderWidthBottom)
Sets the width of a border

Parameters:
borderWidthBottom - a width

getBorderColorLeft

public Color getBorderColorLeft()
Gets the color of a border.

Returns:
a color value

setBorderColorLeft

public void setBorderColorLeft(Color value)
Sets the value of the border color

Parameters:
value - a color value

getBorderColorRight

public Color getBorderColorRight()
Gets the color of a border.

Returns:
a color value

setBorderColorRight

public void setBorderColorRight(Color value)
Sets the value of the border color

Parameters:
value - a color value

getBorderColorTop

public Color getBorderColorTop()
Gets the color of a border.

Returns:
a color value

setBorderColorTop

public void setBorderColorTop(Color value)
Sets the value of the border color

Parameters:
value - a color value

getBorderColorBottom

public Color getBorderColorBottom()
Gets the color of a border.

Returns:
a color value

setBorderColorBottom

public void setBorderColorBottom(Color value)
Sets the value of the border color

Parameters:
value - a color value

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

cloneNonPositionParameters

public void cloneNonPositionParameters(Rectangle rect)
Copies all of the parameters from a Rectangle object except the position.

Parameters:
rect - Rectangle to copy from

softCloneNonPositionParameters

public void softCloneNonPositionParameters(Rectangle rect)
Copies all of the parameters from a Rectangle object except the position.

Parameters:
rect - Rectangle to copy from

toString

public String toString()
Description copied from interface: Element
Gets the content of the text element.

Specified by:
toString in interface Element
See Also:
Object.toString()


Copyright © 2011 EGIZ - E-Government Innovation Center. All Rights Reserved.