Method from com.lowagie.text.Rectangle Detail: |
public void cloneNonPositionParameters(Rectangle rect) {
this.rotation = rect.rotation;
this.backgroundColor = rect.backgroundColor;
this.border = rect.border;
this.useVariableBorders = rect.useVariableBorders;
this.borderWidth = rect.borderWidth;
this.borderWidthLeft = rect.borderWidthLeft;
this.borderWidthRight = rect.borderWidthRight;
this.borderWidthTop = rect.borderWidthTop;
this.borderWidthBottom = rect.borderWidthBottom;
this.borderColor = rect.borderColor;
this.borderColorLeft = rect.borderColorLeft;
this.borderColorRight = rect.borderColorRight;
this.borderColorTop = rect.borderColorTop;
this.borderColorBottom = rect.borderColorBottom;
}
Copies each of the parameters, except the position, from a
Rectangle object |
public void disableBorderSide(int side) {
if (border == UNDEFINED)
border = 0;
border &= ~side;
}
Disables the border on the specified side. |
public void enableBorderSide(int side) {
if (border == UNDEFINED)
border = 0;
border |= side;
}
Enables the border on the specified side. |
public Color getBackgroundColor() {
return backgroundColor;
}
Gets the backgroundcolor. |
public int getBorder() {
return border;
}
Returns the exact type of the border. |
public Color getBorderColor() {
return borderColor;
}
Gets the color of the border. |
public Color getBorderColorBottom() {
if (borderColorBottom == null)
return borderColor;
return borderColorBottom;
}
Gets the color of the bottom border. |
public Color getBorderColorLeft() {
if (borderColorLeft == null)
return borderColor;
return borderColorLeft;
}
Gets the color of the left border. |
public Color getBorderColorRight() {
if (borderColorRight == null)
return borderColor;
return borderColorRight;
}
Gets the color of the right border. |
public Color getBorderColorTop() {
if (borderColorTop == null)
return borderColor;
return borderColorTop;
}
Gets the color of the top border. |
public float getBorderWidth() {
return borderWidth;
}
|
public float getBorderWidthBottom() {
return getVariableBorderWidth(borderWidthBottom, BOTTOM);
}
Gets the width of the bottom border. |
public float getBorderWidthLeft() {
return getVariableBorderWidth(borderWidthLeft, LEFT);
}
Gets the width of the left border. |
public float getBorderWidthRight() {
return getVariableBorderWidth(borderWidthRight, RIGHT);
}
Gets the width of the right border. |
public float getBorderWidthTop() {
return getVariableBorderWidth(borderWidthTop, TOP);
}
Gets the width of the top border. |
public float getBottom() {
return lly;
}
Returns the lower left y-coordinate. |
public float getBottom(float margin) {
return lly + margin;
}
Returns the lower left y-coordinate, considering a given margin. |
public ArrayList getChunks() {
return new ArrayList();
}
Gets all the chunks in this element. |
public float getGrayFill() {
if (backgroundColor instanceof GrayColor)
return ((GrayColor)backgroundColor).getGray();
return 0;
}
|
public float getHeight() {
return ury - lly;
}
Returns the height of the rectangle. |
public float getLeft() {
return llx;
}
Returns the lower left x-coordinate. |
public float getLeft(float margin) {
return llx + margin;
}
Returns the lower left x-coordinate, considering a given margin. |
public float getRight() {
return urx;
}
Returns the upper right x-coordinate. |
public float getRight(float margin) {
return urx - margin;
}
Returns the upper right x-coordinate, considering a given margin. |
public int getRotation() {
return rotation;
}
Gets the rotation of the rectangle |
public float getTop() {
return ury;
}
Returns the upper right y-coordinate. |
public float getTop(float margin) {
return ury - margin;
}
Returns the upper right y-coordinate, considering a given margin. |
public float getWidth() {
return urx - llx;
}
Returns the width of the rectangle. |
public boolean hasBorder(int type) {
if (border == UNDEFINED)
return false;
return (border & type) == type;
}
Indicates whether the specified type of border is set. |
public boolean hasBorders() {
switch (border) {
case UNDEFINED:
case NO_BORDER:
return false;
default:
return borderWidth > 0 || borderWidthLeft > 0
|| borderWidthRight > 0 || borderWidthTop > 0 || borderWidthBottom > 0;
}
}
Indicates whether some type of border is set. |
public boolean isContent() {
return true;
}
|
public boolean isNestable() {
return false;
}
|
public boolean isUseVariableBorders() {
return useVariableBorders;
}
Indicates whether variable width borders are being used.
Returns true if setBorderWidthLeft, setBorderWidthRight,
setBorderWidthTop, or setBorderWidthBottom has been called. |
public void normalize() {
if (llx > urx) {
float a = llx;
llx = urx;
urx = a;
}
if (lly > ury) {
float a = lly;
lly = ury;
ury = a;
}
}
Normalizes the rectangle.
Switches lower left with upper right if necessary. |
public boolean process(ElementListener listener) {
try {
return listener.add(this);
}
catch (DocumentException de) {
return false;
}
}
Processes the element by adding it (or the different parts) to an
ElementListener . |
public Rectangle rectangle(float top,
float bottom) {
Rectangle tmp = new Rectangle(this);
if (getTop() > top) {
tmp.setTop(top);
tmp.disableBorderSide(TOP);
}
if (getBottom() < bottom) {
tmp.setBottom(bottom);
tmp.disableBorderSide(BOTTOM);
}
return tmp;
}
Gets a Rectangle that is altered to fit on the page. |
public Rectangle rotate() {
Rectangle rect = new Rectangle(lly, llx, ury, urx);
rect.rotation = rotation + 90;
rect.rotation %= 360;
return rect;
}
Rotates the rectangle.
Swaps the values of llx and lly and of urx and ury. |
public void setBackgroundColor(Color backgroundColor) {
this.backgroundColor = backgroundColor;
}
Sets the backgroundcolor of the rectangle. |
public void setBorder(int border) {
this.border = 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 . |
public void setBorderColor(Color borderColor) {
this.borderColor = borderColor;
}
Sets the color of the border. |
public void setBorderColorBottom(Color borderColorBottom) {
this.borderColorBottom = borderColorBottom;
}
Sets the color of the bottom border. |
public void setBorderColorLeft(Color borderColorLeft) {
this.borderColorLeft = borderColorLeft;
}
Sets the color of the left border. |
public void setBorderColorRight(Color borderColorRight) {
this.borderColorRight = borderColorRight;
}
Sets the color of the right border. |
public void setBorderColorTop(Color borderColorTop) {
this.borderColorTop = borderColorTop;
}
Sets the color of the top border. |
public void setBorderWidth(float borderWidth) {
this.borderWidth = borderWidth;
}
Sets the borderwidth of the table. |
public void setBorderWidthBottom(float borderWidthBottom) {
this.borderWidthBottom = borderWidthBottom;
updateBorderBasedOnWidth(borderWidthBottom, BOTTOM);
}
Sets the width of the bottom border. |
public void setBorderWidthLeft(float borderWidthLeft) {
this.borderWidthLeft = borderWidthLeft;
updateBorderBasedOnWidth(borderWidthLeft, LEFT);
}
Sets the width of the left border. |
public void setBorderWidthRight(float borderWidthRight) {
this.borderWidthRight = borderWidthRight;
updateBorderBasedOnWidth(borderWidthRight, RIGHT);
}
Sets the width of the right border. |
public void setBorderWidthTop(float borderWidthTop) {
this.borderWidthTop = borderWidthTop;
updateBorderBasedOnWidth(borderWidthTop, TOP);
}
Sets the width of the top border. |
public void setBottom(float lly) {
this.lly = lly;
}
Sets the lower left y-coordinate. |
public void setGrayFill(float value) {
backgroundColor = new GrayColor(value);
}
Sets the the background color to a grayscale value. |
public void setLeft(float llx) {
this.llx = llx;
}
Sets the lower left x-coordinate. |
public void setRight(float urx) {
this.urx = urx;
}
Sets the upper right x-coordinate. |
public void setTop(float ury) {
this.ury = ury;
}
Sets the upper right y-coordinate. |
public void setUseVariableBorders(boolean useVariableBorders) {
this.useVariableBorders = useVariableBorders;
}
Sets a parameter indicating if the rectangle has variable borders |
public void softCloneNonPositionParameters(Rectangle rect) {
if (rect.rotation != 0)
this.rotation = rect.rotation;
if (rect.backgroundColor != null)
this.backgroundColor = rect.backgroundColor;
if (rect.border != UNDEFINED)
this.border = rect.border;
if (useVariableBorders)
this.useVariableBorders = rect.useVariableBorders;
if (rect.borderWidth != UNDEFINED)
this.borderWidth = rect.borderWidth;
if (rect.borderWidthLeft != UNDEFINED)
this.borderWidthLeft = rect.borderWidthLeft;
if (rect.borderWidthRight != UNDEFINED)
this.borderWidthRight = rect.borderWidthRight;
if (rect.borderWidthTop != UNDEFINED)
this.borderWidthTop = rect.borderWidthTop;
if (rect.borderWidthBottom != UNDEFINED)
this.borderWidthBottom = rect.borderWidthBottom;
if (rect.borderColor != null)
this.borderColor = rect.borderColor;
if (rect.borderColorLeft != null)
this.borderColorLeft = rect.borderColorLeft;
if (rect.borderColorRight != null)
this.borderColorRight = rect.borderColorRight;
if (rect.borderColorTop != null)
this.borderColorTop = rect.borderColorTop;
if (rect.borderColorBottom != null)
this.borderColorBottom = rect.borderColorBottom;
}
Copies each of the parameters, except the position, from a
Rectangle object if the value is set there |
public String toString() {
StringBuffer buf = new StringBuffer("Rectangle: ");
buf.append(getWidth());
buf.append('x');
buf.append(getHeight());
buf.append(" (rot: ");
buf.append(rotation);
buf.append(" degrees)");
return buf.toString();
}
|
public int type() {
return Element.RECTANGLE;
}
Gets the type of the text element. |