Package com.google.gwt.i18n.shared
Class SafeHtmlBidiFormatter
java.lang.Object
com.google.gwt.i18n.shared.BidiFormatterBase
com.google.gwt.i18n.shared.SafeHtmlBidiFormatter
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.gwt.i18n.shared.BidiFormatterBase
BidiFormatterBase.Format
-
Method Summary
Modifier and TypeMethodDescriptionendEdge()
Returns "left" for RTL context 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
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).mark()
spanWrapWithKnownDir
(HasDirection.Direction dir, SafeHtml html) spanWrapWithKnownDir
(HasDirection.Direction dir, SafeHtml html, boolean dirReset) spanWrapWithKnownDir
(HasDirection.Direction dir, String str) spanWrapWithKnownDir
(HasDirection.Direction dir, String str, boolean dirReset) Returns "right" for RTL context direction.unicodeWrap
(SafeHtml html) unicodeWrap
(SafeHtml html, boolean dirReset) unicodeWrap
(String str) unicodeWrap
(String str, boolean dirReset) unicodeWrapWithKnownDir
(HasDirection.Direction dir, SafeHtml html, boolean dirReset) unicodeWrapWithKnownDir
(HasDirection.Direction dir, String str, boolean dirReset) Methods inherited from class com.google.gwt.i18n.shared.BidiFormatterBase
dirAttrBase, endEdgeBase, estimateDirection, estimateDirection, getAlwaysSpan, getContextDir, isRtlContext, knownDirAttrBase, markAfterBase, markBase, spanWrapBase, spanWrapWithKnownDirBase, startEdgeBase, unicodeWrapBase, unicodeWrapWithKnownDirBase
-
Method Details
-
getInstance
Factory for creating an instance of SafeHtmlBidiFormatter given the context direction. The default behavior ofspanWrap(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).- Parameters:
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 usingLocaleInfo.getCurrentLocale().isRTL()
-
getInstance
Factory for creating an instance of SafeHtmlBidiFormatter given the context direction and the desired span wrapping behavior (see below).- Parameters:
rtlContext
- Whether the context direction is RTL. See an example of a simple use case atgetInstance(boolean)
alwaysSpan
- WhetherspanWrap(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 directions
-
getInstance
Factory for creating an instance of SafeHtmlBidiFormatter given the context direction. The default behavior ofspanWrap(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).- Parameters:
contextDir
- The context direction. See an example of a simple use case atgetInstance(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 unknown
-
getInstance
public 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).- Parameters:
contextDir
- The context direction. See an example of a simple use case atgetInstance(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
- WhetherspanWrap(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 directions
-
getInstanceForCurrentLocale
Factory for creating an instance of SafeHtmlBidiFormatter whose context direction matches the current locale's direction. The default behavior ofspanWrap(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). -
getInstanceForCurrentLocale
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).- Parameters:
alwaysSpan
- WhetherspanWrap(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 directions
-
dirAttr
- Parameters:
str
- String whose direction is to be estimated- Returns:
- "dir=rtl" for RTL text in non-RTL context; "dir=ltr" for LTR text in non-LTR context; else, the empty string.
- See Also:
-
endEdge
Returns "left" for RTL context direction. Otherwise (LTR or default / unknown context direction) returns "right". -
knownDirAttr
- Parameters:
dir
- Given direction- Returns:
- "dir=rtl" for RTL text in non-RTL context; "dir=ltr" for LTR text in non-LTR context; else, the empty string.
- See Also:
-
mark
- See Also:
-
markAfter
- Parameters:
str
- String after which the mark may need to appear- Returns:
- LRM for RTL text in LTR context; RLM for LTR text in RTL context; else, the empty string.
- See Also:
-
spanWrap
- Parameters:
str
- The input string- Returns:
- Input string after applying the above processing.
- See Also:
-
spanWrap
- Parameters:
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 followstr
- Returns:
- Input string after applying the above processing.
- See Also:
-
spanWrapWithKnownDir
- Parameters:
dir
-str
's directionstr
- The input string- Returns:
- Input string after applying the above processing.
- See Also:
-
spanWrapWithKnownDir
- Parameters:
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 followstr
- Returns:
- Input string after applying the above processing.
- See Also:
-
startEdge
Returns "right" for RTL context direction. Otherwise (LTR or default / unknown context direction) returns "left". -
unicodeWrap
- Parameters:
str
- The input string- Returns:
- Input string after applying the above processing.
- See Also:
-
unicodeWrap
- Parameters:
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 followstr
- Returns:
- Input string after applying the above processing.
- See Also:
-
unicodeWrapWithKnownDir
- Parameters:
dir
-str
's directionstr
- The input string- Returns:
- Input string after applying the above processing.
- See Also:
-
unicodeWrapWithKnownDir
- Parameters:
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 followstr
- Returns:
- Input string after applying the above processing.
- See Also:
-