Package net.atthegate.server.service.pdf
Class Box
java.lang.Object
net.atthegate.server.service.pdf.Box
- All Implemented Interfaces:
Drawable
Used to create rectangular boxes on a page.
Also used to for layout purposes. See the placeIn method in the Image and TextLine classes.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat[]
Draws this box on the specified page.void
Places this box in the another box.void
Places this box in the another box.void
scaleBy
(double factor) Scales this box by the spacified factor.void
scaleBy
(float factor) Scales this box by the spacified factor.setActualText
(String actualText) Sets the actual text for this box.setAltDescription
(String altDescription) Sets the alternate description of this box.void
setColor
(int color) Sets the color for this box.void
setFillShape
(boolean fill_shape) Sets the private fill_shape variable.void
setGoToAction
(String key) Sets the destination key for the action.void
setLineWidth
(double width) Sets the width of this line.void
setLineWidth
(float width) Sets the width of this line.setLocation
(float x, float y) Sets the location of this box on the page.void
setPattern
(String pattern) The line dash pattern controls the pattern of dashes and gaps used to stroke paths.setPosition
(double x, double y) Sets the position of this box on the page.setPosition
(float x, float y) Sets the position of this box on the page.void
setSize
(double w, double h) Sets the size of this box.void
setSize
(float w, float h) Sets the size of this box.void
setURIAction
(String uri) Sets the URI for the "click box" action.
-
Field Details
-
x
protected float x -
y
protected float y -
uri
-
key
-
-
Constructor Details
-
Box
public Box()The default constructor. -
Box
public Box(double x, double y, double w, double h) Creates a box object.- Parameters:
x
- the x coordinate of the top left corner of this box when drawn on the page.y
- the y coordinate of the top left corner of this box when drawn on the page.w
- the width of this box.h
- the height of this box.
-
Box
public Box(float x, float y, float w, float h) Creates a box object.- Parameters:
x
- the x coordinate of the top left corner of this box when drawn on the page.y
- the y coordinate of the top left corner of this box when drawn on the page.w
- the width of this box.h
- the height of this box.
-
-
Method Details
-
setPosition
Sets the position of this box on the page.- Parameters:
x
- the x coordinate of the top left corner of this box when drawn on the page.y
- the y coordinate of the top left corner of this box when drawn on the page.
-
setPosition
Sets the position of this box on the page.- Parameters:
x
- the x coordinate of the top left corner of this box when drawn on the page.y
- the y coordinate of the top left corner of this box when drawn on the page.
-
setLocation
Sets the location of this box on the page.- Parameters:
x
- the x coordinate of the top left corner of this box when drawn on the page.y
- the y coordinate of the top left corner of this box when drawn on the page.
-
setSize
public void setSize(double w, double h) Sets the size of this box.- Parameters:
w
- the width of this box.h
- the height of this box.
-
setSize
public void setSize(float w, float h) Sets the size of this box.- Parameters:
w
- the width of this box.h
- the height of this box.
-
setColor
public void setColor(int color) Sets the color for this box.- Parameters:
color
- the color specified as an integer.
-
setLineWidth
public void setLineWidth(double width) Sets the width of this line.- Parameters:
width
- the width.
-
setLineWidth
public void setLineWidth(float width) Sets the width of this line.- Parameters:
width
- the width.
-
setURIAction
Sets the URI for the "click box" action.- Parameters:
uri
- the URI
-
setGoToAction
Sets the destination key for the action.- Parameters:
key
- the destination name.
-
setAltDescription
Sets the alternate description of this box.- Parameters:
altDescription
- the alternate description of the box.- Returns:
- this Box.
-
setActualText
Sets the actual text for this box.- Parameters:
actualText
- the actual text for the box.- Returns:
- this Box.
-
setPattern
The line dash pattern controls the pattern of dashes and gaps used to stroke paths. It is specified by a dash array and a dash phase. The elements of the dash array are positive numbers that specify the lengths of alternating dashes and gaps. The dash phase specifies the distance into the dash pattern at which to start the dash. The elements of both the dash array and the dash phase are expressed in user space units.Examples of line dash patterns: "[Array] Phase" Appearance Description _______________ _________________ ____________________________________ "[] 0" ----------------- Solid line "[3] 0" --- --- --- 3 units on, 3 units off, ... "[2] 1" - -- -- -- -- 1 on, 2 off, 2 on, 2 off, ... "[2 1] 0" -- -- -- -- -- -- 2 on, 1 off, 2 on, 1 off, ... "[3 5] 6" --- --- 2 off, 3 on, 5 off, 3 on, 5 off, ... "[2 3] 11" - -- -- -- 1 on, 3 off, 2 on, 3 off, 2 on, ...
- Parameters:
pattern
- the line dash pattern.
-
setFillShape
public void setFillShape(boolean fill_shape) Sets the private fill_shape variable. If the value of fill_shape is true - the box is filled with the current brush color.- Parameters:
fill_shape
- the value used to set the private fill_shape variable.
-
placeIn
Places this box in the another box.- Parameters:
box
- the other box.x_offset
- the x offset from the top left corner of the box.y_offset
- the y offset from the top left corner of the box.- Throws:
Exception
-
placeIn
Places this box in the another box.- Parameters:
box
- the other box.x_offset
- the x offset from the top left corner of the box.y_offset
- the y offset from the top left corner of the box.- Throws:
Exception
-
scaleBy
Scales this box by the spacified factor.- Parameters:
factor
- the factor used to scale the box.- Throws:
Exception
-
scaleBy
Scales this box by the spacified factor.- Parameters:
factor
- the factor used to scale the box.- Throws:
Exception
-
drawOn
Draws this box on the specified page.
-