Class ConstantSize

java.lang.Object
com.vaadin.featurepack.desktop.layouts.form.ConstantSize
All Implemented Interfaces:
Size, Serializable

public final class ConstantSize extends Object implements Size
A Size implementation that represents constant sizes described by a value and unit.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    ConstantSize(double value, Unit unit)
    Constructs a ConstantSize for the given size and unit.
    ConstantSize(int value, Unit unit)
    Constructs a ConstantSize for the given size and unit.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a parseable string representation of this constant size.
    boolean
    Indicates whether some other ConstantSize is "equal to" this one.
    Returns this size's unit.
    double
    Returns this size's value.
    int
    Returns a hash code value for the object.
    Returns a string representation of this size object.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ConstantSize

      public ConstantSize(int value, Unit unit)
      Constructs a ConstantSize for the given size and unit.
      Parameters:
      value - the size value interpreted in the given units
      unit - the size's unit
    • ConstantSize

      public ConstantSize(double value, Unit unit)
      Constructs a ConstantSize for the given size and unit.
      Parameters:
      value - the size value interpreted in the given units
      unit - the size's unit
  • Method Details

    • getValue

      public double getValue()
      Returns this size's value.
      Returns:
      the size value
    • getUnit

      public Unit getUnit()
      Returns this size's unit.
      Returns:
      the size unit
    • equals

      public boolean equals(Object o)
      Indicates whether some other ConstantSize is "equal to" this one.
      Overrides:
      equals in class Object
      Parameters:
      o - the Object with which to compare
      Returns:
      true if this object is the same as the obj argument; false otherwise.
      See Also:
    • hashCode

      public int hashCode()
      Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this object.
      See Also:
    • toString

      public String toString()
      Returns a string representation of this size object. Note: This string representation may change at any time. It is intended for debugging purposes. For parsing, use encode() instead.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the constant size
    • encode

      public String encode()
      Returns a parseable string representation of this constant size.
      Specified by:
      encode in interface Size
      Returns:
      a String that can be parsed by the Forms parser