Top Description Inners Fields Constructors Methods
com.openhtmltopdf.layout

public Class LineBreakContext

extends Object
Class Inheritance
Imports
com.openhtmltopdf.layout.Breaker.BreakTextResult

A bean which serves as a way for the layout code to pass information to the line breaking code and for the line breaking code to pass instructions back to the layout code.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
private int
private boolean
private boolean
private boolean
private boolean
private boolean
private int
private String
private boolean
private int
private int
private int
private int
private boolean
private int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
checkConsistency(Breaker.BreakTextResult breakResult)

Given the result of text breaking, makes some sanity preserving asserts to check the state of this object.

public String
public int
public int
public String
public int
getNextWidth()

If needs newline, returns the graphics width of the next unbreakable sequence.

public int
public String
public int
public boolean
public boolean
public boolean
public boolean
public boolean
isFinishedInCharBreakingMode()

If this is true, it means we finished in char breaking mode because a word was too large.

public boolean

Returns:

true if this is the first non-trimmed character in a line.
isFirstCharInLine
()

public boolean
public boolean
public void
newLine()

Record a newline attempt.

public boolean
public void
public void
public void
public void
setEnd(int end)

public void
setEndsOnNL(boolean b)

public void
public void
setEndsOnWordBreak(boolean _endsOnWordBreak)

public void
public void
setFirstCharInLine(boolean
set to true if this is the first non-trimmable character in a line.
isFirstChar
)

public void
setMaster(String master)

public void
setNeedsNewLine(boolean needsLineBreak)

public void
setNextWidth(int nextWidth)

public void
setStart(int start)

public void
setUnbreakable(boolean unbreakable)

public void
setWidth(int width)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_endback to summary
private int _end
_endsOnNLback to summary
private boolean _endsOnNL
_endsOnSoftHyphenback to summary
private boolean _endsOnSoftHyphen
_endsOnWordBreakback to summary
private boolean _endsOnWordBreak
_finishedInCharBreakingModeback to summary
private boolean _finishedInCharBreakingMode
_isFirstCharback to summary
private boolean _isFirstChar
_lastNewLineStartPositionback to summary
private int _lastNewLineStartPosition
_masterback to summary
private String _master
_needsNewLineback to summary
private boolean _needsNewLine
_newlineAttemptsForLastStartPositionback to summary
private int _newlineAttemptsForLastStartPosition
_nextWidthback to summary
private int _nextWidth
_savedEndback to summary
private int _savedEnd
_startback to summary
private int _start
_unbreakableback to summary
private boolean _unbreakable
_widthback to summary
private int _width

Constructor Detail

LineBreakContextback to summary
public LineBreakContext()

Method Detail

checkConsistencyback to summary
public void checkConsistency(Breaker.BreakTextResult breakResult)

Given the result of text breaking, makes some sanity preserving asserts to check the state of this object.

getCalculatedSubstringback to summary
public String getCalculatedSubstring()
getEndback to summary
public int getEnd()
getLastback to summary
public int getLast()
getMasterback to summary
public String getMaster()
getNextWidthback to summary
public int getNextWidth()

If needs newline, returns the graphics width of the next unbreakable sequence. We use this to test if we should actually put in a newline before a long word when break-word is on. If getNextWidth would fit on an empty line we put in the new line else we split in the long word immediately.

getStartback to summary
public int getStart()
getStartSubstringback to summary
public String getStartSubstring()
getWidthback to summary
public int getWidth()
isEndsOnNLback to summary
public boolean isEndsOnNL()
isEndsOnSoftHyphenback to summary
public boolean isEndsOnSoftHyphen()
isEndsOnWordBreakback to summary
public boolean isEndsOnWordBreak()
isFinishedback to summary
public boolean isFinished()
isFinishedInCharBreakingModeback to summary
public boolean isFinishedInCharBreakingMode()

If this is true, it means we finished in char breaking mode because a word was too large. The next line should begin in char breaking mode.

isFirstCharInLineback to summary
public boolean isFirstCharInLine()
Returns:boolean

true if this is the first non-trimmed character in a line.

isNeedsNewLineback to summary
public boolean isNeedsNewLine()
isUnbreakableback to summary
public boolean isUnbreakable()
newLineback to summary
public void newLine()

Record a newline attempt. This should be called at each newline and then possibleEndlessLoop method can be called to check if excessive attempts have been made to output the same character on newlines.

possibleEndlessLoopback to summary
public boolean possibleEndlessLoop()
See Also
newLine()
resetback to summary
public void reset()
resetEndback to summary
public void resetEnd()
saveEndback to summary
public void saveEnd()
setEndback to summary
public void setEnd(int end)
setEndsOnNLback to summary
public void setEndsOnNL(boolean b)
setEndsOnSoftHyphenback to summary
public void setEndsOnSoftHyphen(boolean b)
setEndsOnWordBreakback to summary
public void setEndsOnWordBreak(boolean _endsOnWordBreak)
setFinishedInCharBreakingModeback to summary
public void setFinishedInCharBreakingMode(boolean mode)
setFirstCharInLineback to summary
public void setFirstCharInLine(boolean isFirstChar)
Parameters
isFirstChar:boolean

set to true if this is the first non-trimmable character in a line.

setMasterback to summary
public void setMaster(String master)
setNeedsNewLineback to summary
public void setNeedsNewLine(boolean needsLineBreak)
setNextWidthback to summary
public void setNextWidth(int nextWidth)
setStartback to summary
public void setStart(int start)
setUnbreakableback to summary
public void setUnbreakable(boolean unbreakable)
setWidthback to summary
public void setWidth(int width)
com.openhtmltopdf.layout back to summary

public final Enum LineBreakContext.LineBreakResult

extends Enum<LineBreakContext.LineBreakResult>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final LineBreakContext.LineBreakResult
public static final LineBreakContext.LineBreakResult
public static final LineBreakContext.LineBreakResult
public static final LineBreakContext.LineBreakResult
public static final LineBreakContext.LineBreakResult
public static final LineBreakContext.LineBreakResult
public static final LineBreakContext.LineBreakResult

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static LineBreakContext.LineBreakResult
public static LineBreakContext.LineBreakResult[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CHAR_BREAKING_FINISHEDback to summary
public static final LineBreakContext.LineBreakResult CHAR_BREAKING_FINISHED
CHAR_BREAKING_FOUND_WORD_BREAKback to summary
public static final LineBreakContext.LineBreakResult CHAR_BREAKING_FOUND_WORD_BREAK
CHAR_BREAKING_NEED_NEW_LINEback to summary
public static final LineBreakContext.LineBreakResult CHAR_BREAKING_NEED_NEW_LINE
CHAR_BREAKING_UNBREAKABLEback to summary
public static final LineBreakContext.LineBreakResult CHAR_BREAKING_UNBREAKABLE
WORD_BREAKING_FINISHEDback to summary
public static final LineBreakContext.LineBreakResult WORD_BREAKING_FINISHED
WORD_BREAKING_NEED_NEW_LINEback to summary
public static final LineBreakContext.LineBreakResult WORD_BREAKING_NEED_NEW_LINE
WORD_BREAKING_UNBREAKABLEback to summary
public static final LineBreakContext.LineBreakResult WORD_BREAKING_UNBREAKABLE

Constructor Detail

LineBreakResultback to summary
private LineBreakResult()

Method Detail

valueOfback to summary
public static LineBreakContext.LineBreakResult valueOf(String name)
valuesback to summary
public static LineBreakContext.LineBreakResult[] values()