|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--net.rim.device.api.system.Application
|
+--net.rim.device.api.ui.UiApplication
Base class for all device applications that provide a user interface.
A UI application 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 a UI application 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.
| Constructor Summary | ||
protected |
UiApplication()
Constructs a new UI application. |
|
| Method Summary | ||
protected boolean |
acceptsForeground()
Determines if this application can function in the foreground. |
|
void |
dismissStatus(Screen screen)
Dismisses or removes a global status screen from the queue. |
|
Screen |
getActiveScreen()
Retrieves active displayed screen. |
|
int |
getScreenCount()
Retrieves the number of screens currently on the display stack. |
|
static UiApplication |
getUiApplication()
Retrieves this UI application object. |
|
boolean |
isPaintingSuspended()
Determines if repainting is currently suspended. |
|
void |
popScreen(Screen screen)
Removes a screen from the display stack, and updates the screen. |
|
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)
Adds a screen to the queue of displayed global status screens. |
|
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 for all the screens in this application. |
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
protected UiApplication()
This default constructor is called by UiApplication subclasses.
| Method Detail |
public final void suspendPainting(boolean suspend)
Normally, whenever a message is handled the screen gets repainted; you can invoke this method to prevent this.
suspendPainting in interface UiEnginesuspend - Specify true to suspend repainting; specify
false to re-enable repainting.IllegalStateException - if painting is reenabled
without previously being disabled.public final boolean isPaintingSuspended()
isPaintingSuspended in interface UiEnginepublic final void updateDisplay()
updateDisplay in interface UiEnginepublic final void pushScreen(Screen screen)
This method is non-blocking, and returns immediately; the screen remains on the stack. This will cause a layout and paint, so be sure to add all the controls to the screen before pushing it.
pushScreen in interface UiEnginescreen - Screen to push.public final 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 popScreen(Screen). You must invoke this method on
the event thread.
pushModalScreen in interface UiEnginescreen - Screen to push.public final void popScreen(Screen screen)
screen - Screen to remove.IllegalArgumentException - If your screen is not on
the stack.public final int getScreenCount()
getScreenCount in interface UiEnginepublic final Screen getActiveScreen()
Invoke this method to retrieve the topmost screen on the display stack (the currently active screen).
getActiveScreen in interface UiEnginepublic final void queueStatus(Screen screen, int priority, boolean inputRequired)
Global status screens appear on top of all other screens on the device, even if the current application is not in the foreground.
If no other status screens are currently displayed, your provided screen appears immediately.
If a status screen is currently displayed, or the queue contains other screens, this method uses your provided priority parameter to determine when to display your screen.
This method ensures that your provided screen is bitmap-based.
queueStatus in interface UiEnginescreen - Bitmap-based screen to enqueue.priority - Priority of queued screen. Lower values indicate a higher priority.inputRequired - True if queued screen requires user input;
otherwise, if the system will automatically dismiss your screen,
false.public final 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).
dismissStatus in interface UiEnginescreen - Status screen to remove from the status
queue.protected boolean acceptsForeground()
Note that, since all UI applications should be able to interact with the user, this method simply returns true.
acceptsForeground in class Applicationpublic static final UiApplication getUiApplication()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2002 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.