Package eu.webtoolkit.jwt
Class WLength
- java.lang.Object
-
- eu.webtoolkit.jwt.WLength
-
public class WLength extends java.lang.ObjectA value class that describes a CSS length.The class combines a value with a unit. There is a special value auto which has a different meaning depending on the context.
-
-
Constructor Summary
Constructors Constructor Description WLength()Creates an 'auto' length.WLength(double value)Creates a length with value and unit.WLength(double value, LengthUnit unit)Creates a length with value and unit.WLength(java.lang.String str)Creates a length by parsing the argument as a css length string.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(WLength other)Indicates whether some other object is "equal to" this one.java.lang.StringgetCssText()Returns the CSS text.LengthUnitgetUnit()Returns the unit.doublegetValue()Returns the value.booleanisAuto()Returns whether the length is 'auto'.doubletoPixels()Returns the (approximate) length in pixels.doubletoPixels(double fontSize)Returns the (approximate) length in pixels.
-
-
-
Constructor Detail
-
WLength
public WLength()
Creates an 'auto' length.Specifies an 'auto' length.
- See Also:
Auto
-
WLength
public WLength(java.lang.String str)
Creates a length by parsing the argument as a css length string.This supports all CSS length formats that have an API counterpart.
-
WLength
public WLength(double value, LengthUnit unit)Creates a length with value and unit.This constructor is also used for the implicit conversion of a double to a
WLength, assuming a pixel unit.
-
WLength
public WLength(double value)
Creates a length with value and unit.
-
-
Method Detail
-
getValue
public double getValue()
Returns the value.- See Also:
getUnit()
-
getUnit
public LengthUnit getUnit()
Returns the unit.- See Also:
getValue()
-
getCssText
public java.lang.String getCssText()
Returns the CSS text.
-
equals
public boolean equals(WLength other)
Indicates whether some other object is "equal to" this one.
-
toPixels
public double toPixels(double fontSize)
Returns the (approximate) length in pixels.When the length
isAuto(), 0 is returned, otherwise the approximate length in pixels.Note: For percentages (
LengthUnit.Percentage), and units relative to viewport size (LengthUnit.ViewportWidth,LengthUnit.ViewportHeight,LengthUnit.ViewportMin,LengthUnit.ViewportMax), a percentage of the font size is used.
-
toPixels
public final double toPixels()
Returns the (approximate) length in pixels.Returns
toPixels(16.0)
-
-