/* ComponentOrientation.java -- describes a component's orientation
Copyright (C) 2000, 2001, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt;
import java.io.Serializable;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
* This class is used to differentiate different orientations for text layout.
* It controls whether text flows left-to-right or right-to-left, and whether
* lines are horizontal or vertical, as in this table:
*
* LT RT TL TR * A B C C B A A D G G D A * D E F F E D B E H H E B * G H I I H G C F I I F C ** LT languages are most common (left-to-right lines, top-to-bottom). * This includes Western European languages, and optionally includes Japanese, * Chinese, and Korean. RT languages (right-to-left lines, * top-to-bottom) are mainly middle eastern, such as Hebrew and Arabic. * TR languages flow top-to-bottom in a line, right-to-left, and are * the basis of Japanese, Chinese, and Korean. Finally, TL languages * flow top-to-bottom in a line, left-to-right, as in Mongolian. * *
This is a pretty poor excuse for a type-safe enum, since it is not
* guaranteed that orientation objects are unique (thanks to serialization),
* yet there is no equals() method. You would be wise to compare the output
* of isHorizontal() and isLeftToRight() rather than comparing objects with
* ==, especially since more constants may be added in the future.
*
* @author Bryce McKinlay
*
*
* @param bdl the bundle to use
* @return the orientation
* @throws NullPointerException if bdl is null
* @deprecated use {@link #getOrientation(Locale)} instead
*/
public static ComponentOrientation getOrientation(ResourceBundle bdl)
{
ComponentOrientation r;
try
{
r = (ComponentOrientation) bdl.getObject("Orientation");
if (r != null)
return r;
}
catch (MissingResourceException ignored)
{
}
catch (ClassCastException ignored)
{
}
try
{
r = getOrientation(bdl.getLocale());
if (r != null)
return r;
}
catch (Exception ignored)
{
}
return getOrientation(Locale.getDefault());
}
} // class ComponentOrientation