public abstract class UnitConverter
- Object
- UnitConverter
Fields
public static final int UNABLE = -87654312 | Value to return if this converter can not handle the unit sent in as an argument to the convert method. |
Constructors
public UnitConverter() |
Methods
public abstract int convertToPixels(float value, String unit, boolean isHor, float refValue, ContainerWrapper parent, ComponentWrapper comp) | Converts value to pixels. |
Inherited methods
Field details
UNABLE
public static final int UNABLE = -87654312Value to return if this converter can not handle the
unit sent in as an argument
to the convert method.Constructor details
UnitConverter
public UnitConverter()Method details
convertToPixels
public abstract int convertToPixels(float value, String unit, boolean isHor, float refValue, ContainerWrapper parent, ComponentWrapper comp)Converts
value to pixels.Parameters
valuefloat- The value to be converted.
unitString- The unit of
value. Nevernulland at least one character. isHorboolean- If the value is horizontal (
true) or vertical (false). refValuefloat- Some reference value that may of may not be used. If the unit is percent for instance this value is the value to take the percent from. Usually the size of the parent component in the appropriate dimension.
parentContainerWrapperThe parent of the target component that
valueis to be applied to. Might for instance be needed to get the screen that the component is on in a multi screen environment.May be
nullin which case a “best guess” value should be returned.compComponentWrapper- The component, if applicable, or
nullif none.
Returns
The number of pixels if
unit is handled by this converter, UnitConverter.UNABLE if not.