net.rim.device.api.ui.extension.container
Class ZoomScreen

java.lang.Object
  extended by net.rim.device.api.ui.Field
      extended by net.rim.device.api.ui.Manager
          extended by net.rim.device.api.ui.Screen
              extended by net.rim.device.api.ui.container.FullScreen
                  extended by net.rim.device.api.ui.container.MainScreen
                      extended by net.rim.device.api.ui.extension.container.ZoomScreen

public final class ZoomScreen
extends MainScreen

A screen for zooming-in, and panning around images. Includes an overlay graphic illustrating the viewed portion of the image. On touch screen devices, this screen supports a two finger touch feature where two-fingers-down define the diagonally opposite corners of the region to zoom.

This class supports image orientation either through the use of embedded JPEG EXIF data, or by explicitly specifying an orientation in the constructor.

ZoomScreen supports the following orientation values:

ZoomScreen.ROTATE_0_DEGREES
To correctly display an image with no rotation.
 FFFFFF
 FF
 FFFF
 FF
 FF
 
ZoomScreen.ROTATE_90_DEGREES
To correctly display an image rotated counter clockwise by 90 degrees.
 FF
 FF  FF
 FFFFFFFFFF
 
ZoomScreen.ROTATE_180_DEGREES
To correctly display an image rotated by 180 degrees.
     FF
     FF
   FFFF
     FF
 FFFFFF
 
ZoomScreen.ROTATE_270_DEGREES
To correctly display an image rotated clockwise by 90 degrees.
 FFFFFFFFFF
     FF  FF
         FF
 

Since:
BlackBerry API 5.0.0

Field Summary
static int ROTATE_0_DEGREES
          EXIF orientation value for correctly displaying images with no rotation.
static int ROTATE_180_DEGREES
          EXIF orientation value for correctly displaying images that are rotated by 180 degrees.
static int ROTATE_270_DEGREES
          EXIF orientation value for correctly displaying images that are rotated clockwise by 90 degrees.
static int ROTATE_90_DEGREES
          EXIF orientation value for correctly displaying images that are rotated counter clockwise by 90 degrees.
 
Fields inherited from class net.rim.device.api.ui.Screen
DEFAULT_CLOSE, DEFAULT_MENU, NO_SYSTEM_MENU_ITEMS
 
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
 
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
ZoomScreen(EncodedImage encodedImage)
          Constructs a new ZoomScreen.
ZoomScreen(EncodedImage encodedImage, int orientation)
          Constructs a new ZoomScreen using the specified orientation to display the image.
 
Method Summary
protected  boolean keyChar(char c, int status, int time)
          Delegates key generation event to the controlled field with focus.
protected  boolean navigationClick(int status, int time)
          Increases (multiplies) the amount of zoom by the specified increment.
protected  boolean navigationMovement(int dx, int dy, int status, int time)
          Pans around the zoomed image.
protected  void paint(Graphics graphics)
          Paints this screen's visible region.
protected  void sublayout(int width, int height)
          Lays out this screen's controlled fields.
protected  boolean touchEvent(TouchEvent message)
          Handles touch events.
 
Methods inherited from class net.rim.device.api.ui.container.MainScreen
addMenuItem, getField, getFieldCount, getFieldWithFocus, getFieldWithFocusIndex, getMainManager, keyCharUnhandled, makeMenu, onSavePrompt, removeAllMenuItems, removeMenuItem, setBanner, setId, setStatus, setTitle, setTitle, setTitle
 
Methods inherited from class net.rim.device.api.ui.Screen
add, addKeyListener, addScreenUiEngineAttachedListener, addTrackwheelListener, close, delete, deleteRange, doPaint, ensureRegionVisible, getAccessibleContext, getApplication, getDefaultMenuItem, getDelegate, getFieldAtLocation, getFocusRect, getGraphics, getLeafFieldWithFocus, getMenu, getScreenAbove, getScreenBelow, getUiEngine, getVirtualKeyboard, insert, invalidate, invalidate, invalidateAll, invalidateLayout, invokeAction, isDataValid, isDirty, isDisplayed, isFocus, isFocusable, isGlobal, isGlobalStatus, isMuddy, isSelecting, keyControl, keyDown, keyRepeat, keyStatus, keyUp, layoutDelegate, navigationUnclick, onClose, onDisplay, onExposed, onFocus, onFocusNotify, onMenu, onMenuDismissed, onMenuDismissed, onObscured, onSave, onUiEngineAttached, onUndisplay, onUnfocus, openDevelopmentBackdoor, openProductionBackdoor, paintBackground, removeFocus, removeKeyListener, removeScreenUiEngineAttachedListener, removeTrackwheelListener, replace, save, scroll, setBackdoorAltStatus, setDefaultClose, setDirty, setFocus, setFocus, setHorizontalQuantization, setPositionDelegate, setTrackballFilter, setTrackballSensitivityXOffset, setTrackballSensitivityYOffset, setVerticalQuantization, trackwheelClick, trackwheelClickUnhandled, trackwheelRoll, trackwheelUnclick, updateDisplay
 
Methods inherited from class net.rim.device.api.ui.Manager
addAll, deleteAll, getHorizontalScroll, getPreferredHeightOfChild, getPreferredWidthOfChild, getVerticalScroll, getVirtualHeight, getVirtualWidth, getVisibleHeight, getVisibleWidth, invalidateFieldRange, isDownArrowShown, isUpArrowShown, isValidLayout, layout, layoutChild, moveFocus, moveFocus, nextFocus, nextFocus, paintChild, setFocus, setHorizontalScroll, setHorizontalScroll, setPositionChild, setScrollListener, setScrollingInertial, setVerticalScroll, setVirtualExtent, subpaint
 
Methods inherited from class net.rim.device.api.ui.Field
drawFocus, drawHighlightRegion, fieldChangeNotify, focusAdd, focusRemove, getBackground, getBackground, getBorder, getBorder, getBorder, getChangeListener, getContentHeight, getContentLeft, getContentRect, getContentRect, getContentTop, getContentWidth, getContextMenu, getCookie, getExtent, getExtent, getFieldStyle, getFocusListener, getFont, getHeight, getIndex, getLeft, getManager, getOriginal, getPreferredHeight, getPreferredWidth, getScreen, getStyle, getTop, getVisualState, getWidth, isEditable, isPasteable, isSelectable, isSelectionCopyable, isSelectionCutable, isSelectionDeleteable, isSpellCheckable, isStyle, isVisible, makeContextMenu, onVisibilityChange, paste, select, selectionCopy, selectionCut, selectionDelete, setBackground, setBackground, setBorder, setBorder, setBorder, setBorder, setChangeListener, setCookie, setEditable, setExtent, setFocusListener, setFont, setMuddy, setNonSpellCheckable, setPosition, setVisualState, updateLayout
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

ROTATE_0_DEGREES

public static final int ROTATE_0_DEGREES
EXIF orientation value for correctly displaying images with no rotation.

See Also:
Constant Field Values
Since:
BlackBerry API 5.0.0

ROTATE_180_DEGREES

public static final int ROTATE_180_DEGREES
EXIF orientation value for correctly displaying images that are rotated by 180 degrees.

See Also:
Constant Field Values
Since:
BlackBerry API 5.0.0

ROTATE_90_DEGREES

public static final int ROTATE_90_DEGREES
EXIF orientation value for correctly displaying images that are rotated counter clockwise by 90 degrees.

See Also:
Constant Field Values
Since:
BlackBerry API 5.0.0

ROTATE_270_DEGREES

public static final int ROTATE_270_DEGREES
EXIF orientation value for correctly displaying images that are rotated clockwise by 90 degrees.

See Also:
Constant Field Values
Since:
BlackBerry API 5.0.0


Constructor Detail

ZoomScreen

public ZoomScreen(EncodedImage encodedImage)
Constructs a new ZoomScreen. If encodedImage is a JPEG any embedded EXIF orientation data is applied but can be overridden using the alternative constructor ZoomScreen.ZoomScreen(EncodedImage, int).

Parameters:
encodedImage - the image to display.
Since:
BlackBerry API 5.0.0

ZoomScreen

public ZoomScreen(EncodedImage encodedImage,
                  int orientation)
Constructs a new ZoomScreen using the specified orientation to display the image. For example, if the image needs to be rotated 90 degrees clockwise before being displayed, use ROTATE_90_DEGREES If no rotation is necessary, use ROTATE_0_DEGREES or the alternative constructor ZoomScreen.ZoomScreen(EncodedImage).

Parameters:
encodedImage - the image to display.
orientation - a rotation constant to specify how the image should be rotated before being displayed. One of ROTATE_* values. Any other values will be ignored and will act as if ROTATE_0_DEGREES had been passed.
Since:
BlackBerry API 5.0.0


Method Detail

sublayout

protected void sublayout(int width,
                         int height)
Lays out this screen's controlled fields. For the touch, this is called when the device orientation is changed.

Overrides:
sublayout in class FullScreen
Parameters:
width - Horizontal space available to this screen.
height - Vertical space available to this screen.
Since:
BlackBerry API 5.0.0

paint

protected void paint(Graphics graphics)
Paints this screen's visible region.

Overrides:
paint in class Screen
Parameters:
graphics - Graphics context used to draw the background.
Since:
BlackBerry API 5.0.0

navigationMovement

protected boolean navigationMovement(int dx,
                                     int dy,
                                     int status,
                                     int time)
Pans around the zoomed image.

Overrides:
navigationMovement in class Screen
Parameters:
dx - Magnitude of navigational motion: negative for a move left and positive for a move right.
dy - Magnitude of navigational motion: negative for an upwards move, and positive for a downwards move.
status - Modifier key status at time of move.
time - Number of milliseconds since the device was turned on. One scenario that calls this method is when a Screen object is pushed to an application and a Navigation event is injected into the same application. When this scenario occurs, this method is called using 0 for the time parameter.
Returns:
True if event was consumed; otherwise, false.
Since:
BlackBerry API 5.0.0

touchEvent

protected boolean touchEvent(TouchEvent message)
Handles touch events.

Overrides:
touchEvent in class Screen
Parameters:
message - TouchEvent object containing various input parameters including the event type and touch coordinates.
Returns:
True if event consumed; otherwise, false.
Since:
BlackBerry API 5.0.0

navigationClick

protected boolean navigationClick(int status,
                                  int time)
Increases (multiplies) the amount of zoom by the specified increment.

Overrides:
navigationClick in class Screen
Parameters:
status - State of the modifier keys.
time - Number of milliseconds since the device was turned on. One scenario that calls this method is when a Screen object is pushed to an application and a Navigation event is injected into the same application. When this scenario occurs, this method is called using 0 for the time parameter.
Returns:
True if delegate manager consumed the event; otherwise false.
Since:
BlackBerry API 5.0.0

keyChar

protected boolean keyChar(char c,
                          int status,
                          int time)
Delegates key generation event to the controlled field with focus. Causes the screen to zoom out when the escape key is pressed.

Overrides:
keyChar in class Screen
Parameters:
c - Character generated.
status - Modifier key status.
time - Number of milliseconds since the device was turned on.
Returns:
True if event was consumed; otherwise, false.
Since:
BlackBerry API 5.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.