net.rim.device.api.ui.component.table
Class RegionStyles

java.lang.Object
  extended by net.rim.device.api.ui.component.table.RegionStyles

public class RegionStyles
extends Object

Container class for the region styles to be applied to a region.

Since:
BlackBerry API 6.0.0

Field Summary
static int ALIGN_BOTTOM
          A vertical alignment behavior code indicating that the field in the region should be aligned to the bottom.
static int ALIGN_CENTER
          A horizontal alignment behavior code indicating that the field in the region should be aligned to the center.
static int ALIGN_LEFT
          A horizontal alignment behavior code indicating that the field in the region should be aligned to the left.
static int ALIGN_MIDDLE
          A vertical alignment behavior code indicating that the field in the region should be aligned to the middle.
static int ALIGN_RIGHT
          A horizontal alignment behavior code indicating that the field in the region should be aligned to the right.
static int ALIGN_TOP
          A vertical alignment behavior code indicating that the field in the region should be aligned to the top.
static int BEHAVIOR_FONT
          A behavior type that describes how the region obtains its font.
static int BEHAVIOR_HALIGN
          A behavior type that describes how the field in the region will be horizontally aligned.
static int BEHAVIOR_LAYOUT
          A behavior type that describes the layout of the field that will be housed in this region.
static int BEHAVIOR_VALIGN
          A behavior type that describes how the field in the region will be vertically aligned.
static int FONT_FOLLOW_SPECIFIED
          A font behavior code indicating that the region's font should be the one specified in the RegionStyles constructor or via the setFont() method.
static int FONT_FOLLOW_THEME
          A font behavior code indicating that the region's font should be specified by the current theme.
static int FONT_FOLLOW_USER
          A font behavior code indicating that the region's font should be specified by the current user-specified font.
static int LAYOUT_DYNAMIC
          A layout behavior code indicating that the field will need several re-layouts throughout its lifetime on screen.
static int LAYOUT_STATIC
          A layout behavior code indicating that the field will only need to be laid out once in the table.
 
Constructor Summary
RegionStyles(Border border, Font font, XYEdges margin, XYEdges padding, int horizontalAlignment, int verticalAlignment)
          Creates an instance of a RegionStyles object that will later correspond to a Data Template region.
 
Method Summary
 int getBehavior(int behaviorType)
          Gets the current setting of a particular behavior type for this region.
 Border getBorder()
          Get the border that has been applied to this region.
 Font getFont()
          Get the font that has been applied to this region.
 int getHorizontalAlignment()
          A convenience method to get the horizontal alignment that has been applied to this region.
 XYEdges getMargin()
          Get the margin that has been applied to this region.
 XYEdges getPadding()
          Get the padding that has been applied to this region.
 int getVerticalAlignment()
          A convenience method to get the vertical alignment that has been applied to this region.
 void setBehavior(int behaviorType, int behavior)
          Sets one of the behavior types for this region.
 void setBorder(Border border)
          Set the border for this region.
 void setFont(Font font)
          Specifies a font for this region.
 void setHorizontalAlignment(int horizontalAlignment)
          A convenience method to set the horizontal alignment for this region.
 void setMargin(XYEdges margin)
          Set the margin for this region.
 void setPadding(XYEdges padding)
          Set the padding for this region.
 void setVerticalAlignment(int verticalAlignment)
          A convenience method to set the vertical alignment for this region.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

BEHAVIOR_FONT

public static final int BEHAVIOR_FONT
A behavior type that describes how the region obtains its font. Under this category, the following behaviors are defined: RegionStyles.FONT_FOLLOW_SPECIFIED, RegionStyles.FONT_FOLLOW_THEME and RegionStyles.FONT_FOLLOW_USER.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

BEHAVIOR_HALIGN

public static final int BEHAVIOR_HALIGN
A behavior type that describes how the field in the region will be horizontally aligned. Under this category, the following behaviors are defined: RegionStyles.ALIGN_LEFT, RegionStyles.ALIGN_RIGHT and RegionStyles.ALIGN_CENTER.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

BEHAVIOR_VALIGN

public static final int BEHAVIOR_VALIGN
A behavior type that describes how the field in the region will be vertically aligned. Under this category, the following behaviors are defined: RegionStyles.ALIGN_TOP, RegionStyles.ALIGN_BOTTOM and RegionStyles.ALIGN_MIDDLE.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

BEHAVIOR_LAYOUT

public static final int BEHAVIOR_LAYOUT
A behavior type that describes the layout of the field that will be housed in this region. Under this category, the following behaviors are defined: LAYOUT_STATIC and LAYOUT_DYNAMIC.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

LAYOUT_STATIC

public static final int LAYOUT_STATIC
A layout behavior code indicating that the field will only need to be laid out once in the table. This is the default behavior, unless otherwise stated using RegionStyles.setBehavior(int,int).

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

LAYOUT_DYNAMIC

public static final int LAYOUT_DYNAMIC
A layout behavior code indicating that the field will need several re-layouts throughout its lifetime on screen. An example of this behavior is ChoiceField, where the shape of the choice box changes with each choice.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

ALIGN_LEFT

public static final int ALIGN_LEFT
A horizontal alignment behavior code indicating that the field in the region should be aligned to the left.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

ALIGN_RIGHT

public static final int ALIGN_RIGHT
A horizontal alignment behavior code indicating that the field in the region should be aligned to the right.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

ALIGN_CENTER

public static final int ALIGN_CENTER
A horizontal alignment behavior code indicating that the field in the region should be aligned to the center.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

ALIGN_TOP

public static final int ALIGN_TOP
A vertical alignment behavior code indicating that the field in the region should be aligned to the top.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

ALIGN_BOTTOM

public static final int ALIGN_BOTTOM
A vertical alignment behavior code indicating that the field in the region should be aligned to the bottom.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

ALIGN_MIDDLE

public static final int ALIGN_MIDDLE
A vertical alignment behavior code indicating that the field in the region should be aligned to the middle.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

FONT_FOLLOW_THEME

public static final int FONT_FOLLOW_THEME
A font behavior code indicating that the region's font should be specified by the current theme.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

FONT_FOLLOW_USER

public static final int FONT_FOLLOW_USER
A font behavior code indicating that the region's font should be specified by the current user-specified font.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

FONT_FOLLOW_SPECIFIED

public static final int FONT_FOLLOW_SPECIFIED
A font behavior code indicating that the region's font should be the one specified in the RegionStyles constructor or via the setFont() method.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0


Constructor Detail

RegionStyles

public RegionStyles(Border border,
                    Font font,
                    XYEdges margin,
                    XYEdges padding,
                    int horizontalAlignment,
                    int verticalAlignment)
Creates an instance of a RegionStyles object that will later correspond to a Data Template region.

Parameters:
border - A Border object that will describe a border around the region. Setting this to null will trigger the application of the cell border settings from the currently active theme.
font - The font that will be active in the region. Setting this to null will the trigger the application of the cell font settings from the currently active theme.
margin - The margin assignments for the region.
padding - The padding assignments for the region. Setting this to null will trigger the application of the cell padding settings from the currently active theme.
horizontalAlignment - The horizontal alignment for the region. Should be one of: RegionStyles.ALIGN_LEFT, RegionStyles.ALIGN_RIGHT, RegionStyles.ALIGN_CENTER The default horizontalAlignment is RegionStyles.ALIGN_LEFT
verticalAlignment - The vertical alignment for the region. Should be one of: RegionStyles.ALIGN_TOP, RegionStyles.ALIGN_BOTTOM, RegionStyles.ALIGN_MIDDLE The default verticalAlignment is RegionStyles.ALIGN_TOP
Since:
BlackBerry API 6.0.0


Method Detail

getBorder

public Border getBorder()
Get the border that has been applied to this region.

Returns:
the current border for the region
Since:
BlackBerry API 6.0.0

setBorder

public void setBorder(Border border)
Set the border for this region.

Parameters:
border - the new border for this region
Since:
BlackBerry API 6.0.0

getFont

public Font getFont()
Get the font that has been applied to this region.

Returns:
the current font for the region.
Since:
BlackBerry API 6.0.0

setFont

public void setFont(Font font)
Specifies a font for this region. This automatically changes the font behavior to RegionStyles.FONT_FOLLOW_SPECIFIED

Parameters:
font - the new font for this region
Since:
BlackBerry API 6.0.0

setBehavior

public void setBehavior(int behaviorType,
                        int behavior)
Sets one of the behavior types for this region.

Parameters:
behaviorType - An integer specifying the type of behavior being modified.
behavior - An integer specifying the desired behavior code under the specified behavior type. Note that currently there are three behavior types defined:RegionStyles.BEHAVIOR_FONT, BEHAVIOR_VALIGN, BEHAVIOR_HALIGN. Under the RegionStyles.BEHAVIOR_FONT category, the following behaviors are defined: RegionStyles.FONT_FOLLOW_SPECIFIED, RegionStyles.FONT_FOLLOW_THEME and RegionStyles.FONT_FOLLOW_USER. Under the RegionStyles.BEHAVIOR_VALIGN category, the following behaviors are defined: RegionStyles.ALIGN_TOP, RegionStyles.ALIGN_BOTTOM, RegionStyles.ALIGN_MIDDLE. Under the RegionStyles.BEHAVIOR_HALIGN category, the following behaviors are defined: RegionStyles.ALIGN_LEFT, RegionStyles.ALIGN_RIGHT, RegionStyles.ALIGN_CENTER. If an invalid behavior type is defined, no action will be performed. If an invalid behavior is defined, an IllegalArgumentException will be thrown
Since:
BlackBerry API 7.0.0

getBehavior

public int getBehavior(int behaviorType)
Gets the current setting of a particular behavior type for this region.

Parameters:
behaviorType - An integer describing the type of behavior being modified.
Returns:
An integer describing the current behavior of the specified behavior type. Note that currently there is only one behavior type known as RegionStyles.BEHAVIOR_FONT. Under the RegionStyles.BEHAVIOR_FONT category, the following behaviors are defined: RegionStyles.FONT_FOLLOW_SPECIFIED, RegionStyles.FONT_FOLLOW_THEME and RegionStyles.FONT_FOLLOW_USER. If an invalid type is detected, a value of -1 will be returned.
Since:
BlackBerry API 7.0.0

getHorizontalAlignment

public int getHorizontalAlignment()
A convenience method to get the horizontal alignment that has been applied to this region. RegionStyles.getBehavior(int behaviorType)

Returns:
the current horizontal alignment for the region
Since:
BlackBerry API 6.0.0

setHorizontalAlignment

public void setHorizontalAlignment(int horizontalAlignment)
A convenience method to set the horizontal alignment for this region. RegionStyles.setBehavior(int behaviorType, int behavior)

Parameters:
horizontalAlignment - the new horizontal alignment for this region
Throws:
IllegalArgumentException - if Horizontal Alignment is not one of the following: RegionStyles.ALIGN_LEFT, RegionStyles.ALIGN_RIGHT, RegionStyles.ALIGN_CENTER
Since:
BlackBerry API 6.0.0

getVerticalAlignment

public int getVerticalAlignment()
A convenience method to get the vertical alignment that has been applied to this region. RegionStyles.getBehavior(int behaviorType)

Returns:
the current vertical alignment for the region
Since:
BlackBerry API 6.0.0

setVerticalAlignment

public void setVerticalAlignment(int verticalAlignment)
A convenience method to set the vertical alignment for this region. RegionStyles.setBehavior(int behaviorType, int behavior)

Parameters:
verticalAlignment - the new vertical alignment for this region
Throws:
IllegalArgumentException - if Horizontal Alignment is not one of the following: RegionStyles.ALIGN_TOP, RegionStyles.ALIGN_BOTTOM, RegionStyles.ALIGN_MIDDLE
Since:
BlackBerry API 6.0.0

getPadding

public XYEdges getPadding()
Get the padding that has been applied to this region.

Returns:
the current padding for the region
Since:
BlackBerry API 6.0.0

setPadding

public void setPadding(XYEdges padding)
Set the padding for this region.

Parameters:
padding - the new padding for this region
Since:
BlackBerry API 6.0.0

getMargin

public XYEdges getMargin()
Get the margin that has been applied to this region.

Returns:
the current margin for the region
Since:
BlackBerry API 6.0.0

setMargin

public void setMargin(XYEdges margin)
Set the margin for this region.

Parameters:
margin - the new margin for this region
Since:
BlackBerry API 6.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal