|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.abdera.ext.bidi.BidiHelper
public final class BidiHelper
This is (hopefully) temporary. Ideally, this would be wrapped into the core model API so that the bidi stuff is handled seamlessly. There are still details being worked out on the Atom WG list and it's likely that at least one other impl (mozilla) will do something slightly different.
Based on http://www.ietf.org/internet-drafts/draft-snell-atompub-bidi-04.txt
Example:
<feed xmlns="http://www.w3.org/2005/Atom" dir="rtl"> ... </feed>
The getBidi___ elements use the in-scope direction to wrap the text with the appropriate Unicode control characters. e.g. if dir="rtl", the text is wrapped with the RLE and PDF controls. If the text already contains the control chars, the dir attribute is ignored.
org.apache.abdera.Abdera abdera = new org.apache.abdera.Abdera(); org.apache.abdera.model.Feed feed = abdera.getFactory().newFeed(); feed.setAttributeValue("dir", "rtl"); feed.setTitle("Testing"); feed.addCategory("foo"); System.out.println(BidiHelper.getBidiElementText(feed.getTitleElement())); System.out.println(BidiHelper.getBidiAttributeValue(feed.getCategories().get(0), "term"));
Field Summary | |
---|---|
static QName |
DIR
|
Method Summary | ||
---|---|---|
static
|
getBidiAttributeValue(T element,
QName name)
Return the text content of the specified attribute using the in-scope directionality |
|
static
|
getBidiAttributeValue(T element,
String name)
Return the text content of the specified attribute using the in-scope directionality |
|
static
|
getBidiChildText(T element,
QName child)
Return the textual content of a child element using the in-scope directionality |
|
static
|
getBidiElementText(T element)
Return the textual content of the specified element |
|
static String |
getBidiText(Bidi.Direction direction,
String text)
Return the specified text with appropriate Unicode Control Characters given the specified Direction. |
|
static
|
getDirection(T element)
Get the in-scope direction for an element. |
|
static
|
guessDirectionFromEncoding(T element)
Attempt to guess the base direction using the charset encoding. |
|
static
|
guessDirectionFromEncoding(T element,
boolean ignoredir)
Attempt to guess the base direction using the charset encoding. |
|
static
|
guessDirectionFromJavaBidi(T element)
Use Java's built in support for bidi text to determine the base directionality of the element's text. |
|
static
|
guessDirectionFromJavaBidi(T element,
boolean ignoredir)
Use Java's built in support for bidi text to determine the base directionality of the element's text. |
|
static
|
guessDirectionFromLanguage(T element)
Attempt to guess the base direction using the in-scope language. |
|
static
|
guessDirectionFromLanguage(T element,
boolean ignoredir)
Attempt to guess the base direction using the in-scope language. |
|
static
|
guessDirectionFromTextProperties(T element)
Attempt to guess the base direction of an element using an analysis of the directional properties of the characters used. |
|
static
|
guessDirectionFromTextProperties(T element,
boolean ignoredir)
Attempt to guess the base direction of an element using an analysis of the directional properties of the characters used. |
|
static
|
setDirection(Bidi.Direction direction,
T element)
Set the value of dir attribute |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final QName DIR
Method Detail |
---|
public static <T extends Element> void setDirection(Bidi.Direction direction, T element)
public static <T extends Element> Bidi.Direction getDirection(T element)
public static String getBidiText(Bidi.Direction direction, String text)
direction
- The Directionality of the texttext
- The text to wrap within Unicode Control Characters
public static <T extends Element> String getBidiChildText(T element, QName child)
element
- The parent elementchild
- The XML QName of the child element
public static <T extends Element> String getBidiElementText(T element)
element
- An element containing directionally-sensitive text
public static <T extends Element> String getBidiAttributeValue(T element, String name)
element
- The parent elementname
- the name of the attribute
public static <T extends Element> String getBidiAttributeValue(T element, QName name)
element
- The parent elementname
- the name of the attribute
public static <T extends Element> Bidi.Direction guessDirectionFromLanguage(T element)
public static <T extends Element> Bidi.Direction guessDirectionFromLanguage(T element, boolean ignoredir)
public static <T extends Element> Bidi.Direction guessDirectionFromEncoding(T element)
public static <T extends Element> Bidi.Direction guessDirectionFromEncoding(T element, boolean ignoredir)
public static <T extends Element> Bidi.Direction guessDirectionFromTextProperties(T element)
public static <T extends Element> Bidi.Direction guessDirectionFromTextProperties(T element, boolean ignoredir)
public static <T extends Element> Bidi.Direction guessDirectionFromJavaBidi(T element)
public static <T extends Element> Bidi.Direction guessDirectionFromJavaBidi(T element, boolean ignoredir)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |