|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.enough.polish.ui.Style
public class Style
Style defines the design of any widget.
This class is used by the widgets. If you only use the predefined widgets you do not need to work with this class.
history
04-Jan-2004 - rob creation
| Field Summary | |
|---|---|
Background |
background
|
Border |
border
|
String |
dynamicName
|
static Boolean |
FALSE
|
int |
layout
|
String |
name
The name of this style. |
static Boolean |
TRUE
|
| Constructor Summary | |
|---|---|
Style()
Creates a new style with default settings |
|
Style(int marginLeft,
int marginRight,
int marginTop,
int marginBottom,
int paddingLeft,
int paddingRight,
int paddingTop,
int paddingBottom,
int paddingVertical,
int paddingHorizontal,
int layout,
int fontColor,
Color fontColorObj,
Font font,
Background background,
Border border,
short[] attributeKeys,
Object[] attributeValues)
Creates a new Style. |
|
Style(int marginLeft,
int marginRight,
int marginTop,
int marginBottom,
int paddingLeft,
int paddingRight,
int paddingTop,
int paddingBottom,
int paddingVertical,
int paddingHorizontal,
int layout,
int fontColor,
Font font,
Background background,
Border border,
short[] attributeKeys,
Object[] attributeValues)
Creates a new Style. |
|
Style(String name,
int layout,
Background background,
Border border,
short[] attributeKeys,
Object[] attributeValues)
Creates a new Style |
|
Style(String name,
int layout,
Background background,
Border border,
short[] attributeKeys,
Object[] attributeValues,
CssAnimation[] animations)
Creates a new Style when CSS animations are active. |
|
Style(Style style)
Creates a new style by creating a deep copy of the given style |
|
| Method Summary | |
|---|---|
void |
addAttribute(int key,
Object value)
Adds the specified attribute to this style, possibly replacing a previous set value |
void |
addAttribute(String key,
Object value)
Adds the specified attribute to this style, possibly replacing a previous set value. |
Style |
clone(boolean deepCopy)
Creates a copy of this style. |
void |
extendStyle(Style style)
|
int |
getAnchor()
Translates the layout into a Graphics form. |
int |
getAnchorForText()
Translates the layout into a Graphics form. |
int |
getAnchorHorizontal()
Translates the horizontal layout into a Graphics form. |
CssAnimation[] |
getAnimations()
Retrieves all registered animations Note that this method is only defined when css animations are being used. |
Boolean |
getBooleanProperty(String propName)
Retrieves a non-standard boolean property of this style. |
Color |
getColorProperty(String propName)
Retrieves a non-standard color property of this style. |
Font |
getFont()
Retrieves the font associated with this style |
int |
getFontColor()
Retrieves the font color that should be used. |
Integer |
getIntProperty(String propName)
Retrieves a non-standard integer property of this style. |
int |
getLayout()
Retrieves the layout of this style |
int |
getMarginBottom(int height)
Looks up the bottom margin value and falls back to the default margin value. |
int |
getMarginLeft(int width)
Looks up the left margin value and falls back to the default margin value. |
int |
getMarginRight(int width)
Looks up the right margin value and falls back to the default margin value. |
int |
getMarginTop(int height)
Looks up the top margin value and falls back to the default margin value. |
Object |
getObjectProperty(int key)
|
Object |
getObjectProperty(String propName)
Retrieves a non-standard property of this style. |
int |
getPaddingBottom(int height)
Looks up the bottom padding value and falls back to the default padding value. |
int |
getPaddingHorizontal(int width)
Looks up the horizontal padding value and falls back to the default padding value. |
int |
getPaddingLeft(int width)
Looks up the left padding value and falls back to the default padding value. |
int |
getPaddingRight(int width)
Looks up the right padding value and falls back to the default padding value. |
int |
getPaddingTop(int height)
Looks up the top padding value and falls back to the default padding value. |
int |
getPaddingVertical(int height)
Looks up the vertical padding value and falls back to the default padding value. |
String |
getProperty(String propName)
Retrieves a non-standard property of this style. |
short[] |
getRawAttributeKeys()
Retrieves the internal attribute keys |
Object[] |
getRawAttributeValues()
Retrieves the internal attribute values that are defined in this style. |
void |
read(DataInputStream in)
Reads this style from an InputStream |
void |
releaseResources()
Releases all (memory intensive) resources such as images or RGB arrays of this style. |
void |
removeAttribute(int key)
Removes the specified attribute from this style. |
void |
removeAttribute(String key)
Removes the specified attribute from this style. |
void |
write(DataOutputStream out)
Writes this style to an OutputStream |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Boolean TRUE
public static final Boolean FALSE
public transient String name
public transient String dynamicName
public Background background
public Border border
public int layout
| Constructor Detail |
|---|
public Style()
public Style(Style style)
style - the style
public Style(int marginLeft,
int marginRight,
int marginTop,
int marginBottom,
int paddingLeft,
int paddingRight,
int paddingTop,
int paddingBottom,
int paddingVertical,
int paddingHorizontal,
int layout,
int fontColor,
Font font,
Background background,
Border border,
short[] attributeKeys,
Object[] attributeValues)
marginLeft - the margin in pixels to the next element on the leftmarginRight - the margin in pixels to the next element on the rightmarginTop - the margin in pixels to the next element on the topmarginBottom - the margin in pixels to the next element on the bottompaddingLeft - the padding between the left border and content in pixelspaddingRight - the padding between the right border and content in pixelspaddingTop - the padding between the top border and content in pixelspaddingBottom - the padding between the bottom border and content in pixelspaddingVertical - the vertical padding between internal elements of an itempaddingHorizontal - the horizontal padding between internal elements of an itemlayout - the layout for this style, e.g. Item.LAYOUT_CENTERfontColor - the color of the fontfont - the content-font for this stylebackground - the background for this styleborder - the border for this styleattributeKeys - the integer-IDs of any additional attributes. Can be null.attributeValues - the values of any additional attributes. Can be null.
public Style(int marginLeft,
int marginRight,
int marginTop,
int marginBottom,
int paddingLeft,
int paddingRight,
int paddingTop,
int paddingBottom,
int paddingVertical,
int paddingHorizontal,
int layout,
int fontColor,
Color fontColorObj,
Font font,
Background background,
Border border,
short[] attributeKeys,
Object[] attributeValues)
marginLeft - the margin in pixels to the next element on the leftmarginRight - the margin in pixels to the next element on the rightmarginTop - the margin in pixels to the next element on the topmarginBottom - the margin in pixels to the next element on the bottompaddingLeft - the padding between the left border and content in pixelspaddingRight - the padding between the right border and content in pixelspaddingTop - the padding between the top border and content in pixelspaddingBottom - the padding between the bottom border and content in pixelspaddingVertical - the vertical padding between internal elements of an itempaddingHorizontal - the horizontal padding between internal elements of an itemlayout - the layout for this style, e.g. Item.LAYOUT_CENTERfontColor - the color of the fontfontColorObj - the color of the font, might be a dynamic color like COLOR_FOREGROUNDfont - the content-font for this stylebackground - the background for this styleborder - the border for this styleattributeKeys - the integer-IDs of any additional attributes. Can be null.attributeValues - the values of any additional attributes. Can be null.
public Style(String name,
int layout,
Background background,
Border border,
short[] attributeKeys,
Object[] attributeValues)
name - the name of the stylelayout - the layout for this style, e.g. Item.LAYOUT_CENTERbackground - the background for this styleborder - the border for this styleattributeKeys - the integer-IDs of any additional attributes. Can be null.attributeValues - the values of any additional attributes. Can be null.
public Style(String name,
int layout,
Background background,
Border border,
short[] attributeKeys,
Object[] attributeValues,
CssAnimation[] animations)
name - the name of the stylelayout - the layout for this style, e.g. Item.LAYOUT_CENTERbackground - the background for this styleborder - the border for this styleattributeKeys - the integer-IDs of any additional attributes. Can be null.attributeValues - the values of any additional attributes. Can be null.animations - CSS animation settings| Method Detail |
|---|
public void extendStyle(Style style)
public Style clone(boolean deepCopy)
deepCopy - true when arrays should be copied instead of referenced
public String getProperty(String propName)
propName - the name of the property
public Object getObjectProperty(String propName)
propName - the name of the property
public Integer getIntProperty(String propName)
propName - the name of the property
public Color getColorProperty(String propName)
propName - the name of the property
public Boolean getBooleanProperty(String propName)
propName - the name of the property
public Object getObjectProperty(int key)
public CssAnimation[] getAnimations()
public void releaseResources()
public int getFontColor()
public Font getFont()
public void removeAttribute(int key)
key - the integer key of the attributepublic void removeAttribute(String key)
key - the key name of the attribute
public void addAttribute(String key,
Object value)
key - the integer key of the attributevalue - the value of the attribute
public void addAttribute(int key,
Object value)
key - the integer key of the attributevalue - the value of the attributepublic int getMarginLeft(int width)
width - the corresponding available width
public int getMarginRight(int width)
width - the corresponding available width
public int getMarginTop(int height)
height - the corresponding available height or width - note that the CSS standard uses the width (so will J2ME Polish items) for calculating percentage values for all margins
public int getMarginBottom(int height)
height - the corresponding available height or width - note that the CSS standard uses the width (so will J2ME Polish items) for calculating percentage values for all margins
public int getPaddingLeft(int width)
width - the corresponding available width
public int getPaddingRight(int width)
width - the corresponding available width
public int getPaddingTop(int height)
height - the corresponding available height or width - note that the CSS standard uses the width (so will J2ME Polish items) for calculating percentage values for all paddings
public int getPaddingBottom(int height)
height - the corresponding available height or width - note that the CSS standard uses the width (so will J2ME Polish items) for calculating percentage values for all paddings
public int getPaddingHorizontal(int width)
width - the corresponding available width
public int getPaddingVertical(int height)
height - the corresponding available height or width - note that the CSS standard uses the width (so will J2ME Polish items) for calculating percentage values for all paddings
public int getLayout()
Item.LAYOUT_LEFT,
Item.LAYOUT_RIGHT,
Item.LAYOUT_TOP,
Item.LAYOUT_BOTTOM,
Item.LAYOUT_CENTER,
Item.LAYOUT_VCENTER,
Item.LAYOUT_EXPAND,
Item.LAYOUT_VEXPAND,
Item.LAYOUT_SHRINK,
Item.LAYOUT_VSHRINKpublic int getAnchor()
getAnchorForText(),
Graphics.LEFT,
Graphics.RIGHT,
Graphics.HCENTER,
Graphics.TOP,
Graphics.BOTTOM,
Graphics.VCENTERpublic int getAnchorForText()
getAnchor(),
Graphics.LEFT,
Graphics.RIGHT,
Graphics.HCENTER,
Graphics.TOP,
Graphics.BOTTOM,
Graphics.BASELINEpublic int getAnchorHorizontal()
getAnchor(),
Graphics.LEFT,
Graphics.RIGHT,
Graphics.HCENTER
public void read(DataInputStream in)
throws IOException
read in interface Externalizablein - the input stream
IOException - when reading fails
public void write(DataOutputStream out)
throws IOException
write in interface Externalizableout - the output stream
IOException - when writing failspublic short[] getRawAttributeKeys()
public Object[] getRawAttributeValues()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||