org.kobjects.kui
Class KDisplay

java.lang.Object
  extended by Canvas
      extended by org.kobjects.kui.KDisplay
All Implemented Interfaces:
java.lang.Runnable, KCommandListener

public class KDisplay
extends Canvas
implements java.lang.Runnable, KCommandListener

KDisplay is a singleton class.


Field Summary
static int BORDER
           
static int CANVAS_HEIGHT
           
static int CANVAS_WIDTH
           
static int COMMAND_HEIGHT
          0 if commands are handled by the system, command font height otherwise
static int CONTENT_WIDTH
           
static java.lang.String DELETE_SK
           
static boolean fakeFullscreen
          Assume fullscreen mode although CanvasSwitch is not loadable (for SE P 900, 910)
static boolean fullScreenMode
           
static int ICON_ARROW_OFF
           
static int ICON_ARROW_ON
           
static int ICON_BULLET
           
static int ICON_DOWN_OFF
           
static int ICON_DOWN_ON
           
static int ICON_LEFT_RIGHT_OFF
           
static int ICON_LEFT_RIGHT_ON
           
static int ICON_UP_OFF
           
static int ICON_UP_ON
           
static KDisplay instance
           
static int KEYCODE_CLEAR
          Normalized key code for the clear key
static int KEYCODE_LSK
          Normalized key code for the left soft key
static int KEYCODE_RSK
          Normalized key code for the right soft key
static Image logo
           
static Display midpDisplay
           
static int percent
           
static java.lang.String PLATFORM
           
static Form repaintTimeoutForm
           
static int STYLE_BUTTON
           
static int STYLE_COMMAND
           
static int STYLE_CONTENT
           
static int STYLE_EDIT
           
static int STYLE_ITEM
           
static int STYLE_POPUP
           
static int STYLE_TITLE
           
static int SYMBOL_COUNT
           
static int SYMBOL_HEIGHT
           
static int SYMBOL_WIDTH
           
static Image SYMBOLS
           
static boolean widescreen
           
 
Constructor Summary
KDisplay()
           
 
Method Summary
 void commandAction(Command command, java.lang.Object source)
          Internal implementation for alert handling, please do not use
static KForm createAlert(java.lang.String title, java.lang.String text, Image image)
          Creates an alert form
static void debug(int i, java.lang.String text)
           
static void drawIcon(Graphics g, Image img, int x, int y, int index, int countX, int countY)
           
static java.lang.Object getCurrent()
          Returns the current form or displayable.
 Display getDisplay()
          Returns the underlying LCUDI display instance
static KDisplay getDisplay(MIDlet midlet)
          Returns the display instance.
 Style getStyle(int index)
           
static boolean isPositiveCommand(Command cmd)
          Determines whether the given Command is a "positive" (OK, ITEM, SCREEN) or "negative" (CANCEL, BACK, STOP, EXIT) command.
protected  void keyPressed(int keyCode)
           
protected  void keyReleased(int keyCode)
           
protected  void keyRepeated(int keyCode)
           
static Image loadResImage(java.lang.String fileName)
           
 int normalizeKey(int keyCode)
          Normalizes device dependent key codes to the corresponding WTK values.
protected  void paint(Graphics graphics)
          Internal method; draws the current KForm, popup, wait notification etc.
static void popup(java.lang.String text, int time)
          Displays a popup for the given time
static void requestRepaint()
          Requests a repaint; internal method, called by KForm.repaint()
 void run()
          Internal implementation for timer handling and for screen updates, please do not use
 java.lang.Object setCurrent(java.lang.Object scr)
          Sets the current form or displayable.
static void setPercent(int amount, java.lang.String message)
          Grays out the current screen contents and displays a percent bar and the message (optional) on top.
 void setStyle(int index, Style style)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEYCODE_LSK

public static final int KEYCODE_LSK
Normalized key code for the left soft key

See Also:
Constant Field Values

KEYCODE_RSK

public static final int KEYCODE_RSK
Normalized key code for the right soft key

See Also:
Constant Field Values

KEYCODE_CLEAR

public static final int KEYCODE_CLEAR
Normalized key code for the clear key

See Also:
Constant Field Values

PLATFORM

public static java.lang.String PLATFORM

DELETE_SK

public static java.lang.String DELETE_SK

instance

public static KDisplay instance

midpDisplay

public static Display midpDisplay

percent

public static int percent

logo

public static Image logo

repaintTimeoutForm

public static Form repaintTimeoutForm

SYMBOLS

public static final Image SYMBOLS

ICON_DOWN_ON

public static final int ICON_DOWN_ON
See Also:
Constant Field Values

ICON_UP_ON

public static final int ICON_UP_ON
See Also:
Constant Field Values

ICON_DOWN_OFF

public static final int ICON_DOWN_OFF
See Also:
Constant Field Values

ICON_UP_OFF

public static final int ICON_UP_OFF
See Also:
Constant Field Values

ICON_LEFT_RIGHT_ON

public static final int ICON_LEFT_RIGHT_ON
See Also:
Constant Field Values

ICON_LEFT_RIGHT_OFF

public static final int ICON_LEFT_RIGHT_OFF
See Also:
Constant Field Values

ICON_ARROW_OFF

public static final int ICON_ARROW_OFF
See Also:
Constant Field Values

ICON_ARROW_ON

public static final int ICON_ARROW_ON
See Also:
Constant Field Values

ICON_BULLET

public static final int ICON_BULLET
See Also:
Constant Field Values

STYLE_CONTENT

public static final int STYLE_CONTENT
See Also:
Constant Field Values

STYLE_ITEM

public static final int STYLE_ITEM
See Also:
Constant Field Values

STYLE_EDIT

public static final int STYLE_EDIT
See Also:
Constant Field Values

STYLE_BUTTON

public static final int STYLE_BUTTON
See Also:
Constant Field Values

STYLE_TITLE

public static final int STYLE_TITLE
See Also:
Constant Field Values

STYLE_COMMAND

public static final int STYLE_COMMAND
See Also:
Constant Field Values

STYLE_POPUP

public static final int STYLE_POPUP
See Also:
Constant Field Values

SYMBOL_COUNT

public static final int SYMBOL_COUNT
See Also:
Constant Field Values

SYMBOL_WIDTH

public static final int SYMBOL_WIDTH

SYMBOL_HEIGHT

public static final int SYMBOL_HEIGHT

fakeFullscreen

public static boolean fakeFullscreen
Assume fullscreen mode although CanvasSwitch is not loadable (for SE P 900, 910)


fullScreenMode

public static boolean fullScreenMode

CANVAS_HEIGHT

public static int CANVAS_HEIGHT

CANVAS_WIDTH

public static int CANVAS_WIDTH

CONTENT_WIDTH

public static int CONTENT_WIDTH

COMMAND_HEIGHT

public static int COMMAND_HEIGHT
0 if commands are handled by the system, command font height otherwise


BORDER

public static int BORDER

widescreen

public static boolean widescreen
Constructor Detail

KDisplay

public KDisplay()
Method Detail

getDisplay

public static KDisplay getDisplay(MIDlet midlet)
Returns the display instance. The MIDlet parameter is included for LCDUI-Compatibility and possible future extensions, but currently ignored.


createAlert

public static KForm createAlert(java.lang.String title,
                                java.lang.String text,
                                Image image)
Creates an alert form

Parameters:
title - Title of the alert
text - Alert text
image - Image
Returns:

setCurrent

public java.lang.Object setCurrent(java.lang.Object scr)
Sets the current form or displayable. Returns the previous form or displayable. Because of LCDUI implementation bugs, KUI tries aggresively to keep control over the screen. Please use this call also for native screens (instead of Display.setCurrent) in order to make KUI aware that it shall not try to take the screen back.


requestRepaint

public static void requestRepaint()
Requests a repaint; internal method, called by KForm.repaint()


setPercent

public static void setPercent(int amount,
                              java.lang.String message)
Grays out the current screen contents and displays a percent bar and the message (optional) on top. Useful to signal internal processing to the user. Set the value to -1 in order to remove the percent display.

Parameters:
amount - percent value
message - short optional message string

paint

protected void paint(Graphics graphics)
Internal method; draws the current KForm, popup, wait notification etc.


normalizeKey

public int normalizeKey(int keyCode)
Normalizes device dependent key codes to the corresponding WTK values.


keyPressed

protected final void keyPressed(int keyCode)

keyReleased

protected final void keyReleased(int keyCode)

keyRepeated

protected final void keyRepeated(int keyCode)

getCurrent

public static java.lang.Object getCurrent()
Returns the current form or displayable.


popup

public static void popup(java.lang.String text,
                         int time)
Displays a popup for the given time

Parameters:
text - Popup text
time - Display time in millisectonds

run

public void run()
Internal implementation for timer handling and for screen updates, please do not use

Specified by:
run in interface java.lang.Runnable

commandAction

public void commandAction(Command command,
                          java.lang.Object source)
Internal implementation for alert handling, please do not use

Specified by:
commandAction in interface KCommandListener

getDisplay

public Display getDisplay()
Returns the underlying LCUDI display instance


loadResImage

public static Image loadResImage(java.lang.String fileName)

isPositiveCommand

public static boolean isPositiveCommand(Command cmd)
Determines whether the given Command is a "positive" (OK, ITEM, SCREEN) or "negative" (CANCEL, BACK, STOP, EXIT) command.

Parameters:
cmd - The command to be examined
Returns:
true if the command is a "positive" command.

setStyle

public void setStyle(int index,
                     Style style)

getStyle

public Style getStyle(int index)

debug

public static void debug(int i,
                         java.lang.String text)

drawIcon

public static void drawIcon(Graphics g,
                            Image img,
                            int x,
                            int y,
                            int index,
                            int countX,
                            int countY)