Class PercentageValue

All Implemented Interfaces:
CSSPrimitiveValue, CSSTypedValue, CSSValue, Serializable, Cloneable

public class PercentageValue extends NumberValue
Percentage value.
See Also:
  • Method Details

    • getFloatValue

      public float getFloatValue(short unitType) throws DOMException
      Gets a float value in a specified unit. If this CSS value doesn't contain a float value or can't be converted into the specified unit, a DOMException is raised.
      Specified by:
      getFloatValue in interface CSSTypedValue
      Overrides:
      getFloatValue in class NumberValue
      Parameters:
      unitType - A unit code to get the float value. The unit code can only be CSS_NUMBER or CSS_PERCENTAGE.
      Returns:
      The float value in the specified unit.
      Throws:
      DOMException - INVALID_ACCESS_ERR if the CSS value doesn't contain a float value or if the float value can't be converted into the specified unit.
    • clone

      public PercentageValue clone()
      Description copied from class: TypedValue
      Creates and returns a copy of this object.

      The object will be the same except for the subproperty flag, that will be disabled in the clone object.

      Specified by:
      clone in interface CSSValue
      Overrides:
      clone in class NumberValue
      Returns:
      a copy of this object.