|
|||||||||
| 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.component.pane.TitleView
net.rim.device.api.ui.component.pane.HorizontalScrollableTitleView
public class HorizontalScrollableTitleView
An extension of TitleView that presents the titles
of Pane objects that are contained within the associated
PaneManagerModel.
This class presents the titles as a horizontal scrollable bar.
Three titles are presented at a time. The one representing the
currently selected pane will be centered. The preceeding title, and
the following title are partially presented at the sides of the
view. These placements are the default positions from which
HorizontalScrollableTitleView.drag(int, int, int, int, int) offsets.
This class is designed for use with HorizontalScrollableController.
| 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 | ||
|---|---|---|
HorizontalScrollableTitleView(long style)
Constructor that accepts a long of style bit flags and sets the Field.FOCUSABLE style bit. |
||
| Method Summary | ||
|---|---|---|
boolean |
areArrowsEnabled()
Indicates if rendering of arrows is currently enabled. |
|
void |
drag(int dx,
int dy,
int index,
int leftIndex,
int rightIndex)
Offsets the positions of the current titles within its pushed region. |
|
protected void |
drawFocus(Graphics graphics,
boolean on)
Draws the focus indicator for this field. |
|
void |
enableArrows(boolean enable)
Enables or disables the use of Bitmap images as arrows
to represent that there are more titles that can be scrolled to. |
|
int |
getFieldAtLocation(int x,
int y)
Returns -1 as an index to avoid treating its contained fields as fields. |
|
Field |
getLeafFieldWithFocus()
Returns itself as the leaf field with focus in order to ensure proper focus highlighting |
|
int |
getNumberOfDisplayedPanes()
Returns the number of panes that currently have titles displayed. |
|
XYRect |
getRegionExtent(int index)
Provides the region of the Field that represents the
touch region of a title within the currently pushed region. |
|
boolean |
isAnimating()
Indicates if the view is currently animating the transition between panes. |
|
void |
jumpBackwards(boolean animate,
int duration)
Similar to HorizontalScrollableTitleView.jumpTo(int, int, int, boolean, int, int) except
only causes a transition from the currently selected title to the
one that preceeds it in the model. |
|
void |
jumpForwards(boolean animate,
int duration)
Similar to HorizontalScrollableTitleView.jumpTo(int, int, int, boolean, int, int) except
only causes a transition from the currently selected title to the
one that follows it in the model. |
|
void |
jumpTo(int index,
int leftIndex,
int rightIndex,
boolean animate,
int direction,
int duration)
Causes the view to move from the currently selected pane to the pane at the specified index. |
|
protected void |
moveFocus(int x,
int y,
int status,
int time)
Invoked when an attempt is made to place focus within the HorizontalScrollableTitleView Overridden: Focus highlight should remain on the view and not on contained fields. |
|
protected int |
nextFocus(int direction,
int axis)
Returns the index of the next field that should be given focus. |
|
protected void |
onFocus(int direction)
Invoked by the framework when focus is gained. |
|
protected void |
onUnfocus()
Invoked by the framework when focus is lost. |
|
protected void |
paint(Graphics graphics)
Paints this manager's visible region. |
|
void |
setModel(PaneManagerModel model)
Associates a PaneManagerModel to this view. |
|
void |
snapToCurrent(boolean animate,
int duration,
int direction)
Causes this view to move the currently selected pane back to its default layout position. |
|
protected void |
sublayout(int width,
int height)
Implements custom layout features for this manager. |
|
protected void |
subpaint(Graphics graphics)
Implements custom paint features for this manager. |
|
| Methods inherited from class net.rim.device.api.ui.component.pane.TitleView |
|---|
getLeftArrow, getModel, getRightArrow, setLeftArrow, setRightArrow |
| Methods inherited from class net.rim.device.api.ui.ScrollView |
|---|
configurationChanged, getHorizontalAdjustment, getVerticalAdjustment, getVisibleHeight, getVisibleWidth, onDisplay, onExposed, 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 |
| Constructor Detail |
|---|
public HorizontalScrollableTitleView(long style)
Constructor that accepts a long of style bit flags and sets the Field.FOCUSABLE style bit.
style - the style bit flags to use for this Manager.| Method Detail |
|---|
public boolean areArrowsEnabled()
Indicates if rendering of arrows is currently enabled. When enabled, arrows will render instead of partially displayed titles at the edges of the view.
public void drag(int dx,
int dy,
int index,
int leftIndex,
int rightIndex)
Offsets the positions of the current titles within its pushed region.
This view only allows for the horizontal movement of the titles, so
the dy parameter is ignored.
drag in class TitleViewdx - the horizontal offset from the default position in pixels.dy - the vertical offset from the default position in pixels - ingored in this class.index - the index of the pane that is to be offset.leftIndex - the index of the pane that is to appear to the left
of the pane specified by the parameter index.rightIndex - the index of the pane that is to appear to the right
of the pane specified by the parameter index.
protected void drawFocus(Graphics graphics,
boolean on)
A field's manager invokes this method after painting the field. The
manager initializes the graphics object specified for drawing with
field-local coordinates. It assumes that the region is already drawn
correctly for the opposing state to that indicated by the on parameter.
When overriding this method, fields should use Field.drawHighlightRegion(net.rim.device.api.ui.Graphics, int, boolean, int, int, int, int)
to render focus and select regions instead of hardcoding the logic.
By default this method invokes Field.drawHighlightRegion(net.rim.device.api.ui.Graphics, int, boolean, int, int, int, int) to render
the focus indicator using the rect obtained from Manager.getFocusRect(net.rim.device.api.ui.XYRect).
drawFocus in class Fieldgraphics - Graphics context for drawing the focus.on - True if the focus should be set; otherwise, false.public void enableArrows(boolean enable)
Enables or disables the use of Bitmap images as arrows
to represent that there are more titles that can be scrolled to.
These can be accessed and provided by:
TitleView.getLeftArrow(), TitleView.getRightArrow(),
TitleView.setLeftArrow(Bitmap), TitleView.setRightArrow(Bitmap).
When enabled arrows will be rendered at the edges instead of the titles of
the preceeding and following panes.
enable - true to enable the usage of arrows,
false to disable the rendering of arrowspublic Field getLeafFieldWithFocus()
getLeafFieldWithFocus in class ManagerManager.getFieldWithFocus()public int getNumberOfDisplayedPanes()
Returns the number of panes that currently have titles displayed. May not reflect the number of panes rendered during an animated transition between panes.
getNumberOfDisplayedPanes in class TitleViewpublic XYRect getRegionExtent(int index)
Provides the region of the Field that represents the
touch region of a title within the currently pushed region.
You specify the index of the title.
If the index does not match one of the titles currently
being displayed then the method returns an empty XYRect.
The regions map to the touch regions and may not match the rendering
extents of the Field objects of the titles.
getRegionExtent in class TitleViewindex - the title whose region is to be retrieved.
XYRect of the title at the provided index
or an empty XYRect if the index does not match that of a title
that is currently visible.public boolean isAnimating()
Indicates if the view is currently animating the transition between panes.
isAnimating in class TitleView
public void jumpBackwards(boolean animate,
int duration)
Similar to HorizontalScrollableTitleView.jumpTo(int, int, int, boolean, int, int) except
only causes a transition from the currently selected title to the
one that preceeds it in the model.
jumpBackwards in class TitleViewanimate - true to animate the transition
false to just change the positions of the titles.duration - the amount of time to animate the transition, in milliseconds
public void jumpForwards(boolean animate,
int duration)
Similar to HorizontalScrollableTitleView.jumpTo(int, int, int, boolean, int, int) except
only causes a transition from the currently selected title to the
one that follows it in the model.
jumpForwards in class TitleViewanimate - true to animate the transition
false to just change the positions of the titles.duration - the amount of time to animate the transition, in milliseconds
public void jumpTo(int index,
int leftIndex,
int rightIndex,
boolean animate,
int direction,
int duration)
Causes the view to move from the currently selected pane to
the pane at the specified index. The direction controls the
animation of the change from the currently selected pane to the new pane.
jumpTo in class TitleViewindex - the index of the pane to become the currently selected pane.leftIndex - index of the content Field to render to the left the one we are transitioning to.rightIndex - index of the content Field to render to the right of the one we are transitioning to.animate - true to animate this change, false to just render the new content pane in the final position.direction - the control value for the animation to take place PaneManagerView.DIRECTION_BACKWARDS,
PaneManagerView.DIRECTION_FORWARDSduration - the amount of time to animate the transition, in milliseconds
public int getFieldAtLocation(int x,
int y)
getFieldAtLocation in class Managerx - The distance from the left edge of the manager's extent.y - The distance from the top edge of the manager's extent.
protected void moveFocus(int x,
int y,
int status,
int time)
moveFocus in class Managerx - The distance from the left edge of the virtual region.y - The distance from the top edge of the virtual region.status - Trackwheel event modifiers.time - The number of milliseconds since the device was turned on.
protected int nextFocus(int direction,
int axis)
This method is called by the framework during a trackball 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.
nextFocus in class Managerdirection - Direction the focus is moving within the field.axis - The axis of movement.
protected void onFocus(int direction)
onFocus in class Managerdirection - (ignored in order to force proper focus display for the whole bar)protected void onUnfocus()
onUnfocus in class Managerprotected void paint(Graphics graphics)
Invoke this method to prompt this manager to paint itself. If you
extend the manager to create a custom layout manager, you may want to
implement the HorizontalScrollableTitleView.subpaint(net.rim.device.api.ui.Graphics) method, as this method invokes it.
This method also draws the focus indicator as required.
paint in class Managergraphics - Graphics object used for painting.public void setModel(PaneManagerModel model)
Associates a PaneManagerModel to this view.
setModel in class TitleViewmodel - the PaneManagerModel to associate to this view.
public void snapToCurrent(boolean animate,
int duration,
int direction)
Causes this view to move the currently selected pane back to its
default layout position. This undoes any offsets applied by calling
HorizontalScrollableTitleView.drag(int, int, int, int, int).
The titles will also be reset to the default position corresponding to the currently selected pane.
This transition will be animated based on the provided direction.
If the view has been offset by calling HorizontalScrollableTitleView.drag(int, int, int, int, int) then calling this
method will result in a visual effect of the pane having performed a slight bounce.
snapToCurrent in class TitleViewanimate - true to animate the transition
false to just change the positions of the titles.duration - the amount of time to animate the transition, in millisecondsdirection - the animation control for which direction the panes should move
with respect to the model: PaneManagerView.DIRECTION_BACKWARDS,
PaneManagerView.DIRECTION_FORWARDS.
protected void sublayout(int width,
int height)
To implement a manager with custom layout features, extend the Manager class and implement this method.
Invoking the sublayout method prompts your manager subclass to lay out controlled fields appropriately.
Manager.layout(int, int) invokes this method to perform custom layout handling.
A manager MUST call setPositionChild for each child during sublayout. Note that setExtent must also be called,
but it is the field's responsibility to do this in layout.
sublayout in class Managerwidth - Width available for this manager.height - Height available for this manager.protected void subpaint(Graphics graphics)
Manager.paintChild(net.rim.device.api.ui.Graphics, net.rim.device.api.ui.Field).
By default, this method paints all child fields, without regard to the clipping region.
If implementing a custom manager that has requirements for special
paint handling, you can override this method for optimization:
HorizontalScrollableTitleView.paint(net.rim.device.api.ui.Graphics) invokes this method to perform custom paint functions.
subpaint in class Managergraphics - Graphics object used for painting.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
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