net.rim.device.api.ui.component.progressindicator
Class ActivityImageField

java.lang.Object
  extended by net.rim.device.api.ui.Field
      extended by net.rim.device.api.ui.component.progressindicator.ActivityImageField
All Implemented Interfaces:
Animatable

public class ActivityImageField
extends Field
implements Animatable

This field loops an animation that represents the progress of a task.

The animation is represented by a bitmap. The bitmap should contain all frames of the animation laid out horizontally with each frame having the same width. The total width of the bitmap should be the width of one frame times the number of frames.

Since:
BlackBerry API 6.0.0

Field Summary
 
Fields inherited from class net.rim.device.api.ui.Field
ACTION_INVOKE, AXIS_HORIZONTAL, AXIS_SEQUENTIAL, AXIS_VERTICAL, EDITABLE, EDITABLE_MASK, FIELD_BOTTOM, FIELD_HALIGN_MASK, FIELD_HCENTER, FIELD_LEADING, FIELD_LEFT, FIELD_RIGHT, FIELD_TOP, FIELD_TRAILING, FIELD_VALIGN_MASK, FIELD_VCENTER, FOCUSABLE, FOCUSABLE_MASK, HIGHLIGHT_FOCUS, HIGHLIGHT_SELECT, NON_FOCUSABLE, NON_SPELLCHECKABLE, READONLY, SPELLCHECKABLE, SPELLCHECKABLE_MASK, STATUS_MOVE_FOCUS_HORIZONTALLY, STATUS_MOVE_FOCUS_VERTICALLY, USE_ALL_HEIGHT, USE_ALL_WIDTH, VISUAL_STATE_ACTIVE, VISUAL_STATE_DISABLED, VISUAL_STATE_DISABLED_FOCUS, VISUAL_STATE_FOCUS, VISUAL_STATE_NORMAL
 
Constructor Summary
ActivityImageField(Bitmap bitmap, int numFrames, long style)
          Constructs a new ActivityImageField, initializing all aspects of the animation.
ActivityImageField(Bitmap bitmap, int numFrames, long style, boolean loop)
          Constructs a new ActivityImageField, initializing all aspects of the animation.
ActivityImageField(Bitmap bitmap, int numFrames, long style, boolean loop, int targetFramesPerSecond)
          Constructs a new ActivityImageField, initializing all aspects of the animation.
ActivityImageField(Bitmap bitmap, int numFrames, long style, boolean loop, int duration, int targetFramesPerSecond)
          Constructs a new ActivityImageField, initializing all aspects of the animation.
ActivityImageField(Bitmap bitmap, int numFrames, long style, int duration)
          Constructs a new ActivityImageField, initializing all aspects of the animation.
 
Method Summary
 int getAnimationPropertyComponentCount(int property)
          Gets the number of components that comprise the given property.
 void getAnimationValue(int property, AnimationValue value)
          Gets the current value(s) for the given property.
 int getCurrentFrame()
          Returns the index of the frame that is currently being animated.
 int getNumberOfFrames()
          Returns the number of frames of the animation contained within the bitmap.
 boolean isAnimating()
          Returns whether or not the frame is currently animating.
protected  void layout(int width, int height)
          Lays out contents of this field.
protected  void onDisplay()
          Invoked when the screen this field is on is pushed onto the display stack.
protected  void onUndisplay()
          Invoked when the screen this field is on is popped off the display stack.
protected  void paint(Graphics g)
          Paints the contents of the field.
 void setAnimate(boolean animate)
          Turns the animation of this field on or off.
 void setAnimationValue(int property, AnimationValue value)
          Sets the current value(s) for the given property.
 void setCurrentFrameIndex(int index)
          Changes the index of the current frame.
 
Methods inherited from class net.rim.device.api.ui.Field
drawFocus, drawHighlightRegion, fieldChangeNotify, focusAdd, focusRemove, getAccessibleContext, getBackground, getBackground, getBorder, getBorder, getBorder, getChangeListener, getCommandItemProvider, getContentHeight, getContentLeft, getContentRect, getContentRect, getContentTop, getContentWidth, getContextMenu, getCookie, getExtent, getExtent, getFieldStyle, getFocusListener, getFocusRect, getFont, getHeight, getIndex, getLeafFieldWithFocus, getLeft, getManager, getMargin, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getOriginal, getPadding, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getPreferredHeight, getPreferredWidth, getScreen, getStyle, getTop, getVisualState, getWidth, invalidate, invalidate, invalidateAll, invokeAction, isDataValid, isDirty, isEditable, isEnabled, isFocus, isFocusable, isMuddy, isPasteable, isScrollCopyable, isSelectable, isSelecting, isSelectionCopyable, isSelectionCutable, isSelectionDeleteable, isSpellCheckable, isStyle, isVisible, keyChar, keyControl, keyDown, keyRepeat, keyStatus, keyUp, makeContextMenu, moveFocus, moveFocus, navigationClick, navigationMovement, navigationUnclick, onExposed, onFocus, onMenuDismissed, onMenuDismissed, onObscured, onUnfocus, onVisibilityChange, paste, select, selectionCopy, selectionCut, selectionDelete, setBackground, setBackground, setBorder, setBorder, setBorder, setBorder, setChangeListener, setCommandItemProvider, setCookie, setDirty, setEditable, setEnabled, setExtent, setFocus, setFocusListener, setFont, setMargin, setMargin, setMuddy, setNonSpellCheckable, setPadding, setPadding, setPosition, setVisualState, touchEvent, trackwheelClick, trackwheelUnclick, updateLayout
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

ActivityImageField

public ActivityImageField(Bitmap bitmap,
                          int numFrames,
                          long style)
Constructs a new ActivityImageField, initializing all aspects of the animation. The bitmap must be laid out horizontally, with frames of equal width. The total length of the bitmap must be the size of a frame times the number of frames.

This field is set as non-focusable by default.

This field defaults to the animation being active. The field will loop the animation using a default rendering delay of 200 milliseconds.

Parameters:
bitmap - The bitmap containing all frames of the animation.
numFrames - The number of frames in the animation.
style - The style bits for this field.
Since:
BlackBerry API 6.0.0

ActivityImageField

public ActivityImageField(Bitmap bitmap,
                          int numFrames,
                          long style,
                          boolean loop)
Constructs a new ActivityImageField, initializing all aspects of the animation. The bitmap must be laid out horizontally, with frames of equal width. The total length of the bitmap must be the size of a frame times the number of frames.

This field will be set as non-focusable by default.

This field defaults to the animation being active. The animation uses a default duration per frame of 200 milliseconds. The frame rate will default to a target of 60 frames per second.

Parameters:
bitmap - The bitmap containing all frames of the animation.
numFrames - The number of frames in the animation.
style - The style bits for this field.
loop - true to loop the animation back to the start, false to stop animation on the final frame.
Since:
BlackBerry API 6.0.0

ActivityImageField

public ActivityImageField(Bitmap bitmap,
                          int numFrames,
                          long style,
                          int duration)
Constructs a new ActivityImageField, initializing all aspects of the animation. The bitmap must be laid out horizontally, with frames of equal width. The total length of the bitmap must be the size of a frame times the number of frames.

This field will be set as non-focusable by default.

This field defaults to the animation being active. The field will loop the animation. The frame rate used will be the default, a target of 60 frames per second.

Parameters:
bitmap - The bitmap containing all frames of the animation.
numFrames - The number of frames in the animation.
style - The style bits for this field.
duration - The time in milliseconds for the animation to complete.
Since:
BlackBerry API 6.0.0

ActivityImageField

public ActivityImageField(Bitmap bitmap,
                          int numFrames,
                          long style,
                          boolean loop,
                          int targetFramesPerSecond)
Constructs a new ActivityImageField, initializing all aspects of the animation. The bitmap must be laid out horizontally, with frames of equal width. The total length of the bitmap must be the size of a frame times the number of frames.

This field will be set as non-focusable by default.

This field defaults to the animation being active. The default duration for each frame will be used.

Parameters:
bitmap - The bitmap containing all frames of the animation.
numFrames - The number of frames in the animation.
style - The style bits for this field.
loop - true to loop the animation back to the start, false to stop animation on the final frame.
targetFramesPerSecond - The preferred frame rate for the animation.
Since:
BlackBerry API 6.0.0

ActivityImageField

public ActivityImageField(Bitmap bitmap,
                          int numFrames,
                          long style,
                          boolean loop,
                          int duration,
                          int targetFramesPerSecond)
Constructs a new ActivityImageField, initializing all aspects of the animation. The bitmap must be laid out horizontally, with frames of equal width. The total length of the bitmap must be the size of a frame times the number of frames.

This field will be set as non-focusable by default.

This field defaults to the animation being active.

Parameters:
bitmap - The bitmap containing all frames of the animation.
numFrames - The number of frames in the animation.
style - The style bits for this field.
loop - true to loop the animation back to the start, false to stop animation on the final frame.
duration - The time in milliseconds for the animation to complete.
targetFramesPerSecond - The preferred frame rate for the animation.
Since:
BlackBerry API 6.0.0


Method Detail

getAnimationPropertyComponentCount

public int getAnimationPropertyComponentCount(int property)
Gets the number of components that comprise the given property.

The implementer must define the component size for every animatable property defined for the Animatable.

Specified by:
getAnimationPropertyComponentCount in interface Animatable
Parameters:
property - The property to retrieve the component count for.
Returns:
The number of components comprising the given property.
Throws:
IllegalArgumentException - if the property is not defined on the Animatable.
Since:
BlackBerry API 6.0.0

getAnimationValue

public void getAnimationValue(int property,
                              AnimationValue value)
Gets the current value(s) for the given property.

Used by the Animation engine to obtain the current value(s) for the given target property on the Animatable. The implementer must set the current value(s) of the given target property in the value parameter.

Specified by:
getAnimationValue in interface Animatable
Parameters:
property - The property to get the current value(s) of.
value - The AnimationValue to set the current value(s) for the given property.
Throws:
IllegalArgumentException - if the property is not defined on the Animatable.
See Also:
AnimationValue
Since:
BlackBerry API 6.0.0

getCurrentFrame

public int getCurrentFrame()
Returns the index of the frame that is currently being animated.

Returns:
The index of the frame currently being animated.
Since:
BlackBerry API 6.0.0

getNumberOfFrames

public int getNumberOfFrames()
Returns the number of frames of the animation contained within the bitmap.

Returns:
The number of frames of animation.
Since:
BlackBerry API 6.0.0

isAnimating

public boolean isAnimating()
Returns whether or not the frame is currently animating.

Returns:
true if animating, false otherwise.
Since:
BlackBerry API 6.0.0

layout

protected void layout(int width,
                      int height)
Lays out contents of this field.

Specified by:
layout in class Field
Parameters:
width - Amount of available horizontal space.
height - Amount of available vertical space.
Since:
BlackBerry API 6.0.0

onDisplay

protected void onDisplay()
Invoked when the screen this field is on is pushed onto the display stack.

Sets up the field for rendering.

Overrides:
onDisplay in class Field
Since:
BlackBerry API 6.0.0

onUndisplay

protected void onUndisplay()
Invoked when the screen this field is on is popped off the display stack.

Stops the rendering.

Overrides:
onUndisplay in class Field
Since:
BlackBerry API 6.0.0

paint

protected void paint(Graphics g)
Paints the contents of the field.

Specified by:
paint in class Field
Parameters:
g - Graphics context for drawing in this field.
Since:
BlackBerry API 6.0.0

setAnimate

public void setAnimate(boolean animate)
Turns the animation of this field on or off.

Parameters:
animate - true to turn animation on, false to turn animation off.
Since:
BlackBerry API 6.0.0

setAnimationValue

public void setAnimationValue(int property,
                              AnimationValue value)
Sets the current value(s) for the given property.

Used by the Animation engine to update the current value(s) of the given target property on the Animatable with the currently calculated animation value. The implementer must update the current value(s) of the given target property with the value(s) in the value parameter.

Specified by:
setAnimationValue in interface Animatable
Parameters:
property - The property to set the current value(s) for.
value - The AnimationValue used to hold the current value(s) for the given property.
Throws:
IllegalArgumentException - if the property is not defined on the Animatable.
See Also:
AnimationValue
Since:
BlackBerry API 6.0.0

setCurrentFrameIndex

public void setCurrentFrameIndex(int index)
Changes the index of the current frame. If index is less than 0, it will be set to 0. If index is greater or equal to the number of frames, it will be set to the last frame.

Parameters:
index - The index of the frame to render.
Since:
BlackBerry API 6.0.0





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.