|
||||||||||
| 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.Screen
net.rim.device.api.ui.container.FullScreen
de.enough.polish.blackberry.ui.BaseScreen
public abstract class BaseScreen
Provides the base screen / displayable implementation for BlackBerry devices.
| Field Summary | |
|---|---|
Item |
currentItem
|
protected boolean |
isLastEventProcessed
|
| 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_SCROLL_MASK, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_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_SCROLL_MASK, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_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 | |
|---|---|
protected |
BaseScreen()
Constructs a new Canvas object. |
protected |
BaseScreen(net.rim.device.api.ui.Manager manager,
long style)
Constructs a new Canvas object. |
| Method Summary | |
|---|---|
void |
addCommand(Command cmd)
|
void |
addPermanentNativeItem(Item item)
|
void |
clearPermanentNativeItems()
|
protected boolean |
focusChangeNeeded(net.rim.device.api.ui.Field field)
|
boolean |
forwardEventToNativeField(Screen screen,
int keyCode)
Decides if a key command should be forwarded to the currently focused native BlackBerry field of this screen. |
int |
getGameAction(int keyCode)
Gets the game action associated with the given key code of the device. |
int |
getKeyCode(int gameAction)
Gets a key code that corresponds to the specified game action on the device. |
String |
getKeyName(int keyCode)
Gets an informative key string for a key. |
boolean |
handlePointerTouchDown(int x,
int y)
Deprecated. as BlackBerry used to differentiate between click and touch only on its first Storm model |
boolean |
handlePointerTouchUp(int x,
int y)
Deprecated. as BlackBerry used to differentiate between click and touch only on its first Storm model |
boolean |
hasPointerEvents()
Checks if the platform supports pointer press and release events. |
boolean |
hasPointerMotionEvents()
Checks if the platform supports pointer motion events (pointer dragged). |
boolean |
hasRepeatEvents()
Checks if the platform can generate repeat events when key is kept down. |
protected void |
hideNotify()
The implementation calls hideNotify() shortly
after the Canvas has been
removed from the display. |
boolean |
isDoubleBuffered()
Checks if the Canvas is double buffered by the
implementation. |
boolean |
isNativeUiShownFor(Item item)
Determines whether a native UI component is shown for the specified item. |
boolean |
isShown()
Determines whether this screen is shown |
protected boolean |
keyDown(int keyCode,
int time)
|
protected void |
keyPressed(int keyCode)
Called when a key is pressed. |
protected void |
keyReleased(int keyCode)
Called when a key is released. |
protected boolean |
keyRepeat(int keyCode,
int time)
|
protected void |
keyRepeated(int keyCode)
Called when a key is repeated (held down). |
protected boolean |
keyUp(int keyCode,
int time)
|
protected void |
makeContextMenu(net.rim.device.api.ui.ContextMenu menu)
|
protected void |
makeMenu(net.rim.device.api.ui.component.Menu menu,
int instance)
|
protected boolean |
navigationClick(int status,
int time)
|
protected boolean |
navigationMovement(int dx,
int dy,
int status,
int time)
|
protected boolean |
navigationUnclick(int status,
int time)
|
void |
notifyDisplayableChange(Displayable currentDisplayable,
Displayable nextDisplayable)
|
void |
notifyFocusSet(Item item)
Notifies this screen about the new item that is focused on BlackBerry platforms. |
void |
notifyFocusSet(Item item,
boolean repeatSync)
Focuses an item and it's corresponding blackberry field if available. |
protected void |
onDisplay()
|
protected void |
onExposed()
|
boolean |
onMenu(int instance)
|
protected void |
onMenuDismissed(net.rim.device.api.ui.component.Menu m)
|
protected void |
onObscured()
|
protected void |
onUiEngineAttached(boolean attached)
|
protected void |
onUndisplay()
|
protected abstract void |
paint(Graphics g)
Renders the Canvas. |
protected void |
paintBackground(net.rim.device.api.ui.Graphics g)
|
protected void |
pointerDragged(int x,
int y)
Called when the pointer is dragged. |
protected void |
pointerPressed(int x,
int y)
Called when the pointer is pressed. |
protected void |
pointerReleased(int x,
int y)
Called when the pointer is released. |
void |
removeCommand(Command cmd)
|
void |
removePermanentNativeItem(Item item)
Notifies this screen about an item with a native componen that is removed on BlackBerry platforms. |
void |
repaint()
Requests a repaint for the entire Canvas. |
void |
repaint(int x,
int y,
int width,
int height)
Requests a repaint for the specified region of the Canvas. |
void |
serviceRepaints()
Forces any pending repaint requests to be serviced immediately. |
void |
setCommandListener(CommandListener l)
|
void |
setFullScreenMode(boolean mode)
Controls whether the Canvas is in full-screen mode
or in normal mode. |
void |
setIgnoreObscureEvent(boolean ignore)
|
void |
setTitle(String title)
|
protected void |
showNotify()
The implementation calls showNotify()
immediately prior to this Canvas being made
visible on the display. |
protected void |
sizeChanged(int w,
int h)
Called when the drawable area of the Canvas has
been changed. |
protected void |
sublayout(int width,
int height)
|
protected boolean |
touchEvent(net.rim.device.api.ui.TouchEvent message)
Handles BlackBerry touch events. |
protected boolean |
trackwheelRoll(int amount,
int status,
int time)
|
| Methods inherited from class net.rim.device.api.ui.Screen |
|---|
add, addInputSettings, addKeyListener, addScreenUiEngineAttachedListener, addTrackwheelListener, clearInputSettings, close, delete, deleteRange, doPaint, ensureRegionVisible, getAccessibleContext, getApplication, getContextMenuProvider, getDefaultMenuItem, getDelegate, getField, getFieldAtLocation, getFieldCount, getFieldWithFocus, getFieldWithFocusIndex, getFocusRect, getGraphics, getInputHelper, getInputSettings, getLeafFieldWithFocus, getMenu, getScreenAbove, getScreenBelow, getTitleBar, getUiEngine, getVirtualKeyboard, insert, invalidate, invalidate, invalidateAll, invalidateLayout, invokeAction, isDataValid, isDirty, isDisplayed, isFocus, isFocusable, isGlobal, isGlobalStatus, isMuddy, isSelecting, keyChar, keyCharUnhandled, keyControl, keyStatus, layoutDelegate, onClose, onFocus, onFocusNotify, onMenuDismissed, onSave, onSavePrompt, onUnfocus, openDevelopmentBackdoor, openProductionBackdoor, paint, removeFocus, removeInputSettings, removeKeyListener, removeScreenUiEngineAttachedListener, removeTrackwheelListener, replace, save, scroll, setBackdoorAltStatus, setContextMenuProvider, setDefaultClose, setDirty, setFocus, setFocus, setHorizontalQuantization, setInputHelper, setPositionDelegate, setTitleBar, setTrackballFilter, setTrackballSensitivityXOffset, setTrackballSensitivityYOffset, setVerticalQuantization, trackwheelClick, trackwheelClickUnhandled, trackwheelUnclick, updateDisplay |
| Methods inherited from class net.rim.device.api.ui.Manager |
|---|
addAll, deleteAll, getHorizontalScroll, getPreferredHeightOfChild, getPreferredWidthOfChild, getVerticalScroll, getVirtualHeight, getVirtualWidth, insertAll, invalidateFieldRange, isDownArrowShown, isUpArrowShown, isValidLayout, layout, layoutChild, moveFocus, moveFocus, nextFocus, nextFocus, paintChild, setFieldWithFocus, setFocus, setPositionChild, setScrollingInertial, setVirtualExtent, subpaint |
| Methods inherited from class net.rim.device.api.ui.ScrollView |
|---|
configurationChanged, getHorizontalAdjustment, getVerticalAdjustment, getVisibleHeight, getVisibleWidth, setCurrentLocation, setExtent, setHorizontalAdjustment, setHorizontalScroll, setHorizontalScroll, setScrollListener, setVerticalAdjustment, setVerticalScroll, setVerticalScroll, valueChanged, waitForScrolling |
| Methods inherited from class net.rim.device.api.ui.Field |
|---|
applyTheme, assertHaveEventLock, drawFocus, drawHighlightRegion, fieldChangeNotify, focusAdd, focusChangeNotify, focusRemove, getBackground, getBackground, getBorder, getBorder, getBorder, getChangeListener, getCommandItemProvider, getContentHeight, getContentLeft, getContentRect, getContentRect, getContentTop, getContentWidth, getContextMenu, getCookie, getExtent, getExtent, getFieldStyle, getFocusListener, getFont, getHeight, getIndex, getLeft, getManager, getMargin, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getOriginal, getPadding, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getPreferredHeight, getPreferredWidth, getScreen, getState, getStyle, getTop, getVisualState, getWidth, isEditable, isEnabled, isPasteable, isScrollCopyable, isSelectable, isSelectionCopyable, isSelectionCutable, isSelectionDeleteable, isSpellCheckable, isStyle, isVisible, onVisibilityChange, paste, select, selectionCopy, selectionCut, selectionDelete, setBackground, setBackground, setBorder, setBorder, setBorder, setBorder, setChangeListener, setCommandItemProvider, setCookie, setEditable, setEnabled, setFocusListener, setFont, setMargin, setMargin, setMinimalWidth, setMuddy, setNonSpellCheckable, setPadding, setPadding, setPosition, setVisualState, updateLayout |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public Item currentItem
protected boolean isLastEventProcessed
| Constructor Detail |
|---|
protected BaseScreen()
Canvas object.
protected BaseScreen(net.rim.device.api.ui.Manager manager,
long style)
Canvas object.
| Method Detail |
|---|
public boolean isDoubleBuffered()
Canvas is double buffered by the
implementation.
public boolean hasPointerEvents()
public boolean hasPointerMotionEvents()
public boolean hasRepeatEvents()
public int getKeyCode(int gameAction)
getGameAction(int) and then interpret the
resulting game action, instead of generating a table of key codes at
using this method during initialization.
The mapping between key codes and game actions will not change during the execution of the application.
gameAction - - the game action
IllegalArgumentException - - if gameAction is not a valid game actionpublic String getKeyName(int keyCode)
F1 through F4,
calling this method on the keyCode for
the F1 key will return the string
"F1". A typical use for this string
will be to compose help text such as "Press
F1 to proceed."
This method will return a non-empty string for every valid key code.
There is no direct mapping from game actions to key names. To get
the string name for a game action GAME_A, the
application must call
|
keyCode - - the key code being requested
IllegalArgumentException - - if keyCode is not a valid key codepublic int getGameAction(int keyCode)
The mapping between key codes and game actions will not change during the execution of the application.
keyCode - - the key code
IllegalArgumentException - - if keyCode is not a valid key codepublic void setFullScreenMode(boolean mode)
Canvas is in full-screen mode
or in normal mode.
mode - true if the Canvas is to be in full screen mode, false otherwiseprotected void keyPressed(int keyCode)
The getGameAction() method can be called to
determine what game action, if any, is mapped to the key.
Class Canvas has an empty implementation of this method, and
the subclass has to redefine it if it wants to listen this method.
keyCode - - the key code of the key that was pressedprotected void keyRepeated(int keyCode)
The getGameAction() method can
be called to determine what game action,
if any, is mapped to the key.
Class Canvas has an empty implementation of this method, and
the subclass has to redefine it if it wants to listen this method.
keyCode - - the key code of the key that was repeatedhasRepeatEvents()protected void keyReleased(int keyCode)
The getGameAction() method can be called to
determine what game action, if any, is mapped to the key.
Class Canvas has an empty implementation of this method, and
the subclass has to redefine it if it wants to listen this method.
keyCode - - the key code of the key that was released
protected void pointerPressed(int x,
int y)
The hasPointerEvents()
method may be called to determine if the device supports pointer events.
Class Canvas has an empty implementation of this method, and
the subclass has to redefine it if it wants to listen this method.
x - - the horizontal location where the pointer was pressed (relative to the Canvas)y - - the vertical location where the pointer was pressed (relative to the Canvas)
protected void pointerReleased(int x,
int y)
The hasPointerEvents()
method may be called to determine if the device supports pointer events.
Class Canvas has an empty implementation of this method, and
the subclass has to redefine it if it wants to listen this method.
x - - the horizontal location where the pointer was released (relative to the Canvas)y - - the vertical location where the pointer was released (relative to the Canvas)
protected void pointerDragged(int x,
int y)
The hasPointerMotionEvents()
method may be called to determine if the device supports pointer events.
Class Canvas has an empty implementation of this method, and
the subclass has to redefine it if it wants to listen this method.
x - - the horizontal location where the pointer was dragged (relative to the Canvas)y - - the vertical location where the pointer was dragged (relative to the Canvas)
public boolean handlePointerTouchDown(int x,
int y)
x - the absolute horizontal pixel position of the touch eventy - the absolute vertical pixel position of the touch event
public boolean handlePointerTouchUp(int x,
int y)
x - the absolute horizontal pixel position of the touch eventy - the absolute vertical pixel position of the touch event
public final void repaint(int x,
int y,
int width,
int height)
Canvas.
Calling
this method may result in subsequent call to
paint(), where the passed
Graphics object's clip region will include at
least the specified
region.
If the canvas is not visible, or if width and height are zero or less, or if the rectangle does not specify a visible region of the display, this call has no effect.
The call to paint() occurs asynchronously of
the call to repaint().
That is, repaint() will not block waiting for
paint() to finish. The
paint() method will either be called after the
caller of repaint()
returns
to the implementation (if the caller is a callback) or on another thread
entirely.
To synchronize with its paint() routine,
applications can use either
Display.callSerially() or
serviceRepaints(), or they can code explicit
synchronization into their paint() routine.
The origin of the coordinate system is above and to the left of the
pixel in the upper left corner of the displayable area of the
Canvas.
The X-coordinate is positive right and the Y-coordinate is
positive downwards.
x - - the x coordinate of the rectangle to be repaintedy - - the y coordinate of the rectangle to be repaintedwidth - - the width of the rectangle to be repaintedheight - - the height of the rectangle to be repaintedDisplay.callSerially(Runnable),
serviceRepaints()public final void repaint()
Canvas. The
effect is identical to
repaint(0, 0, getWidth(), getHeight());
public final void serviceRepaints()
Warning: This method blocks until the call to the
application's paint() method returns. The
application has no
control over
which thread calls paint(); it may vary from
implementation to
implementation. If the caller of serviceRepaints()
holds a lock that the
paint() method acquires, this may result in
deadlock. Therefore, callers
of serviceRepaints() must not hold any
locks that might be
acquired within the paint() method. The
Display.callSerially()
method provides a facility where an application can be called back after
painting has completed, avoiding the danger of deadlock.
Display.callSerially(Runnable)protected void showNotify()
showNotify()
immediately prior to this Canvas being made
visible on the display.
Canvas subclasses may override
this method to perform tasks before being shown, such
as setting up animations, starting timers, etc.
protected void hideNotify()
hideNotify() shortly
after the Canvas has been
removed from the display.
Canvas subclasses may override this method in
order to pause
animations,
revoke timers, etc. The default implementation of this
method in class Canvas is empty.
protected abstract void paint(Graphics g)
Canvas. The application must implement
this method in
order to paint any graphics.
The Graphics object's clip region defines the
area of the screen
that is considered to be invalid. A correctly-written
paint() routine
must paint every pixel within this region. This is necessary
because the implementation is not required to clear the region prior to
calling paint() on it. Thus, failing to paint
every pixel may result
in a portion of the previous screen image remaining visible.
Applications must not assume that
they know the underlying source of the paint()
call and use this
assumption
to paint only a subset of the pixels within the clip region. The
reason is
that this particular paint() call may have
resulted from multiple
repaint()
requests, some of which may have been generated from outside the
application. An application that paints only what it thinks is
necessary to
be painted may display incorrectly if the screen contents had been
invalidated by, for example, an incoming telephone call.
Operations on this graphics object after the paint()
call returns are
undefined. Thus, the application must not cache this
Graphics
object for later use or use by another thread. It must only be
used within
the scope of this method.
The implementation may postpone visible effects of graphics operations until the end of the paint method.
The contents of the Canvas are never saved if
it is hidden and then
is made visible again. Thus, shortly after
showNotify() is called,
paint() will always be called with a
Graphics object whose clip region
specifies the entire displayable area of the
Canvas. Applications
must not rely on any contents being preserved from a previous
occasion when the Canvas was current. This call to
paint() will not
necessarily occur before any other key or pointer
methods are called on the Canvas. Applications
whose repaint
recomputation is expensive may create an offscreen
Image, paint into it,
and then draw this image on the Canvas when
paint() is called.
The application code must never call paint();
it is called only by
the implementation.
The Graphics object passed to the
paint() method has the following
properties:
Canvas;Font.getDefaultFont();SOLID;Canvas; andCanvas is visible, that is, a call to
isShown() will return
true.
g - - the Graphics object to be used for rendering the Canvas
protected void sizeChanged(int w,
int h)
Canvas has
been changed. This
method has augmented semantics compared to Displayable.sizeChanged.
In addition to the causes listed in
Displayable.sizeChanged, a size change can occur on a
Canvas because of a change between normal and
full-screen modes.
If the size of a Canvas changes while it is
actually visible on the
display, it may trigger an automatic repaint request. If this occurs,
the call to sizeChanged will occur prior to the call to
paint. If the Canvas has become smaller, the
implementation may choose not to trigger a repaint request if the
remaining contents of the Canvas have been
preserved. Similarly, if
the Canvas has become larger, the implementation
may choose to trigger
a repaint only for the new region. In both cases, the preserved
contents must remain stationary with respect to the origin of the
Canvas. If the size change is significant to the
contents of the
Canvas, the application must explicitly issue a
repaint request for the
changed areas. Note that the application's repaint request should not
cause multiple repaints, since it can be coalesced with repaint
requests that are already pending.
If the size of a Canvas changes while it is not
visible, the
implementation may choose to delay calls to sizeChanged
until immediately prior to the call to showNotify. In
that case, there will be only one call to sizeChanged,
regardless of the number of size changes.
An application that is sensitive to size changes can update instance
variables in its implementation of sizeChanged. These
updated values will be available to the code in the
showNotify, hideNotify, and
paint methods.
w - - the new width in pixels of the drawable area of the Canvash - - the new height in pixels of the drawable area of the Canvasin class Displayableprotected void paintBackground(net.rim.device.api.ui.Graphics g)
paintBackground in class net.rim.device.api.ui.Screenprotected void onExposed()
onExposed in class net.rim.device.api.ui.Screenprotected void onObscured()
onObscured in class net.rim.device.api.ui.Screenprotected void onUiEngineAttached(boolean attached)
onUiEngineAttached in class net.rim.device.api.ui.Screenprotected void onDisplay()
onDisplay in class net.rim.device.api.ui.Screenprotected void onUndisplay()
onUndisplay in class net.rim.device.api.ui.Screen
protected void sublayout(int width,
int height)
sublayout in class net.rim.device.api.ui.container.FullScreenpublic boolean onMenu(int instance)
onMenu in class net.rim.device.api.ui.Screenprotected void onMenuDismissed(net.rim.device.api.ui.component.Menu m)
onMenuDismissed in class net.rim.device.api.ui.Screen
protected boolean trackwheelRoll(int amount,
int status,
int time)
trackwheelRoll in class net.rim.device.api.ui.Screen
protected boolean keyDown(int keyCode,
int time)
keyDown in class net.rim.device.api.ui.Screen
public boolean forwardEventToNativeField(Screen screen,
int keyCode)
screen - this canvas as a J2ME Polish ScreenkeyCode - the blackberry key code
protected boolean keyUp(int keyCode,
int time)
keyUp in class net.rim.device.api.ui.Screen
protected boolean keyRepeat(int keyCode,
int time)
keyRepeat in class net.rim.device.api.ui.Screenprotected boolean touchEvent(net.rim.device.api.ui.TouchEvent message)
touchEvent in class net.rim.device.api.ui.Screenmessage - the touch event
public boolean isShown()
public void notifyFocusSet(Item item)
item - the item that has been focused
public void notifyFocusSet(Item item,
boolean repeatSync)
item - the item that is focusedrepeatSync - true when the access should be tried synchronized again when the first trial failspublic boolean isNativeUiShownFor(Item item)
item - the item that has been focusedpublic void removePermanentNativeItem(Item item)
item - the item with a native component which was displayed all the time.public void addPermanentNativeItem(Item item)
public void clearPermanentNativeItems()
protected boolean navigationClick(int status,
int time)
navigationClick in class net.rim.device.api.ui.Screen
protected boolean navigationUnclick(int status,
int time)
navigationUnclick in class net.rim.device.api.ui.Screenprotected boolean focusChangeNeeded(net.rim.device.api.ui.Field field)
protected boolean navigationMovement(int dx,
int dy,
int status,
int time)
navigationMovement in class net.rim.device.api.ui.Screen
public void notifyDisplayableChange(Displayable currentDisplayable,
Displayable nextDisplayable)
public void addCommand(Command cmd)
public void removeCommand(Command cmd)
protected void makeMenu(net.rim.device.api.ui.component.Menu menu,
int instance)
makeMenu in class net.rim.device.api.ui.Screenprotected void makeContextMenu(net.rim.device.api.ui.ContextMenu menu)
makeContextMenu in class net.rim.device.api.ui.Fieldpublic void setTitle(String title)
public void setCommandListener(CommandListener l)
public void setIgnoreObscureEvent(boolean ignore)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||