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.Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()booleanIndicates whether some other object is "equal to" this one.final ClassgetClass()Returns the runtime class of an object.inthashCode()Returns a hash code value for the object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.final voidwait()Causes current thread to wait until another thread invokes the method or the method for this object.final voidwait(long timeout) Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.final voidwait(long timeout, int nanos) Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
-
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.
-