Package com.teamten.typeset
Class VerticalList
java.lang.Object
com.teamten.typeset.ElementList
com.teamten.typeset.VerticalList
- All Implemented Interfaces:
ElementSink
Accumulates elements in a vertical list until the document is finished, at which point a list of
pages (type VBox) is generated.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.teamten.typeset.ElementList
ElementList.Breakpoint
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addElement
(Element element) Override this so that we can insert glues between lines to create an even baseline skip.void
changeColumnLayout
(@NotNull ColumnLayout columnLayout) Specify that there should be a new column layout after the last-inserted element.void
Add infinite vertical glue and force a page break.long
Get the distance between baselines.protected int
getChunkExtraIncrement
(Chunk chunk) When generating breakpoints, if there are images and other things in a chunk, we must adjust the counter if those images will take up space (such as a space).protected long
getElementSize
(Element element) Return the size (width for horizontal lists, height + depth for vertical lists) of the element.getElementSublist
(ElementList.Breakpoint beginBreakpoint, ElementList.Breakpoint endBreakpoint) Return the list of elements on this page, from beginBreakpoint (inclusive) to endBreakpoint (exclusive).long
Get the height of the first HBox we saw.long
Get the depth of the most recent HBox we've seen.protected Page
makeOutputBox
(List<Element> elements, int counter, long shift) Generate the Box that will be sent to the output.void
newPage()
LikeejectPage()
, but only if the document is not empty.void
oddPage()
LikenewPage()
, but ensures that the next page is an odd page.long
setBaselineSkip
(long baselineSkip) Specify the distance between baselines.void
Skip the next vertical space inserted before an HBox to get the leading to work.Methods inherited from class com.teamten.typeset.ElementList
computeStartIndices, findBreakpoints, format, format, getElements, println, reverseRightToLeftText
-
Constructor Details
-
VerticalList
public VerticalList()
-
-
Method Details
-
addElement
Override this so that we can insert glues between lines to create an even baseline skip.- Specified by:
addElement
in interfaceElementSink
- Overrides:
addElement
in classElementList
-
getBaselineSkip
public long getBaselineSkip()Get the distance between baselines. -
getFirstHBoxHeight
public long getFirstHBoxHeight()Get the height of the first HBox we saw. -
getLastHBoxDepth
public long getLastHBoxDepth()Get the depth of the most recent HBox we've seen. -
skipNextLeadingAdjust
public void skipNextLeadingAdjust()Skip the next vertical space inserted before an HBox to get the leading to work. This is useful before things like horizontal lines that don't need to be on any leading and the extra space would throw things off. It only skips once, resetting after the next element. -
changeColumnLayout
Specify that there should be a new column layout after the last-inserted element. -
setBaselineSkip
public long setBaselineSkip(long baselineSkip) Specify the distance between baselines. This is normally scaled by the font size, for example 120% of font size. Set this between paragraphs when the font size changes.- Returns:
- the previous baseline skip.
-
makeOutputBox
Description copied from class:ElementList
Generate the Box that will be sent to the output.- Specified by:
makeOutputBox
in classElementList
- Parameters:
elements
- the elements of the box.counter
- the number of the box, starting from 1. For horizontal lists this is the line number of the paragraph. For vertical lists this is the physical page number.shift
- how much to shift the box in the final layout (up or to the right).
-
getElementSize
Description copied from class:ElementList
Return the size (width for horizontal lists, height + depth for vertical lists) of the element.- Specified by:
getElementSize
in classElementList
-
getElementSublist
protected List<Element> getElementSublist(ElementList.Breakpoint beginBreakpoint, ElementList.Breakpoint endBreakpoint) Return the list of elements on this page, from beginBreakpoint (inclusive) to endBreakpoint (exclusive). Combines elements of multiple columns into groups.- Specified by:
getElementSublist
in classElementList
-
getChunkExtraIncrement
Description copied from class:ElementList
When generating breakpoints, if there are images and other things in a chunk, we must adjust the counter if those images will take up space (such as a space).- Specified by:
getChunkExtraIncrement
in classElementList
-
newPage
public void newPage()LikeejectPage()
, but only if the document is not empty. -
oddPage
public void oddPage()LikenewPage()
, but ensures that the next page is an odd page. -
ejectPage
public void ejectPage()Add infinite vertical glue and force a page break.
-