Package com.helger.css
Enum ECSSUnit
- All Implemented Interfaces:
com.helger.commons.name.IHasName,ICSSVersionAware,Serializable,Comparable<ECSSUnit>,java.lang.constant.Constable
public enum ECSSUnit
extends Enum<ECSSUnit>
implements com.helger.commons.name.IHasName, ICSSVersionAware
Enumeration containing all predefined CSS units.
Source: http://www.w3.org/TR/css3-values/
Source: http://www.w3.org/TR/css3-values/
- Author:
- Philip Helger
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionDegrees.Gradians, also known as "gons" or "grades".Radians.Turns.width of the "0" glyph in the element's fontDots per CSS centimeterDots per CSS inchDots per pixel centimeterfont size of the elementx-height of the element's fontFlexible length or flexHertz.Kilohertz.centimetersinches; 1in is equal to 2.54cmmillimeters; 10 millimeters = 1 centimeterpicas; 1pc is equal to 12ptpoints; 1pt is equal to 1/72nd of 1inquarter millimeters; 40 quarter-millimeters = 1 centimeterpercentagepixels; 1px is equal to 1/96th of 1infont size of the root elementMilliseconds.Seconds.Equal to 1% of the height of the initial containing block.Equal to the larger of 'vw' or 'vh'.Equal to the smaller of 'vw' or 'vh'.Equal to 1% of the width of the initial containing block. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringch(double dValue) static Stringch(int nValue) static Stringch(BigDecimal aValue) static Stringcm(double dValue) static Stringcm(int nValue) static Stringcm(BigDecimal aValue) static Stringdeg(double dValue) static Stringdeg(int nValue) static Stringdeg(BigDecimal aValue) static Stringdpcm(double dValue) static Stringdpcm(int nValue) static Stringdpcm(BigDecimal aValue) static Stringdpi(double dValue) static Stringdpi(int nValue) static Stringdpi(BigDecimal aValue) static Stringdppx(double dValue) static Stringdppx(int nValue) static Stringdppx(BigDecimal aValue) static Stringem(double dValue) static Stringem(int nValue) static Stringem(BigDecimal aValue) static Stringex(double dValue) static Stringex(int nValue) static Stringex(BigDecimal aValue) format(double dValue) Get the passed value formatted with this unit.format(int nValue) Get the passed value formatted with this unitformat(long nValue) Get the passed value formatted with this unitformat(BigDecimal aValue) Get the passed value formatted with this unit.static Stringfr(double dValue) static Stringfr(int nValue) static Stringfr(BigDecimal aValue) static ECSSUnitgetFromNameOrDefault(String sName, ECSSUnit eDefault) static ECSSUnitgetFromNameOrNull(String sName) getName()static Stringgrad(double dValue) static Stringgrad(int nValue) static Stringgrad(BigDecimal aValue) static Stringhz(double dValue) static Stringhz(int nValue) static Stringhz(BigDecimal aValue) static Stringin(double dValue) static Stringin(int nValue) static Stringin(BigDecimal aValue) static Stringkhz(double dValue) static Stringkhz(int nValue) static Stringkhz(BigDecimal aValue) static Stringmm(double dValue) static Stringmm(int nValue) static Stringmm(BigDecimal aValue) static Stringms(double dValue) static Stringms(int nValue) static Stringms(BigDecimal aValue) static Stringpc(double dValue) static Stringpc(int nValue) static Stringpc(BigDecimal aValue) static Stringperc(double dValue) static Stringperc(int nValue) static Stringperc(BigDecimal aValue) static Stringpt(double dValue) static Stringpt(int nValue) static Stringpt(BigDecimal aValue) static Stringpx(double dValue) static Stringpx(int nValue) static Stringpx(BigDecimal aValue) static Stringq(double dValue) static Stringq(int nValue) static Stringq(BigDecimal aValue) static Stringrad(double dValue) static Stringrad(int nValue) static Stringrad(BigDecimal aValue) static Stringrem(double dValue) static Stringrem(int nValue) static Stringrem(BigDecimal aValue) static Strings(double dValue) static Strings(int nValue) static Strings(BigDecimal aValue) static Stringturn(double dValue) static Stringturn(int nValue) static Stringturn(BigDecimal aValue) static ECSSUnitReturns the enum constant of this type with the specified name.static ECSSUnit[]values()Returns an array containing the constants of this enum type, in the order they are declared.static Stringvh(double dValue) static Stringvh(int nValue) static Stringvh(BigDecimal aValue) static Stringvmax(double dValue) static Stringvmax(int nValue) static Stringvmax(BigDecimal aValue) static Stringvmin(double dValue) static Stringvmin(int nValue) static Stringvmin(BigDecimal aValue) static Stringvw(double dValue) static Stringvw(int nValue) static Stringvw(BigDecimal aValue) static Stringzero()
-
Enum Constant Details
-
EM
font size of the element -
EX
x-height of the element's font -
PX
pixels; 1px is equal to 1/96th of 1in -
CH
width of the "0" glyph in the element's font -
REM
font size of the root element -
VW
Equal to 1% of the width of the initial containing block. -
VH
Equal to 1% of the height of the initial containing block. -
VMIN
Equal to the smaller of 'vw' or 'vh'. -
VMAX
Equal to the larger of 'vw' or 'vh'. -
LENGTH_IN
inches; 1in is equal to 2.54cm -
LENGTH_CM
centimeters -
LENGTH_MM
millimeters; 10 millimeters = 1 centimeter -
LENGTH_Q
quarter millimeters; 40 quarter-millimeters = 1 centimeter -
LENGTH_PT
points; 1pt is equal to 1/72nd of 1in -
LENGTH_PC
picas; 1pc is equal to 12pt -
PERCENTAGE
percentage -
ANGLE_DEG
Degrees. There are 360 degrees in a full circle. -
ANGLE_RAD
Radians. There are 2*pi radians in a full circle. -
ANGLE_GRAD
Gradians, also known as "gons" or "grades". There are 400 gradians in a full circle. -
ANGLE_TURN
Turns. There is 1 turn in a full circle. -
TIME_MS
Milliseconds. There are 1000 milliseconds in a second. -
TIME_S
Seconds. -
FREQ_HZ
Hertz. It represents the number of occurrences per second. -
FREQ_KHZ
Kilohertz. A kiloHertz is 1000 Hertz. -
DPI
Dots per CSS inch -
DPCM
Dots per CSS centimeter -
DPPX
Dots per pixel centimeter -
FR
Flexible length or flex
-
-
Field Details
-
LENGTH_PX
Length in pixel
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
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
-
getName
- Specified by:
getNamein interfacecom.helger.commons.name.IHasName- Returns:
- The name of the unit as it should be used in CSS. E.g. "px"
-
getMetaUnit
- Returns:
- The underlying meta unit. Never
null.
-
getMinimumCSSVersion
- Specified by:
getMinimumCSSVersionin interfaceICSSVersionAware- Returns:
- The minimum CSS version that is required to read or write this
artifact. May not be
null.
-
format
Get the passed value formatted with this unit- Parameters:
nValue- Value to format- Returns:
value + getName()
-
format
Get the passed value formatted with this unit- Parameters:
nValue- Value to format- Returns:
value + getName()
-
format
Get the passed value formatted with this unit. Always '.' is used as the separator.- Parameters:
dValue- Value to format- Returns:
value + getName()
-
format
Get the passed value formatted with this unit. Always '.' is used as the separator.- Parameters:
aValue- Value to format. May not benull.- Returns:
value + getName()- Since:
- 3.7.3
-
getFromNameOrNull
-
getFromNameOrDefault
-
em
- Parameters:
nValue- value to format- Returns:
value + "em"
-
em
- Parameters:
dValue- value to format- Returns:
value + "em"
-
em
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "em"- Since:
- 3.7.3
-
ex
- Parameters:
nValue- value to format- Returns:
value + "ex"
-
ex
- Parameters:
dValue- value to format- Returns:
value + "ex"
-
ex
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "ex"- Since:
- 3.7.3
-
px
- Parameters:
nValue- value to format- Returns:
value + "px"
-
px
- Parameters:
dValue- value to format- Returns:
value + "px"
-
px
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "px"- Since:
- 3.7.3
-
rem
- Parameters:
nValue- value to format- Returns:
value + "rem"
-
rem
- Parameters:
dValue- value to format- Returns:
value + "rem"
-
rem
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "rem"- Since:
- 3.7.3
-
vw
- Parameters:
nValue- value to format- Returns:
value + "vw"
-
vw
- Parameters:
dValue- value to format- Returns:
value + "vw"
-
vw
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "vw"- Since:
- 3.7.3
-
vh
- Parameters:
nValue- value to format- Returns:
value + "vh"
-
vh
- Parameters:
dValue- value to format- Returns:
value + "vh"
-
vh
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "vh"- Since:
- 3.7.3
-
vmin
- Parameters:
nValue- value to format- Returns:
value + "vmin"
-
vmin
- Parameters:
dValue- value to format- Returns:
value + "vmin"
-
vmin
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "vmin"- Since:
- 3.7.3
-
vmax
- Parameters:
nValue- value to format- Returns:
value + "vmax"- Since:
- 5.0.4
-
vmax
- Parameters:
dValue- value to format- Returns:
value + "vmax"- Since:
- 5.0.4
-
vmax
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "vmax"- Since:
- 5.0.4
-
ch
- Parameters:
nValue- value to format- Returns:
value + "ch"
-
ch
- Parameters:
dValue- value to format- Returns:
value + "ch"
-
ch
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "ch"- Since:
- 3.7.3
-
in
- Parameters:
nValue- value to format- Returns:
value + "in"
-
in
- Parameters:
dValue- value to format- Returns:
value + "in"
-
in
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "in"- Since:
- 3.7.3
-
cm
- Parameters:
nValue- value to format- Returns:
value + "cm"
-
cm
- Parameters:
dValue- value to format- Returns:
value + "cm"
-
cm
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "cm"- Since:
- 3.7.3
-
mm
- Parameters:
nValue- value to format- Returns:
value + "mm"
-
mm
- Parameters:
dValue- value to format- Returns:
value + "mm"
-
mm
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "mm"- Since:
- 3.7.3
-
q
- Parameters:
nValue- value to format- Returns:
value + "q"- Since:
- 5.0.4
-
q
- Parameters:
dValue- value to format- Returns:
value + "q"- Since:
- 5.0.4
-
q
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "q"- Since:
- 5.0.4
-
pt
- Parameters:
nValue- value to format- Returns:
value + "pt"
-
pt
- Parameters:
dValue- value to format- Returns:
value + "pt"
-
pt
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "pt"- Since:
- 3.7.3
-
pc
- Parameters:
nValue- value to format- Returns:
value + "pc"
-
pc
- Parameters:
dValue- value to format- Returns:
value + "pc"
-
pc
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "pc"- Since:
- 3.7.3
-
perc
- Parameters:
nValue- value to format- Returns:
value + "%"
-
perc
- Parameters:
dValue- value to format- Returns:
value + "%"
-
perc
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "%"- Since:
- 3.7.3
-
deg
- Parameters:
nValue- value to format- Returns:
value + "deg"
-
deg
- Parameters:
dValue- value to format- Returns:
value + "deg"
-
deg
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "deg"- Since:
- 3.7.3
-
rad
- Parameters:
nValue- value to format- Returns:
value + "rad"
-
rad
- Parameters:
dValue- value to format- Returns:
value + "rad"
-
rad
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "rad"- Since:
- 3.7.3
-
grad
- Parameters:
nValue- value to format- Returns:
value + "grad"
-
grad
- Parameters:
dValue- value to format- Returns:
value + "grad"
-
grad
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "grad"- Since:
- 3.7.3
-
turn
- Parameters:
nValue- value to format- Returns:
value + "turn"
-
turn
- Parameters:
dValue- value to format- Returns:
value + "turn"
-
turn
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "turn"- Since:
- 3.7.3
-
ms
- Parameters:
nValue- value to format- Returns:
value + "ms"
-
ms
- Parameters:
dValue- value to format- Returns:
value + "ms"
-
ms
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "ms"- Since:
- 3.7.3
-
s
- Parameters:
nValue- value to format- Returns:
value + "s"
-
s
- Parameters:
dValue- value to format- Returns:
value + "s"
-
s
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "s"- Since:
- 3.7.3
-
hz
- Parameters:
nValue- value to format- Returns:
value + "hz"
-
hz
- Parameters:
dValue- value to format- Returns:
value + "hz"
-
hz
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "hz"- Since:
- 3.7.3
-
khz
- Parameters:
nValue- value to format- Returns:
value + "khz"
-
khz
- Parameters:
dValue- value to format- Returns:
value + "khz"
-
khz
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "khz"- Since:
- 3.7.3
-
dpi
- Parameters:
nValue- value to format- Returns:
value + "dpi"
-
dpi
- Parameters:
dValue- value to format- Returns:
value + "dpi"
-
dpi
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "dpi"- Since:
- 3.7.3
-
dpcm
- Parameters:
nValue- value to format- Returns:
value + "dpcm"
-
dpcm
- Parameters:
dValue- value to format- Returns:
value + "dpcm"
-
dpcm
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "dpcm"- Since:
- 3.7.3
-
dppx
- Parameters:
nValue- value to format- Returns:
value + "dppx"
-
dppx
- Parameters:
dValue- value to format- Returns:
value + "dppx"
-
dppx
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "dppx"- Since:
- 3.7.3
-
fr
- Parameters:
nValue- value to format- Returns:
value + "fr"- Since:
- 5.0.4
-
fr
- Parameters:
dValue- value to format- Returns:
value + "fr"- Since:
- 5.0.4
-
fr
- Parameters:
aValue- Value to format. May not benull.- Returns:
value + "fr"- Since:
- 5.0.4
-
zero
- Returns:
- "0" without a unit
-