Class Orientation
- java.lang.Object
-
- io.guise.framework.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
Fields Modifier and Type Field Description 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
Constructors Constructor Description Orientation(FlowOrientation lineOrientation, FlowOrientation pageOrientation)
Flow orientation constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object object)
@returntrue
if the given object is another orientation with the same line and page directions.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()
-
-
-
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 isnull
.java.lang.IllegalArgumentException
- if the line orientation and/or page orientation uses theAxis.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 isnull
.
-
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 isnull
.
-
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 isnull
.
-
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 isnull
.
-
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 isnull
.
-
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 isnull
.
-
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 returnedend
- 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 isnull
.- 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 benull
.- Parameters:
lineEnd
- The end of the line flow, ornull
if a cardinal direction is requested and a page end is provided.pageEnd
- The end of the page flow, ornull
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 arenull
.- 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.
- 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.
- Arabic (
-
equals
public boolean equals(java.lang.Object object)
@returntrue
if the given object is another orientation with the same line and page directions.- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-