public class SizeValue extends Object
Modifier and Type | Field and Description |
---|---|
static String |
HEIGHT_SUFFIX
Add a HEIGHT_SUFFIX to some size value to indicate that this value
will be calculated in respect to the Height of an element.
|
static float |
MAX_PERCENT
Max percent constant.
|
static String |
PERCENT
Add a PERCENT to some size value to indicate a percent value.
|
static String |
PIXEL
Add a PIXEL to some size value to indicate a pixel value.
|
static String |
WIDTH_SUFFIX
Add a WIDTH_SUFFIX to some size value to indicate that this value
will be calculated in respect to the Width of an element.
|
static String |
WILDCARD
The WILDCARD value will not really be handled by the SizeValue class.
|
Constructor and Description |
---|
SizeValue(String valueParam)
Create a new instance using the given value.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
float |
getValue(float range)
Get the value as float.
|
int |
getValueAsInt(float range)
Get the value as int.
|
int |
hashCode() |
boolean |
hasHeightSuffix() |
boolean |
hasWidthSuffix() |
boolean |
hasWildcard() |
boolean |
isPercentOrPixel()
Checks if the value contains either PERCENT or PIXEL.
|
boolean |
isPixel()
Checks if this value describes a pixel value.
|
static SizeValue |
percent(int percentage)
static helper to create a percentage based SizeValue.
|
static SizeValue |
px(int pixelValue)
static helper to create a pixel based SizeValue.
|
String |
toString()
toString.
|
static SizeValue |
wildcard()
static helper to create a wildcard based SizeValue.
|
public static final String PIXEL
public static final String PERCENT
public static final String WIDTH_SUFFIX
public static final String HEIGHT_SUFFIX
public static final String WILDCARD
public static final float MAX_PERCENT
public SizeValue(String valueParam)
valueParam
- the String valuepublic static SizeValue px(int pixelValue)
pixelValue
- pixel valuepublic static SizeValue percent(int percentage)
percentage
- percentage valuepublic static SizeValue wildcard()
public boolean isPercentOrPixel()
public float getValue(float range)
range
- the size that percent values are calculated from.public int getValueAsInt(float range)
range
- range the size that percent values are calculated from.public boolean isPixel()
public boolean hasWidthSuffix()
public boolean hasHeightSuffix()
public boolean hasWildcard()
Copyright © 2013. All Rights Reserved.