Package com.vaadin.flow.component.page
Enum Class ScreenOrientation
- All Implemented Interfaces:
Serializable,Comparable<ScreenOrientation>,Constable
Represents the orientation of the browser screen.
Mirrors the values reported by the browser's Screen
Orientation API, plus an UNKNOWN sentinel used before the first
value has arrived from the client and an UNSUPPORTED sentinel for
browsers that do not implement the API.
- 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 screen is in primary landscape orientation (the device is rotated 90° clockwise from its natural portrait position).The screen is in secondary landscape orientation (the device is rotated 90° counter-clockwise from its natural portrait position).The screen is in primary portrait orientation (the device is held upright in its natural portrait position).The screen is in secondary portrait orientation (the device is rotated 180° fromPORTRAIT_PRIMARY).No value has been reported by the browser yet.The browser does not implement the Screen Orientation API. -
Method Summary
Modifier and TypeMethodDescriptionstatic ScreenOrientationfromClientValue(String clientValue) Returns the enum constant matching the given client-side orientation type string.Returns the value as used by the browser's Screen Orientation API.booleanbooleanstatic ScreenOrientationReturns the enum constant of this class with the specified name.static ScreenOrientation[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
UNKNOWN
No value has been reported by the browser yet. Used as the initial value of the signal before the first client handshake delivers a real one. In normal request handling the signal is seeded before any user code runs, so this value is essentially never observed in practice; once a real value has arrived, the signal never returns toUNKNOWN. -
UNSUPPORTED
The browser does not implement the Screen Orientation API. Distinct fromUNKNOWNso callers can tell "no data yet" apart from "the platform will never produce data." -
PORTRAIT_PRIMARY
The screen is in primary portrait orientation (the device is held upright in its natural portrait position). -
PORTRAIT_SECONDARY
The screen is in secondary portrait orientation (the device is rotated 180° fromPORTRAIT_PRIMARY). -
LANDSCAPE_PRIMARY
The screen is in primary landscape orientation (the device is rotated 90° clockwise from its natural portrait position). -
LANDSCAPE_SECONDARY
The screen is in secondary landscape orientation (the device is rotated 90° counter-clockwise from its natural portrait position).
-
-
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
-
getClientValue
Returns the value as used by the browser's Screen Orientation API.- Returns:
- the client-side orientation type string
-
isLandscape
public boolean isLandscape()Returnstruefor the two landscape orientations (LANDSCAPE_PRIMARY,LANDSCAPE_SECONDARY).UNKNOWNandUNSUPPORTEDreturnfalse.- Returns:
- whether this is a landscape orientation
-
isPortrait
public boolean isPortrait()Returnstruefor the two portrait orientations (PORTRAIT_PRIMARY,PORTRAIT_SECONDARY).UNKNOWNandUNSUPPORTEDreturnfalse.- Returns:
- whether this is a portrait orientation
-
fromClientValue
Returns the enum constant matching the given client-side orientation type string.- Parameters:
clientValue- the orientation type string from the browser- Returns:
- the corresponding enum value
- Throws:
IllegalArgumentException- if the value does not match any known orientation type
-