|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.wings.SDimension
public class SDimension
Holds preferred component sizes (dimensions).
Web browsers support different notations for sizes. Absolute pixel values, realtive percentages (of the available viewport) and special CSS values as 'inherit' and 'auto' (Default). This class if capable of handling all these cases.
| Field Summary | |
|---|---|
static String |
AUTO
String constant for CSS dimension 'auto'. |
static int |
AUTO_INT
Integer constant for CSS dimension 'auto'. |
static SDimension |
AUTOAREA
Immutable SDimension constants for a component taking up normal space |
static SDimension |
FULLAREA
Immutable SDimension constants for a component taking up the full available area. |
static SDimension |
FULLHEIGHT
Immutable SDimension constants for a component taking up the full available height. |
static SDimension |
FULLWIDTH
Immutable SDimension constants for a component taking up the full available width. |
static String |
INHERIT
String for CSS dimension 'inherit'. |
static int |
INHERIT_INT
Integer constant for CSS dimension 'inherit'. |
| Constructor Summary | |
|---|---|
SDimension()
|
|
SDimension(Integer width,
Integer height)
Construct a new dimension with absolute values. |
|
SDimension(int width,
int height)
Construct a new dimension with absolute values. |
|
SDimension(String width,
String height)
|
|
| Method Summary | |
|---|---|
boolean |
equals(Object o)
|
protected int |
extractNumericValue(String value)
Extract number from string. |
String |
getHeight()
|
int |
getHeightInt()
Get just the height as number without trailing unit. |
String |
getHeightUnit()
|
protected int |
getIntValue(String sizeString)
Extract number from string. |
String |
getWidth()
|
int |
getWidthInt()
Get just the width as number without trailing unit. |
String |
getWidthUnit()
|
int |
hashCode()
|
void |
setHeight(int height)
Set height in pixel. |
void |
setHeight(String height)
Sets the preferred height via an string. |
void |
setSize(int width,
int height)
Set the size of this Dimension object to the specified width and height and append "px" to both values. |
void |
setWidth(int width)
Set width in pixel. |
void |
setWidth(String width)
Sets the preferred width via an string. |
String |
toString()
|
protected String |
toString(int size,
String unit)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String AUTO
public static final String INHERIT
public static final int AUTO_INT
public static final int INHERIT_INT
public static final SDimension FULLWIDTH
public static final SDimension FULLHEIGHT
public static final SDimension FULLAREA
public static final SDimension AUTOAREA
| Constructor Detail |
|---|
public SDimension()
public SDimension(String width,
String height)
public SDimension(int width,
int height)
width - the preferred width in pixel. Use -1 for AUTO.height - the preferred height in pixel. Use -1 for AUTO.setSize(int,int)
public SDimension(Integer width,
Integer height)
width - the preferred width in pixel. You may pass null.height - the preferred height in pixel. You may pass null.setSize(int,int)| Method Detail |
|---|
public void setWidth(String width)
width - A preferred witdth.public void setHeight(String height)
height - A preferred height.public void setWidth(int width)
width - if -1 set widthInt to nullpublic void setHeight(int height)
height - if -1 set heightInt to nullpublic String getWidth()
120px or 80% or autopublic String getHeight()
120px or 80% or autopublic int getWidthInt()
public int getHeightInt()
public String getWidthUnit()
null for AUTO and INHERIT.
Otherwise always returns a non-null value!public String getHeightUnit()
null for AUTO and INHERIT.
Otherwise always returns a non-null value!
public void setSize(int width,
int height)
setHeight(int),
setWidth(int)public String toString()
toString in class Objectprotected int getIntValue(String sizeString)
protected String toString(int size,
String unit)
protected int extractNumericValue(String value)
AUTO_INT if nullpublic boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||