|
|||||||||
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.Manager
net.rim.device.api.ui.container.FlowFieldManager
public class FlowFieldManager
Manager that lays out fields in a horizontal-then-vertical flow.
Behaviour
When laying out, this manager first tries to lay out a field along the
current horizontal row. If there's not enough horizontal space, it places the
field on the next row of fields.
If you build this manager with the style Manager.VERTICAL_SCROLL
, then it
will have an infinite number of rows into which it can layout fields.
Field Summary |
---|
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 | ||
---|---|---|
FlowFieldManager()
Constructs a flow field manager. |
||
FlowFieldManager(long style)
Constructs a flow field manager of provided style. |
Method Summary | ||
---|---|---|
int |
getFieldAtLocation(int x,
int y)
Retrieves field under a particular point. |
|
int |
getPreferredHeight()
Retrieves this manager's preferred height. |
|
int |
getPreferredWidth()
Retrieves this manager's preferred width. |
|
protected boolean |
keyControl(char c,
int status,
int time)
Sends key-generation event to the controlled field with focus. |
|
protected boolean |
navigationMovement(int dx,
int dy,
int status,
int time)
Invoked when a navigational motion occurs. |
|
int |
nextFocus(int direction,
boolean alt)
Returns the index of the next controlled field that should be given the focus. |
|
protected void |
sublayout(int width,
int height)
Lays out this manager's controlled fields. |
|
protected void |
subpaint(Graphics graphics)
Redraws this manager's controlled fields. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FlowFieldManager()
This method builds a default flow field manager, with the styles
Field.USE_ALL_WIDTH
and
Manager.VERTICAL_SCROLL
.
public FlowFieldManager(long style)
Use this method to build a flow field manager with your provided style(s). Note that, unlike the default constructor, this method uses only the style(s) you specify. Specifying a style of zero will ensure that not all the available width will be used for layout.
style
- Style(s) for this manager (can be Field.USE_ALL_WIDTH
,
Manager.VERTICAL_SCROLL
, and/or Manager.HORIZONTAL_SCROLL
.Method Detail |
---|
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.
By default, this method performs a linear search, testing each controlled field in turn. If you extend this manager, you can override this method to optimize its functionality.
getFieldAtLocation
in class Manager
x
- Distance from left edge of this manager's extent.y
- Distance from top edge of this manager's extent.
public int getPreferredHeight()
This method queries each controlled field for its preferred height, returning the sum of all these heights.
This method is likely to return a value that's much larger than actually required, since it's accurate only for the degenerate case where each controlled field is laid out on its own row.
getPreferredHeight
in class Field
public int getPreferredWidth()
This method queries each controlled field for its preferred width, returning the greatest of these widths.
This method is likely to return a value that's smaller than actually required, since it's accurate only for the degenerate case where each controlled field is laid out on its own row.
getPreferredWidth
in class Field
protected boolean keyControl(char c, int status, int time)
This method maps Characters.CONTROL_UP
,
Characters.CONTROL_DOWN
, Characters.CONTROL_LEFT
and
Characters.CONTROL_RIGHT
keys to horizontal trackwheel rolls, and
otherwise passes on key-generation events to the parent class.
keyControl
in class Manager
c
- Character generated.status
- Modifier key status.time
- Number of milliseconds since the device was turned on.
protected boolean navigationMovement(int dx, int dy, int status, int time)
Manager
The source of the navigation event can be determined by checking the
KeypadListener.STATUS_TRACKWHEEL
and KeypadListener.STATUS_FOUR_WAY
bits in the status
parameter; exactly one of them will be set.
navigationMovement
in class Manager
dx
- Magnitude of navigational motion: negative for a move left
and postive for a move right.dy
- Magnitude of navigational motion: negative for an upwards
move, and positive for a downwards move.status
- Bitfield of values defined by KeypadListener
.time
- Number of milliseconds since the device was turned on.
public int nextFocus(int direction, boolean alt)
The framework invokes this method during a trackwheel focus move operation.
The direction parameter indicates the direction in which the focus is moving:
However, if the alt paramater is true (the trackwheel is being ALT-rolled), then the focus is moved vertically, not horizontally.
nextFocus
in class Manager
direction
- Direction in which the focus is moving within this
manager.alt
- True if the trackwheel is being ALT-rolled.
protected void sublayout(int width, int height)
The framework invokes this method to direct this manager to lay out its controlled fields. If the FlowFieldManager was created with a style of zero, it will be checked for here to ensure that not all the available width is used for layout
sublayout
in class Manager
width
- Horizontal space available for this manager.height
- 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.
|
|||||||||
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.