com.vaadin.client
Class WidgetUtil.CssSize

java.lang.Object
  extended by com.vaadin.client.WidgetUtil.CssSize
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
WidgetUtil

public static class WidgetUtil.CssSize
extends java.lang.Object
implements java.io.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 Summary
 boolean equals(java.lang.Object obj)
           
static boolean equals(java.lang.String cssSize1, java.lang.String cssSize2)
          Check whether the two sizes are equals.
static WidgetUtil.CssSize fromString(java.lang.String s)
          Parse the size from string format to WidgetUtil.CssSize.
static WidgetUtil.CssSize fromValueUnit(float value, Unit unit)
          Creates a WidgetUtil.CssSize using a value and its measurement unit.
 Unit getUnit()
          Gets the measurement unit for this css size.
 float getValue()
          Gets the value for this css size.
 java.lang.String toString()
           
static Unit unitByType(java.lang.String type)
          Gets the unit value by its type.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

unitByType

public static Unit unitByType(java.lang.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.

fromString

public static WidgetUtil.CssSize fromString(java.lang.String s)
Parse the size from string format to WidgetUtil.CssSize.

Parameters:
s - the size as string.
Returns:
a WidgetUtil.CssSize object.

fromValueUnit

public static WidgetUtil.CssSize fromValueUnit(float value,
                                               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 Unit getUnit()
Gets the measurement unit for this css size.

Returns:
the unit.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

equals

public static boolean equals(java.lang.String cssSize1,
                             java.lang.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.


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.