|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface UiEngine
Defines functionality for a user interface engine applications can use for their UI operations.
A UI engine maintains a stack of Screen objects. As it pushes screens onto the stack, it draws them on top of any other screens already on the stack. When the application pops a screen off the stack, it redraws the underlying screens as necessary. Only the screen on the top of the stack receives input events.
Each screen may appear only once in the display stack. The application throws a runtime exception if you attempt to push a single screen onto the stack more than once.
Note that users of a UI engine must follow rules similar to those of traditional Swing applications. In particular
invokeLater()
or
invokeAndWait()
methods.
Alternatively, a worker thread can synchronize on the event lock
(returned by Application.getEventLock()
to ensure serialized access to
the UI. Note that you should only hold this lock for short periods of time.
Code on the event thread should not block or execute for long periods of time: the system will not dispatch messages, and the event queue can therefore overflow. You can use background threads for long processing.
Field Summary | ||
---|---|---|
static int |
GLOBAL_MODAL
For pushGlobalScreen(). |
|
static int |
GLOBAL_QUEUE
For pushGlobalScreen(). |
|
static int |
GLOBAL_SHOW_LOWER
For pushGlobalScreen(). |
Method Summary | ||
---|---|---|
void |
dismissStatus(Screen screen)
Deprecated. Use popScreen(Screen) |
|
Screen |
getActiveScreen()
Retrieves handle for the active screen. |
|
int |
getScreenCount()
Retrieves the number of screens currently on the display stack. |
|
boolean |
isPaintingSuspended()
Determines if repainting is currently suspended. |
|
void |
popScreen(Screen screen)
Removes a screen from the display stack, and updates the display. |
|
void |
pushGlobalScreen(Screen screen,
int priority,
boolean inputRequired)
Deprecated. Use pushGlobalScreen(Screen, int, int) |
|
void |
pushGlobalScreen(Screen screen,
int priority,
int flags)
Adds a screen to the queue of displayed global status screens. |
|
void |
pushModalScreen(Screen screen)
Pushes a modal screen onto the display and paints it. |
|
void |
pushScreen(Screen screen)
Pushes a screen onto the display stack and paints it. |
|
void |
queueStatus(Screen screen,
int priority,
boolean inputRequired)
Deprecated. Use pushGlobalScreen(Screen, int, int) |
|
void |
relayout()
Updates the layout of all screens and repaints. |
|
void |
repaint()
Repaints entire display. |
|
void |
suspendPainting(boolean suspend)
Suspends painting of the UI. |
|
void |
updateDisplay()
Updates the display with pending graphics operations. |
Field Detail |
---|
static final int GLOBAL_MODAL
static final int GLOBAL_QUEUE
static final int GLOBAL_SHOW_LOWER
Method Detail |
---|
void dismissStatus(Screen screen)
If this screen is currently showing, this method dismisses the screen, replacing it with the next screen in the queue (if one exists). If the screen is not currently showing, this method simply removes it from the queue.
The invoking application must be the same application which enqueued the screen (the application displaying the screen).
screen
- Global Screen to remove from the queue.Screen getActiveScreen()
int getScreenCount()
boolean isPaintingSuspended()
void pushGlobalScreen(Screen screen, int priority, int flags)
This method should be used instead of the old versions of pushGlobalScreen or queueStatus. All variants can be obtained using the appropriate combination of flags:
GLOBAL_MODAL -- block until the screen closes
GLOBAL_QUEUE -- insert the screen underneath global screens of equal priority
GLOBAL_SHOW_LOWER -- don't suppress the display of global screens with lower priority
screen
- A screen to enqueue.priority
- Priority of queued screen.flags
- One or more of GLOBAL_MODAL, GLOBAL_QUEUE, and GLOBAL_SHOW_LOWERvoid pushScreen(Screen screen)
This causes a layout and paint, so add required controls to the screen before pushing it. This method does not block.
Call UiEngine.popScreen(net.rim.device.api.ui.Screen)
to remove the screen.
screen
- Screen to push.void pushModalScreen(Screen screen)
Invoke this method to push a modal screen on to the
stack and paint it. This method does not return until you
invoke UiEngine.popScreen(net.rim.device.api.ui.Screen)
. You must invoke this method on
the event thread.
screen
- Screen to push.void popScreen(Screen screen)
screen
- Screen to remove.
IllegalArgumentException
- If your screen is not on
the stack.void queueStatus(Screen screen, int priority, boolean inputRequired)
If no other status screens are currently displayed, your provided screen appears immediately.
This method ensures that your provided screen is bitmap-based.
screen
- Bitmap-based screen to enqueue.priority
- Priority of queued screen.inputRequired
- True if queued screen requires user
input; otherwise, if the system will automatically dismiss
your screen, false.void repaint()
Invoke this method to repaint the entire display. It invalidates, and then paints, each screen on the display stack.
void relayout()
You can invoke this method when, for example, global UI settings change.
void pushGlobalScreen(Screen screen, int priority, boolean inputRequired)
If no other global screens are currently displayed, your provided screen appears immediately.
If a global screen is currently displayed, or the
set contains other global screens, this method uses your
provided priority
to determine when to
display your screen. If the priority of the currently displayed
screen is greater than or equal to the newly pushed screen then the
new screen will be shown.
This method ensures that your provided screen is bitmap-based.
screen
- Bitmap-based screen to enqueue.priority
- Priority of global screen.inputRequired
- True if queued screen requires user
input; otherwise, if the system will automatically dismiss
your screen, false.void suspendPainting(boolean suspend)
Normally, whenever a message is handled the screen gets repainted; you can invoke this method to prevent this.
suspend
- Specify true to suspend repainting; specify
false to re-enable repainting.
IllegalStateException
- if painting is reenabled
without previously being disabled.void updateDisplay()
Drawing on the back buffer is done with methods on the Graphics object returned from Screen.getGraphics(), and these will be clipped to the extent of the screen. Note that Screen.getGraphics() may in some circumstances return an off-screen buffer.
|
|||||||||
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