net.sf.mmm.util.lang.api
Enum HorizontalAlignment

java.lang.Object
  extended by java.lang.Enum<HorizontalAlignment>
      extended by net.sf.mmm.util.lang.api.HorizontalAlignment
All Implemented Interfaces:
Serializable, Comparable<HorizontalAlignment>, Datatype<String>

public enum HorizontalAlignment
extends Enum<HorizontalAlignment>
implements Datatype<String>

This enum represents a horizontal alignment (e.g. for Justification).
The following table gives an example to illustrate the expected behavior of according to an HorizontalAlignment.

Alignment Text
LEFT Hello    
CENTER   Hello  
RIGHT     Hello

Since:
2.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Enum Constant Summary
CENTER
          Align content centered to the middle (same space to the left and the right).
LEFT
          Align content to the left side.
RIGHT
          Align content to the right side.
 
Field Summary
private  String title
           
private  String value
           
 
Method Summary
static HorizontalAlignment fromValue(String value)
          This method gets the HorizontalAlignment with the given value.
 String getTitle()
          This method gets the title of this datatype.
 String getValue()
          This method returns the raw value of this datatype.
 String toString()
          This method needs to return the same result a Datatype.getTitle().
static HorizontalAlignment valueOf(String name)
          Returns the enum constant of this type with the specified name.
static HorizontalAlignment[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

LEFT

public static final HorizontalAlignment LEFT
Align content to the left side.


RIGHT

public static final HorizontalAlignment RIGHT
Align content to the right side.


CENTER

public static final HorizontalAlignment CENTER
Align content centered to the middle (same space to the left and the right).

Field Detail

value

private final String value
See Also:
getValue()

title

private final String title
See Also:
getTitle()
Method Detail

values

public static HorizontalAlignment[] 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 (HorizontalAlignment c : HorizontalAlignment.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static HorizontalAlignment 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

getValue

public String getValue()
This method returns the raw value of this datatype. This will typically be a common java.lang datatype. In case of a composed datatype it is also legal that this method returns the datatype instance itself.

Specified by:
getValue in interface Datatype<String>
Returns:
the value of this datatype.

getTitle

public String getTitle()
This method gets the title of this datatype. The title is a string representation intended to be displayed to end-users (i18n will be done externally - see NlsMessage).
Since the general contract of Datatype.toString() is quite weak, this method is added to explicitly express the presence of the title and to ensure implementors of this interface can NOT miss to implement this.

Specified by:
getTitle in interface Datatype<String>
Returns:
the display title of this datatype.
See Also:
Datatype.toString()

toString

public String toString()
This method needs to return the same result a Datatype.getTitle().

Specified by:
toString in interface Datatype<String>
Overrides:
toString in class Enum<HorizontalAlignment>
Returns:
the display title of this datatype.

fromValue

public static HorizontalAlignment fromValue(String value)
This method gets the HorizontalAlignment with the given value.

Parameters:
value - is the value of the requested alignment.
Returns:
the requested alignment.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.