FileDocCategorySizeDatePackage
DisplayableLFImpl.javaAPI DocphoneME MR2 API (J2ME)37422Wed May 02 18:00:20 BST 2007javax.microedition.lcdui

DisplayableLFImpl

public class DisplayableLFImpl extends Object implements DisplayableLF
This is the look & feel implementation for Displayable.

Fields Summary
Display
currentDisplay
The current Display object
int[]
viewport
The viewport coordinates. Index 0: x origin coordinate (in the Display's coordinate space) Index 1: y origin coordinate (in the DIsplay's coordinate space) Index 2: width Index 3: height
boolean
invalidScroll
Signals that scroll has changed, and needs resetting. It is used by Form (or Alert) to reset the scroll. It should be false before paint can be performed. It is set to true if one of these conditions occurs: - viewport height has changed - viewport y has changed - traverse ot of the screen occurred - layout() occurred It is set back to false by the Form (or Alert)
boolean
defferedSizeChange
True, indicates that before being painted, this Displayable should be notified that its size has changed via uCallSizeChanged()
Displayable
owner
The owner of this view.
int
state
current state of DisplayableLF (HIDDEN, SHOWN, or FROZEN)
boolean
sawPointerPress
true, if a pointer press is in progress.
boolean
sawKeyPress
true, if a key press is in progress.
private int
stickyKeyMask
stores key code of the current key pressed at least once
private int
currentKeyMask
stores key code of the current key is currently down
boolean
pendingInvalidate
Used to indicate the invalidate is needed
static final int
X
Used as an index into the viewport[], for the x
static final int
Y
Used as an index into the viewport[], for the y
static final int
WIDTH
Used as an index into the viewport[], for the width
static final int
HEIGHT
Used as an index into the viewport[], for the height
static final int
HIDDEN
hidden state of DisplayableLF
static final int
SHOWN
shown state of DisplayableLF
static final int
FROZEN
frozen state of DisplayableLF
Constructors Summary
DisplayableLFImpl(Displayable d)
Creates DisplayableLF for the passed in Displayable.

param
d the Displayable object associated with this look &s; feel.

        owner = d;
        resetViewport();
    
Methods Summary
public intgetDisplayableHeight()
Calculate the height a displayable would occupy if it was to be displayed.

return
the height a displayable would occupy

        int h = 0;
        
        if (!owner.isInFullScreenMode) {
            h = ScreenSkin.HEIGHT - SoftButtonSkin.HEIGHT;
            
            if (owner.getTitle() != null) {
                h -= TitleSkin.HEIGHT;
            }
            if (owner.getTicker() != null) {
                h -= TickerSkin.HEIGHT;
            }
        } else {
            h = ScreenSkin.HEIGHT;
        }
        return h;
    
public intgetDisplayableWidth()
Calculate the width a displayable would occupy if it was to be displayed

return
the width a displayable would occupy

        int w = currentDisplay != null ?
            currentDisplay.getWindow().getBodyWidth() :
            ScreenSkin.WIDTH;
        return w;
    
public intgetVerticalScrollPosition()
Get the current vertical scroll position

return
int The vertical scroll position on a scale of 0-100

        return 0;
    
public intgetVerticalScrollProportion()
Get the current vertical scroll proportion

return
ing The vertical scroll proportion on a scale of 0-100

        // SYNC NOTE: return of atomic value
        return 100;
    
public voidlAddCommand(Command cmd, int i)
Notifies look & feel object of a command addition to the Displayable. SYNC NOTE: The caller of this method handles synchronization.

param
cmd the command that was added
param
i the index of the added command in Displayable.commands[] array

        updateCommandSet();
    
voidlCallFreeze()
While UI resources of this LF are created and visible already, stop any further updates to physical screen because some "system modal dialog" takes over physical screen buffer and user input now or foreground is lost. Repaint and invalidate requests from this DisplayableLF will be really scheduled into event queue. Instead, only dirty flag is set. After a LF enters "freeze" mode, it can be resumed of visibility or directly replaced by a new Displayable. This function simply sets this DisplayableLF to HIDDEN state.

        if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
            Logging.report(Logging.INFORMATION, 
                           LogChannels.LC_HIGHUI_FORM_LAYOUT,
                           "# in DisplayableLFImpl: lCallFreeze");        
        }
        state = FROZEN;
    
voidlCallHide()
Remove this displayable from physical screen. The displayable should unload any resource that was allocated. It's not required to clean the physical screen before this function returns. This function could be called while a LF is in "freeze" mode.

This function simply sets this DisplayableLF to HIDDEN state.

        if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
            Logging.report(Logging.INFORMATION, 
                           LogChannels.LC_HIGHUI_FORM_LAYOUT,
                           "# in DisplayableLFImpl: lCallHide");        
        }

        state = HIDDEN;
    
voidlCallPaint(Graphics g, java.lang.Object target)
Display calls this method on it's current Displayable. Displayable uses this opportunity to do necessary stuff on the Graphics context, this includes, paint Ticker, paint Title, translate as necessary.

The target Object of this repaint may be some Object initially set by this Displayable when the repaint was requested - allowing this Displayable to know exactly which Object it needs to call to service this repaint, rather than potentially querying all of its Objects to determine the one(s) which need painting. SYNC NOTE: The caller of this method handles synchronization.

param
g the graphics context to paint into.
param
target the target Object of this repaint

        if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
            Logging.report(Logging.INFORMATION, 
                           LogChannels.LC_HIGHUI_FORM_LAYOUT,
                           "# in DisplayableLFImpl: lCallPaint");        
        }
    
voidlCallShow()
Prepare to show this LF on physical screen. This is the internal version of showNotify() function as defined in MIDP spec. It is called immediately prior to this LF being made visible on the display. The LF should load any resource that is needed, layout. App's paint() should NOT be called in this function. Instead, it should be in the uCallPaint() that will be called on this LF shortly after. This function sets this DisplayableLF to SHOWN state.


        if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
            Logging.report(Logging.INFORMATION, 
                           LogChannels.LC_HIGHUI_FORM_LAYOUT,
                           "# in DisplayableLFImpl: lCallShow");        
        }

        // This will suppress drags, repeats and ups until a
        // corresponding down is seen.
        sawPointerPress = sawKeyPress = false;

        // IMPL_NOTE: Move this to CanvasLFImpl
        // set mapping between GameCanvas and DisplayAccess
        // set Game key event flag based on value passed in
        // GameCanvas constructor.
        if (owner instanceof GameCanvas) {
            GameMap.registerDisplayAccess(owner, currentDisplay.accessor);
            stickyKeyMask = currentKeyMask = 0;
        } else {
            // set the keymask to -1 when
            // the displayable is not a GameCanvas.
            stickyKeyMask = currentKeyMask = -1;
        }
                
        // Setup scroll bar
        currentDisplay.setVerticalScroll(getVerticalScrollPosition(),
                                         getVerticalScrollProportion());
        state = SHOWN;

    
public voidlCommitPendingInteraction()
Called to commit any pending user interaction for the current item.

 
public DisplaylGetCurrentDisplay()
Return the Display instance in which the LF is currently shown.

return
the current Display.

        return currentDisplay;
    
public DisplayablelGetDisplayable()
Return the associated Displayable object.

return
the Displayable.

        return owner;
    
public intlGetHeight()
Returns the height of the area available to the application.

return
height of the area available to the application


        // NOTE: If we update the viewport size in all cases we change
        // the displayable's size then we needn't to update it inside
        // the method.  So we need to investigate removing
        // 'resetViewport()' below.

        resetViewport();
        return viewport[HEIGHT];
    
public intlGetWidth()
Returns the width of the area available to the application.

return
width of the area available to the application


        // NOTE: If we update the viewport size in all cases we change
        // the displayable's size then we needn't to update it inside
        // the method.  So we need to investigate removing
        // 'resetViewport()' below.

        resetViewport();
        return viewport[WIDTH];
    
public booleanlIsShown()
Implement public API isShown().

return
true if current DisplayableLF is interactive with user.

        return !(currentDisplay == null) && currentDisplay.isShown(this);
    
public voidlRemoveCommand(Command cmd, int i)
Notifies look & feel object of a command removal from the Displayable. SYNC NOTE: The caller of this method handles synchronization.

param
cmd the command that was removed
param
i the index of the removed command in Displayable.commands[] array

        updateCommandSet();
    
voidlRequestInvalidate()
Called to schedule an "invalidate" for this Displayable. Invalidation is caused by things like size changes, content changes, or spontaneous traversal within the Displayable. SYNC NOTE: Caller should hold LCDUILock.

        if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
            Logging.report(Logging.INFORMATION, 
                           LogChannels.LC_HIGHUI_FORM_LAYOUT,
                           "# in DisplayableLFImpl: invalidate");
        }

        pendingInvalidate = true;

        if (state == SHOWN && currentDisplay != null) {
            currentDisplay.invalidate();
            invalidScroll = true;
        }
    
voidlRequestPaint(int x, int y, int width, int height)
Request to paint this Displayable.

param
x The x coordinate of the region to repaint
param
y The y coordinate of the region to repaint
param
width The width of the region to repaint
param
height The height of the region to repaint

        if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
            Logging.report(Logging.INFORMATION, 
                           LogChannels.LC_HIGHUI_FORM_LAYOUT,
                           "# in DisplayableLFImpl: lRequestPaint");        
        }

        // Note: Display will not let anyone but the current
        // Displayable schedule repaints
        if (lIsShown()) {
            currentDisplay.repaintImpl(this, 
                                       x, y, width, height,
                                       null);
        }
    
voidlRequestPaint()
Request to paint all of this Displayable. This is the same as calling lRequestPaint(0, 0, viewport[WIDTH], viewport[HEIGHT], null)

        if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
            Logging.report(Logging.INFORMATION, 
                           LogChannels.LC_HIGHUI_FORM_LAYOUT,
                           "# in DisplayableLFImpl: lRequestPaint");        
        }

        lRequestPaint(0, 0, viewport[WIDTH], viewport[HEIGHT]);
    
public voidlSetDisplay(Display d)
Set the display instance the Displayable is associated with. Caller should hold LCDUILock around this call.

param
d Display instance in which this DisplayableLF is visible. null if this DisplayableLF is no longer visible.

        // ASSERT(d == null || currentDisplay == null)
        currentDisplay = d;
    
public voidlSetTicker(Ticker oldTicker, Ticker newTicker)
Notifies Displayable's look & feel object of a ticker change. SYNC NOTE: The caller of this method handles synchronization.

param
oldTicker the old ticker, or null for no ticker
param
newTicker the new ticker, or null for no ticker

        Display d = lGetCurrentDisplay();
        if (d != null) {
            d.lSetTicker(this, newTicker);
        }
        if (newTicker != null) {
            newTicker.tickerLF.lSetOwner(this);            
        }
        // Displayable area size may be affected by the presence or
        // absence of the ticker so we need to update the viewport
        resetViewport();
    
public voidlSetTitle(java.lang.String oldTitle, java.lang.String newTitle)
Notifies Displayable's look & feel object of a title change. SYNC NOTE: The caller of this method handles synchronization.

param
oldTitle the old title, or null for no title
param
newTitle the new title, or null for no title

        Display d = lGetCurrentDisplay();
        if (d != null) {
            d.lSetTitle(this, newTitle);
        }
        // Displayable area size may be affected by the presence or
        // absence of the title so we need to update the viewport
        resetViewport();
    
voidlayout()
Perform any necessary layout, and update the viewport as necessary

        resetViewport();
    
private voidreleaseKeyMask(int keyCode)
IMPL_NOTE: Move this to CanvasLFImpl. Called to release key mask of all the keys that were release.

param
keyCode The key code to release the key mask.


        // set the mask of keys pressed 
        switch (KeyConverter.getGameAction(keyCode)) {
        case Canvas.UP:
            currentKeyMask = currentKeyMask & ~ GameCanvas.UP_PRESSED;
            break;
        case Canvas.DOWN:
            currentKeyMask = currentKeyMask & ~ GameCanvas.DOWN_PRESSED;
            break;
        case Canvas.LEFT:
            currentKeyMask = currentKeyMask & ~ GameCanvas.LEFT_PRESSED;
            break;
        case Canvas.RIGHT:
            currentKeyMask = currentKeyMask & ~ GameCanvas.RIGHT_PRESSED;
            break;
        case Canvas.FIRE:
            currentKeyMask = currentKeyMask & ~ GameCanvas.FIRE_PRESSED;
            break;
        case Canvas.GAME_A:
            currentKeyMask = currentKeyMask & ~ GameCanvas.GAME_A_PRESSED;
            break;
        case Canvas.GAME_B:
            currentKeyMask = currentKeyMask & ~ GameCanvas.GAME_B_PRESSED;
            break;
        case Canvas.GAME_C:
            currentKeyMask = currentKeyMask & ~ GameCanvas.GAME_C_PRESSED;
            break;
        case Canvas.GAME_D:
            currentKeyMask = currentKeyMask & ~ GameCanvas.GAME_D_PRESSED;
            break;
        default:
            // no key mask should be set
            break;
        }
    
private voidresetViewport()
By default, the viewport array is configured to be at origin 0,0 with width and height set depending on the full screen mode setting.

        // setup the default viewport, the size of the Display
        if (viewport == null) {
            viewport = new int[4];
        }

        viewport[WIDTH] = getDisplayableWidth();
        viewport[HEIGHT] = getDisplayableHeight();
    
private voidsetKeyMask(int keyCode)
IMPL_NOTE: Move this to CanvasLFImpl. Called to set key mask of all the keys that were pressed.

param
keyCode The key code to set the key mask.


        // set the mask of keys pressed 
        switch (KeyConverter.getGameAction(keyCode)) {
        case Canvas.UP:
            stickyKeyMask = stickyKeyMask | GameCanvas.UP_PRESSED;
            currentKeyMask = currentKeyMask | GameCanvas.UP_PRESSED;
            break;
        case Canvas.DOWN:
            stickyKeyMask = stickyKeyMask | GameCanvas.DOWN_PRESSED;
            currentKeyMask = currentKeyMask | GameCanvas.DOWN_PRESSED;
            break;
        case Canvas.LEFT:
            stickyKeyMask = stickyKeyMask | GameCanvas.LEFT_PRESSED;
            currentKeyMask = currentKeyMask | GameCanvas.LEFT_PRESSED;
            break;
        case Canvas.RIGHT:
            stickyKeyMask = stickyKeyMask | GameCanvas.RIGHT_PRESSED;
            currentKeyMask = currentKeyMask | GameCanvas.RIGHT_PRESSED;
            break;
        case Canvas.FIRE:
            stickyKeyMask = stickyKeyMask | GameCanvas.FIRE_PRESSED;
            currentKeyMask = currentKeyMask | GameCanvas.FIRE_PRESSED;
            break;
        case Canvas.GAME_A:
            stickyKeyMask = stickyKeyMask | GameCanvas.GAME_A_PRESSED;
            currentKeyMask = currentKeyMask | GameCanvas.GAME_A_PRESSED;
            break;
        case Canvas.GAME_B:
            stickyKeyMask = stickyKeyMask | GameCanvas.GAME_B_PRESSED;
            currentKeyMask = currentKeyMask | GameCanvas.GAME_B_PRESSED;
            break;
        case Canvas.GAME_C:
            stickyKeyMask = stickyKeyMask | GameCanvas.GAME_C_PRESSED;
            currentKeyMask = currentKeyMask | GameCanvas.GAME_C_PRESSED;
            break;
        case Canvas.GAME_D:
            stickyKeyMask = stickyKeyMask | GameCanvas.GAME_D_PRESSED;
            currentKeyMask = currentKeyMask | GameCanvas.GAME_D_PRESSED;
            break;
        default:
            // no mask should be set
            break;
        }
    
public voiduCallFreeze()
Stop any further updates to physical screen because some "system modal dialog" takes over physical screen buffer and user input now or foreground is lost. This function simply calls lCallFreeze after obtaining LCDUILock.

        if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
            Logging.report(Logging.INFORMATION, 
                           LogChannels.LC_HIGHUI_FORM_LAYOUT,
                           "# in DisplayableLFImpl: uCallFreeze");        
        }

        synchronized (Display.LCDUILock) {
            lCallFreeze();
        }
    
public voiduCallHide()
Remove this displayable from physical screen. This function simply calls lCallHide() after obtaining LCDUILock.

        if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
            Logging.report(Logging.INFORMATION, 
                           LogChannels.LC_HIGHUI_FORM_LAYOUT,
                           "# in DisplayableLFImpl: uCallHide");        
        }

        synchronized (Display.LCDUILock) {
            lCallHide();
        }
    
public voiduCallInvalidate()
Called by the event handler to perform an invalidation of this Displayable

        
        if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
            Logging.report(Logging.INFORMATION, 
                           LogChannels.LC_HIGHUI_FORM_LAYOUT,
                           "# in DisplayableLFImpl: uCallInvalidate");        
        }

        // SYNC NOTE: It is safe to obtain a lock here because
        // the only subclass that can call into the app code in layout()
        // is FormLFImpl and it overrides uCallInvalidate()

        synchronized (Display.LCDUILock) {
            pendingInvalidate = false;

            layout();
        }
    
public voiduCallKeyEvent(int type, int keyCode)
Handle a raw key event from Display.

param
type - key event type.
param
keyCode - the key involved in this key event.

        int eventType = -1;

        synchronized (Display.LCDUILock) {

            switch (type) {
                case EventConstants.PRESSED:
                    sawKeyPress = true;
                    eventType = 0;
                    break;
                case EventConstants.RELEASED:
                    if (sawKeyPress) {
                        eventType = 1;
                    }
                    break;
                case EventConstants.REPEATED:
                    if (sawKeyPress) {
                        eventType = 2;
                    }
                    break;
                default:
                    // wrong key type will be handled below
                    break;
            }
            // used later by getKeyMask()
            if (currentKeyMask > -1 && eventType != -1) {
                if (eventType == 1) {
                    releaseKeyMask(keyCode);
                } else {
                    // set the mask on key press, repeat or type.
                    // don't set the mask when a key was released.
                    setKeyMask(keyCode);
                }
            }
        } // synchronized

        // SYNC NOTE: Since we may call into application code,
        // we do so outside of LCDUILock
        switch (eventType) {
        case 0:
            uCallKeyPressed(keyCode);
            break;
        case 1:
            uCallKeyReleased(keyCode);
            break;
        case 2:
            uCallKeyRepeated(keyCode);
            break;
        default:
            /*
             * TBD:
             *
             * Originally severity level was "ERROR". 
             * But it was reduced to INFO because 
             * a). it do not harm to the system
             * b). some cases, 
             *     Displayable processes KEY_PRESS events
             *     (when in system menu) & cleans all related status flag, 
             *     while following KEY_REPEAT & KEY_RELEASE event pairs
             *     are not processed in the same way and therefore
             *     this eror messae was printed or them.
             *
             * As a temporary solution it was decided to disable messages 
             * insead of additional event filtering.
             */
            if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
                Logging.report(Logging.INFORMATION, LogChannels.LC_HIGHUI,
                               "DisplayableLFImpl: uCallKeyEvent," +
                               "type=" +type+ " keyCode=" +keyCode);
            }
            break;
        }
    
voiduCallKeyPressed(int keyCode)
Handle a key press

param
keyCode The key that was pressed

 
voiduCallKeyReleased(int keyCode)
Handle a key release

param
keyCode The key that was released

 
voiduCallKeyRepeated(int keyCode)
Handle a repeated key press

param
keyCode The key that was pressed

 
public voiduCallPaint(Graphics g, java.lang.Object target)
Display calls this method on it's current Displayable. This function simply calls lCallPaint() after obtaining LCDUILock.

param
g the graphics context to paint into.
param
target the target Object of this repaint

        if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
            Logging.report(Logging.INFORMATION, 
                           LogChannels.LC_HIGHUI_FORM_LAYOUT,
                           "# in DisplayableLFImpl: uCallPaint");        
        }

        synchronized (Display.LCDUILock) {
            lCallPaint(g, target);
        }
    
voiduCallPointerDragged(int x, int y)
Handle a pointer drag event

param
x The x coordinate of the drag
param
y The y coordinate of the drag

 
public voiduCallPointerEvent(int type, int x, int y)
Called from the event delivery loop when a pointer event is seen.

param
type kind of pointer event
param
x x-coordinate of pointer event
param
y y-coordinate of pointer event

        int eventType = -1;

        synchronized (Display.LCDUILock) {
            switch (type) {
                case EventConstants.PRESSED:
                    sawPointerPress = true;
                    eventType = 0;
                    break;
                case EventConstants.RELEASED:
                    if (sawPointerPress) {
                        eventType = 1;
                    }
                    break;
                case EventConstants.DRAGGED:
                    if (sawPointerPress) {
                        eventType = 2;
                    }
                    break;
                default:
                    // will be handled below
                    break;
            }
        } // synchronized

        // SYNC NOTE: Since we may call into application code,
        // we do so outside of LCDUILock
        switch (eventType) {
        case 0:
            uCallPointerPressed(x, y);
            break;
        case 1:
            uCallPointerReleased(x, y);
            break;
        case 2:
            uCallPointerDragged(x, y);
            break;
        default:
            if (sawPointerPress) {
                Logging.report(Logging.ERROR, LogChannels.LC_HIGHUI,
                               "DisplayableLFImpl: uCallPointerEvent," +
                               " type=" +type+ " x=" +x+ " y=" +y);
            }
            break;
        }
    
voiduCallPointerPressed(int x, int y)
Handle a pointer press event

param
x The x coordinate of the press
param
y The y coordinate of the press

 
voiduCallPointerReleased(int x, int y)
Handle a pointer release event

param
x The x coordinate of the release
param
y The y coordinate of the release

 
public voiduCallScrollContent(int scrollType, int thumbPosition)
This method notify displayable to scroll its content

param
scrollType scrollType
param
thumbPosition

        // by default nothing to do 
    
public voiduCallShow()
Prepare to show this LF on physical screen. This function simply calls lCallShow() after obtaining LCDUILock.


        boolean copyDefferedSizeChange;

        if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
            Logging.report(Logging.INFORMATION,
                    LogChannels.LC_HIGHUI_FORM_LAYOUT,
                    "# in DisplayableLFImpl: uCallShow");
        }

        synchronized (Display.LCDUILock) {

            // Assure correct screen mode
            currentDisplay.lSetFullScreen(owner.isInFullScreenMode);
            copyDefferedSizeChange = defferedSizeChange;
            defferedSizeChange = false;
        }

        if (copyDefferedSizeChange) {
            synchronized (Display.calloutLock) {
                try {
                    owner.sizeChanged(viewport[WIDTH], viewport[HEIGHT]);
                } catch (Throwable t) {
                    Display.handleThrowable(t);
                }
            }
        }
        synchronized (Display.LCDUILock) {
            // Do the internal show preparation
            lCallShow();
            if (pendingInvalidate || copyDefferedSizeChange) {
                lRequestInvalidate();
            }
        }
    
public voiduCallSizeChanged(int w, int h)
Package private equivalent of sizeChanged()

param
w the new width
param
h the new height

        
        
        boolean copyDefferedSizeChange;

        synchronized (Display.LCDUILock) {
            if (owner instanceof GameCanvas) {
                GameCanvasLFImpl gameCanvasLF =
                    GameMap.getGameCanvasImpl((GameCanvas)owner);
                if (gameCanvasLF != null) {
                    gameCanvasLF.lCallSizeChanged(w, h);
                }
            }
  
            // If there is no Display, or if this Displayable is not
            // currently visible, we simply record the fact that the
            // size has changed
            defferedSizeChange = (state != SHOWN);
            copyDefferedSizeChange = defferedSizeChange;

            /*
            * sizeChangeOccurred is a boolean which (when true) indicates
            * that sizeChanged() will be called at a later time. So, if it
            * is false after calling super(), we go ahead and notify the
            * Canvas now, rather than later
            */

            resetViewport();

            if (!defferedSizeChange) {
                lRequestInvalidate();
            }

        }
        if (!copyDefferedSizeChange) {
            synchronized (Display.calloutLock) {
                try {
                    owner.sizeChanged(w, h);
                } catch (Throwable t) {
                    Display.handleThrowable(t);
                }
            }
        }

    
public intuGetKeyMask()
\Need revisit Move this to CanvasLFImpl. Called to get key mask of all the keys that were pressed.

return
keyMask The key mask of all the keys that were pressed.

        synchronized (Display.LCDUILock) {
            // don't release currently pressed keys
            int savedMaskCopy = stickyKeyMask | currentKeyMask;
            stickyKeyMask = 0;
            return savedMaskCopy;
        }
    
public booleanuIsScrollNative()
This method is used int repaint, int order to determine the translation of the draw coordinates.

return
true if the scroll responsibility is of the native platform. false - if the scroll is done in the Java level.

        // only native form overrides this and returns true
        return false;
    
voiduRequestPaint(int x, int y, int width, int height)
Request to paint this Displayable (without holding a lock).

param
x The x coordinate of the region to repaint
param
y The y coordinate of the region to repaint
param
width The width of the region to repaint
param
height The height of the region to repaint

        synchronized (Display.LCDUILock) {
            lRequestPaint(x, y, width, height);
        }
    
voiduRequestPaint()
Request to paint all of this Displayable (without holding a lock).

        synchronized (Display.LCDUILock) {
            lRequestPaint();
        }
    
public voiduSetFullScreenMode(boolean mode)
Notifies look and feel object of a full screen mode change. If true, this DisplayableLF will take up as much screen real estate as possible.

param
mode - if true displayable should be displayed without title, ticker, etc.; if false - otherwise

        boolean requestRepaint = false;
        
        synchronized (Display.LCDUILock) {
            if (lIsShown()) {
                // IMPL_NOTE: Notify MainWindow of screen mode change
                
                // currentDisplay is not null when lIsShown is true
                currentDisplay.lSetFullScreen(mode);
                
                layout();
                updateCommandSet();
                requestRepaint = true;
                
            } else {
                // Layout needs to happen even if the canvas is not visible
                // so that correct width and height could be returned 
                // in getWidth() and getHeight()
                layout();
            }  
        } 

        // app's sizeChanged has to be called before repaint
        synchronized (Display.LCDUILock) {
            if (requestRepaint) {
                lRequestPaint();
            }
        }
    
public booleanuSetRotatedStatus(boolean newStatus)
Set status of screen rotation

param
newStatus
return

        synchronized (Display.LCDUILock) {
            if (newStatus == owner.isRotated) {
                return false;
            } else {
                owner.isRotated = newStatus;
                return true;
            }
        }
    
public voidupdateCommandSet()
Updates command set if this Displayable is visible. SYNC NOTE: Caller should hold LCDUILock.

        if (state == SHOWN && currentDisplay != null) {
            currentDisplay.updateCommandSet();
        }