public abstract class BidiFormatterBase extends 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.
|
Modifier | Constructor and Description |
---|---|
protected |
BidiFormatterBase(HasDirection.Direction contextDir,
boolean alwaysSpan) |
Modifier and Type | Method and Description |
---|---|
protected String |
dirAttrBase(String str,
boolean isHtml) |
protected String |
endEdgeBase() |
HasDirection.Direction |
estimateDirection(String str)
Like
estimateDirection(String, boolean) , but assumes isHtml is false. |
HasDirection.Direction |
estimateDirection(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 String |
knownDirAttrBase(HasDirection.Direction dir) |
protected String |
markAfterBase(String str,
boolean isHtml) |
protected String |
markBase() |
protected String |
spanWrapBase(String str,
boolean isHtml,
boolean dirReset) |
protected String |
spanWrapWithKnownDirBase(HasDirection.Direction dir,
String str,
boolean isHtml,
boolean dirReset) |
protected String |
startEdgeBase() |
protected String |
unicodeWrapBase(String str,
boolean isHtml,
boolean dirReset) |
protected String |
unicodeWrapWithKnownDirBase(HasDirection.Direction dir,
String str,
boolean isHtml,
boolean dirReset) |
protected BidiFormatterBase(HasDirection.Direction contextDir, boolean alwaysSpan)
public HasDirection.Direction estimateDirection(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(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 String dirAttrBase(String str, boolean isHtml)
str
- String whose direction is to be estimatedisHtml
- Whether str
is HTML / HTML-escapedBidiFormatter.dirAttr(String, boolean)
protected String endEdgeBase()
BidiFormatter.endEdge()
protected String knownDirAttrBase(HasDirection.Direction dir)
dir
- Given directionBidiFormatter.knownDirAttr(HasDirection.Direction)
protected String markAfterBase(String str, boolean isHtml)
str
- String after which the mark may need to appearisHtml
- Whether str
is HTML / HTML-escapedBidiFormatter.markAfter(String, boolean)
protected String markBase()
BidiFormatter.mark()
protected String spanWrapBase(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 String spanWrapWithKnownDirBase(HasDirection.Direction dir, 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 String startEdgeBase()
BidiFormatter.startEdge()
protected String unicodeWrapBase(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 String unicodeWrapWithKnownDirBase(HasDirection.Direction dir, 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)
Copyright © 2018. All rights reserved.