com.guiseframework.component.layout
Class Orientation

java.lang.Object
  extended by com.guiseframework.component.layout.Orientation

public class Orientation
extends java.lang.Object

Encapsulates internationalized orientation of objects. Static preinstantiated orientation objects are provided for common orientations.

Author:
Garret Wilson

Field Summary
static Orientation LEFT_TO_RIGHT_TOP_TO_BOTTOM
          Left-to-right line, top-to-bottom page orientation (e.g.
static Orientation RIGHT_TO_LEFT_TOP_TO_BOTTOM
          Right-to-left line, top-to-bottom page orientation (e.g.
static Orientation TOP_TO_BOTTOM_RIGHT_TO_LEFT
          Top-to-bottom line, right-to-left page orientation (e.g.
 
Constructor Summary
Orientation(FlowOrientation lineOrientation, FlowOrientation pageOrientation)
          Flow orientation constructor.
 
Method Summary
 boolean equals(java.lang.Object object)
          Determines whether the given object is equal to this object.
 Axis getAxis(Flow flow)
          Determines the axis for the particular flow.
 Border getBorder(Side side)
          Determines the border that appears on the given side.
 CompassPoint getCompassPoint(Flow.End lineEnd, Flow.End pageEnd)
          Retrieves a cardinal or ordinal compass point indicating the absolute direction based upon the given line and/or page ends.
 CompassPoint getCompassPoint(Flow flow, Flow.End end)
          Retrieves a cardinal compass point indicating the absolute direction based upon the given flow and end.
 Flow.Direction getDirection(Flow flow)
          Determines the direction of the particular flow.
 Flow getFlow(Axis axis)
          Determines the flow (line or page) that is aligned to the given axis.
 FlowOrientation getOrientation(Flow flow)
          Determines the orientation for the particular flow.
static Orientation getOrientation(java.util.Locale locale)
          Retrieves the default orientation for a particular locale.
 Side getSide(Border border)
          Determines the side for the particular border.
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT_TO_RIGHT_TOP_TO_BOTTOM

public static final Orientation LEFT_TO_RIGHT_TOP_TO_BOTTOM
Left-to-right line, top-to-bottom page orientation (e.g. English).


RIGHT_TO_LEFT_TOP_TO_BOTTOM

public static final Orientation RIGHT_TO_LEFT_TOP_TO_BOTTOM
Right-to-left line, top-to-bottom page orientation (e.g. Arabic).


TOP_TO_BOTTOM_RIGHT_TO_LEFT

public static final Orientation TOP_TO_BOTTOM_RIGHT_TO_LEFT
Top-to-bottom line, right-to-left page orientation (e.g. Chinese).

Constructor Detail

Orientation

public Orientation(FlowOrientation lineOrientation,
                   FlowOrientation pageOrientation)
Flow orientation constructor.

Parameters:
lineOrientation - The orientation of the line.
pageOrientation - The orientation of the page.
Throws:
java.lang.NullPointerException - if the line orientation and/or page orientation is null.
java.lang.IllegalArgumentException - if the line orientation and/or page orientation uses the Axis.Z axis.
java.lang.IllegalArgumentException - if both flow orientations specify the same axis.
Method Detail

getOrientation

public FlowOrientation getOrientation(Flow flow)
Determines the orientation for the particular flow.

Parameters:
flow - The flow (line or page).
Returns:
The orientation for the specified flow.
Throws:
java.lang.NullPointerException - if the given flow is null.

getAxis

public Axis getAxis(Flow flow)
Determines the axis for the particular flow.

Parameters:
flow - The flow (line or page).
Returns:
The axis for the specified flow.
Throws:
java.lang.NullPointerException - if the given flow is null.

getFlow

public Flow getFlow(Axis axis)
Determines the flow (line or page) that is aligned to the given axis.

Parameters:
axis - The axis for which flow should be determined.
Returns:
The flow that is aligned to the given axis.
Throws:
java.lang.NullPointerException - if the given axis is null.

getDirection

public Flow.Direction getDirection(Flow flow)
Determines the direction of the particular flow.

Parameters:
flow - The flow (line or page).
Returns:
The direction of the specified flow.
Throws:
java.lang.NullPointerException - if the given flow is null.

getSide

public Side getSide(Border border)
Determines the side for the particular border.

Parameters:
border - The logical border.
Returns:
The side for the specified border.
Throws:
java.lang.NullPointerException - if the given border is null.

getBorder

public Border getBorder(Side side)
Determines the border that appears on the given side.

Parameters:
side - The side for which the border should be determined.
Returns:
The border that appears on the given side.
Throws:
java.lang.NullPointerException - if the given side is null.

getCompassPoint

public CompassPoint getCompassPoint(Flow flow,
                                    Flow.End end)
Retrieves a cardinal compass point indicating the absolute direction based upon the given flow and end.

Parameters:
flow - The flow for which the compass point should be returned
end - The end of the flow requested.
Returns:
The cardinal compass point indicating the absolute direction of the given flow end.
Throws:
java.lang.NullPointerException - if the given flow and/or end is null.
See Also:
CompassPoint.NORTH, CompassPoint.EAST, CompassPoint.SOUTH, CompassPoint.WEST

getCompassPoint

public CompassPoint getCompassPoint(Flow.End lineEnd,
                                    Flow.End pageEnd)
Retrieves a cardinal or ordinal compass point indicating the absolute direction based upon the given line and/or page ends. Each, but not both, of the ends may be null.

Parameters:
lineEnd - The end of the line flow, or null if a cardinal direction is requested and a page end is provided.
pageEnd - The end of the page flow, or null if a cardinal direction is requested and a line end is provided.
Returns:
The cardinal or ordinal compass point indicating the absolute direction of the given line and page end.
Throws:
java.lang.NullPointerException - if both the given line end and the given page end are null.
See Also:
CompassPoint.NORTH, CompassPoint.NORTHEAST, CompassPoint.EAST, CompassPoint.SOUTHEAST, CompassPoint.SOUTH, CompassPoint.SOUTHWEST, CompassPoint.WEST, CompassPoint.NORTHWEST

getOrientation

public static Orientation getOrientation(java.util.Locale locale)
Retrieves the default orientation for a particular locale. This method currently supports the following locales:
Arabic (ar)
Right-to-left, top-to-bottom.
Farsi (fa)
Right-to-left, top-to-bottom.
Hebrew (he, iw)
Right-to-left, top-to-bottom.
Urdu (ur)
Right-to-left, top-to-bottom.
All other languages will be assumed left-to-right, top-to-bottom.

Parameters:
locale - The locale for which an orientation should be returned.
Returns:
The default orientation for the given locale, or LEFT_TO_RIGHT_TOP_TO_BOTTOM by default.

equals

public boolean equals(java.lang.Object object)
Determines whether the given object is equal to this object.

Overrides:
equals in class java.lang.Object
Parameters:
object - The object to compare to this object.
Returns:
true if the given object is another orientation with the same line and page directions.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
Returns:
A hash code for the cell.


Copyright © 2005-2010 GlobalMentor, Inc. All Rights Reserved.