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 |
getAccentColor() |
java.lang.Integer |
getBackgroundColor() |
javax.microedition.lcdui.Image |
getBackgroundImage() |
java.lang.String |
getDateFormat() |
java.lang.Integer |
getErrorTextColor() |
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.Integer |
getHintTextColor() |
java.lang.Boolean |
getHScrollable() |
java.lang.Integer |
getIndicatorColor() |
java.lang.Integer |
getInnerX() |
java.lang.Integer |
getInnerY() |
java.lang.Integer |
getInnerYSpacing() |
java.lang.String |
getInputType() |
java.lang.Integer |
getLabelTextColor() |
java.lang.Integer |
getLines() |
java.lang.Integer |
getMaxLines() |
java.lang.Integer |
getMinLines() |
java.lang.Integer |
getOutlineColor() |
java.lang.Boolean |
getOverscrollingEnabled() |
java.lang.Integer |
getRenderType() |
java.lang.Boolean |
getScaleToFitEnabled() |
java.lang.Integer |
getSeparatorColor() |
java.lang.Integer |
getTabBackgroundColor() |
java.lang.Float |
getTabFontSize() |
java.lang.Integer |
getTabFontStyle() |
java.lang.Integer |
getTabIndicatorColor() |
java.lang.Float |
getTabIndicatorHeight() |
java.lang.Integer |
getTabMode() |
java.lang.Integer |
getTabSelectedTextColor() |
java.lang.Integer |
getTabTextColor() |
java.lang.Integer |
getTextAlign() |
java.lang.Integer |
getTextClipType() |
java.lang.Integer |
getTextColor() |
java.lang.Integer |
getThumbColor() |
java.lang.Integer |
getTickColor() |
java.lang.Integer |
getTintColor() |
java.lang.Integer |
getVAlign() |
java.lang.Boolean |
getVScrollable() |
java.lang.Integer |
getWidth() |
java.lang.Integer |
getX() |
java.lang.Integer |
getY() |
Style |
setAccentColor(int accentColor)
Sets the
accentColor property. |
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 |
setErrorTextColor(int errorTextColor)
Sets the
errorTextColor 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 |
setHintTextColor(int color)
Sets the
hintTextColor property. |
Style |
setHScrollable(boolean hScrollable)
Sets the
hScrollable property. |
Style |
setIndicatorColor(int indicatorColor)
Sets the
indicatorColor 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 |
setLabelTextColor(int labelTextColor)
Sets the
labelTextColor 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 |
setOutlineColor(int outlineColor)
Sets the
outlineColor 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 |
setTabBackgroundColor(int tabBackgroundColor)
Sets the
tabBackgroundColor property. |
Style |
setTabFontSize(float tabFontSize)
Sets the
tabFontSize property. |
Style |
setTabFontStyle(int tabFontStyle)
Sets the
tabFontStyle property. |
Style |
setTabIndicatorColor(int tabIndicatorColor)
Sets the
tabIndicatorColor property. |
Style |
setTabIndicatorHeight(float tabIndicatorHeight)
Sets the
tabIndicatorHeight property. |
Style |
setTabMode(int tabMode)
Sets the
tabMode property. |
Style |
setTabSelectedTextColor(int tabSelectedTextColor)
Sets the
tabSelectedTextColor property. |
Style |
setTabTextColor(int tabTextColor)
Sets the
tabTextColor property. |
Style |
setTextAlign(int textAlign)
Sets the
textAlign property. |
Style |
setTextClipType(int clipType)
Sets the
renderType property. |
Style |
setThumbColor(int thumbColor)
Sets the
thumbColor property. |
Style |
setTickColor(int tickColor)
Sets the
tickColor property. |
Style |
setTintColor(int color)
Sets the
tintColor 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)
nUISearchNavButton.setSearchFieldBackground(com.softwareag.mobile.runtime.nui.IBackgroundDrawable)
color
- the value to be used for this style propertyStyle
objectpublic 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
- the value to be used for this style propertyStyle
objectpublic Style setHScrollable(boolean hScrollable)
hScrollable
property.
This property will be applied to:
nUIContainerElement.setHscrollable(boolean)
nUIViewDisplay.setHscrollable(boolean)
hScrollable
- the value to be used for this style propertyStyle
objectpublic Style setVScrollable(boolean vScrollable)
vScrollable
property.
This property will be applied to:
nUIContainerElement.setVscrollable(boolean)
nUIViewDisplay.setVscrollable(boolean)
vScrollable
- the value to be used for this style propertyStyle
objectpublic 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
- the value to be used for this style propertyStyle
objectpublic 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
- the value to be used for this style propertyStyle
objectpublic 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
- the value to be used for this style propertyStyle
objectpublic 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)
nUINavbuttonElement.setTextColor(int)
nUISearchNavButton.setSearchFieldTextColor(int)
color
- the value to be used for this style propertyStyle
objectpublic 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
- the value to be used for this style propertyStyle
objectpublic 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)
fontStyle
- the value to be used for this style propertyStyle
objectpublic 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
- the value to be used for this style propertyStyle
objectpublic 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
- the value to be used for this style propertyStyle
objectpublic 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
- the value to be used for this style propertyStyle
objectpublic Style setMaxLines(int maxLines)
maxLines
property.
This property will be applied to:
nUITextfieldElement.setMaxLines(int)
maxLines
- the value to be used for this style propertyStyle
objectpublic Style setMinLines(int minLines)
minLines
property.
This property will be applied to:
nUITextfieldElement.setMinLines(int)
minLines
- the value to be used for this style propertyStyle
objectpublic Style setLines(int lines)
lines
property. This property will be applied to:
nUIEntryElement.setLines(int)
lines
- the value to be used for this style propertyStyle
objectpublic 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
- the value to be used for this style propertyStyle
objectpublic 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
- the value to be used for this style propertyStyle
objectpublic 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)
spacing
- the value to be used for this style propertyStyle
objectpublic Style setX(int x)
x
property.
The passed int value must be greater or equal to zero.
x
- the value to be used for this style propertyStyle
objectpublic Style setY(int y)
y
property.
The passed int value must be greater or equal to zero.
y
- the value to be used for this style propertyStyle
objectpublic Style setWidth(int width)
width
property.
The passed int value must be greater or equal to zero.
width
- the value to be used for this style propertyStyle
objectpublic Style setHeight(int height)
height
property.
The passed int value must be greater or equal to zero.
height
- the value to be used for this style propertyStyle
objectpublic 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
- the value to be used for this style propertyStyle
objectpublic 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)
clipType
- the value to be used for this style propertyStyle
objectpublic 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
- the value to be used for this style propertyStyle
objectpublic 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
- the value to be used for this style propertyStyle
objectpublic Style setOverscrollingEnabled(boolean overscrollingEnabled)
overscrollingEnabled
property.
This property will be applied to:
nUIWebviewElement.setOverscrollingEnabled(boolean)
nUIWebView.setOverscrollingEnabled(boolean)
overscrollingEnabled
- the value to be used for this style propertyStyle
objectpublic Style setScaleToFitEnabled(boolean scaleToFitEnabled)
scaleToFitEnabled
property.
This property will be applied to:
nUIWebviewElement.setScaleToFitEnabled(boolean)
nUIWebView.setScaleToFitEnabled(boolean)
scaleToFitEnabled
- the value to be used for this style propertyStyle
objectpublic 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
- the value to be used for this style propertyStyle
objectpublic Style setParent(Style parent)
parent
Style.parent
- the value to be used for this style propertyStyle
objectpublic Style setTabBackgroundColor(int tabBackgroundColor)
tabBackgroundColor
property.
The passed value must be either a RGB (0xffffff) or ARGB (0xffffffff) value.
This property will be applied to:
nUITabView.setTabBackgroundColor(IBackgroundDrawable)
tabBackgroundColor
- the value to be used for this style propertyStyle
objectpublic Style setTabFontSize(float tabFontSize)
tabFontSize
property.
The passed value represents the font size in pixel.
This property will be applied to:
nUITabView.setTabFontSize(float)
tabFontSize
- the value to be used for this style propertyStyle
objectpublic Style setTabFontStyle(int tabFontStyle)
tabFontStyle
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:
nUITabView.setTabFontFace(int)
tabFontStyle
- the value to be used for this style propertyStyle
objectpublic Style setTabIndicatorColor(int tabIndicatorColor)
tabIndicatorColor
property.
The passed value must be either a RGB (0xffffff) or ARGB (0xffffffff) value.
This property will be applied to:
nUITabView.setIndicatorColor(int)
tabIndicatorColor
- the value to be used for this style propertyStyle
objectpublic Style setTabIndicatorHeight(float tabIndicatorHeight)
tabIndicatorHeight
property.
Any positive int-value is supported. Be aware that the
tabIndicatorHeight
represents a dp value and not
pixel.
This property will be applied to:
nUITabView.setIndicatorHeight(float)
tabIndicatorHeight
- the value to be used for this style propertyStyle
objectpublic Style setTabMode(int tabMode)
tabMode
property.
Possible values are defined in nUITabView
:
nUITabView.TAB_FIXED
nUITabView.TAB_DYNAMIC
This property will be applied to:
nUITabView.setTabMode(int)
tabMode
- the value to be used for this style propertyStyle
objectpublic Style setTabSelectedTextColor(int tabSelectedTextColor)
tabSelectedTextColor
property.
The passed value must be either a RGB (0xffffff) or ARGB (0xffffffff) value.
This property will be applied to:
nUITabView.setTabTextColor(int, int)
for state
nUITabView.TEXT_COLOR_SELECTED
tabSelectedTextColor
- the value to be used for this style propertyStyle
objectpublic Style setTabTextColor(int tabTextColor)
tabTextColor
property.
The passed value must be either a RGB (0xffffff) or ARGB (0xffffffff) value.
This property will be applied to:
nUITabView.setTabTextColor(int, int)
for state
nUITabView.TEXT_COLOR_NORMAL
tabTextColor
- the value to be used for this style propertyStyle
objectpublic Style setAccentColor(int accentColor)
accentColor
property.
The passed value must be either a RGB (0xffffff) or ARGB (0xffffffff) value.
This property will be applied to:
nUICheckboxButton.setAccentColor(int)
nUISwitchButton.setAccentColor(int)
nUISearchNavButton.setSearchFieldAccentColor(int)
public Style setOutlineColor(int outlineColor)
outlineColor
property.
The passed value must be either a RGB (0xffffff) or ARGB (0xffffffff) value.
This property will be applied to:
nUICheckboxButton.setOutlineColor(int)
nUISwitchButton.setOutlineColor(int)
public Style setThumbColor(int thumbColor)
thumbColor
property.
The passed value must be either a RGB (0xffffff) or ARGB (0xffffffff) value.
This property will be applied to:
nUISwitchButton.setThumbColor(int)
public Style setTickColor(int tickColor)
tickColor
property.
The passed value must be either a RGB (0xffffff) or ARGB (0xffffffff) value.
This property will be applied to:
nUICheckboxButton.setTickColor(int)
public Style setErrorTextColor(int errorTextColor)
errorTextColor
property.
The passed value must be either a RGB (0xffffff) or ARGB (0xffffffff) value.
This property will be applied to:
nUIFloatingEntry.setErrorTextColor(int)
public Style setLabelTextColor(int labelTextColor)
labelTextColor
property.
The passed value must be either a RGB (0xffffff) or ARGB (0xffffffff) value.
This property will be applied to:
nUIFloatingEntry.setLabelTextColor(int)
public Style setHintTextColor(int color)
hintTextColor
property.
The passed value must be either a RGB (0xffffff) or ARGB (0xffffffff) value.
This property will be applied to:
nUISearchNavButton.setSearchFieldHintTextColor(int)
nUIEntryElement.setHintTextColor(int)
public Style setTintColor(int color)
tintColor
property.
The passed value must be either a RGB (0xffffff) or ARGB (0xffffffff) value.
This property will be applied to:
nUISearchNavButton.setSearchFieldTintColor(int)
public Style setIndicatorColor(int indicatorColor)
indicatorColor
property.
The passed value must be either a RGB (0xffffff) or ARGB (0xffffffff) value.
This property will be applied to:
nUIDropdownlistEntry.setIndicatorColor(int)
indicatorColor
- the value to be used for this style propertyStyle
objectpublic 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 java.lang.Integer getTabBackgroundColor()
public java.lang.Float getTabFontSize()
public java.lang.Integer getTabFontStyle()
public java.lang.Integer getTabIndicatorColor()
public java.lang.Float getTabIndicatorHeight()
public java.lang.Integer getTabMode()
public java.lang.Integer getTabSelectedTextColor()
public java.lang.Integer getTabTextColor()
public java.lang.Integer getAccentColor()
public java.lang.Integer getOutlineColor()
public java.lang.Integer getThumbColor()
public java.lang.Integer getTickColor()
public java.lang.Integer getErrorTextColor()
public java.lang.Integer getLabelTextColor()
public java.lang.Integer getHintTextColor()
public java.lang.Integer getTintColor()
public java.lang.Integer getIndicatorColor()