Methods Summary |
---|
void | addEmbeddedVideo(java.lang.Object video)Add embedded video player.
These are called by MMHelperImpl , whenever a video
player joins this canvas.
embeddedVideos.addElement(video);
|
private boolean | allowKey(int keyCode)Test to see if the given keyCode should be sent to
the application
if (!canvas.suppressKeyEvents) {
return true;
}
switch (KeyConverter.getGameAction(keyCode)) {
case -1:
// Invalid keycode, don't
// block this key.
return true;
case Canvas.UP:
case Canvas.DOWN:
case Canvas.LEFT:
case Canvas.RIGHT:
case Canvas.FIRE:
case Canvas.GAME_A:
case Canvas.GAME_B:
case Canvas.GAME_C:
case Canvas.GAME_D :
// don't generate key events for
// the defined game keys
return false;
default:
return true;
}
|
void | lCallShow()Prepare this CanvasLF to show.
Override the version in DisplayableLFImpl to perform layout.
int oldState = state;
super.lCallShow();
if (oldState != FROZEN) {
layout();
}
|
public void | lRepaint(int x, int y, int width, int height, java.lang.Object target)Notifies look &s; feel object that repaint of a (x, y, width, height)
area is needed.
SYNC NOTE: The caller of this method handles synchronization.
lRequestPaint(x, y, width, height);
|
public void | lRepaint()Notifies that repaint of the entire Canvas look &s; feel is
needed and should repaint the viewport area.
SYNC NOTE: The caller of this method handles synchronization.
lRequestPaint();
|
void | removeEmbeddedVideo(java.lang.Object video)Remove embedded video player.
This is called by MMHelperImpl , whenever a video
player leaves this canvas.
embeddedVideos.removeElement(video);
|
public void | uCallFreeze()Notify this Canvas that it is being frozen on the
given Display .
int oldState = state;
// Delete native resources including title and ticker
super.uCallFreeze();
// Notify canvas subclass after hiding the native resource
synchronized (Display.calloutLock) {
if (oldState == SHOWN) {
try {
canvas.hideNotify();
} catch (Throwable t) {
Display.handleThrowable(t);
}
}
}
|
public void | uCallHide()Notify this Canvas it is being hidden on the given Display
int oldState = state;
super.uCallHide();
// SYNC NOTE: Call into app code. So do it outside LUICDLock
synchronized (Display.calloutLock) {
if (oldState == SHOWN) {
try {
canvas.hideNotify();
if (mmHelper != null) {
for (Enumeration e = embeddedVideos.elements();
e.hasMoreElements();) {
mmHelper.hideVideo(e.nextElement());
}
}
} catch (Throwable t) {
Display.handleThrowable(t);
}
}
}
|
void | uCallKeyPressed(int keyCode)Handle a key press
if (allowKey(keyCode)) {
synchronized (Display.calloutLock) {
try {
canvas.keyPressed(keyCode);
} catch (Throwable t) {
Display.handleThrowable(t);
}
}
}
|
void | uCallKeyReleased(int keyCode)Handle a key release
if (allowKey(keyCode)) {
synchronized (Display.calloutLock) {
try {
canvas.keyReleased(keyCode);
} catch (Throwable t) {
Display.handleThrowable(t);
}
}
}
|
void | uCallKeyRepeated(int keyCode)Handle a repeated key press
if (allowKey(keyCode)) {
synchronized (Display.calloutLock) {
try {
canvas.keyRepeated(keyCode);
} catch (Throwable t) {
Display.handleThrowable(t);
}
}
}
|
public void | uCallPaint(Graphics g, java.lang.Object target)Paint this Canvas
synchronized (Display.LCDUILock) {
// SYNC NOTE: We assert the super function will not call into
// app code. So we can call it inside sync block.
super.lCallPaint(g, target);
// Optimize to not call paint at all
// when clipping is out of bound (relative to viewport)
if (g.getClipY() + g.getClipHeight() <= 0) {
return;
}
}
// We prevent the Canvas from drawing outside of the
// allowable viewport - such as over the command labels
// or over the theme area.
// We also need to preserve the original translation.
g.preserveMIDPRuntimeGC(0, 0, viewport[WIDTH], viewport[HEIGHT]);
// Reset the graphics context according to
// the spec. requirement. This is a must
// before we call canvas's paint(g) since
// the title or ticker drawing routines may
// change the GC before.
g.resetGC();
synchronized (Display.calloutLock) {
try {
canvas.paint(g);
// If there are any video players in this canvas,
// let the helper class invoke video rendering
// Update frames of any video players displayed on this Canvas
if (mmHelper != null) {
for (Enumeration e = embeddedVideos.elements();
e.hasMoreElements();) {
mmHelper.paintVideo(e.nextElement(), g);
}
}
} catch (Throwable t) {
Display.handleThrowable(t);
}
}
g.restoreMIDPRuntimeGC();
|
void | uCallPointerDragged(int x, int y)Handle a pointer drag event
synchronized (Display.calloutLock) {
try {
canvas.pointerDragged(x, y);
} catch (Throwable t) {
Display.handleThrowable(t);
}
}
|
void | uCallPointerPressed(int x, int y)Handle a pointer press event
synchronized (Display.calloutLock) {
try {
canvas.pointerPressed(x, y);
} catch (Throwable t) {
Display.handleThrowable(t);
}
}
|
void | uCallPointerReleased(int x, int y)Handle a pointer release event
synchronized (Display.calloutLock) {
try {
canvas.pointerReleased(x, y);
} catch (Throwable t) {
Display.handleThrowable(t);
}
}
|
public void | uCallShow()Notify this Canvas it is being shown on the given Display
// Check full screen mode and call lCallShow below
super.uCallShow();
// SYNC NOTE: Call into app code. So do it outside LUICDLock
synchronized (Display.calloutLock) {
try {
canvas.showNotify();
/* For MMAPI VideoControl in a Canvas */
if (mmHelper != null) {
for (Enumeration e = embeddedVideos.elements();
e.hasMoreElements();) {
mmHelper.showVideo(e.nextElement());
}
}
} catch (Throwable t) {
Display.handleThrowable(t);
}
}
|
public void | uServiceRepaints()Request serviceRepaints from current Display.
SYNC NOTE: No locking is held when
this function is called because Display.serviceRepaints()
needs to handle its own locking.
// Avoid locking by making a copy of currentDisplay
// -- an atomic operation -- before testing and using it.
Display d = currentDisplay;
if (d != null) {
d.serviceRepaints(this);
}
|