public class

SafeHtmlBidiFormatter

extends BidiFormatterBase
java.lang.Object
   ↳ com.google.gwt.i18n.shared.BidiFormatterBase
     ↳ com.google.gwt.i18n.shared.SafeHtmlBidiFormatter

Class Overview

A wrapper to BidiFormatter whose methods return SafeHtml instead of String.

Summary

Public Methods
SafeHtml dirAttr(SafeHtml html)
SafeHtml dirAttr(String str)
SafeHtml endEdge()
Returns "left" for RTL context direction.
HasDirection.Direction estimateDirection(SafeHtml html)
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 getInstance(boolean rtlContext)
Factory for creating an instance of SafeHtmlBidiFormatter given the context 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).
static SafeHtmlBidiFormatter getInstanceForCurrentLocale()
Factory for creating an instance of SafeHtmlBidiFormatter whose context direction matches the current locale's direction.
SafeHtml knownDirAttr(HasDirection.Direction dir)
SafeHtml mark()
SafeHtml markAfter(String str)
SafeHtml markAfter(SafeHtml html)
SafeHtml spanWrap(SafeHtml html, boolean dirReset)
SafeHtml spanWrap(SafeHtml html)
SafeHtml spanWrap(String str)
SafeHtml spanWrap(String str, boolean dirReset)
SafeHtml spanWrapWithKnownDir(HasDirection.Direction dir, String str)
SafeHtml spanWrapWithKnownDir(HasDirection.Direction dir, String str, boolean dirReset)
SafeHtml spanWrapWithKnownDir(HasDirection.Direction dir, SafeHtml html, boolean dirReset)
SafeHtml spanWrapWithKnownDir(HasDirection.Direction dir, SafeHtml html)
SafeHtml startEdge()
Returns "right" for RTL context direction.
SafeHtml unicodeWrap(String str)
SafeHtml unicodeWrap(SafeHtml html, boolean dirReset)
SafeHtml unicodeWrap(SafeHtml html)
SafeHtml unicodeWrap(String str, boolean dirReset)
SafeHtml unicodeWrapWithKnownDir(HasDirection.Direction dir, String str)
SafeHtml unicodeWrapWithKnownDir(HasDirection.Direction dir, SafeHtml html, boolean dirReset)
SafeHtml unicodeWrapWithKnownDir(HasDirection.Direction dir, String str, boolean dirReset)
SafeHtml unicodeWrapWithKnownDir(HasDirection.Direction dir, SafeHtml html)
[Expand]
Inherited Methods
From class com.google.gwt.i18n.shared.BidiFormatterBase
From class java.lang.Object

Public Methods

public SafeHtml dirAttr (SafeHtml html)

Parameters
html Html 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.

public SafeHtml dirAttr (String str)

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

public SafeHtml endEdge ()

Returns "left" for RTL context direction. Otherwise (LTR or default / unknown context direction) returns "right".

public HasDirection.Direction estimateDirection (SafeHtml html)

Parameters
html Html whose direction is to be estimated
Returns
  • html's estimated overall direction

public 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).

Parameters
rtlContext Whether the context direction is RTL. See an example of a simple use case at getInstance(boolean)
alwaysSpan Whether spanWrap(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

public static SafeHtmlBidiFormatter getInstance (HasDirection.Direction contextDir)

Factory for creating an instance of SafeHtmlBidiFormatter given the context direction. The default behavior of spanWrap(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 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 unknown

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 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 unknown
alwaysSpan Whether spanWrap(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

public static SafeHtmlBidiFormatter getInstance (boolean rtlContext)

Factory for creating an instance of SafeHtmlBidiFormatter given the context direction. The default behavior of spanWrap(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 using LocaleInfo.getCurrentLocale().isRTL()

public 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).

Parameters
alwaysSpan Whether spanWrap(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

public static SafeHtmlBidiFormatter getInstanceForCurrentLocale ()

Factory for creating an instance of SafeHtmlBidiFormatter whose context direction matches the current locale's direction. The default behavior of spanWrap(SafeHtml) and its variations is set to avoid span wrapping unless it's necessary ('dir' attribute needs to be set).

public SafeHtml knownDirAttr (HasDirection.Direction dir)

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.

public SafeHtml mark ()

See Also

public SafeHtml markAfter (String str)

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.

public SafeHtml markAfter (SafeHtml html)

Parameters
html Html 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.

public SafeHtml spanWrap (SafeHtml html, boolean dirReset)

Parameters
html The input html
dirReset Whether to append a trailing unicode bidi mark matching the context direction, when needed, to prevent the possible garbling of whatever may follow html
Returns
  • Input html after applying the above processing.

public SafeHtml spanWrap (SafeHtml html)

Parameters
html The input html
Returns
  • Input html after applying the above processing.

public SafeHtml spanWrap (String str)

Parameters
str The input string
Returns
  • Input string after applying the above processing.
See Also

public SafeHtml spanWrap (String str, boolean dirReset)

Parameters
str The input string
dirReset Whether to append a trailing unicode bidi mark matching the context direction, when needed, to prevent the possible garbling of whatever may follow str
Returns
  • Input string after applying the above processing.

public SafeHtml spanWrapWithKnownDir (HasDirection.Direction dir, String str)

Parameters
dir str's direction
str The input string
Returns
  • Input string after applying the above processing.

public SafeHtml spanWrapWithKnownDir (HasDirection.Direction dir, String str, boolean dirReset)

Parameters
dir str's direction
str The input string
dirReset Whether to append a trailing unicode bidi mark matching the context direction, when needed, to prevent the possible garbling of whatever may follow str
Returns
  • Input string after applying the above processing.

public SafeHtml spanWrapWithKnownDir (HasDirection.Direction dir, SafeHtml html, boolean dirReset)

Parameters
dir html's direction
html The input html
dirReset Whether to append a trailing unicode bidi mark matching the context direction, when needed, to prevent the possible garbling of whatever may follow html
Returns
  • Input html after applying the above processing.

public SafeHtml spanWrapWithKnownDir (HasDirection.Direction dir, SafeHtml html)

Parameters
dir str's direction
html The input html
Returns
  • Input html after applying the above processing.

public SafeHtml startEdge ()

Returns "right" for RTL context direction. Otherwise (LTR or default / unknown context direction) returns "left".

public SafeHtml unicodeWrap (String str)

Parameters
str The input string
Returns
  • Input string after applying the above processing.

public SafeHtml unicodeWrap (SafeHtml html, boolean dirReset)

Parameters
html The input html
dirReset Whether to append a trailing unicode bidi mark matching the context direction, when needed, to prevent the possible garbling of whatever may follow html
Returns
  • Input html after applying the above processing.

public SafeHtml unicodeWrap (SafeHtml html)

Parameters
html The input html
Returns
  • Input html after applying the above processing.

public SafeHtml unicodeWrap (String str, boolean dirReset)

Parameters
str The input string
dirReset Whether to append a trailing unicode bidi mark matching the context direction, when needed, to prevent the possible garbling of whatever may follow str
Returns
  • Input string after applying the above processing.

public SafeHtml unicodeWrapWithKnownDir (HasDirection.Direction dir, String str)

Parameters
dir str's direction
str The input string
Returns
  • Input string after applying the above processing.

public SafeHtml unicodeWrapWithKnownDir (HasDirection.Direction dir, SafeHtml html, boolean dirReset)

Parameters
dir html's direction
html The input html
dirReset Whether to append a trailing unicode bidi mark matching the context direction, when needed, to prevent the possible garbling of whatever may follow html
Returns
  • Input html after applying the above processing.

public SafeHtml unicodeWrapWithKnownDir (HasDirection.Direction dir, String str, boolean dirReset)

Parameters
dir str's direction
str The input string
dirReset Whether to append a trailing unicode bidi mark matching the context direction, when needed, to prevent the possible garbling of whatever may follow str
Returns
  • Input string after applying the above processing.

public SafeHtml unicodeWrapWithKnownDir (HasDirection.Direction dir, SafeHtml html)

Parameters
dir html's direction
html The input html
Returns
  • Input html after applying the above processing.