Enum 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 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 name
        NullPointerException - if the argument is null
      • findOrientation

        public static Orientation findOrientation​(String value)
        Tries to match the given string value with an Orientation 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 corresponding Orientation 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 default Orientation if the string value is null. This method tries to find a match for the given string. If this is successful, the matching Orientation instance is returned. Otherwise, an exception is thrown. If the passed in string is null and a default Orientation is provided, then this default value is returned. If the default Orientation is null, null input also leads to an exception.
        Parameters:
        value - the value to be searched (case does not matter)
        defaultOrientation - the default Orientation 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 overloaded getOrientation(String, Orientation) method with a default Orientation 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