Package com.itextpdf.text
Class RectangleReadOnly
- java.lang.Object
-
- com.itextpdf.text.Rectangle
-
- com.itextpdf.text.RectangleReadOnly
-
- All Implemented Interfaces:
Element
public class RectangleReadOnly extends Rectangle
ARectangleReadOnly
is the representation of a geometric figure. It's the same as aRectangle
but immutable. Rectangles support constant width borders usingsetBorderWidth(float)
andsetBorder(int)
. They also support borders that vary in width/color on each side using methods likesetBorderWidthLeft(float)
orsetBorderColorLeft(BaseColor)
.- Since:
- 2.1.2
- See Also:
Element
-
-
Field Summary
-
Fields inherited from class com.itextpdf.text.Rectangle
backgroundColor, border, borderColor, borderColorBottom, borderColorLeft, borderColorRight, borderColorTop, borderWidth, borderWidthBottom, borderWidthLeft, borderWidthRight, borderWidthTop, BOTTOM, BOX, LEFT, llx, lly, NO_BORDER, RIGHT, rotation, TOP, UNDEFINED, urx, ury, useVariableBorders
-
Fields inherited from interface com.itextpdf.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, BODY, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CHAPTER, CHUNK, CREATIONDATE, CREATOR, DIV, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LANGUAGE, LIST, LISTITEM, MARKED, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, SECTION, SUBJECT, TITLE, WRITABLE_DIRECT, YMARK
-
-
Constructor Summary
Constructors Constructor Description RectangleReadOnly(float urx, float ury)
Constructs aRectangleReadOnly
-object starting from the origin (0, 0).RectangleReadOnly(float llx, float lly, float urx, float ury)
Constructs aRectangleReadOnly
-object.RectangleReadOnly(float llx, float lly, float urx, float ury, int rotation)
Constructs aRectangleReadOnly
-object.RectangleReadOnly(float urx, float ury, int rotation)
Constructs aRectangleReadOnly
-object starting from the origin (0, 0) and with a specific rotation (valid values are 0, 90, 180, 270).RectangleReadOnly(Rectangle rect)
Constructs aRectangleReadOnly
-object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cloneNonPositionParameters(Rectangle rect)
Copies each of the parameters, except the position, from aRectangle
objectvoid
disableBorderSide(int side)
Disables the border on the specified side.void
enableBorderSide(int side)
Enables the border on the specified side.void
normalize()
Normalizes the rectangle.void
setBackgroundColor(BaseColor value)
Sets the backgroundcolor of the rectangle.void
setBorder(int border)
Enables/Disables the border on the specified sides.void
setBorderColor(BaseColor borderColor)
Sets the color of the border.void
setBorderColorBottom(BaseColor borderColorBottom)
Sets the color of the bottom border.void
setBorderColorLeft(BaseColor borderColorLeft)
Sets the color of the left border.void
setBorderColorRight(BaseColor borderColorRight)
Sets the color of the right bordervoid
setBorderColorTop(BaseColor borderColorTop)
Sets the color of the top border.void
setBorderWidth(float borderWidth)
Sets the borderwidth of the table.void
setBorderWidthBottom(float borderWidthBottom)
Sets the width of the bottom bordervoid
setBorderWidthLeft(float borderWidthLeft)
Sets the width of the left bordervoid
setBorderWidthRight(float borderWidthRight)
Sets the width of the right bordervoid
setBorderWidthTop(float borderWidthTop)
Sets the width of the top bordervoid
setBottom(float lly)
Sets the lower left y-coordinate.void
setGrayFill(float value)
Sets the grayscale of the rectangle.void
setLeft(float llx)
Sets the lower left x-coordinate.void
setRight(float urx)
Sets the upper right x-coordinate.void
setRotation(int rotation)
Sets the rotation of the rectangle.void
setTop(float ury)
Sets the upper right y-coordinate.void
setUseVariableBorders(boolean useVariableBorders)
Sets a parameter indicating if the rectangle has variable bordersvoid
softCloneNonPositionParameters(Rectangle rect)
Copies each of the parameters, except the position, from aRectangle
object if the value is set there.private void
throwReadOnlyError()
Throws an error because of the read only nature of this object.java.lang.String
toString()
Gets the content of the text element.-
Methods inherited from class com.itextpdf.text.Rectangle
equals, getBackgroundColor, getBorder, getBorderColor, getBorderColorBottom, getBorderColorLeft, getBorderColorRight, getBorderColorTop, getBorderWidth, getBorderWidthBottom, getBorderWidthLeft, getBorderWidthRight, getBorderWidthTop, getBottom, getBottom, getChunks, getGrayFill, getHeight, getLeft, getLeft, getRight, getRight, getRotation, getTop, getTop, getWidth, hasBorder, hasBorders, isContent, isNestable, isUseVariableBorders, process, rectangle, rotate, type
-
-
-
-
Constructor Detail
-
RectangleReadOnly
public RectangleReadOnly(float llx, float lly, float urx, float ury)
Constructs aRectangleReadOnly
-object.- Parameters:
llx
- lower left xlly
- lower left yurx
- upper right xury
- upper right y
-
RectangleReadOnly
public RectangleReadOnly(float llx, float lly, float urx, float ury, int rotation)
Constructs aRectangleReadOnly
-object.- Parameters:
llx
- lower left xlly
- lower left yurx
- upper right xury
- upper right yrotation
- the rotation of the Rectangle (0, 90, 180, 270)- Since:
- iText 5.0.6
-
RectangleReadOnly
public RectangleReadOnly(float urx, float ury)
Constructs aRectangleReadOnly
-object starting from the origin (0, 0).- Parameters:
urx
- upper right xury
- upper right y
-
RectangleReadOnly
public RectangleReadOnly(float urx, float ury, int rotation)
Constructs aRectangleReadOnly
-object starting from the origin (0, 0) and with a specific rotation (valid values are 0, 90, 180, 270).- Parameters:
urx
- upper right xury
- upper right yrotation
- the rotation- Since:
- iText 5.0.6
-
RectangleReadOnly
public RectangleReadOnly(Rectangle rect)
Constructs aRectangleReadOnly
-object.- Parameters:
rect
- anotherRectangle
-
-
Method Detail
-
throwReadOnlyError
private void throwReadOnlyError()
Throws an error because of the read only nature of this object.
-
setRotation
public void setRotation(int rotation)
Sets the rotation of the rectangle. Valid values are 0, 90, 180, and 270.- Overrides:
setRotation
in classRectangle
- Parameters:
rotation
- the new rotation value- Since:
- iText 5.0.6
-
setLeft
public void setLeft(float llx)
Sets the lower left x-coordinate.
-
setRight
public void setRight(float urx)
Sets the upper right x-coordinate.
-
setTop
public void setTop(float ury)
Sets the upper right y-coordinate.
-
setBottom
public void setBottom(float lly)
Sets the lower left y-coordinate.
-
normalize
public void normalize()
Normalizes the rectangle. Switches lower left with upper right if necessary.
-
setBackgroundColor
public void setBackgroundColor(BaseColor value)
Sets the backgroundcolor of the rectangle.- Overrides:
setBackgroundColor
in classRectangle
- Parameters:
value
- the new value
-
setGrayFill
public void setGrayFill(float value)
Sets the grayscale of the rectangle.- Overrides:
setGrayFill
in classRectangle
- Parameters:
value
- the new value
-
setBorder
public void setBorder(int border)
Enables/Disables the border on the specified sides. The border is specified as an integer bitwise combination of the constants:LEFT, RIGHT, TOP, BOTTOM
.- Overrides:
setBorder
in classRectangle
- Parameters:
border
- the new value- See Also:
enableBorderSide(int)
,disableBorderSide(int)
-
setUseVariableBorders
public void setUseVariableBorders(boolean useVariableBorders)
Sets a parameter indicating if the rectangle has variable borders- Overrides:
setUseVariableBorders
in classRectangle
- Parameters:
useVariableBorders
- indication if the rectangle has variable borders
-
enableBorderSide
public void enableBorderSide(int side)
Enables the border on the specified side.- Overrides:
enableBorderSide
in classRectangle
- Parameters:
side
- the side to enable. One ofLEFT, RIGHT, TOP, BOTTOM
-
disableBorderSide
public void disableBorderSide(int side)
Disables the border on the specified side.- Overrides:
disableBorderSide
in classRectangle
- Parameters:
side
- the side to disable. One ofLEFT, RIGHT, TOP, BOTTOM
-
setBorderWidth
public void setBorderWidth(float borderWidth)
Sets the borderwidth of the table.- Overrides:
setBorderWidth
in classRectangle
- Parameters:
borderWidth
- the new value
-
setBorderWidthLeft
public void setBorderWidthLeft(float borderWidthLeft)
Sets the width of the left border- Overrides:
setBorderWidthLeft
in classRectangle
- Parameters:
borderWidthLeft
- a width
-
setBorderWidthRight
public void setBorderWidthRight(float borderWidthRight)
Sets the width of the right border- Overrides:
setBorderWidthRight
in classRectangle
- Parameters:
borderWidthRight
- a width
-
setBorderWidthTop
public void setBorderWidthTop(float borderWidthTop)
Sets the width of the top border- Overrides:
setBorderWidthTop
in classRectangle
- Parameters:
borderWidthTop
- a width
-
setBorderWidthBottom
public void setBorderWidthBottom(float borderWidthBottom)
Sets the width of the bottom border- Overrides:
setBorderWidthBottom
in classRectangle
- Parameters:
borderWidthBottom
- a width
-
setBorderColor
public void setBorderColor(BaseColor borderColor)
Sets the color of the border.- Overrides:
setBorderColor
in classRectangle
- Parameters:
borderColor
- aBaseColor
-
setBorderColorLeft
public void setBorderColorLeft(BaseColor borderColorLeft)
Sets the color of the left border.- Overrides:
setBorderColorLeft
in classRectangle
- Parameters:
borderColorLeft
- aBaseColor
-
setBorderColorRight
public void setBorderColorRight(BaseColor borderColorRight)
Sets the color of the right border- Overrides:
setBorderColorRight
in classRectangle
- Parameters:
borderColorRight
- aBaseColor
-
setBorderColorTop
public void setBorderColorTop(BaseColor borderColorTop)
Sets the color of the top border.- Overrides:
setBorderColorTop
in classRectangle
- Parameters:
borderColorTop
- aBaseColor
-
setBorderColorBottom
public void setBorderColorBottom(BaseColor borderColorBottom)
Sets the color of the bottom border.- Overrides:
setBorderColorBottom
in classRectangle
- Parameters:
borderColorBottom
- aBaseColor
-
cloneNonPositionParameters
public void cloneNonPositionParameters(Rectangle rect)
Copies each of the parameters, except the position, from aRectangle
object- Overrides:
cloneNonPositionParameters
in classRectangle
- Parameters:
rect
-Rectangle
to copy from
-
softCloneNonPositionParameters
public void softCloneNonPositionParameters(Rectangle rect)
Copies each of the parameters, except the position, from aRectangle
object if the value is set there.- Overrides:
softCloneNonPositionParameters
in classRectangle
- Parameters:
rect
-Rectangle
to copy from
-
toString
public java.lang.String toString()
Description copied from interface:Element
Gets the content of the text element.
-
-