Class UnitConverter
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intValue to return if this converter can not handle theunitsent in as an argument to the convert method. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract intconvertToPixels(float value, String unit, boolean isHor, float refValue, ContainerWrapper parent, ComponentWrapper comp) Convertsvalueto pixels.
-
Field Details
-
UNABLE
public static final int UNABLEValue to return if this converter can not handle theunitsent in as an argument to the convert method.- See Also:
-
-
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
valueto pixels.Parameters
-
value: The value to be converted. -
unit: The unit ofvalue. Nevernulland at least one character. -
refValue: @param refValue 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. -
isHor: If the value is horizontal (true) or vertical (false). -
parent: @param parent The parent of the target component thatvalueis 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.comp: The component, if applicable, ornullif none.
Returns
The number of pixels if
unitis handled by this converter,UnitConverter.UNABLEif not. -
-