Class StyleParser.ScalarValue
java.lang.Object
com.codename1.ui.plaf.StyleParser.ScalarValue
- Enclosing class:
StyleParser
Encapsulates a scalar value with a unit.
-
Constructor Summary
ConstructorsConstructorDescriptionScalarValue(double value, byte unit) Creates a new scalar value given magnitude and unit. -
Method Summary
Modifier and TypeMethodDescriptionintGets the magnitude of this scalar value in pixels.bytegetUnit()Returns
doublegetValue()Returns
voidsetUnit(byte unit) Parameters
voidsetValue(double value) Parameters
toString()Returns the scalar value in CN1 style string format.toString(int decimalPlaces) Formats this scalar value (including units) but rounding to the given number of decimal places.
-
Constructor Details
-
ScalarValue
public ScalarValue(double value, byte unit) Creates a new scalar value given magnitude and unit.
Parameters
-
value: The value to set. -
unit: The unit of the value. One of#UNIT_INHERIT,Style#UNIT_TYPE_DIPS,Style#UNIT_TYPE_PIXELS, orStyle#UNIT_TYPE_SCREEN_PERCENTAGE.
-
-
ScalarValue
public ScalarValue()
-
-
Method Details
-
getUnit
public byte getUnit()Returns
the unit of the value. One of
#UNIT_INHERIT,Style#UNIT_TYPE_DIPS,Style#UNIT_TYPE_PIXELS, orStyle#UNIT_TYPE_SCREEN_PERCENTAGE. -
setUnit
public void setUnit(byte unit) Parameters
unit: the unit of the value. One of#UNIT_INHERIT,Style#UNIT_TYPE_DIPS,Style#UNIT_TYPE_PIXELS, orStyle#UNIT_TYPE_SCREEN_PERCENTAGE.
-
getValue
public double getValue()Returns
the value of the scalar.
-
setValue
public void setValue(double value) Parameters
value: the value of the scalar.
-
toString
-
toString
Formats this scalar value (including units) but rounding to the given number of decimal places.
Parameters
decimalPlaces
-
getPixelValue
public int getPixelValue()Gets the magnitude of this scalar value in pixels.
-