de.enough.polish.ui.splash
Class InitializerSplashScreen

java.lang.Object
  extended by javax.microedition.lcdui.Displayable
      extended by javax.microedition.lcdui.Canvas
          extended by de.enough.polish.ui.splash.InitializerSplashScreen
All Implemented Interfaces:
Runnable

public class InitializerSplashScreen
extends Canvas
implements Runnable

Provides a SplashScreen that initializes the real application in a background thread.

Copyright (c) Enough Software 2005 - 2009

Author:
Robert Virkus, j2mepolish@enough.de
See Also:
ApplicationInitializer.initApp()

Field Summary
 
Fields inherited from class javax.microedition.lcdui.Canvas
DOWN, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_POUND, KEY_STAR, LEFT, RIGHT, UP
 
Constructor Summary
InitializerSplashScreen(Display display, Image image, ApplicationInitializer initializer)
          Creates a new InitializerSplashScreen using the internal default view and a white background.
InitializerSplashScreen(Display display, Image image, ApplicationInitializer initializer, Style style)
          Creates a new InitializerSplashScreen using the internal default view and a white background.
InitializerSplashScreen(Display display, Image image, int backgroundColor, String readyMessage, int messageColor, ApplicationInitializer initializer)
          Creates a new InitializerSplashScreen using the internal default view.
InitializerSplashScreen(Display display, Image image, int backgroundColor, String readyMessage, int messageColor, ApplicationInitializer initializer, Style style)
          Creates a new InitializerSplashScreen using the internal default view.
InitializerSplashScreen(Display display, SplashView view, ApplicationInitializer initializer)
           
 
Method Summary
 Background getBackground()
          Retrieves the background.
 void hideNotify()
           
 void keyPressed(int keyCode)
           
 void keyReleased(int keyCode)
           
 void keyRepeated(int keyCode)
           
 void paint(Graphics g)
           
 void pointerDragged(int x, int y)
          Processes pointer dragged events.
 void pointerPressed(int x, int y)
           
 void pointerReleased(int x, int y)
           
 void run()
           
 void setBackground(Background background)
          Sets the background of this splash screen.
 void setMessage(String message)
          Sets a message that is displayed immediately.
 void showNotify()
           
 void sizeChanged(int width, int height)
           
 
Methods inherited from class javax.microedition.lcdui.Canvas
getGameAction, getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, isDoubleBuffered, repaint, repaint, serviceRepaints, setFullScreenMode
 
Methods inherited from class javax.microedition.lcdui.Displayable
addCommand, getHeight, getTicker, getTitle, getWidth, isShown, removeCommand, setCommandListener, setTicker, setTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InitializerSplashScreen

public InitializerSplashScreen(Display display,
                               Image image,
                               ApplicationInitializer initializer)
Creates a new InitializerSplashScreen using the internal default view and a white background.

Parameters:
display - the display responsible for switching screens
image - the image that is shown in the center
initializer - the application initializer that will be called in a background thread

InitializerSplashScreen

public InitializerSplashScreen(Display display,
                               Image image,
                               ApplicationInitializer initializer,
                               Style style)
Creates a new InitializerSplashScreen using the internal default view and a white background.

Parameters:
display - the display responsible for switching screens
image - the image that is shown in the center
initializer - the application initializer that will be called in a background thread
style - the style for this screen - only the background is currently applied

InitializerSplashScreen

public InitializerSplashScreen(Display display,
                               Image image,
                               int backgroundColor,
                               String readyMessage,
                               int messageColor,
                               ApplicationInitializer initializer)
Creates a new InitializerSplashScreen using the internal default view. The message will be shown in the default font.

Parameters:
display - the display responsible for switching screens
image - the image that is shown in the center
backgroundColor - the background color, e.g. white: 0xFFFFFF
readyMessage - the message that is displayed when the application has been initialized, set to null if the screen created by ApplicationInitializer.initApp() should be shown directly after that method returns.
messageColor - the color for the message, e.g. black: 0
initializer - the application initializer that will be called in a background thread

InitializerSplashScreen

public InitializerSplashScreen(Display display,
                               Image image,
                               int backgroundColor,
                               String readyMessage,
                               int messageColor,
                               ApplicationInitializer initializer,
                               Style style)
Creates a new InitializerSplashScreen using the internal default view. The message will be shown in the default font.

Parameters:
display - the display responsible for switching screens
image - the image that is shown in the center
backgroundColor - the background color, e.g. white: 0xFFFFFF
readyMessage - the message that is displayed when the application has been initialized, set to null if the screen created by ApplicationInitializer.initApp() should be shown directly after that method returns.
messageColor - the color for the message, e.g. black: 0
initializer - the application initializer that will be called in a background thread
style - the style for this screen - only the background is currently applied

InitializerSplashScreen

public InitializerSplashScreen(Display display,
                               SplashView view,
                               ApplicationInitializer initializer)
Method Detail

setMessage

public void setMessage(String message)
Sets a message that is displayed immediately. This call is ignored when a SplashView is used.

Parameters:
message - the new message, null when no message should be shown.

paint

public void paint(Graphics g)
Specified by:
paint in class Canvas

run

public void run()
Specified by:
run in interface Runnable

keyPressed

public void keyPressed(int keyCode)
Overrides:
keyPressed in class Canvas

keyReleased

public void keyReleased(int keyCode)
Overrides:
keyReleased in class Canvas

keyRepeated

public void keyRepeated(int keyCode)
Overrides:
keyRepeated in class Canvas

pointerPressed

public void pointerPressed(int x,
                           int y)
Overrides:
pointerPressed in class Canvas

pointerReleased

public void pointerReleased(int x,
                            int y)
Overrides:
pointerReleased in class Canvas

pointerDragged

public void pointerDragged(int x,
                           int y)
Processes pointer dragged events.

Overrides:
pointerDragged in class Canvas
Parameters:
x - the horizontal coordinate of the clicked pixel
y - the vertical coordinate of the clicked pixel

sizeChanged

public void sizeChanged(int width,
                        int height)
Overrides:
sizeChanged in class Canvas

showNotify

public void showNotify()
Overrides:
showNotify in class Canvas

hideNotify

public void hideNotify()
Overrides:
hideNotify in class Canvas

getBackground

public Background getBackground()
Retrieves the background. Warning: this method is only available when the J2ME Polish GUI is used, check for the polish.usePolishGui preprocessing symbol

Returns:
the background

setBackground

public void setBackground(Background background)
Sets the background of this splash screen. Warning: this method is only available when the J2ME Polish GUI is used, check for the polish.usePolishGui preprocessing symbol

Parameters:
background - the background to set