ca.sqlpower.wabit.report
Enum HorizontalAlignment

java.lang.Object
  extended by java.lang.Enum<HorizontalAlignment>
      extended by ca.sqlpower.wabit.report.HorizontalAlignment
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<HorizontalAlignment>

public enum HorizontalAlignment
extends java.lang.Enum<HorizontalAlignment>

Enumeration of possible horizontal alignments.

See Also:
VerticalAlignment

Enum Constant Summary
CENTER
          Indicates the item's centre should be lined up with the centre of the containing box.
LEFT
          Indicates the item should run from the left-hand boundary of its containing box to its natural width.
RIGHT
          Indicates the item should run to the right-hand boundary of its containing box from the position of the right-hand boundary less its natural width.
 
Method Summary
 int computeStartX(int containingBoxWidth, int itemWidth)
          Computes the starting X position within the given box for content that has the given width.
static HorizontalAlignment valueOf(java.lang.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, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

LEFT

public static final HorizontalAlignment LEFT
Indicates the item should run from the left-hand boundary of its containing box to its natural width. If the item is too wide for the box, it will be clipped at the right-hand boundary of the containing box.


CENTER

public static final HorizontalAlignment CENTER
Indicates the item's centre should be lined up with the centre of the containing box. If the item is wider than its containing box, both its right and left sides will be clipped by the containing box.


RIGHT

public static final HorizontalAlignment RIGHT
Indicates the item should run to the right-hand boundary of its containing box from the position of the right-hand boundary less its natural width. If the item is too wide for the box, it will still end at the right-hand boundary of the containing box and its left portion will be clipped by the left-hand side of the box.

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(java.lang.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:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

computeStartX

public int computeStartX(int containingBoxWidth,
                         int itemWidth)
Computes the starting X position within the given box for content that has the given width.

Parameters:
containingBoxWidth - The width of the containing box
itemWidth - The width of the item to align within the containing box
Returns:
The x-coordinate for the left-hand side of the item that makes it align according to this alignment rule. The x-coordinate is relative to the containing box's left-hand side, so a value of 0 is on the box's left-hand edge, negative values are outside the box (to its left), positive values less than containingBoxWidth are inside the box, and positive values larger than containingBoxWidth are outside the box (to its right).


Copyright © 2009. All Rights Reserved.