Enum Orientation
- java.lang.Object
-
- java.lang.Enum<Orientation>
-
- net.sf.jguiraffe.gui.builder.components.Orientation
-
- All Implemented Interfaces:
Serializable
,Comparable<Orientation>
public enum Orientation extends Enum<Orientation>
An enumeration class that defines allowed values for the orientation of components.
A couple of components can have either horizontal or vertical orientation, for instance sliders or splitters. This enumeration class defines the allowed values for orientation attributes and provides methods for checking them or converting them to
Orientation
instances.- Version:
- $Id: Orientation.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Enum Constant Summary
Enum Constants Enum Constant Description HORIZONTAL
Horizontal orientation.VERTICAL
Vertical orientation.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Orientation
findOrientation(String value)
Tries to match the given string value with anOrientation
instance.static Orientation
getOrientation(String value)
Transforms the given string value into an instance of this enumeration class.static Orientation
getOrientation(String value, Orientation defaultOrientation)
Transforms the given string value into an instance of this enumeration class, using the defaultOrientation
if the string value is null.static Orientation
valueOf(String name)
Returns the enum constant of this type with the specified name.static Orientation[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
HORIZONTAL
public static final Orientation HORIZONTAL
Horizontal orientation.
-
VERTICAL
public static final Orientation VERTICAL
Vertical orientation.
-
-
Method Detail
-
values
public static Orientation[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Orientation c : Orientation.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Orientation valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
findOrientation
public static Orientation findOrientation(String value)
Tries to match the given string value with anOrientation
instance. This method checks whether the passed in string corresponds to the name of an enumeration literal (case does not matter when doing the comparison). If a match is found, the correspondingOrientation
instance is returned. Otherwise, the result of this method is null.- Parameters:
value
- the value to be searched (case does not matter)- Returns:
- the corresponding
Orientation
instance or null
-
getOrientation
public static Orientation getOrientation(String value, Orientation defaultOrientation) throws FormBuilderException
Transforms the given string value into an instance of this enumeration class, using the defaultOrientation
if the string value is null. This method tries to find a match for the given string. If this is successful, the matchingOrientation
instance is returned. Otherwise, an exception is thrown. If the passed in string is null and a defaultOrientation
is provided, then this default value is returned. If the defaultOrientation
is null, null input also leads to an exception.- Parameters:
value
- the value to be searched (case does not matter)defaultOrientation
- the defaultOrientation
to be returned for null strings- Returns:
- the found
Orientation
- Throws:
FormBuilderException
- if no match is found
-
getOrientation
public static Orientation getOrientation(String value) throws FormBuilderException
Transforms the given string value into an instance of this enumeration class. This method is basically the same as calling the overloadedgetOrientation(String, Orientation)
method with a defaultOrientation
of null; i.e. null input also causes an exception.- Parameters:
value
- the value to be searched (case does not matter)- Returns:
- the found
Orientation
- Throws:
FormBuilderException
- if no match is found
-
-