Package com.teamten.typeset.element
Class Box
java.lang.Object
com.teamten.typeset.element.Element
com.teamten.typeset.element.NonDiscardableElement
com.teamten.typeset.element.Box
- All Implemented Interfaces:
Dimensions
Represents a 2D box of something, like a word or an image. Can be used by itself to make an empty space.
-
Field Summary
Fields inherited from class com.teamten.typeset.element.Element
DRAW_DEBUG -
Constructor Summary
ConstructorsModifierConstructorDescriptionBox(long width, long height, long depth) Box(long width, long height, long depth, long shift) protectedBox(Dimensions dimensions) protectedBox(Dimensions dimensions, long shift) -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddrawDebugRectangle(org.apache.pdfbox.pdmodel.PDPageContentStream contents, long x, long y) Draw a debug rectangle at specified point, which represents the left-most point at the baseline.longgetDepth()The distance from the baseline to the bottom of the box.protected StringA string that specifies the three dimensions of the box.longThe distance from the baseline to the top of the box.longgetShift()The amount to shift this box, to the right during vertical layout and up during horizontal layout.longgetWidth()The width (horizontally) of this box.longlayOutHorizontally(long x, long y, org.apache.pdfbox.pdmodel.PDPageContentStream contents) Add the element to the contents as part of a horizontal sequence.longlayOutVertically(long x, long y, org.apache.pdfbox.pdmodel.PDPageContentStream contents) Add the element to the contents as part of a vertical sequence.toString()Methods inherited from class com.teamten.typeset.element.Element
getVerticalSize, println, println, shouldSkipElementAtStart, toTextString, toTextString, visit
-
Constructor Details
-
Box
public Box(long width, long height, long depth, long shift) -
Box
public Box(long width, long height, long depth) -
Box
-
Box
-
-
Method Details
-
drawDebugRectangle
protected void drawDebugRectangle(org.apache.pdfbox.pdmodel.PDPageContentStream contents, long x, long y) throws IOException Draw a debug rectangle at specified point, which represents the left-most point at the baseline.- Throws:
IOException
-
getWidth
public long getWidth()The width (horizontally) of this box.- Specified by:
getWidthin interfaceDimensions- Specified by:
getWidthin classElement
-
getHeight
public long getHeight()The distance from the baseline to the top of the box.- Specified by:
getHeightin interfaceDimensions- Specified by:
getHeightin classElement
-
getDepth
public long getDepth()The distance from the baseline to the bottom of the box.- Specified by:
getDepthin interfaceDimensions- Specified by:
getDepthin classElement
-
getShift
public long getShift()The amount to shift this box, to the right during vertical layout and up during horizontal layout. -
layOutHorizontally
public long layOutHorizontally(long x, long y, org.apache.pdfbox.pdmodel.PDPageContentStream contents) throws IOException Description copied from class:ElementAdd the element to the contents as part of a horizontal sequence.- Specified by:
layOutHorizontallyin classElement- Parameters:
x- the left-most point of the element.y- the baseline of the element.contents- the stream to add the element to.- Returns:
- how much to move right afterward.
- Throws:
IOException
-
layOutVertically
public long layOutVertically(long x, long y, org.apache.pdfbox.pdmodel.PDPageContentStream contents) throws IOException Description copied from class:ElementAdd the element to the contents as part of a vertical sequence.- Specified by:
layOutVerticallyin classElement- Parameters:
x- the left-most point of the element.y- the upper-left point of the element.contents- the stream to add the element to.- Returns:
- how much to move down afterward.
- Throws:
IOException
-
toString
-
getDimensionString
A string that specifies the three dimensions of the box.
-