Class WidgetUtil.CssSize

  • All Implemented Interfaces:
    Serializable
    Enclosing class:
    WidgetUtil

    public static class WidgetUtil.CssSize
    extends Object
    implements Serializable
    Wrap a css size value and its unit and translate back and forth to the string representation.
    Eg. 50%, 123px, ...
    Since:
    7.2.6
    Author:
    Vaadin Ltd
    See Also:
    Serialized Form
    • Method Detail

      • unitByType

        public static com.google.gwt.dom.client.Style.Unit unitByType​(String type)
        Gets the unit value by its type.
        Parameters:
        type - the type of the unit as found in the style.
        Returns:
        the unit value.
      • fromValueUnit

        public static WidgetUtil.CssSize fromValueUnit​(float value,
                                                       com.google.gwt.dom.client.Style.Unit unit)
        Creates a WidgetUtil.CssSize using a value and its measurement unit.
        Parameters:
        value - the value.
        unit - the unit.
        Returns:
        the WidgetUtil.CssSize object.
      • getValue

        public float getValue()
        Gets the value for this css size.
        Returns:
        the value.
      • getUnit

        public com.google.gwt.dom.client.Style.Unit getUnit()
        Gets the measurement unit for this css size.
        Returns:
        the unit.
      • equals

        public static boolean equals​(String cssSize1,
                                     String cssSize2)
        Check whether the two sizes are equals.
        Parameters:
        cssSize1 - the first size to compare.
        cssSize2 - the other size to compare with the first one.
        Returns:
        true if the two sizes are equals, otherwise false.