de.enough.polish.ui
Class SplashScreen

java.lang.Object
  extended by javax.microedition.lcdui.Displayable
      extended by javax.microedition.lcdui.Canvas
          extended by de.enough.polish.ui.Screen
              extended by de.enough.polish.ui.SplashScreen
All Implemented Interfaces:
AccessibleCanvas

public class SplashScreen
extends Screen

This component represents a splash screen, which is usually being displayed when the application starts. It waits for a specified amount of time (by default 5000 milliseconds) and then calls specified command listener commandAction method with DISMISS_COMMAND as command parameter.

This version is using CommandListener and static Command pattern, but is still compatible with older version. So if there is no command listener specified, it still can use setNextDisplayable() method to specify the dismiss screen and automatically switch to it.

Author:
breh

Field Summary
static javax.microedition.lcdui.Command DISMISS_COMMAND
          Command fired when the screen is about to be dismissed //TODO add i18n
static int FOREVER
          Timeout value which wait forever.
 
Fields inherited from class de.enough.polish.ui.Screen
background, border, container, contentHeight, contentWidth, contentX, contentY, cssSelector, fullScreenHeight, ignoreRepaintRequests, infoHeight, isInitRequested, isRepaintRequested, isScrollBackground, isSetFullScreenCalled, itemStateListener, keyPressedProcessed, keyReleasedProcessed, lastInteractionTime, lastTriggeredCommand, menuBarHeight, originalScreenHeight, paintScrollBarOnRightSide, screenHeight, screenOrientationDegrees, screenStateListener, screenWidth, scrollBar, scrollBarVisible, style, subTitleHeight, title, titleHeight, triggerReleasedKeyCode, triggerReleasedTime
 
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
SplashScreen(javax.microedition.lcdui.Display display)
          Creates a new instance of SplashScreen
SplashScreen(javax.microedition.lcdui.Display display, Style style)
          Creates a new instance of SplashScreen
 
Method Summary
protected  java.lang.String createCssSelector()
          Retrieves the CSS selector for this screen.
 int getTimeout()
          Gets current timeout of the splash screen
 void hideNotify()
          Unregisters this screen and notifies all items that they will not be shown anymore.
 boolean isAllowTimeoutInterrupt()
          Can be the splashscreen interrupted (dismissed) by the user pressing a key?
 void keyPressed(int keyCode)
          keyPressed callback
protected  void paintScreen(javax.microedition.lcdui.Graphics g)
          Paints the screen.
 void pointerPressed(int x, int y)
          pointerPressed callback
 void setAllowTimeoutInterrupt(boolean allow)
          When set to true, the splashscreen timeout can be interrupted (and thus dismissed) by pressing a key.
 void setImage(javax.microedition.lcdui.Image image)
           
 void setTimeout(int timeout)
          Sets the timeout of the splash screen - i.e.
 void showNotify()
          starts the coundown of the timeout
 
Methods inherited from class de.enough.polish.ui.Screen
addCommand, addCommand, addSubCommand, addSubCommand, animate, animate, calculateContentArea, callCommandListener, checkForRequestInit, closeMenu, commandAction, focus, focus, focus, focus, focus, getAvailableHeight, getCommandItem, getCommandListener, getCurrentIndex, getCurrentItem, getGameAction, getItemAt, getMenuBar, getPolishTicker, getRootItems, getScreenContentHeight, getScreenContentWidth, getScreenData, getScreenFullHeight, getScreenFullWidth, getScreenHeight, getScreenStyle, getScrollBarWidth, getScrollYOffset, getTitle, handleCommand, handleKeyPressed, handleKeyReleased, handleKeyRepeated, handlePointerPressed, handlePointerReleased, isGameActionFire, isKeyboardAccessible, isMenuOpened, isShown, isSoftKey, isSoftKey, isSoftKeyLeft, isSoftKeyMiddle, isSoftKeyRight, keyReleased, keyRepeated, notifyScreenStateChanged, notifyStateListener, paint, pointerDragged, pointerReleased, releaseResources, removeAllCommands, removeCommand, removeItemCommands, requestInit, requestRepaint, requestRepaint, scrollRelative, setCommandListener, setFullScreenMode, setInfo, setItemCommands, setItemStateListener, setItemStateListener, setMenuBarStyle, setMenuItemStyle, setPolishTicker, setPolishTicker, setScreenData, setScreenOrientation, setScreenStateListener, setScrollYOffset, setStyle, setSubTitle, setTitle, setTitle, setTitle, sizeChanged
 
Methods inherited from class javax.microedition.lcdui.Canvas
getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, isDoubleBuffered, repaint, repaint, serviceRepaints
 
Methods inherited from class javax.microedition.lcdui.Displayable
getHeight, getTicker, getWidth, setTicker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DISMISS_COMMAND

public static final javax.microedition.lcdui.Command DISMISS_COMMAND
Command fired when the screen is about to be dismissed //TODO add i18n


FOREVER

public static final int FOREVER
Timeout value which wait forever. Value is "0".

See Also:
Constant Field Values
Constructor Detail

SplashScreen

public SplashScreen(javax.microedition.lcdui.Display display)
             throws java.lang.IllegalArgumentException
Creates a new instance of SplashScreen

Parameters:
display - display - is ignored
Throws:
java.lang.IllegalArgumentException

SplashScreen

public SplashScreen(javax.microedition.lcdui.Display display,
                    Style style)
             throws java.lang.IllegalArgumentException
Creates a new instance of SplashScreen

Parameters:
display - display - is ignored
style - the style for the splash screen
Throws:
java.lang.IllegalArgumentException
Method Detail

setTimeout

public void setTimeout(int timeout)
Sets the timeout of the splash screen - i.e. the time in milliseconds for how long the splash screen is going to be shown on the display.

If the supplied timeout is 0, then the splashscreen waits forever (it needs to be dismissed by pressing a key)

Parameters:
timeout - in milliseconds

getTimeout

public int getTimeout()
Gets current timeout of the splash screen

Returns:
timeout value

setAllowTimeoutInterrupt

public void setAllowTimeoutInterrupt(boolean allow)
When set to true, the splashscreen timeout can be interrupted (and thus dismissed) by pressing a key.

Parameters:
allow - true if the user can interrupt the screen, false if the user need to wait until timeout.

isAllowTimeoutInterrupt

public boolean isAllowTimeoutInterrupt()
Can be the splashscreen interrupted (dismissed) by the user pressing a key?

Returns:
true if user can interrupt it, false otherwise

keyPressed

public void keyPressed(int keyCode)
keyPressed callback

Specified by:
keyPressed in interface AccessibleCanvas
Overrides:
keyPressed in class Screen
Parameters:
keyCode -

pointerPressed

public void pointerPressed(int x,
                           int y)
pointerPressed callback

Specified by:
pointerPressed in interface AccessibleCanvas
Overrides:
pointerPressed in class Screen
Parameters:
x -
y -

showNotify

public void showNotify()
starts the coundown of the timeout

Specified by:
showNotify in interface AccessibleCanvas
Overrides:
showNotify in class Screen

hideNotify

public void hideNotify()
Description copied from class: Screen
Unregisters this screen and notifies all items that they will not be shown anymore.

Specified by:
hideNotify in interface AccessibleCanvas
Overrides:
hideNotify in class Screen

setImage

public void setImage(javax.microedition.lcdui.Image image)

paintScreen

protected void paintScreen(javax.microedition.lcdui.Graphics g)
Description copied from class: Screen
Paints the screen. This method also needs to set the protected variables paintScrollIndicator, paintScrollIndicatorUp and paintScrollIndicatorDown.

Overrides:
paintScreen in class Screen
Parameters:
g - the graphics on which the screen should be painted
See Also:
Screen.contentX, Screen.contentY, Screen.contentWidth, Screen.contentHeight, Screen.paintScrollIndicator, Screen.paintScrollIndicatorUp, Screen.paintScrollIndicatorDown

createCssSelector

protected java.lang.String createCssSelector()
Description copied from class: Screen
Retrieves the CSS selector for this screen. The CSS selector is used for the dynamic assignment of styles - that is the styles are assigned by the usage of the screen and not by a predefined style-name. With the #style preprocessing command styles are set in a static way, this method yields in a faster GUI and is recommended. When in a style-sheet dynamic styles are used, e.g. "form>p", than the selector of the screen is needed. This abstract method needs only be implemented, when dynamic styles are used: #ifdef polish.useDynamicStyles

Specified by:
createCssSelector in class Screen
Returns:
the name of the appropriate CSS Selector for this screen.