public class SafeHtmlBidiFormatter extends BidiFormatterBase
Modifier and Type | Class and Description |
---|---|
(package private) static class |
SafeHtmlBidiFormatter.Factory |
BidiFormatterBase.Format
Modifier and Type | Method and Description |
---|---|
SafeHtml |
dirAttr(SafeHtml html) |
SafeHtml |
dirAttr(java.lang.String str) |
SafeHtml |
endEdge()
Returns "left" for RTL context direction.
|
HasDirection.Direction |
estimateDirection(SafeHtml html) |
static SafeHtmlBidiFormatter |
getInstance(boolean rtlContext)
Factory for creating an instance of SafeHtmlBidiFormatter given the context
direction.
|
static SafeHtmlBidiFormatter |
getInstance(boolean rtlContext,
boolean alwaysSpan)
Factory for creating an instance of SafeHtmlBidiFormatter given the context
direction and the desired span wrapping behavior (see below).
|
static SafeHtmlBidiFormatter |
getInstance(HasDirection.Direction contextDir)
Factory for creating an instance of SafeHtmlBidiFormatter given the context
direction.
|
static SafeHtmlBidiFormatter |
getInstance(HasDirection.Direction contextDir,
boolean alwaysSpan)
Factory for creating an instance of SafeHtmlBidiFormatter given the context
direction and the desired span wrapping behavior (see below).
|
static SafeHtmlBidiFormatter |
getInstanceForCurrentLocale()
Factory for creating an instance of SafeHtmlBidiFormatter whose context
direction matches the current locale's direction.
|
static SafeHtmlBidiFormatter |
getInstanceForCurrentLocale(boolean alwaysSpan)
Factory for creating an instance of SafeHtmlBidiFormatter whose context
direction matches the current locale's direction, and given the desired
span wrapping behavior (see below).
|
SafeHtml |
knownDirAttr(HasDirection.Direction dir) |
SafeHtml |
mark() |
SafeHtml |
markAfter(SafeHtml html) |
SafeHtml |
markAfter(java.lang.String str) |
SafeHtml |
spanWrap(SafeHtml html) |
SafeHtml |
spanWrap(SafeHtml html,
boolean dirReset) |
SafeHtml |
spanWrap(java.lang.String str) |
SafeHtml |
spanWrap(java.lang.String str,
boolean dirReset) |
SafeHtml |
spanWrapWithKnownDir(HasDirection.Direction dir,
SafeHtml html) |
SafeHtml |
spanWrapWithKnownDir(HasDirection.Direction dir,
SafeHtml html,
boolean dirReset) |
SafeHtml |
spanWrapWithKnownDir(HasDirection.Direction dir,
java.lang.String str) |
SafeHtml |
spanWrapWithKnownDir(HasDirection.Direction dir,
java.lang.String str,
boolean dirReset) |
SafeHtml |
startEdge()
Returns "right" for RTL context direction.
|
SafeHtml |
unicodeWrap(SafeHtml html) |
SafeHtml |
unicodeWrap(SafeHtml html,
boolean dirReset) |
SafeHtml |
unicodeWrap(java.lang.String str) |
SafeHtml |
unicodeWrap(java.lang.String str,
boolean dirReset) |
SafeHtml |
unicodeWrapWithKnownDir(HasDirection.Direction dir,
SafeHtml html) |
SafeHtml |
unicodeWrapWithKnownDir(HasDirection.Direction dir,
SafeHtml html,
boolean dirReset) |
SafeHtml |
unicodeWrapWithKnownDir(HasDirection.Direction dir,
java.lang.String str) |
SafeHtml |
unicodeWrapWithKnownDir(HasDirection.Direction dir,
java.lang.String str,
boolean dirReset) |
dirAttrBase, endEdgeBase, estimateDirection, estimateDirection, getAlwaysSpan, getContextDir, isRtlContext, knownDirAttrBase, markAfterBase, markBase, spanWrapBase, spanWrapWithKnownDirBase, startEdgeBase, unicodeWrapBase, unicodeWrapWithKnownDirBase
public static SafeHtmlBidiFormatter getInstance(boolean rtlContext)
spanWrap(com.google.gwt.safehtml.shared.SafeHtml)
and its variations is
set to avoid span wrapping unless it's necessary ('dir' attribute needs to
be set).rtlContext
- Whether the context direction is RTL.
In one simple use case, the context direction would simply be the
locale direction, which can be retrieved using
LocaleInfo.getCurrentLocale().isRTL()
public static SafeHtmlBidiFormatter getInstance(boolean rtlContext, boolean alwaysSpan)
rtlContext
- Whether the context direction is RTL. See an example of
a simple use case at getInstance(boolean)
alwaysSpan
- Whether spanWrap(com.google.gwt.safehtml.shared.SafeHtml)
(and its variations) should
always use a 'span' tag, even when the input direction is neutral
or matches the context, so that the DOM structure of the output
does not depend on the combination of directionspublic static SafeHtmlBidiFormatter getInstance(HasDirection.Direction contextDir)
spanWrap(com.google.gwt.safehtml.shared.SafeHtml)
and its variations is
set to avoid span wrapping unless it's necessary ('dir' attribute needs to
be set).contextDir
- The context direction. See an example of a simple use
case at getInstance(boolean)
. Note: Direction.DEFAULT
indicates unknown context direction. Try not to use it, since it
is impossible to reset the direction back to the context when it
is unknownpublic static SafeHtmlBidiFormatter getInstance(HasDirection.Direction contextDir, boolean alwaysSpan)
contextDir
- The context direction. See an example of a simple use
case at getInstance(boolean)
. Note: Direction.DEFAULT
indicates unknown context direction. Try not to use it, since it
is impossible to reset the direction back to the context when it
is unknownalwaysSpan
- Whether spanWrap(com.google.gwt.safehtml.shared.SafeHtml)
(and its variations) should
always use a 'span' tag, even when the input direction is neutral
or matches the context, so that the DOM structure of the output
does not depend on the combination of directionspublic static SafeHtmlBidiFormatter getInstanceForCurrentLocale()
spanWrap(com.google.gwt.safehtml.shared.SafeHtml)
and its variations is set to avoid span wrapping unless
it's necessary ('dir' attribute needs to be set).public static SafeHtmlBidiFormatter getInstanceForCurrentLocale(boolean alwaysSpan)
alwaysSpan
- Whether spanWrap(com.google.gwt.safehtml.shared.SafeHtml)
(and its variations) should
always use a 'span' tag, even when the input direction is neutral
or matches the context, so that the DOM structure of the output
does not depend on the combination of directionspublic SafeHtml dirAttr(SafeHtml html)
html
- Html whose direction is to be estimatedBidiFormatter.dirAttr(String, boolean)
public SafeHtml dirAttr(java.lang.String str)
str
- String whose direction is to be estimatedBidiFormatter.dirAttr(java.lang.String)
public SafeHtml endEdge()
public HasDirection.Direction estimateDirection(SafeHtml html)
html
- Html whose direction is to be estimatedhtml
's estimated overall directionBidiFormatterBase.estimateDirection(String, boolean)
public SafeHtml knownDirAttr(HasDirection.Direction dir)
dir
- Given directionBidiFormatter.knownDirAttr(com.google.gwt.i18n.client.HasDirection.Direction)
public SafeHtml mark()
BidiFormatter.mark()
public SafeHtml markAfter(SafeHtml html)
html
- Html after which the mark may need to appearBidiFormatter.markAfter(java.lang.String)
public SafeHtml markAfter(java.lang.String str)
str
- String after which the mark may need to appearBidiFormatter.markAfter(java.lang.String)
public SafeHtml spanWrap(SafeHtml html)
html
- The input htmlBidiFormatter.spanWrap(String, boolean)
public SafeHtml spanWrap(SafeHtml html, boolean dirReset)
html
- The input htmldirReset
- Whether to append a trailing unicode bidi mark matching the
context direction, when needed, to prevent the possible garbling
of whatever may follow html
BidiFormatter.spanWrap(String, boolean, boolean)
public SafeHtml spanWrap(java.lang.String str)
str
- The input stringBidiFormatter.spanWrap(String)
public SafeHtml spanWrap(java.lang.String str, boolean dirReset)
str
- The input stringdirReset
- 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)
public SafeHtml spanWrapWithKnownDir(HasDirection.Direction dir, SafeHtml html)
dir
- str
's directionhtml
- The input htmlBidiFormatter.spanWrapWithKnownDir(
com.google.gwt.i18n.client.HasDirection.Direction, String, boolean)
public SafeHtml spanWrapWithKnownDir(HasDirection.Direction dir, SafeHtml html, boolean dirReset)
dir
- html
's directionhtml
- The input htmldirReset
- Whether to append a trailing unicode bidi mark matching the
context direction, when needed, to prevent the possible garbling
of whatever may follow html
BidiFormatter.spanWrapWithKnownDir(
com.google.gwt.i18n.client.HasDirection.Direction, String, boolean, boolean)
public SafeHtml spanWrapWithKnownDir(HasDirection.Direction dir, java.lang.String str)
dir
- str
's directionstr
- The input stringBidiFormatter.spanWrapWithKnownDir(
com.google.gwt.i18n.client.HasDirection.Direction, String)
public SafeHtml spanWrapWithKnownDir(HasDirection.Direction dir, java.lang.String str, boolean dirReset)
dir
- str
's directionstr
- The input stringdirReset
- 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(
com.google.gwt.i18n.client.HasDirection.Direction, String, boolean, boolean)
public SafeHtml startEdge()
public SafeHtml unicodeWrap(SafeHtml html)
html
- The input htmlBidiFormatter.unicodeWrap(String, boolean)
public SafeHtml unicodeWrap(SafeHtml html, boolean dirReset)
html
- The input htmldirReset
- Whether to append a trailing unicode bidi mark matching the
context direction, when needed, to prevent the possible garbling
of whatever may follow html
BidiFormatter.unicodeWrap(String, boolean, boolean)
public SafeHtml unicodeWrap(java.lang.String str)
str
- The input stringBidiFormatter.unicodeWrap(String)
public SafeHtml unicodeWrap(java.lang.String str, boolean dirReset)
str
- The input stringdirReset
- 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)
public SafeHtml unicodeWrapWithKnownDir(HasDirection.Direction dir, SafeHtml html)
dir
- html
's directionhtml
- The input htmlBidiFormatter.unicodeWrapWithKnownDir(
com.google.gwt.i18n.client.HasDirection.Direction, String, boolean)
public SafeHtml unicodeWrapWithKnownDir(HasDirection.Direction dir, SafeHtml html, boolean dirReset)
dir
- html
's directionhtml
- The input htmldirReset
- Whether to append a trailing unicode bidi mark matching the
context direction, when needed, to prevent the possible garbling
of whatever may follow html
BidiFormatter.unicodeWrapWithKnownDir(
com.google.gwt.i18n.client.HasDirection.Direction, String, boolean, boolean)
public SafeHtml unicodeWrapWithKnownDir(HasDirection.Direction dir, java.lang.String str)
dir
- str
's directionstr
- The input stringBidiFormatter.unicodeWrapWithKnownDir(
com.google.gwt.i18n.client.HasDirection.Direction, String)
public SafeHtml unicodeWrapWithKnownDir(HasDirection.Direction dir, java.lang.String str, boolean dirReset)
dir
- str
's directionstr
- The input stringdirReset
- 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(
com.google.gwt.i18n.client.HasDirection.Direction, String, boolean, boolean)