|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.ui.Field
net.rim.device.api.ui.ScrollView
net.rim.device.api.ui.Manager
net.rim.device.api.ui.container.HorizontalFieldManager
public class HorizontalFieldManager
A manager that lays out fields along a single, horizontal row.
Behaviour
A horizontal field manager lays out fields from left to right on a single row.
The layout direction can be changed to locale-aware leading to trailing
by specifying the HorizontalFieldManager.LOCALE_AWARE_LAYOUT
style bit in the constructor.
The layout direction can also be controlled by setting the style of the
HorizontalFieldManager to include Field.RIGHT_TO_LEFT
or
Field.LEFT_TO_RIGHT
in the constructor. This will override any locale
aware settings.
You can build this manager with Manager.HORIZONTAL_SCROLL
to accommodate
collections of fields wider than the manager's visible frame; you can build
this manager with Manager.VERTICAL_SCROLL
to accommodate fields taller than
the manager's visible frame.
Field Summary | ||
---|---|---|
static int |
LOCALE_AWARE_LAYOUT
Used to specify locale aware layout. |
Fields inherited from class net.rim.device.api.ui.Manager |
---|
BOTTOMMOST, DOWNWARD, HORIZONTAL_SCROLL, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_MASK, HORIZONTAL_SCROLL_MASK, LEAVE_BLANK_SPACE, LEFTMOST, LEFTWARD, NO_HORIZONTAL_SCROLL, NO_HORIZONTAL_SCROLLBAR, NO_SCROLL_RESET, NO_VERTICAL_SCROLL, NO_VERTICAL_SCROLLBAR, QUANTA_FONT, RIGHTMOST, RIGHTWARD, TOPMOST, UPWARD, VERTICAL_SCROLL, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_MASK, VERTICAL_SCROLL_MASK |
Constructor Summary | ||
---|---|---|
HorizontalFieldManager()
Constructs a new horizontal field manager. |
||
HorizontalFieldManager(long style)
Constructs a new horizontal field manager with provided style(s). |
Method Summary | ||
---|---|---|
int |
getFieldAtLocation(int x,
int y)
Retrieves field under a particular point. |
|
int |
getPreferredHeight()
Retrieves the manager's preferred height (in pixels). |
|
int |
getPreferredWidth()
Retrieves the manager's preferred width (in pixels). |
|
protected int |
nextFocus(int direction,
int axis)
Retrieves the index of the next field that should be given focus. |
|
protected void |
sublayout(int maxWidth,
int maxHeight)
Lays out this manager's controlled fields. |
|
protected void |
subpaint(Graphics graphics)
Redraws this manager's controlled fields. |
Methods inherited from class net.rim.device.api.ui.ScrollView |
---|
configurationChanged, getHorizontalAdjustment, getVerticalAdjustment, getVisibleHeight, getVisibleWidth, onDisplay, onUndisplay, setCurrentLocation, setExtent, setHorizontalAdjustment, setHorizontalScroll, setHorizontalScroll, setScrollListener, setVerticalAdjustment, setVerticalScroll, setVerticalScroll, valueChanged, waitForScrolling |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int LOCALE_AWARE_LAYOUT
Constructor Detail |
---|
public HorizontalFieldManager()
This method builds a new horizontal field manager with no style.
public HorizontalFieldManager(long style)
style
- Styles recognized by this manager include Manager.HORIZONTAL_SCROLL
,
Manager.VERTICAL_SCROLL
Field.LEFT_TO_RIGHT
and Field.RIGHT_TO_LEFT
.Method Detail |
---|
public int getPreferredWidth()
This method returns the width (in pixels) required to lay out the manager’s contents. It includes the preferred widths for the controlled fields, as well as spacing between these fields. Spacing between neighboring fields is defined by the largest of each field’s margins.
getPreferredWidth
in class Field
public int getPreferredHeight()
This method returns the height (in pixels) required to lay out the manager’s contents. The contents height is defined by the highest of controlled fields and its margins.
getPreferredHeight
in class Field
protected int nextFocus(int direction, int axis)
This method is called by the framework during a track-ball focus move operation.
The direction parameter indicates the direction in which the focus is moving: a value of 1 indicates that the focus is moving forward (generally down and to the right), while a value of -1 indicates that the focus is moving backwards (generally up and to the left).
The axis parameter indicates which axis of movement the direction is in.
This can be one of Field.AXIS_SEQUENTIAL
, Field.AXIS_HORIZONTAL
or Field.AXIS_VERTICAL
.
HorizontalFieldManager will move focus out of the manager in the event of AXIS_VERTICAL movement.
nextFocus
in class Manager
direction
- Direction the focus is moving within the field.axis
- The axis of movement.
IllegalArgumentException
- If direction parameter is a value other than 1 or -1.protected void sublayout(int maxWidth, int maxHeight)
The framework invokes this method to direct this manager to lay out its controlled fields.
sublayout
in class Manager
maxWidth
- Horizontal space available for this manager.maxHeight
- Vertical space available for this manager.protected void subpaint(Graphics graphics)
The framework invokes this method to direct this manager to repaint its controlled fields. This method examines the clipping rectangle contained in the graphics context parameter to determine which controlled fields are in the invalid region (require repainting), in order to prevent unnecessary redraws.
subpaint
in class Manager
graphics
- Graphics context used for the redraw operation.public int getFieldAtLocation(int x, int y)
Given a point in coordinates local to this manager's extent, this method returns the index of the controlled field under that point.
If no field exists under the point you specify, this method returns -1.
If you provide a coordinate outside this manager's extent, this method uses values along the edges of the extent as required.
HorizontalFieldManager performs a binary search for the x coordinate passed in. No checks are made for the vertical value.
getFieldAtLocation
in class Manager
x
- Distance from left edge of this manager's extent.y
- Distance from top edge of this manager's extent.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2010 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. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.