Class WLength

java.lang.Object
eu.webtoolkit.jwt.WLength

public class WLength extends Object
A 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.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static WLength
    An 'auto' length.
  • Constructor Summary

    Constructors
    Constructor
    Description
    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.
    Creates a length by parsing the argument as a css length string.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(WLength other)
    Indicates whether some other object is "equal to" this one.
    Returns the CSS text.
    Returns the unit.
    double
    Returns the value.
    boolean
    Returns whether the length is 'auto'.
    final double
    Returns the (approximate) length in pixels.
    double
    toPixels(double fontSize)
    Returns the (approximate) length in pixels.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • WLength

      public WLength()
      Creates an 'auto' length.

      Specifies an 'auto' length.

      See Also:
    • WLength

      public WLength(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.

      Calls this(value, LengthUnit.Pixel)

  • Method Details