net.rim.device.api.ui.decor
Class BorderFactory

java.lang.Object
  |
  +--net.rim.device.api.ui.decor.BorderFactory

public final class BorderFactory
extends Object

A factory class for creating different types of borders. See Border for more details.

In this class, padding refers to the number of pixels from the bitmapís edge to be treated as the border and corner refers to the width and height from the bitmapís edge to be treated as the corners (refer to the image below). If you only specify padding and do not specify any value for corners, then by default it equals to padding ( corners = = padding ).

Image explaining border and padding



Since:
JDE 4.6.0

Method Summary
static Border createBevelBorder(XYEdges edges)
          Create a bevel (3D) border.
static Border createBevelBorder(XYEdges edges, XYEdges colorsOuter, XYEdges colorsInner)
          Create a simple border with specified style.
static Border createBitmapBorder(XYEdges padding, Bitmap bitmap)
          Create a bitmap border with specified outer padding/spacing.
static Border createBitmapBorder(XYEdges padding, XYEdges corners, Bitmap bitmap)
          Create a bitmap border with specified outer padding/spacing.
static Border createRoundedBorder(XYEdges padding)
          Create a single-line rounded border.
static Border createRoundedBorder(XYEdges padding, int style)
          Create a single-line rounded border with specified style.
static Border createRoundedBorder(XYEdges padding, int color, int style)
          Create a single-line rounded border with specified color and style.
static Border createSimpleBorder(XYEdges edges)
          Create a simple single-line solid border.
static Border createSimpleBorder(XYEdges edges, int style)
          Create a simple border with specified style.
static Border createSimpleBorder(XYEdges edges, XYEdges colors, int style)
          Create a simple border with specified colors and style.
static Border createSimpleBorder(XYEdges edges, XYEdges colors, XYEdges style)
          Create a simple border with specified colors and styles.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createBevelBorder

public static Border createBevelBorder(XYEdges edges)
Create a bevel (3D) border. By default, the inner and outer border colors consist of Color.LIGHTGREY and Color.DARKGRAY.
Parameters:
edges - XYEdges object representing the width/thickness of the border's bevel in pixels: top, right, bottom, left edges.
Throws:
IllegalArgumentException - If edges is null.
Since:
JDE 4.6.0

createBevelBorder

public static Border createBevelBorder(XYEdges edges,
                                       XYEdges colorsOuter,
                                       XYEdges colorsInner)
Create a simple border with specified style.
Parameters:
edges - XYEdges object representing the width/thickness of the border's bevel in pixels: top, right, bottom, left edges.
colorsOuter - XYEdges object representing the colors of the bevel's outer edge.
colorsInner - XYEdges object representing the colors of the bevel's inner edge.
Throws:
IllegalArgumentException - If edges is null.
Since:
JDE 4.6.0

createBitmapBorder

public static Border createBitmapBorder(XYEdges padding,
                                        Bitmap bitmap)
Create a bitmap border with specified outer padding/spacing.
Parameters:
padding - XYEdges object representing the padding/spacing from the bitmap's edge in pixels, i.e. top-left corner of bitmap at (edges.left, edges.top).
bitmap - Reference to bitmap for the border.
Throws:
IllegalArgumentException - If either of the parameters, padding or bitmap , is null; if the total value of the left and right padding is greater than the width of the bitmap; if the total value of the top and bottom padding is greater than the height of the bitmap. In other words, this exception is thrown for any of the following conditions:
  • padding = = null
  • bitmap = = null
  • padding.right + padding.left > bitmap.getWidth()
  • padding.top + padding.bottom > bitmap.getHeight()
Since:
JDE 4.6.0

createBitmapBorder

public static Border createBitmapBorder(XYEdges padding,
                                        XYEdges corners,
                                        Bitmap bitmap)
Create a bitmap border with specified outer padding/spacing.
Parameters:
padding - XYEdges object representing the padding/spacing from the bitmap's edge in pixels, i.e. top-left corner of bitmap at (edges.left, edges.top).
corners - XYEdgse boject representing the width (corners.left, corners.right) and height (corners.top, corners.bottom) of the corner bitmaps.
bitmap - Reference to bitmap for the border.
Throws:
IllegalArgumentException - If any of the parameters: padding , corners , or bitmap , is null; if the total value of the left and right padding is greater than the width of the bitmap; if the total value of the top and bottom padding is greater than the height of the bitmap; if the dimensions for the corner is less than padding. In other words, this exception is thrown for any of the following conditions:
  • padding = = null
  • corners = = null
  • bitmap = = null
  • (corners.top < padding.top) || (corners.right < padding.right) || (corners.bottom < padding.bottom) || (corners.left < padding.left)
  • padding.right + padding.left > bitmap.getWidth()
  • padding.top + padding.bottom > bitmap.getHeight()
Since:
JDE 4.6.0

createRoundedBorder

public static Border createRoundedBorder(XYEdges padding)
Create a single-line rounded border.
Parameters:
padding - XYEdges object representing the width/thickness of the border's background, i.e. padding/spacing from the border's edge.
Returns:
Border object representing a rounded border.
Throws:
IllegalArgumentException - If padding is null.
Since:
JDE 4.6.0

createRoundedBorder

public static Border createRoundedBorder(XYEdges padding,
                                         int style)
Create a single-line rounded border with specified style.
Parameters:
padding - XYEdges object representing the width/thickness of the border's background, i.e. padding/spacing from the border's edge.
style - STYLE_TRANSPARENT, STYLE_SOLID, SYLE_DOTTED, STYLE_DASHED.
Returns:
Border object representing a rounded border.
Throws:
IllegalArgumentException - If padding is null.
Since:
JDE 4.6.0

createRoundedBorder

public static Border createRoundedBorder(XYEdges padding,
                                         int color,
                                         int style)
Create a single-line rounded border with specified color and style.
Parameters:
padding - XYEdges object representing the width/thickness of the border's background, i.e. padding/spacing from the border's edge.
color - 32-bit RGB color in 0xAARRGGBB format (includes alpha channel).
style - STYLE_TRANSPARENT, STYLE_SOLID, SYLE_DOTTED, STYLE_DASHED.
Returns:
Border object representing a rounded border.
Throws:
IllegalArgumentException - If padding is null.
Since:
JDE 4.6.0

createSimpleBorder

public static Border createSimpleBorder(XYEdges edges)
Create a simple single-line solid border.
Parameters:
edges - XYEdges object representing the width/thickness of the border's four sides in pixels.
Returns:
Border object representing a simple single-line solid border.
Throws:
IllegalArgumentException - If edges is null.
Since:
JDE 4.6.0

createSimpleBorder

public static Border createSimpleBorder(XYEdges edges,
                                        int style)
Create a simple border with specified style.
Parameters:
edges - XYEdges object representing the width/thickness of the border's four sides in pixels.
style - STYLE_TRANSPARENT, STYLE_SOLID, SYLE_DOTTED, STYLE_DASHED.
Returns:
Border object representing a simple border.
Throws:
IllegalArgumentException - If edges is null.
Since:
JDE 4.6.0

createSimpleBorder

public static Border createSimpleBorder(XYEdges edges,
                                        XYEdges colors,
                                        int style)
Create a simple border with specified colors and style.
Parameters:
edges - XYEdges object representing the width/thickness of the border's four sides in pixels.
colors - XYEdges object representing the colors of the border's four sides in 0xAARRGGBB format (includes alpha channel).
style - STYLE_TRANSPARENT, STYLE_SOLID, SYLE_DOTTED, STYLE_DASHED.
Returns:
Border object representing a simple border.
Throws:
IllegalArgumentException - If edges is null.
Since:
JDE 4.6.0

createSimpleBorder

public static Border createSimpleBorder(XYEdges edges,
                                        XYEdges colors,
                                        XYEdges style)
Create a simple border with specified colors and styles.
Parameters:
edges - XYEdges object representing the width/thickness of the border's four sides in pixels.
colors - XYEdges object representing the colors of the border's four sides in 0xAARRGGBB format (includes alpha channel).
styles - XYEdges object representing the styles of the border's four sides: STYLE_TRANSPARENT, STYLE_SOLID, SYLE_DOTTED, STYLE_DASHED.
Returns:
Border object representing a simple border.
Throws:
IllegalArgumentException - If padding is null.
Since:
JDE 4.6.0



Copyright 1999-2009 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.