public class HtmlFormattingAppendableBase<T extends HtmlFormattingAppendableBase> extends Object implements HtmlFormattingAppendable
ALLOW_LEADING_EOL, ALLOW_LEADING_WHITESPACE, COLLAPSE_WHITESPACE, CONVERT_TABS, FORMAT_ALL, PASS_THROUGH, PREFIX_AFTER_PENDING_EOL, PREFIX_PRE_FORMATTED, SUPPRESS_TRAILING_WHITESPACE| Constructor and Description |
|---|
HtmlFormattingAppendableBase(int indentSize,
int formatOptions) |
HtmlFormattingAppendableBase(LineFormattingAppendable other,
boolean inheritIndent) |
| Modifier and Type | Method and Description |
|---|---|
T |
addIndentOnFirstEOL(Runnable runnable) |
T |
addLine()
Add a new line or blank lines as needed.
|
T |
addPrefix(CharSequence prefix)
Add to prefix appended after a new line character for every line
and after a new line in pre-formatted sections
|
T |
addPrefix(CharSequence prefix,
boolean afterEol)
Add to prefix appended after a new line character for every line
and after a new line in pre-formatted sections
|
T |
append(char c) |
T |
append(CharSequence csq) |
T |
append(CharSequence csq,
int start,
int end) |
T |
append(LineFormattingAppendable lines,
int startLine,
int endLine)
Append lines with given prefix
|
T |
appendTo(Appendable out,
int maxBlankLines,
CharSequence prefix,
int startLine,
int endLine)
append lines to appendable with given maximum trailing blank lines and given prefix to add to all lines
|
T |
attr(Attribute... attribute) |
T |
attr(Attributes attributes) |
T |
attr(CharSequence attrName,
CharSequence value) |
T |
blankLine()
Add a blank line, if there is not one already appended.
|
T |
blankLine(int count)
Add a blank lines, if there isn't already given number of blank lines appended.
|
T |
blankLineIf(boolean predicate)
Add a blank line, if predicate is true and there isn't already blank lines appended.
|
T |
closePre() |
T |
closePreFormatted()
Close preformatted section and suspend content modification
|
T |
closeTag(CharSequence tagName) |
int |
column()
Get column offset after last append
|
Attributes |
getAttributes() |
CharSequence |
getIndentPrefix()
Get prefix appended after a new line character for every indent level
|
List<CharSequence> |
getLineContents(int startLine,
int endLine)
Get Lines without prefixes or EOL
|
int |
getLineCount()
Get the number of lines appended, does not include pending: EOLs
|
List<BasedSequence> |
getLinePrefixes(int startLine,
int endLine)
Get Line prefixes
|
List<CharSequence> |
getLines(int startLine,
int endLine)
Get Lines without EOL
|
Stack<String> |
getOpenTags() |
List<String> |
getOpenTagsAfterLast(CharSequence latestTag) |
protected String |
getOpenTagText() |
int |
getOptions()
Get current options
|
int |
getPendingEOL()
Get number of EOLs at end of text (including pending text)
|
int |
getPendingSpace()
Get trailing spaces or tabs of trailing text
|
CharSequence |
getPrefix()
Get prefix being applied to all lines, even in pre-formatted sections
|
T |
indent()
Increase the indent level, will terminate the current line if there is unterminated text
|
boolean |
inPre() |
boolean |
isPendingSpace()
Test if trailing text ends in space or tab
|
boolean |
isPreFormatted() |
boolean |
isPreFormattedLine(int line)
Test if given line is part of pre-formatted text
|
boolean |
isSuppressCloseTagLine() |
boolean |
isSuppressOpenTagLine() |
T |
line()
Add a new line, if there was any unterminated text appended
|
T |
lineIf(boolean predicate)
Add a new line, if predicate is true and there was any unterminated text appended
|
T |
lineOnFirstText(boolean value) |
T |
lineWithTrailingSpaces(int count)
Add a new line, keep trailing spaces if there was any unterminated text appended
|
int |
offset()
Get text offset of all output lines (not including any text not included because it is not yet terminated by line() call)
NOTE: this includes prefixes
|
int |
offsetWithPending()
Get column offset after last append
NOTE: this includes prefixes
|
T |
openPre() |
T |
openPreFormatted()
Open preformatted section and suspend content modification but add prefix to first line
|
T |
openPreFormatted(boolean keepIndent)
Open preformatted section and suspend content modification
|
T |
popPrefix()
Pop a prefix from the stack and set the current prefix
|
T |
popPrefix(boolean afterEol)
Pop a prefix from the stack and set the current prefix
|
protected void |
popTag(CharSequence tagName) |
T |
prefixLines(CharSequence prefix,
boolean addAfterLinePrefix,
int startLine,
int endLine)
Add prefix to selected lines either before the line prefix or after it
|
T |
prefixLines(CharSequence prefix,
int startLine,
int endLine)
Add prefix to selected lines
|
T |
pushPrefix()
Save the current prefix on the stack
|
protected void |
pushTag(CharSequence tagName) |
T |
raw(CharSequence s) |
T |
raw(CharSequence s,
int count) |
T |
rawIndentedPre(CharSequence s) |
T |
rawPre(CharSequence s) |
T |
removeIndentOnFirstEOL(Runnable runnable) |
T |
removeLines(int startLine,
int endLine)
Remove line range from result set
|
T |
repeat(char c,
int count) |
T |
repeat(CharSequence csq,
int count) |
T |
repeat(CharSequence csq,
int start,
int end,
int count) |
T |
setAttributes(Attributes attributes) |
T |
setIndentPrefix(CharSequence prefix)
Set prefix to append after a new line character for every indent level
|
T |
setOptions(int options)
Set options on processing text
|
T |
setPrefix(CharSequence prefix)
Set prefix appended after a new line character for every line
and after a new line in pre-formatted sections
|
T |
setPrefix(CharSequence prefix,
boolean afterEol)
Set prefix appended after a new line character for every line
and after a new line in pre-formatted sections
|
T |
setSuppressCloseTagLine(boolean suppressCloseTagLine) |
void |
setSuppressOpenTagLine(boolean suppressOpenTagLine) |
T |
tag(CharSequence tagName) |
T |
tag(CharSequence tagName,
boolean voidElement) |
T |
tag(CharSequence tagName,
boolean withIndent,
boolean withLine,
Runnable runnable) |
T |
tag(CharSequence tagName,
Runnable runnable) |
protected void |
tagClosed(CharSequence tagName) |
T |
tagIndent(CharSequence tagName,
Runnable runnable) |
T |
tagLine(CharSequence tagName) |
T |
tagLine(CharSequence tagName,
boolean voidElement) |
T |
tagLine(CharSequence tagName,
Runnable runnable) |
T |
tagLineIndent(CharSequence tagName,
Runnable runnable) |
protected void |
tagOpened(CharSequence tagName) |
T |
tagVoid(CharSequence tagName) |
T |
tagVoidLine(CharSequence tagName) |
T |
text(CharSequence s) |
int |
textOnlyOffset()
Get text offset of all output lines (not including any text not included because it is not yet terminated by line() call)
NOTE: this does not include prefixes
|
int |
textOnlyOffsetWithPending()
Get column offset after last append
NOTE: this does not include prefixes
|
String |
toString() |
String |
toString(int maxBlankLines)
get the resulting text for all lines
|
T |
unIndent()
Decrease the indent level, min level is 0, will terminate the current line if there is unterminated text
|
T |
unIndentNoEol()
Decrease the indent level, if there is unterminated text then unindented prefix
is to be applied after the next EOL.
|
T |
withAttr() |
T |
withCondIndent() |
T |
withCondLineOnChildText() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitwithCondLineappend, append, appendTo, appendTo, appendTo, appendTo, clearLineOnFirstText, getLineContent, getLineContents, getLineContents, getLinePrefix, getLinePrefixes, getLinePrefixes, getLines, getLines, lineWithTrailingSpaces, prefixLines, prefixLines, setLineOnFirstTextpublic HtmlFormattingAppendableBase(LineFormattingAppendable other, boolean inheritIndent)
public HtmlFormattingAppendableBase(int indentSize,
int formatOptions)
public boolean isSuppressOpenTagLine()
public void setSuppressOpenTagLine(boolean suppressOpenTagLine)
public boolean isSuppressCloseTagLine()
public T setSuppressCloseTagLine(boolean suppressCloseTagLine)
public T openPre()
openPre in interface HtmlFormattingAppendablepublic T closePre()
closePre in interface HtmlFormattingAppendablepublic boolean inPre()
inPre in interface HtmlFormattingAppendablepublic T raw(CharSequence s)
raw in interface HtmlFormattingAppendablepublic T raw(CharSequence s, int count)
raw in interface HtmlFormattingAppendablepublic T rawPre(CharSequence s)
rawPre in interface HtmlFormattingAppendablepublic T rawIndentedPre(CharSequence s)
rawIndentedPre in interface HtmlFormattingAppendablepublic T text(CharSequence s)
text in interface HtmlFormattingAppendablepublic T attr(CharSequence attrName, CharSequence value)
attr in interface HtmlFormattingAppendablepublic T attr(Attribute... attribute)
attr in interface HtmlFormattingAppendablepublic T attr(Attributes attributes)
attr in interface HtmlFormattingAppendablepublic T withAttr()
withAttr in interface HtmlFormattingAppendablepublic Attributes getAttributes()
getAttributes in interface HtmlFormattingAppendablepublic T setAttributes(Attributes attributes)
setAttributes in interface HtmlFormattingAppendablepublic T withCondLineOnChildText()
withCondLineOnChildText in interface HtmlFormattingAppendablepublic T withCondIndent()
withCondIndent in interface HtmlFormattingAppendablepublic T tag(CharSequence tagName)
tag in interface HtmlFormattingAppendablepublic T tag(CharSequence tagName, Runnable runnable)
tag in interface HtmlFormattingAppendablepublic T tagVoid(CharSequence tagName)
tagVoid in interface HtmlFormattingAppendableprotected String getOpenTagText()
protected void pushTag(CharSequence tagName)
protected void popTag(CharSequence tagName)
protected void tagOpened(CharSequence tagName)
protected void tagClosed(CharSequence tagName)
public Stack<String> getOpenTags()
getOpenTags in interface HtmlFormattingAppendablepublic List<String> getOpenTagsAfterLast(CharSequence latestTag)
getOpenTagsAfterLast in interface HtmlFormattingAppendablepublic T tag(CharSequence tagName, boolean voidElement)
tag in interface HtmlFormattingAppendablepublic T closeTag(CharSequence tagName)
closeTag in interface HtmlFormattingAppendablepublic T tag(CharSequence tagName, boolean withIndent, boolean withLine, Runnable runnable)
tag in interface HtmlFormattingAppendablepublic T tagVoidLine(CharSequence tagName)
tagVoidLine in interface HtmlFormattingAppendablepublic T tagLine(CharSequence tagName)
tagLine in interface HtmlFormattingAppendablepublic T tagLine(CharSequence tagName, boolean voidElement)
tagLine in interface HtmlFormattingAppendablepublic T tagLine(CharSequence tagName, Runnable runnable)
tagLine in interface HtmlFormattingAppendablepublic T tagIndent(CharSequence tagName, Runnable runnable)
tagIndent in interface HtmlFormattingAppendablepublic T tagLineIndent(CharSequence tagName, Runnable runnable)
tagLineIndent in interface HtmlFormattingAppendablepublic boolean isPendingSpace()
LineFormattingAppendableisPendingSpace in interface LineFormattingAppendablepublic boolean isPreFormatted()
isPreFormatted in interface LineFormattingAppendablepublic boolean isPreFormattedLine(int line)
LineFormattingAppendableisPreFormattedLine in interface LineFormattingAppendableline - linepublic CharSequence getIndentPrefix()
LineFormattingAppendablegetIndentPrefix in interface LineFormattingAppendablepublic CharSequence getPrefix()
LineFormattingAppendablegetPrefix in interface LineFormattingAppendablepublic int column()
LineFormattingAppendablecolumn in interface LineFormattingAppendablepublic int getLineCount()
LineFormattingAppendablegetLineCount in interface LineFormattingAppendablepublic int getOptions()
LineFormattingAppendablegetOptions in interface LineFormattingAppendablepublic int getPendingEOL()
LineFormattingAppendablegetPendingEOL in interface LineFormattingAppendablepublic int getPendingSpace()
LineFormattingAppendablegetPendingSpace in interface LineFormattingAppendablepublic int offset()
LineFormattingAppendableoffset in interface LineFormattingAppendablepublic int offsetWithPending()
LineFormattingAppendableoffsetWithPending in interface LineFormattingAppendableLineFormattingAppendable.offset() after line() call less 1 for EOLpublic int textOnlyOffset()
LineFormattingAppendabletextOnlyOffset in interface LineFormattingAppendablepublic int textOnlyOffsetWithPending()
LineFormattingAppendabletextOnlyOffsetWithPending in interface LineFormattingAppendableLineFormattingAppendable.offset() after line() call less 1 for EOLpublic List<BasedSequence> getLinePrefixes(int startLine, int endLine)
LineFormattingAppendablegetLinePrefixes in interface LineFormattingAppendablestartLine - starting line offsetendLine - end line offsetpublic List<CharSequence> getLineContents(int startLine, int endLine)
LineFormattingAppendablegetLineContents in interface LineFormattingAppendablestartLine - starting line offsetendLine - end line offsetpublic List<CharSequence> getLines(int startLine, int endLine)
LineFormattingAppendablegetLines in interface LineFormattingAppendablestartLine - starting line offsetendLine - end line offsetpublic String toString(int maxBlankLines)
LineFormattingAppendabletoString in interface LineFormattingAppendablemaxBlankLines - maximum blank lines to allow at end, if -1 then no trailing EOL will be generatedpublic T addIndentOnFirstEOL(Runnable runnable)
addIndentOnFirstEOL in interface LineFormattingAppendablepublic T addLine()
LineFormattingAppendableaddLine in interface LineFormattingAppendablepublic T addPrefix(CharSequence prefix)
LineFormattingAppendableThis appends the sequence to current prefix
addPrefix in interface LineFormattingAppendableprefix - prefix characters to add to current prefix for new lines appended after this is setpublic T addPrefix(CharSequence prefix, boolean afterEol)
LineFormattingAppendableThis appends the sequence to current prefix
addPrefix in interface LineFormattingAppendableprefix - prefix characters to add to current prefix for new lines appended after this is setafterEol - if true prefix will take effect after EOLpublic T append(char c)
append in interface LineFormattingAppendableappend in interface Appendablepublic T append(CharSequence csq)
append in interface LineFormattingAppendableappend in interface Appendablepublic T append(CharSequence csq, int start, int end)
append in interface LineFormattingAppendableappend in interface Appendablepublic T append(LineFormattingAppendable lines, int startLine, int endLine)
LineFormattingAppendableappend in interface LineFormattingAppendablelines - lines to appendstartLine - start line to appendendLine - end line to appendpublic T appendTo(Appendable out, int maxBlankLines, CharSequence prefix, int startLine, int endLine) throws IOException
LineFormattingAppendableappendTo in interface LineFormattingAppendableout - appendable to output the resulting linesmaxBlankLines - maximum blank lines to allow at end, if -1 then no trailing EOL will be generatedprefix - prefix to add before each linestartLine - line from which to start outputIOException - if thrown by appendablepublic T blankLine()
LineFormattingAppendableblankLine in interface LineFormattingAppendablepublic T blankLine(int count)
LineFormattingAppendableblankLine in interface LineFormattingAppendablecount - number of blank lines to appendpublic T blankLineIf(boolean predicate)
LineFormattingAppendableblankLineIf in interface LineFormattingAppendablepredicate - when true append blank linepublic T closePreFormatted()
LineFormattingAppendableclosePreFormatted in interface LineFormattingAppendablepublic T indent()
LineFormattingAppendable
NOTE: this is equivalent to pushPrefix(), addPrefix(getIndentPrefix()) but adds flag to
validate that LineFormattingAppendable.unIndent() is called only on prefixes added by indent()
indent in interface LineFormattingAppendablepublic T line()
LineFormattingAppendableline in interface LineFormattingAppendablepublic T lineIf(boolean predicate)
LineFormattingAppendablelineIf in interface LineFormattingAppendablepredicate - if true then new line will be startedpublic T lineOnFirstText(boolean value)
lineOnFirstText in interface LineFormattingAppendablepublic T lineWithTrailingSpaces(int count)
LineFormattingAppendablelineWithTrailingSpaces in interface LineFormattingAppendablecount - number of trailing spaces to addpublic T openPreFormatted()
LineFormattingAppendableopenPreFormatted in interface LineFormattingAppendablepublic T openPreFormatted(boolean keepIndent)
LineFormattingAppendableopenPreFormatted in interface LineFormattingAppendablekeepIndent - if true will add current prefix to first linepublic T popPrefix()
LineFormattingAppendablepopPrefix in interface LineFormattingAppendablepublic T popPrefix(boolean afterEol)
LineFormattingAppendablepopPrefix in interface LineFormattingAppendableafterEol - if true prefix will take effect after EOLpublic T prefixLines(CharSequence prefix, boolean addAfterLinePrefix, int startLine, int endLine)
LineFormattingAppendableprefixLines in interface LineFormattingAppendableprefix - prefix to addaddAfterLinePrefix - if true add given prefix after the line prefixstartLine - starting line offsetendLine - end line offsetpublic T prefixLines(CharSequence prefix, int startLine, int endLine)
LineFormattingAppendableprefixLines in interface LineFormattingAppendableprefix - prefix to addstartLine - starting line offsetendLine - end line offsetpublic T pushPrefix()
LineFormattingAppendablepushPrefix in interface LineFormattingAppendablepublic T removeIndentOnFirstEOL(Runnable runnable)
removeIndentOnFirstEOL in interface LineFormattingAppendablepublic T removeLines(int startLine, int endLine)
LineFormattingAppendableremoveLines in interface LineFormattingAppendablestartLine - starting line offsetendLine - end line offsetpublic T repeat(char c, int count)
repeat in interface LineFormattingAppendablepublic T repeat(CharSequence csq, int count)
repeat in interface LineFormattingAppendablepublic T repeat(CharSequence csq, int start, int end, int count)
repeat in interface LineFormattingAppendablepublic T setIndentPrefix(CharSequence prefix)
LineFormattingAppendablesetIndentPrefix in interface LineFormattingAppendableprefix - prefix characters for new lines appended after this is setpublic T setOptions(int options)
LineFormattingAppendablesetOptions in interface LineFormattingAppendableoptions - option flagspublic T setPrefix(CharSequence prefix)
LineFormattingAppendableThis appends the sequence to current prefix
setPrefix in interface LineFormattingAppendableprefix - prefix characters to add to current prefix for new lines appended after this is setpublic T setPrefix(CharSequence prefix, boolean afterEol)
LineFormattingAppendableThis appends the sequence to current prefix
setPrefix in interface LineFormattingAppendableprefix - prefix characters to add to current prefix for new lines appended after this is setafterEol - if true prefix will take effect after EOLpublic T unIndent()
LineFormattingAppendable
NOTE: this is equivalent to popPrefix() but with validation
that it is called only on prefixes added by LineFormattingAppendable.indent()
unIndent in interface LineFormattingAppendablepublic T unIndentNoEol()
LineFormattingAppendableWill NOT terminate the current line if there is unterminated text
NOTE: should be used with LineFormattingAppendable.addIndentOnFirstEOL(Runnable) if callback is invoked
unIndentNoEol in interface LineFormattingAppendableCopyright © 2019. All rights reserved.