org.apache.wookie.w3c.util
Class FormattingUtils

java.lang.Object
  extended by org.apache.wookie.w3c.util.FormattingUtils

public class FormattingUtils
extends java.lang.Object

i18n formatting utilities

The methods in this class can be used to obtain strings that have been processed for i18n content to be presented in different ways, for example using CSS styling or unicode control characters

The getFormattedXYZ methods generate i18n strings using CSS bidi properties for use in display. This involves inserting HTML <span> tags containing CSS styling properties for text direction

The getEncodedXYZ methods generate unicode Strings using unicode control characters, and remove any embedded <span> tags


Field Summary
static java.lang.String END
           
static java.lang.String LRO
           
static java.lang.String LTR
           
static java.lang.String RLO
           
static java.lang.String RTL
           
 
Constructor Summary
FormattingUtils()
           
 
Method Summary
static java.lang.String getEncoded(java.lang.String dir, java.lang.String value)
           
protected static java.lang.String getFormatted(java.lang.String value)
          Generates a CSS i18n string from a raw string.
protected static java.lang.String getFormatted(java.lang.String dir, java.lang.String value)
          Generates a CSS i18n string using a given direction and value
static java.lang.String getFormattedWidgetAuthor(IAuthor author)
          Returns the CSS formatted i18n string for the widget author's name
static java.lang.String getFormattedWidgetDescription(IDescription description)
          Returns the CSS formatted i18n string for the widget description
static java.lang.String getFormattedWidgetLicense(ILicense license)
          Returns the CSS formatted i18n string for the widget license
static java.lang.String getFormattedWidgetName(IName name)
          Returns the CSS formatted i18n string for the widget name
static java.lang.String getFormattedWidgetShortName(IName name)
          Returns the CSS formatted i18n string for the widget short name
static java.lang.String getFormattedWidgetVersion(W3CWidget widget)
          Returns the CSS formatted i18n string for the widget version
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LTR

public static final java.lang.String LTR
See Also:
Constant Field Values

RTL

public static final java.lang.String RTL
See Also:
Constant Field Values

LRO

public static final java.lang.String LRO
See Also:
Constant Field Values

RLO

public static final java.lang.String RLO
See Also:
Constant Field Values

END

public static final java.lang.String END
See Also:
Constant Field Values
Constructor Detail

FormattingUtils

public FormattingUtils()
Method Detail

getFormattedWidgetName

public static java.lang.String getFormattedWidgetName(IName name)
Returns the CSS formatted i18n string for the widget name

Parameters:
name - the Widget's Name entity
Returns:
a CSS-formatted i18n string

getFormattedWidgetShortName

public static java.lang.String getFormattedWidgetShortName(IName name)
Returns the CSS formatted i18n string for the widget short name

Parameters:
name - the Widget's Name entity
Returns:
a CSS-formatted i18n string

getFormattedWidgetVersion

public static java.lang.String getFormattedWidgetVersion(W3CWidget widget)
Returns the CSS formatted i18n string for the widget version

Parameters:
widget - the Widget
Returns:
a CSS-formatted i18n string

getFormattedWidgetDescription

public static java.lang.String getFormattedWidgetDescription(IDescription description)
Returns the CSS formatted i18n string for the widget description

Parameters:
description - the Widget's description entity
Returns:
a CSS-formatted i18n string

getFormattedWidgetAuthor

public static java.lang.String getFormattedWidgetAuthor(IAuthor author)
Returns the CSS formatted i18n string for the widget author's name

Parameters:
author - the Widget's author entity
Returns:
a CSS-formatted i18n string

getFormattedWidgetLicense

public static java.lang.String getFormattedWidgetLicense(ILicense license)
Returns the CSS formatted i18n string for the widget license

Parameters:
license - the Widget's License entity
Returns:
a CSS-formatted i18n string

getFormatted

protected static java.lang.String getFormatted(java.lang.String value)
Generates a CSS i18n string from a raw string. Only use this method where the only possible directional information is inline and you want to ensure that embedded "dir" attributes are correctly formatted

Parameters:
value -
Returns:
a CSS i18n string

getFormatted

protected static java.lang.String getFormatted(java.lang.String dir,
                                               java.lang.String value)
Generates a CSS i18n string using a given direction and value

Parameters:
dir - the text direction
value - the value to modify
Returns:
a CSS i18n string

getEncoded

public static java.lang.String getEncoded(java.lang.String dir,
                                          java.lang.String value)


2012 Apache Software Foundation.