FileDocCategorySizeDatePackage
ComponentOrientation.javaAPI DocAndroid 1.5 API4788Wed May 06 22:41:54 BST 2009java.awt

ComponentOrientation

public final class ComponentOrientation extends Object implements Serializable
The ComponentOrientation class specifies the language-sensitive orientation of component's elements or text. It is used to reflect the differences in this ordering between different writing systems. The ComponentOrientation class indicates the orientation of the elements/text in the horizontal direction ("left to right" or "right to left") and in the vertical direction ("top to bottom" or "bottom to top").
since
Android 1.0

Fields Summary
private static final long
serialVersionUID
The Constant serialVersionUID.
public static final ComponentOrientation
LEFT_TO_RIGHT
The Constant LEFT_TO_RIGHT indicates that items run left to right.
public static final ComponentOrientation
RIGHT_TO_LEFT
The Constant RIGHT_TO_LEFT indicates that items run right to left.
public static final ComponentOrientation
UNKNOWN
The Constant UNKNOWN indicates that a component's orientation is not set.
private static final Set
rlLangs
The Constant rlLangs.
private final boolean
horizontal
The horizontal.
private final boolean
left2right
The left2right.
Constructors Summary
private ComponentOrientation(boolean hor, boolean l2r)
Instantiates a new component orientation.

param
hor whether the items should be arranged horizontally.
param
l2r whether this orientation specifies a left-to-right flow.

        horizontal = hor;
        left2right = l2r;
    
Methods Summary
public static java.awt.ComponentOrientationgetOrientation(java.util.ResourceBundle bdl)
Gets the orientation for the given ResourceBundle's localization.

param
bdl the ResourceBundle.
return
the ComponentOrientation.
deprecated
Use getOrientation(java.util.Locale) method.


     
        rlLangs.add("ar"); //$NON-NLS-1$
        rlLangs.add("fa"); //$NON-NLS-1$
        rlLangs.add("iw"); //$NON-NLS-1$
        rlLangs.add("ur"); //$NON-NLS-1$
    
        Object obj = null;
        try {
            obj = bdl.getObject("Orientation"); //$NON-NLS-1$
        } catch (MissingResourceException mre) {
            obj = null;
        }
        if (obj instanceof ComponentOrientation) {
            return (ComponentOrientation)obj;
        }
        Locale locale = bdl.getLocale();
        if (locale == null) {
            locale = Locale.getDefault();
        }
        return getOrientation(locale);
    
public static java.awt.ComponentOrientationgetOrientation(java.util.Locale locale)
Gets the orientation for the specified locale.

param
locale the specified Locale.
return
the ComponentOrientation.

        String lang = locale.getLanguage();
        return rlLangs.contains(lang) ? RIGHT_TO_LEFT : LEFT_TO_RIGHT;
    
public booleanisHorizontal()
Returns true if the text of the of writing systems arranged horizontally.

return
true, if the text is written horizontally, false for a vertical arrangement.

        return horizontal;
    
public booleanisLeftToRight()
Returns true if the text is arranged from left to right.

return
true, for writing systems written from left to right; false for right-to-left.

        return left2right;