public abstract class BidiFormatterBase
extends java.lang.Object
BidiFormatter
and SafeHtmlBidiFormatter
that
contains their common implementation.Modifier and Type | Class and Description |
---|---|
protected static class |
BidiFormatterBase.Factory<T extends BidiFormatterBase>
Abstract factory class for BidiFormatterBase.
|
(package private) static class |
BidiFormatterBase.Format
A container class for direction-related string constants, e.g.
|
Modifier | Constructor and Description |
---|---|
protected |
BidiFormatterBase(HasDirection.Direction contextDir,
boolean alwaysSpan) |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
dirAttrBase(java.lang.String str,
boolean isHtml) |
protected java.lang.String |
endEdgeBase() |
HasDirection.Direction |
estimateDirection(java.lang.String str)
Like
estimateDirection(String, boolean) , but assumes isHtml is false. |
HasDirection.Direction |
estimateDirection(java.lang.String str,
boolean isHtml)
Estimates the direction of a string using the best known general-purpose
method, i.e.
|
boolean |
getAlwaysSpan()
Returns whether the span structure added by the formatter should be stable,
i.e., spans added even when the direction does not need to be declared.
|
HasDirection.Direction |
getContextDir()
Returns the context direction.
|
boolean |
isRtlContext()
Returns whether the context direction is RTL.
|
protected java.lang.String |
knownDirAttrBase(HasDirection.Direction dir) |
protected java.lang.String |
markAfterBase(java.lang.String str,
boolean isHtml) |
protected java.lang.String |
markBase() |
protected java.lang.String |
spanWrapBase(java.lang.String str,
boolean isHtml,
boolean dirReset) |
protected java.lang.String |
spanWrapWithKnownDirBase(HasDirection.Direction dir,
java.lang.String str,
boolean isHtml,
boolean dirReset) |
protected java.lang.String |
startEdgeBase() |
protected java.lang.String |
unicodeWrapBase(java.lang.String str,
boolean isHtml,
boolean dirReset) |
protected java.lang.String |
unicodeWrapWithKnownDirBase(HasDirection.Direction dir,
java.lang.String str,
boolean isHtml,
boolean dirReset) |
protected BidiFormatterBase(HasDirection.Direction contextDir, boolean alwaysSpan)
public HasDirection.Direction estimateDirection(java.lang.String str)
estimateDirection(String, boolean)
, but assumes isHtml
is false.str
- String whose direction is to be estimatedstr
's estimated overall directionpublic HasDirection.Direction estimateDirection(java.lang.String str, boolean isHtml)
str
- String whose direction is to be estimatedisHtml
- Whether str
is HTML / HTML-escapedstr
's estimated overall directionpublic boolean getAlwaysSpan()
public HasDirection.Direction getContextDir()
public boolean isRtlContext()
protected java.lang.String dirAttrBase(java.lang.String str, boolean isHtml)
str
- String whose direction is to be estimatedisHtml
- Whether str
is HTML / HTML-escapedBidiFormatter.dirAttr(String, boolean)
protected java.lang.String endEdgeBase()
BidiFormatter.endEdge()
protected java.lang.String knownDirAttrBase(HasDirection.Direction dir)
dir
- Given directionBidiFormatter.knownDirAttr(HasDirection.Direction)
protected java.lang.String markAfterBase(java.lang.String str, boolean isHtml)
str
- String after which the mark may need to appearisHtml
- Whether str
is HTML / HTML-escapedBidiFormatter.markAfter(String, boolean)
protected java.lang.String markBase()
BidiFormatter.mark()
protected java.lang.String spanWrapBase(java.lang.String str, boolean isHtml, boolean dirReset)
str
- The input stringisHtml
- Whether str
is HTML / HTML-escapeddirReset
- Whether to append a trailing unicode bidi mark matching the
context direction, when needed, to prevent the possible garbling
of whatever may follow str
BidiFormatter.spanWrap(String, boolean, boolean)
protected java.lang.String spanWrapWithKnownDirBase(HasDirection.Direction dir, java.lang.String str, boolean isHtml, boolean dirReset)
dir
- str
's directionstr
- The input stringisHtml
- Whether str
is HTML / HTML-escapeddirReset
- Whether to append a trailing unicode bidi mark matching the
context direction, when needed, to prevent the possible garbling
of whatever may follow str
BidiFormatter.spanWrapWithKnownDir(HasDirection.Direction, String, boolean, boolean)
protected java.lang.String startEdgeBase()
BidiFormatter.startEdge()
protected java.lang.String unicodeWrapBase(java.lang.String str, boolean isHtml, boolean dirReset)
str
- The input stringisHtml
- Whether str
is HTML / HTML-escapeddirReset
- Whether to append a trailing unicode bidi mark matching the
context direction, when needed, to prevent the possible garbling
of whatever may follow str
BidiFormatter.unicodeWrap(String, boolean, boolean)
protected java.lang.String unicodeWrapWithKnownDirBase(HasDirection.Direction dir, java.lang.String str, boolean isHtml, boolean dirReset)
dir
- str
's directionstr
- The input stringisHtml
- Whether str
is HTML / HTML-escapeddirReset
- Whether to append a trailing unicode bidi mark matching the
context direction, when needed, to prevent the possible garbling
of whatever may follow str
BidiFormatter.unicodeWrapWithKnownDir(HasDirection.Direction, String, boolean, boolean)