|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.lessvoid.nifty.tools.SizeValue
public class SizeValue
The SizeValue class stores and manages size value strings. Such strings are used to store size representations. See the constants for all supported special kind of values.
Field Summary | |
---|---|
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 Summary | |
---|---|
SizeValue(String valueParam)
Create a new instance using the given value. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public SizeValue(String valueParam)
valueParam
- the String valueMethod Detail |
---|
public static SizeValue px(int pixelValue)
pixelValue
- pixel value
public static SizeValue percent(int percentage)
percentage
- percentage value
public 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 String toString()
toString
in class Object
public boolean hasWidthSuffix()
public boolean hasHeightSuffix()
public boolean hasWildcard()
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |