SafeHtmlBidiFormatter (GWT Javadoc)

Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.gwt.i18n.shared
Class SafeHtmlBidiFormatter

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

    public class SafeHtmlBidiFormatter

extends BidiFormatterBase

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

Nested Class Summary
`(package private) static class` | `SafeHtmlBidiFormatter.Factory`

Nested classes/interfaces inherited from class com.google.gwt.i18n.shared.BidiFormatterBase
`BidiFormatterBase.Format`

Method Summary
`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)`

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`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getInstance

    public static SafeHtmlBidiFormatter getInstance(boolean rtlContext)

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

  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()`

### getInstance

    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(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

    public static SafeHtmlBidiFormatter getInstance(HasDirection.Direction contextDir)

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

  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

### 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 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(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

    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(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

    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(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

    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.
  See Also:
    `BidiFormatter.dirAttr(String, boolean)`

### dirAttr

    public SafeHtml dirAttr(java.lang.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:
    `BidiFormatter.dirAttr(java.lang.String)`

### endEdge

    public SafeHtml endEdge()

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

### estimateDirection

    public HasDirection.Direction estimateDirection(SafeHtml html)

  Parameters:
    `html` - Html whose direction is to be estimated
  Returns:
    `html`'s estimated overall direction
  See Also:
    `BidiFormatterBase.estimateDirection(String, boolean)`

### knownDirAttr

    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.
  See Also:
    `BidiFormatter.knownDirAttr(com.google.gwt.i18n.client.HasDirection.Direction)`

### mark

    public SafeHtml mark()

  See Also:
    `BidiFormatter.mark()`

### markAfter

    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.
  See Also:
    `BidiFormatter.markAfter(java.lang.String)`

### markAfter

    public SafeHtml markAfter(java.lang.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.
  See Also:
    `BidiFormatter.markAfter(java.lang.String)`

### spanWrap

    public SafeHtml spanWrap(SafeHtml html)

  Parameters:
    `html` - The input html
  Returns:
    Input html after applying the above processing.
  See Also:
    `BidiFormatter.spanWrap(String, boolean)`

### spanWrap

    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.
  See Also:
    `BidiFormatter.spanWrap(String, boolean, boolean)`

### spanWrap

    public SafeHtml spanWrap(java.lang.String str)

  Parameters:
    `str` - The input string
  Returns:
    Input string after applying the above processing.
  See Also:
    `BidiFormatter.spanWrap(String)`

### spanWrap

    public SafeHtml spanWrap(java.lang.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.
  See Also:
    `BidiFormatter.spanWrap(String, boolean, boolean)`

### spanWrapWithKnownDir

    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.
  See Also:
    `BidiFormatter.spanWrapWithKnownDir( com.google.gwt.i18n.client.HasDirection.Direction, String, boolean)`

### spanWrapWithKnownDir

    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.
  See Also:
    `BidiFormatter.spanWrapWithKnownDir( com.google.gwt.i18n.client.HasDirection.Direction, String, boolean, boolean)`

### spanWrapWithKnownDir

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

  Parameters:
    `dir` - `str`'s direction
    `str` - The input string
  Returns:
    Input string after applying the above processing.
  See Also:
    `BidiFormatter.spanWrapWithKnownDir( com.google.gwt.i18n.client.HasDirection.Direction, String)`

### spanWrapWithKnownDir

    public SafeHtml spanWrapWithKnownDir(HasDirection.Direction dir,
                                         java.lang.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.
  See Also:
    `BidiFormatter.spanWrapWithKnownDir( com.google.gwt.i18n.client.HasDirection.Direction, String, boolean, boolean)`

### startEdge

    public SafeHtml startEdge()

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

### unicodeWrap

    public SafeHtml unicodeWrap(SafeHtml html)

  Parameters:
    `html` - The input html
  Returns:
    Input html after applying the above processing.
  See Also:
    `BidiFormatter.unicodeWrap(String, boolean)`

### unicodeWrap

    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.
  See Also:
    `BidiFormatter.unicodeWrap(String, boolean, boolean)`

### unicodeWrap

    public SafeHtml unicodeWrap(java.lang.String str)

  Parameters:
    `str` - The input string
  Returns:
    Input string after applying the above processing.
  See Also:
    `BidiFormatter.unicodeWrap(String)`

### unicodeWrap

    public SafeHtml unicodeWrap(java.lang.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.
  See Also:
    `BidiFormatter.unicodeWrap(String, boolean, boolean)`

### unicodeWrapWithKnownDir

    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.
  See Also:
    `BidiFormatter.unicodeWrapWithKnownDir( com.google.gwt.i18n.client.HasDirection.Direction, String, boolean)`

### unicodeWrapWithKnownDir

    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.
  See Also:
    `BidiFormatter.unicodeWrapWithKnownDir( com.google.gwt.i18n.client.HasDirection.Direction, String, boolean, boolean)`

### unicodeWrapWithKnownDir

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

  Parameters:
    `dir` - `str`'s direction
    `str` - The input string
  Returns:
    Input string after applying the above processing.
  See Also:
    `BidiFormatter.unicodeWrapWithKnownDir( com.google.gwt.i18n.client.HasDirection.Direction, String)`

### unicodeWrapWithKnownDir

    public SafeHtml unicodeWrapWithKnownDir(HasDirection.Direction dir,
                                            java.lang.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.
  See Also:
    `BidiFormatter.unicodeWrapWithKnownDir( com.google.gwt.i18n.client.HasDirection.Direction, String, boolean, boolean)`

Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD