Class RectangleReadOnly
java.lang.Object
com.itextpdf.text.Rectangle
com.itextpdf.text.RectangleReadOnly
- All Implemented Interfaces:
Element
A
RectangleReadOnly is the representation of a geometric figure.
It's the same as a Rectangle but immutable.
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(BaseColor).- Since:
- 2.1.2
- See Also:
-
Field Summary
Fields inherited from class 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, useVariableBordersFields inherited from interface 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
ConstructorsConstructorDescriptionRectangleReadOnly(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
Modifier and TypeMethodDescriptionvoidCopies each of the parameters, except the position, from aRectangleobjectvoiddisableBorderSide(int side) Disables the border on the specified side.voidenableBorderSide(int side) Enables the border on the specified side.voidNormalizes the rectangle.voidsetBackgroundColor(BaseColor value) Sets the backgroundcolor of the rectangle.voidsetBorder(int border) Enables/Disables the border on the specified sides.voidsetBorderColor(BaseColor borderColor) Sets the color of the border.voidsetBorderColorBottom(BaseColor borderColorBottom) Sets the color of the bottom border.voidsetBorderColorLeft(BaseColor borderColorLeft) Sets the color of the left border.voidsetBorderColorRight(BaseColor borderColorRight) Sets the color of the right bordervoidsetBorderColorTop(BaseColor borderColorTop) Sets the color of the top border.voidsetBorderWidth(float borderWidth) Sets the borderwidth of the table.voidsetBorderWidthBottom(float borderWidthBottom) Sets the width of the bottom bordervoidsetBorderWidthLeft(float borderWidthLeft) Sets the width of the left bordervoidsetBorderWidthRight(float borderWidthRight) Sets the width of the right bordervoidsetBorderWidthTop(float borderWidthTop) Sets the width of the top bordervoidsetBottom(float lly) Sets the lower left y-coordinate.voidsetGrayFill(float value) Sets the grayscale of the rectangle.voidsetLeft(float llx) Sets the lower left x-coordinate.voidsetRight(float urx) Sets the upper right x-coordinate.voidsetRotation(int rotation) Sets the rotation of the rectangle.voidsetTop(float ury) Sets the upper right y-coordinate.voidsetUseVariableBorders(boolean useVariableBorders) Sets a parameter indicating if the rectangle has variable bordersvoidCopies each of the parameters, except the position, from aRectangleobject if the value is set there.private voidThrows an error because of the read only nature of this object.toString()Gets the content of the text element.Methods inherited from class 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 Details
-
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
Constructs aRectangleReadOnly-object.- Parameters:
rect- anotherRectangle
-
-
Method Details
-
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:
setRotationin classRectangle- Parameters:
rotation- the new rotation value- Since:
- iText 5.0.6
-
setLeft
-
setRight
-
setTop
-
setBottom
-
normalize
-
setBackgroundColor
Sets the backgroundcolor of the rectangle.- Overrides:
setBackgroundColorin classRectangle- Parameters:
value- the new value
-
setGrayFill
public void setGrayFill(float value) Sets the grayscale of the rectangle.- Overrides:
setGrayFillin classRectangle- Parameters:
value- the new value
-
setBorder
-
setUseVariableBorders
public void setUseVariableBorders(boolean useVariableBorders) Sets a parameter indicating if the rectangle has variable borders- Overrides:
setUseVariableBordersin classRectangle- Parameters:
useVariableBorders- indication if the rectangle has variable borders
-
enableBorderSide
public void enableBorderSide(int side) Enables the border on the specified side.- Overrides:
enableBorderSidein 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:
disableBorderSidein 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:
setBorderWidthin classRectangle- Parameters:
borderWidth- the new value
-
setBorderWidthLeft
public void setBorderWidthLeft(float borderWidthLeft) Sets the width of the left border- Overrides:
setBorderWidthLeftin classRectangle- Parameters:
borderWidthLeft- a width
-
setBorderWidthRight
public void setBorderWidthRight(float borderWidthRight) Sets the width of the right border- Overrides:
setBorderWidthRightin classRectangle- Parameters:
borderWidthRight- a width
-
setBorderWidthTop
public void setBorderWidthTop(float borderWidthTop) Sets the width of the top border- Overrides:
setBorderWidthTopin classRectangle- Parameters:
borderWidthTop- a width
-
setBorderWidthBottom
public void setBorderWidthBottom(float borderWidthBottom) Sets the width of the bottom border- Overrides:
setBorderWidthBottomin classRectangle- Parameters:
borderWidthBottom- a width
-
setBorderColor
Sets the color of the border.- Overrides:
setBorderColorin classRectangle- Parameters:
borderColor- aBaseColor
-
setBorderColorLeft
Sets the color of the left border.- Overrides:
setBorderColorLeftin classRectangle- Parameters:
borderColorLeft- aBaseColor
-
setBorderColorRight
Sets the color of the right border- Overrides:
setBorderColorRightin classRectangle- Parameters:
borderColorRight- aBaseColor
-
setBorderColorTop
Sets the color of the top border.- Overrides:
setBorderColorTopin classRectangle- Parameters:
borderColorTop- aBaseColor
-
setBorderColorBottom
Sets the color of the bottom border.- Overrides:
setBorderColorBottomin classRectangle- Parameters:
borderColorBottom- aBaseColor
-
cloneNonPositionParameters
Copies each of the parameters, except the position, from aRectangleobject- Overrides:
cloneNonPositionParametersin classRectangle- Parameters:
rect-Rectangleto copy from
-
softCloneNonPositionParameters
Copies each of the parameters, except the position, from aRectangleobject if the value is set there.- Overrides:
softCloneNonPositionParametersin classRectangle- Parameters:
rect-Rectangleto copy from
-
toString
-