public class AlignmentHelper
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
checkAlignment(int anchor)
Checks whether an alignment bit-field is valid or not.
|
static boolean |
checkHorizontalAlignment(int anchor)
Checks whether an alignment bit-field is valid horizontally or not.
|
static boolean |
checkVerticalAlignment(int anchor)
Checks whether an alignment bit-field is valid vertically or not.
|
static int |
computeXLeftCorner(int width,
int areaX,
int areaWidth,
int anchor)
Computes the x coordinate of the left edge of an element in an area.
|
static int |
computeYTopCorner(int height,
int areaY,
int areaHeight,
int anchor)
Computes the y coordinate of the top edge of an element in an area.
|
static void |
validateAlignment(int anchor)
Verify whether an alignment bit-field is valid or not.
|
public static void validateAlignment(int anchor)
checkHorizontalAlignment(int)
and checkVerticalAlignment(int)
sequentially.anchor
- the anchor to check.java.lang.IllegalArgumentException
- if the alignment is not valid.public static boolean checkAlignment(int anchor)
checkHorizontalAlignment(int)
and checkVerticalAlignment(int)
sequentially.anchor
- the anchor to check.true
if the given alignment is valid, false
otherwise.public static boolean checkHorizontalAlignment(int anchor)
GraphicsContext#LEFT
, GraphicsContext#RIGHT
or GraphicsContext#HCENTER
.anchor
- the anchor to check.true
if the given alignment is valid horizontally, false
otherwise.public static boolean checkVerticalAlignment(int anchor)
GraphicsContext#TOP
, GraphicsContext#BOTTOM
or GraphicsContext#VCENTER
.anchor
- the anchor to check.true
if the given alignment is valid vertically, false
otherwise.public static int computeXLeftCorner(int width, int areaX, int areaWidth, int anchor)
The result is not defined if the anchor is invalid.
width
- the element width.areaX
- the area x coordinate.areaWidth
- the area width.anchor
- the anchor.checkHorizontalAlignment(int)
public static int computeYTopCorner(int height, int areaY, int areaHeight, int anchor)
The result is not defined if the anchor is invalid.
height
- the element height.areaY
- the area y coordinate.areaHeight
- the area height.anchor
- the anchor.java.lang.IllegalArgumentException
- if the anchor is invalid.checkVerticalAlignment(int)