public class Style
extends java.lang.Object
All styles - specified in the application model - are stored as singleton instances and can be accessed using the application controller.
To create a custom style, subclass Style
and apply properties
according to your needs using the floating pattern. Use the
apply(nUIDisplayObject)
method to set properties to a dedicated
UI element, e.g.:
final Style style = ...; final nUIDisplayObject element = ...; style.setBackgroundColor(0xff00ff).setTextColor(0xffffff); style.apply(element);
Users are able to set each of the listed properties individually for a particular UI element using the application model. Therefore, properties which are not exposed in the model, can't be set using a Style.
Constructor and Description |
---|
Style() |
Modifier and Type | Method and Description |
---|---|
Style |
apply(com.softwareag.mobile.runtime.nui.nUIDisplayObject element)
Applies all non-null properties to the passed
nUIDisplayObject . |
java.lang.Integer |
getBackgroundColor() |
javax.microedition.lcdui.Image |
getBackgroundImage() |
java.lang.String |
getDateFormat() |
FontSize |
getFontSize() |
java.lang.Integer |
getFontStyle() |
java.lang.Integer |
getHAlign() |
java.lang.Integer |
getHeaderBackgroundColor() |
java.lang.Integer |
getHeaderForegroundColor() |
javax.microedition.lcdui.Image |
getHeaderImage() |
java.lang.Integer |
getHeight() |
java.lang.Boolean |
getHScrollable() |
java.lang.Integer |
getInnerX() |
java.lang.Integer |
getInnerY() |
java.lang.Integer |
getInnerYSpacing() |
java.lang.String |
getInputType() |
java.lang.Integer |
getLines() |
java.lang.Integer |
getMaxLines() |
java.lang.Integer |
getMinLines() |
java.lang.Boolean |
getOverscrollingEnabled() |
java.lang.Integer |
getRenderType() |
java.lang.Boolean |
getScaleToFitEnabled() |
java.lang.Integer |
getSeparatorColor() |
java.lang.Integer |
getTextAlign() |
java.lang.Integer |
getTextClipType() |
java.lang.Integer |
getTextColor() |
java.lang.Integer |
getVAlign() |
java.lang.Boolean |
getVScrollable() |
java.lang.Integer |
getWidth() |
java.lang.Integer |
getX() |
java.lang.Integer |
getY() |
Style |
setBackgroundColor(int color)
Sets the
backgroundColor property. |
Style |
setBackgroundImage(javax.microedition.lcdui.Image image)
Sets the
backgroundImage property. |
Style |
setDateFormat(java.lang.String dateFormat)
Sets the
dateFormat property. |
Style |
setFontColor(int color)
Sets the
textColor property. |
Style |
setFontSize(FontSize fontSize)
Sets the
fontSize property. |
Style |
setFontStyle(int fontStyle)
Sets the
fontStyle property. |
Style |
setHAlign(int hAlign)
Sets the
hAlign property. |
Style |
setHeaderBackgroundColor(int color)
Sets the
headerBackgroundColor property. |
Style |
setHeaderForegroundColor(int color)
Sets the
headerForegroundColor property. |
Style |
setHeaderImage(javax.microedition.lcdui.Image image)
Sets the
headerImage property. |
Style |
setHeight(int height)
Sets the
height property. |
Style |
setHScrollable(boolean hScrollable)
Sets the
hScrollable property. |
Style |
setInnerX(int innerX)
Sets the
innerX property. |
Style |
setInnerY(int innerY)
Sets the
innerY property. |
Style |
setInnerYSpacing(int spacing)
Sets the
innerYSpacing property. |
Style |
setInputType(java.lang.String inputType)
Sets the
inputType property. |
Style |
setLines(int lines)
Sets the
lines property. |
Style |
setMaxLines(int maxLines)
Sets the
maxLines property. |
Style |
setMinLines(int minLines)
Sets the
minLines property. |
Style |
setOverscrollingEnabled(boolean overscrollingEnabled)
Sets the
overscrollingEnabled property. |
Style |
setParent(Style parent)
Sets the
parent Style. |
Style |
setRenderType(int renderType)
Sets the
renderType property. |
Style |
setScaleToFitEnabled(boolean scaleToFitEnabled)
Sets the
scaleToFitEnabled property. |
Style |
setSeparatorColor(int color)
Sets the
separatorColor property. |
Style |
setTextAlign(int textAlign)
Sets the
textAlign property. |
Style |
setTextClipType(int clipType)
Sets the
renderType property. |
Style |
setVAlign(int vAlign)
Sets the
vAlign property. |
Style |
setVScrollable(boolean vScrollable)
Sets the
vScrollable property. |
Style |
setWidth(int width)
Sets the
width property. |
Style |
setX(int x)
Sets the
x property. |
Style |
setY(int y)
Sets the
y property. |
public Style setBackgroundColor(int color)
backgroundColor
property.
The passed value must be either a RGB (0xffffff) or ARGB (0xffffffff) value.
This property will be applied to:
nUIDisplayObject.setBgcolor(int)
color
- public Style setBackgroundImage(javax.microedition.lcdui.Image image)
backgroundImage
property.
Note that null values will not be taken into account.
This property will be applied to:
nUIViewDisplay.setBgimage(Image)
image
- public Style setHScrollable(boolean hScrollable)
hScrollable
property.
This property will be applied to:
nUIContainerElement.setHscrollable(boolean)
nUIViewDisplay.setHscrollable(boolean)
hScrollable
- public Style setVScrollable(boolean vScrollable)
vScrollable
property.
This property will be applied to:
nUIContainerElement.setVscrollable(boolean)
nUIViewDisplay.setVscrollable(boolean)
vScrollable
- public Style setHeaderBackgroundColor(int color)
headerBackgroundColor
property.
The passed value must be either a RGB (0xffffff) or ARGB (0xffffffff) value.
This property will be applied to:
nUIViewDisplay.setHeaderBgcolor(int)
color
- public Style setHeaderForegroundColor(int color)
headerForegroundColor
property.
The passed value must be either a RGB (0xffffff) or ARGB (0xffffffff) value.
This property will be applied to:
nUIViewDisplay.setHeaderFgColor(int)
color
- public Style setHeaderImage(javax.microedition.lcdui.Image image)
headerImage
property.
Note that null values will not be taken into account.
This property will be applied to:
nUIViewDisplay.setHeaderimage(Image)
image
- public Style setFontColor(int color)
textColor
property.
The passed value must be either a RGB (0xffffff) or ARGB (0xffffffff) value.
This property will be applied to:
nUITextfieldElement.setTextColor(int)
nUIEntryElement.setTextColor(int)
nUIButtonElement.setTextColor(int)
color
- public Style setFontSize(FontSize fontSize)
fontSize
property.
The passed value must be an instance of AbsoluteFontSize
or
RelativeFontSize
.
This property will be applied to:
nUITextfieldElement.setFontSizeRelative(int, int)
nUITextfieldElement.setFontSizeAbsolute(int, boolean)
nUIEntryElement.setFontSizeRelative(int, int)
nUIEntryElement.setFontSizeAbsolute(int, boolean)
nUIButtonElement.setFontSizeRelative(int, int)
nUIButtonElement.setFontSizeAbsolute(int, boolean)
fontSize
- public Style setFontStyle(int fontStyle)
fontStyle
property.
Possible values are defined in nUIConstants
:
nUIConstants.style_bold
nUIConstants.style_default
nUIConstants.style_italic
nUIConstants.style_underlined
This property will be applied to:
nUITextfieldElement.setFontStyle(int)
nUIEntryElement.setFontStyle(int)
nUIButtonElement.setFontStyle(int)
fontStlye
- public Style setHAlign(int hAlign)
hAlign
property.
Possible values are defined in nUIConstants
:
nUIConstants.center
nUIConstants.centre
nUIConstants.left
nUIConstants.right
This property will be applied to:
nUIImageElement.setAlign(int)
hAlign
- public Style setVAlign(int vAlign)
vAlign
property.
Possible values are defined in nUIConstants
:
nUIConstants.center
nUIConstants.centre
nUIConstants.top
nUIConstants.bottom
This property will be applied to:
nUITablecellElement.setVAlign(int)
vAlign
- public Style setTextAlign(int textAlign)
textAlign
property.
Possible values are defined in nUIConstants
:
nUIConstants.center
nUIConstants.left
nUIConstants.right
This property will be applied to:
nUITextfieldElement.setHAlign(int)
nUIButtonElement.setTextalign(int)
nUIDateEntry#setTextalign(int)
nUIDropdownlistEntry#setTextalign(int)
textAlign
- public Style setMaxLines(int maxLines)
maxLines
property.
This property will be applied to:
nUITextfieldElement.setMaxLines(int)
maxLines
- public Style setMinLines(int minLines)
minLines
property.
This property will be applied to:
nUITextfieldElement.setMinLines(int)
minLines
- public Style setLines(int lines)
lines
property. This property will be applied to:
nUIEntryElement.setLines(int)
lines
- public Style setInnerX(int innerX)
innerX
property.
The passed int value must be greater or equal to zero.
This property will be applied to:
nUIDisplayObject.setInnerX(int)
nUIDisplayObject.setInnerX(int)
nUIDisplayObject.setInnerX(int)
innerX
- public Style setInnerY(int innerY)
innerY
property.
The passed int value must be greater or equal to zero.
This property will be applied to:
nUIDisplayObject.setInnerY(int)
nUIDisplayObject.setInnerY(int)
nUIDisplayObject.setInnerY(int)
innerY
- public Style setInnerYSpacing(int spacing)
innerYSpacing
property.
The passed int value must be greater or equal to zero.
This property will be applied to:
nUIViewDisplay#setInterElementYSpacing(int))
innerY
- public Style setX(int x)
x
property.
The passed int value must be greater or equal to zero.
x
- public Style setY(int y)
y
property.
The passed int value must be greater or equal to zero.
y
- public Style setWidth(int width)
width
property.
The passed int value must be greater or equal to zero.
width
- public Style setHeight(int height)
height
property.
The passed int value must be greater or equal to zero.
height
- public Style setRenderType(int renderType)
renderType
property.
Possible values are defined in nUITextfieldElement
:
nUITextfieldElement.RENDER_TYPE_PLAIN_TEXT
nUITextfieldElement.RENDER_TYPE_HYPERLINKS
This property will be applied to:
nUITextfieldElement.setRenderType(int)
renderType
- public Style setTextClipType(int clipType)
renderType
property.
Possible values are defined in nUITextfieldElement
:
nUITextfieldElement.CLIP_TYPE_CLIP
nUITextfieldElement.CLIP_TYPE_ELLIPSIS
This property will be applied to:
nUITextfieldElement.setClipType(int)
renderType
- public Style setInputType(java.lang.String inputType)
inputType
property.
Possible values are defined in nUIEntryElement
:
nUIEntryElement.FORMAT_STRING_ANY
nUIEntryElement.FORMAT_NUMBER_ANY
nUIEntryElement.FORMAT_STRING_HIDDEN
nUIEntryElement.FORMAT_NUMBER_HIDDEN
This property will be applied to:
nUIEntryElement.setFormat(String)
inputType
- public Style setDateFormat(java.lang.String dateFormat)
dateFormat
property.
Possible values are defined in nUIDateEntry
:
nUIDateEntry.dd_MM_yyyy
nUIDateEntry.MM_dd_yyyy
nUIDateEntry.yyyy_MM_dd
nUIDateEntry.HH_mm_ss
nUIDateEntry.HH_mm
This property will be applied to:
nUIDateEntry.setFormat(String)
dateFormat
- public Style setOverscrollingEnabled(boolean overscrollingEnabled)
overscrollingEnabled
property.
This property will be applied to:
nUIWebviewElement.setOverscrollingEnabled(boolean)
nUIWebView.setOverscrollingEnabled(boolean)
overscrollingEnabled
- public Style setScaleToFitEnabled(boolean scaleToFitEnabled)
scaleToFitEnabled
property.
This property will be applied to:
nUIWebviewElement.setScaleToFitEnabled(boolean)
nUIWebView.setScaleToFitEnabled(boolean)
scaleToFitEnabled
- public Style setSeparatorColor(int color)
separatorColor
property.
The passed value must be either a RGB (0xffffff) or ARGB (0xffffffff) value.
This property will be applied to:
nUISeparatorElement.setColor(int)
color
- public java.lang.Integer getBackgroundColor()
public javax.microedition.lcdui.Image getBackgroundImage()
public java.lang.Boolean getHScrollable()
public java.lang.Boolean getVScrollable()
public java.lang.Integer getHeaderBackgroundColor()
public java.lang.Integer getHeaderForegroundColor()
public javax.microedition.lcdui.Image getHeaderImage()
public java.lang.Integer getTextColor()
public FontSize getFontSize()
public java.lang.Integer getFontStyle()
public java.lang.Integer getHAlign()
public java.lang.Integer getVAlign()
public java.lang.Integer getTextAlign()
public java.lang.Integer getMaxLines()
public java.lang.Integer getMinLines()
public java.lang.Integer getLines()
public java.lang.Integer getInnerX()
public java.lang.Integer getInnerY()
public java.lang.Integer getInnerYSpacing()
public java.lang.Integer getX()
public java.lang.Integer getY()
public java.lang.Integer getWidth()
public java.lang.Integer getHeight()
public java.lang.Integer getRenderType()
public java.lang.Integer getTextClipType()
public java.lang.String getDateFormat()
public java.lang.String getInputType()
public java.lang.Boolean getOverscrollingEnabled()
public java.lang.Boolean getScaleToFitEnabled()
public java.lang.Integer getSeparatorColor()
public Style apply(com.softwareag.mobile.runtime.nui.nUIDisplayObject element)
nUIDisplayObject
.element
-