Enum Class UI.Placement
- All Implemented Interfaces:
Serializable,Comparable<UI.Placement>,Constable,UIEnum<UI.Placement>
- Enclosing class:
UI
ImageConf and TextConf styles, and to align the contents of a label
through UIForLabel.withAlignment(Placement).
UNDEFINED names no point at all, which leaves the choice to whoever does
the placing: an image style falls back to the preferred placement of an
SvgIcon, and to CENTER where there is none.
A placement is a point which has already been chosen, so this enum names no reading
direction: it has no leading and no trailing constant.
of(VerticalAlignment, HorizontalAlignment, ComponentOrientation) accepts
UI.HorizontalAlignment.LEADING and UI.HorizontalAlignment.TRAILING and
resolves them against an orientation, but horizontal() never answers with
either of them. To align a component along the reading direction rather than at a
fixed side, pass those two constants to
UIForLabel.withHorizontalAlignment(UI.HorizontalAlignment) instead.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe middle of the bottom edge, so at the bottom and horizontally centred.The bottom left corner.The bottom right corner.The middle of the component, on both axes.The middle of the left edge, so at the left and vertically centred.The middle of the right edge, so at the right and vertically centred.The middle of the top edge, so at the top and horizontally centred.The top left corner.The top right corner.No point at all, which leaves the choice of one to whoever does the placing. -
Method Summary
Modifier and TypeMethodDescriptionReturns which of the left, the middle or the right of the component this point sits at.booleanisCorner()Tells whether this point is one of the four corners rather than a side or the center.static UI.Placementof(UI.VerticalAlignment vertical, UI.HorizontalAlignment horizontal) Combines a vertical and a horizontal alignment into the single point they name, readingUI.HorizontalAlignment.LEADINGandUI.HorizontalAlignment.TRAILINGleft to right.static UI.Placementof(UI.VerticalAlignment vertical, UI.HorizontalAlignment horizontal, UI.ComponentOrientation orientation) Combines a vertical and a horizontal alignment into the single point they name, readingUI.HorizontalAlignment.LEADINGandUI.HorizontalAlignment.TRAILINGagainst the given orientation, which is the only place their meaning is decided.opposite()Returns the point reached by going from this one through the center of the component and out the other side, which is where to put something that should sit across from whatever this point marks.static UI.PlacementReturns the enum constant of this class with the specified name.static UI.Placement[]values()Returns an array containing the constants of this enum class, in the order they are declared.vertical()Returns which of the top, the middle or the bottom of the component this point sits at.
-
Enum Constant Details
-
UNDEFINED
No point at all, which leaves the choice of one to whoever does the placing. -
TOP
The middle of the top edge, so at the top and horizontally centred. -
LEFT
The middle of the left edge, so at the left and vertically centred. -
BOTTOM
The middle of the bottom edge, so at the bottom and horizontally centred. -
RIGHT
The middle of the right edge, so at the right and vertically centred. -
TOP_LEFT
The top left corner. -
TOP_RIGHT
The top right corner. -
BOTTOM_LEFT
The bottom left corner. -
BOTTOM_RIGHT
The bottom right corner. -
CENTER
The middle of the component, on both axes.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException- if the argument is null
-
of
public static UI.Placement of(UI.VerticalAlignment vertical, UI.HorizontalAlignment horizontal, UI.ComponentOrientation orientation) Combines a vertical and a horizontal alignment into the single point they name, readingUI.HorizontalAlignment.LEADINGandUI.HorizontalAlignment.TRAILINGagainst the given orientation, which is the only place their meaning is decided.- Parameters:
vertical- Which of the top, the middle or the bottom of the component to use.horizontal- Which of the left, the middle or the right of the component to use.orientation- The reading direction that turnsUI.HorizontalAlignment.LEADINGinto a left or a right;UI.ComponentOrientation.UNKNOWNreads left to right, matchingComponentOrientation.UNKNOWN.- Returns:
- The point named by both alignments, or
UNDEFINEDif neither names one.
-
of
Combines a vertical and a horizontal alignment into the single point they name, readingUI.HorizontalAlignment.LEADINGandUI.HorizontalAlignment.TRAILINGleft to right. Callof(VerticalAlignment, HorizontalAlignment, ComponentOrientation)where the reading direction of the component is known.- Parameters:
vertical- Which of the top, the middle or the bottom of the component to use.horizontal- Which of the left, the middle or the right of the component to use.- Returns:
- The point named by both alignments, or
UNDEFINEDif neither names one.
-
vertical
Returns which of the top, the middle or the bottom of the component this point sits at. A point has both coordinates, so the side constants answer here too:LEFTsits at the middle of the left edge and answersUI.VerticalAlignment.CENTER.- Returns:
- The vertical half of this point, and
UI.VerticalAlignment.UNDEFINEDonly forUNDEFINED.
-
horizontal
Returns which of the left, the middle or the right of the component this point sits at. A point has both coordinates, so the side constants answer here too:TOPsits at the middle of the top edge and answersUI.HorizontalAlignment.CENTER. This never answersUI.HorizontalAlignment.LEADINGorUI.HorizontalAlignment.TRAILING, because the reading direction was already resolved when the point was built.- Returns:
- The horizontal half of this point, and
UI.HorizontalAlignment.UNDEFINEDonly forUNDEFINED.
-
opposite
Returns the point reached by going from this one through the center of the component and out the other side, which is where to put something that should sit across from whatever this point marks. -
isCorner
public boolean isCorner()Tells whether this point is one of the four corners rather than a side or the center.- Returns:
- True for
TOP_LEFT,TOP_RIGHT,BOTTOM_LEFTandBOTTOM_RIGHT.
-