|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.motorola.iden.lcdui.ExternalDisplay
ExternalDisplay represents the manager of the external display
and input devices of the system when the external display is active.
It includes methods for retrieving properties of the
device and for requesting that objects be displayed on the device.
There is exactly one instance of Display per
ExtDisplayEventHandler
and the
application can get a reference to that instance by calling the
getDisplay()
method. The application may call the getDisplay() method from
anywhere until the
destroyApp()
call returns. The ExternalDisplay object returned by all calls
to getDisplay() will remain the same during this time.
The user interface objects that are shown on the external display device are
contained within a Displayable
object. At any time the application may have at most one Displayable
object that it intends to be shown on the external display device and
through which user interaction occurs. This Displayable is referred
to as the current Displayable.
The ExternalDisplay class has a method for setting the current
Displayable
and a
getCurrent()
method for
retrieving the current Displayable. The application has control over
its current Displayable and may call setCurrent() at any time.
Typically, the application will change the current Displayable in
response to some user action. This is not always the case, however.
Another thread may change the current Displayable in response to
some other stimulus. The current Displayable will also be changed
when the timer for an Alert
elapses.
The implementation only supports two types of Displayables. The supported
Displayables are Alert and Canvas. If the method
setCurrent(Displayable)
is called with a reference to a Displayable other than any of the
supported types, the request to change the Displayable will be ignored.
The current Displayable is always significant, even for applications
that do not have control over the external display device. The current Displayable
is always the one that will be shown when the application gains control
over the external display device. An application can determine whether
a Displayable is actually visible on the display by calling
isShown()
. In the case of Canvas,
the showNotify()
and hideNotify()
methods are called when the Canvas is made visible and is hidden, respectively.
ExtDisplayEventHandler
,
javax.microedition.lcdui.Display
Method Summary | |
Displayable |
getCurrent()
Gets the current Displayable object associated with the external display for this MIDlet. |
static ExternalDisplay |
getDisplay(MIDlet m)
Gets the ExternalDisplay object that is unique to this MIDlet. |
boolean |
getFlipState()
Returns what the current state of the flip is. |
static int |
getHeight()
Retrives the External Display's width |
static int |
getWidth()
Retrives the External Display's width |
boolean |
isColor()
Gets information about color support of the device. |
int |
numColors()
Gets the number of colors (if isColor() is
true) or graylevels (if isColor() is
false) that can be represented on the device. |
void |
releaseDisplay()
Tells the AMS that the midlet no longer needs access to the External Display. |
void |
requestDisplay()
Requests to the AMS to gain access to the external display. |
void |
setCurrent(Alert alert,
Displayable nextDisplayable)
Requests that alert be made current, and that nextDisplayable be made current after the Alert is dismissed. |
void |
setCurrent(Displayable next)
Requests that a different Displayable object be made visible on the external display. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public void requestDisplay()
When the Displayable associated with the ExternalDisplay is a Canvas the Displayable is notified it has gained focus to the external Display by having it's showNotify called. There is no guarantee as to when if ever in the future the request shall be granted to the application.
If the Displayable associated with the ExternalDisplay is an Alert, the AMS shall try it's best to alert the user at the earliest opportunity it can.
public void releaseDisplay()
When the Displayable associated with the ExternalDisplay is a Canvas the Displayable is notified it has lost focus to the external Display by having it's hideNotify called.
public boolean getFlipState()
public static int getWidth()
public static int getHeight()
public Displayable getCurrent()
isShown()
method may be called to determine whether the Displayable
is actually visible on the Display. The value returned by getCurrent() may be null. This occurs after the application has been initialized but before the first call to setCurrent().
public static ExternalDisplay getDisplay(MIDlet m)
m
- the midlet that this ExternalDisplay object belongs to
java.lang.NullPointerException
- if m is nullpublic boolean isColor()
public int numColors()
isColor()
is
true) or graylevels (if isColor()
is
false) that can be represented on the device.Note that number of colors for black and white display is 2.
public void setCurrent(Alert alert, Displayable nextDisplayable)
In other respects, this method behaves identically to
setCurrent(Displayable)
.
alert
- the Alert to be shownnextDisplayable
- the Displayable to be shown after this Alert is
dismissed
java.lang.NullPointerException
- if alert or
nextDisplayable is null
java.lang.IllegalArgumentException
- if nextDisplayable is an
Alert
java.lang.IllegalArgumentException
- if nextDisplayable is not
a subclass of ExternalDisplayCanvasAlert
public void setCurrent(Displayable next)
Calls to setCurrent() are not queued. A delayed request made by a setCurrent() call may be superseded by a subsequent call to setCurrent(). For example, if screen S1 is current, then
d.setCurrent(S2);
d.setCurrent(S3);
may eventually result in S3 being made current, bypassing S2 entirely.
When a MIDlet application is first started, there is no current Displayable object. It is the responsibility of the application to ensure that a Displayable is visible and can interact with the user at all times. Therefore the application should always call setCurrent() as part of its initialization.
If the Displayable passed to setCurrent() is an
Alert
, the
previous Displayable is restored after the Alert has been dismissed. The
effect is as if setCurrent(Alert, getCurrent()) had been called. Note
that this will result in an exception being thrown if the current
Displayable is already an alert. To specify the screen to be shown
after an Alert is dismissed, the application should use
setCurrent(Alert, Displayable)
.
If the Displayable passed to setCurrent() is not of type
ExternalDisplayCanvas
then an IllegalArgumentException shall be thrown, due to the fact that the
ExternalDisplay class only supports a displayable of ExternalDisplayCanvas.
next
- the Displayable requested to be made current
java.lang.NullPointerException
- if next is null
java.lang.IllegalArgumentException
- if next is not
a subclass of ExternalDisplayCanvas
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |