public enum Unit extends Enum<Unit>
Mainly intended as a replacement for the Vaadin 7/8 Sizeable.Unit class to ensure API backward compatibility.
| Enum Constant and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getSymbol()
Get the unit symbol.
|
static Optional<Unit> |
getUnitFromSymbol(String symbol)
Get the
Unit which corresponds to given symbol, if available. |
static Unit |
orDefault(Unit unit)
Get the given unit or the default one (Unit
PIXELS) if null. |
static String |
sizeToString(float size)
Get the
String representation of given size. |
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.
|
public static final Unit PIXELS
public static final Unit POINTS
public static final Unit PICAS
public static final Unit EM
public static final Unit REM
public static final Unit EX
public static final Unit MM
public static final Unit CM
public static final Unit INCH
public static final Unit PERCENTAGE
public static Unit[] values()
for (Unit c : Unit.values()) System.out.println(c);
public static Unit valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic String getSymbol()
public static Unit orDefault(Unit unit)
PIXELS) if null.unit - The unitPIXELS) if nullpublic static Optional<Unit> getUnitFromSymbol(String symbol)
Unit which corresponds to given symbol, if available.symbol - Unit symbol (may be null)Unit which corresponds to given symbolCopyright © 2019 The Holon Platform. All rights reserved.