com.vaadin.flow.component.
Enum Unit
- java.lang.Object
-
- java.lang.Enum<Unit>
-
- com.vaadin.flow.component.Unit
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CH
Unit code representing the width of the "0" (zero).
CM
Unit code representing centimeters.
EM
Unit code representing the font-size of the relevant font.
EX
Unit code representing the x-height of the relevant font.
INCH
Unit code representing inches.
MM
Unit code representing millimeters.
PERCENTAGE
Unit code representing in percentage of the containing element defined by terminal.
PICAS
Unit code representing picas (12 points).
PIXELS
Unit code representing pixels.
POINTS
Unit code representing points (1/72nd of an inch).
REM
Unit code representing the font-size of the root font.
VH
Unit code representing the viewport's height.
VMAX
Unit code representing the viewport's larger dimension.
VMIN
Unit code representing the viewport's smaller dimension.
VW
Unit code representing the viewport's width.
-
Method Summary
All Methods Modifier and Type Method Description static float
getSize(String cssSize)
Gives size component as float of the css string representing a size.
String
getSymbol()
static Optional<Unit>
getUnit(String cssSize)
Gives size unit of the css string representing a size.
static Unit
getUnitFromSymbol(String symbol)
Convert unit string symbol to Unit.
String
toString()
static Unit
valueOf(String name)
Returns the enum constant of this type with the specified name.
static Unit[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
PERCENTAGE
public static final Unit PERCENTAGE
Unit code representing in percentage of the containing element defined by terminal.
-
PIXELS
public static final Unit PIXELS
Unit code representing pixels.
-
REM
public static final Unit REM
Unit code representing the font-size of the root font.
-
EM
public static final Unit EM
Unit code representing the font-size of the relevant font.
-
VW
public static final Unit VW
Unit code representing the viewport's width.
-
VH
public static final Unit VH
Unit code representing the viewport's height.
-
VMIN
public static final Unit VMIN
Unit code representing the viewport's smaller dimension.
-
VMAX
public static final Unit VMAX
Unit code representing the viewport's larger dimension.
-
POINTS
public static final Unit POINTS
Unit code representing points (1/72nd of an inch).
-
PICAS
public static final Unit PICAS
Unit code representing picas (12 points).
-
EX
public static final Unit EX
Unit code representing the x-height of the relevant font.
-
MM
public static final Unit MM
Unit code representing millimeters.
-
CH
public static final Unit CH
Unit code representing the width of the "0" (zero).
-
CM
public static final Unit CM
Unit code representing centimeters.
-
INCH
public static final Unit INCH
Unit code representing inches.
-
-
Method Detail
-
values
public static Unit[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Unit c : Unit.values()) System.out.println(c);
Returns:
an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Unit valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-
getSymbol
public String getSymbol()
-
getUnit
public static Optional<Unit> getUnit(String cssSize)
Gives size unit of the css string representing a size.
Parameters:
cssSize
- Css compliant size string such as "50px".Returns:
A Optional unit.
-
getSize
public static float getSize(String cssSize)
Gives size component as float of the css string representing a size.
Parameters:
cssSize
- Css compliant size string such as "50px".Returns:
Size as float, 0 if string contained only the unit.
-
-