gr.bluevibe.fire.displayables
Class FireScreen

java.lang.Object
  extended byjavax.microedition.lcdui.Displayable
      extended byjavax.microedition.lcdui.Canvas
          extended bygr.bluevibe.fire.displayables.FireScreen
All Implemented Interfaces:
java.lang.Runnable

public final class FireScreen
extends javax.microedition.lcdui.Canvas
implements java.lang.Runnable

FireScreen is the core of the Fire engine. It is the only Displayable in an Fire based, application (not counting SplashScreen). It is indented to be used as the Display singleton is used when developing a regular j2me midlet.

Author:
padeler

Field Summary
static int ALERT_HORIZONTAL_OFFSET
           
static int ALERT_VERTICAL_OFFSET
           
static int ANIMATION_COUNT
           
static int BOTTOM
           
static int bottomOffset
           
static int CENTRE
           
static long CLOCK_STEP
          The step of the inner clock in miliseconds.
static javax.microedition.lcdui.Image defaultBgImageSrc
           
static javax.microedition.lcdui.Image defaultBorder
           
static int defaultBorderColor
           
static int defaultColor
           
static int defaultFilledRowColor
           
static javax.microedition.lcdui.Image defaultGradImage
           
static int defaultHpos
           
static java.lang.String defaultLabel
           
static int defaultLabelColor
           
static javax.microedition.lcdui.Font defaultLabelFont
           
static javax.microedition.lcdui.Image defaultLogo
           
static int defaultPointerColor
           
static javax.microedition.lcdui.Font defaultPopupFont
           
static int defaultRulerColor1
           
static int defaultRulerColor2
           
static int defaultScrollColor
           
static int defaultScrollRulerColor1
           
static int defaultScrollRulerColor2
           
static int defaultScrollRulerColor3
           
static int defaultSecondaryFilledRowColor
           
static int defaultSecondaryPointerColor
           
static int defaultTickerColor
           
static javax.microedition.lcdui.Font defaultTickerFont
           
static boolean defaultTiled
           
static int defaultTooltipBgColor
           
static int defaultTooltipFgColor
           
static boolean defaultVertical
           
static int defaultVpos
           
static int DOWN
           
static int LANDSCAPELEFT
           
static int LANDSCAPERIGHT
           
static int LEFT
           
static int leftSoftKey
           
static int linkColor
           
static int NONE
           
static int NORMAL
           
static int RIGHT
           
static int rightSoftKey
           
static int SCROLL_COUNT
           
static int SCROLL_HEIGHT
           
static int SCROLL_STEP
           
static int SCROLLBAR_HEIGHT
           
static int SCROLLBAR_WIDTH
           
static java.lang.Integer selectedLinkBgColor
           
static int selectedLinkColor
           
static java.lang.String THEME_BG
          The name of the backgroung key.
static java.lang.String THEME_FILE
          The name of the theme key, used by FireIO.
static int TOP
           
static int topOffset
           
static int UP
           
 
Fields inherited from class javax.microedition.lcdui.Canvas
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
 
Method Summary
 boolean closePopup()
          Closes the top-level popup, shown on the FireScreen
 void destroy()
          Destroys the FireScreen instance.
 javax.microedition.lcdui.Image getBgImage()
           
 javax.microedition.lcdui.Image getBgImageSrc()
           
static int getBottomOffset()
           
 int getColor()
           
 Panel getCurrentPanel()
          Returns the current panel set on the FireScreen.
 FGauge getGauge()
           
 javax.microedition.lcdui.Image getGradImage()
           
 int getHeight()
          Returns the height of this FireScreen.
 int getHpos()
           
 javax.microedition.lcdui.Font getLabelFont()
           
static int getLeftSoftKey()
           
 java.lang.String getLeftSoftKeyShortcut()
          Return left softkey shortcut, depending on the screen orientation (left/right landscare or normal)
static int getLogoPossition()
           
 int getOrientation()
           
static int getRightSoftKey()
           
 java.lang.String getRightSoftKeyShortcut()
          Returns right softkey shortcut, depending on the screen orientation (left/right landscare or normal)
static FireScreen getScreen(javax.microedition.lcdui.Display display)
          Used to create and retrieve the FireScreen singleton.
static int getTopOffset()
           
 int getVpos()
           
 int getWidth()
          Returns the width of this FireScreen.
 boolean isBusyMode()
           
 boolean isInteractiveBusyMode()
          If this FireScreen instance is in interactive busy mode, it will allow user actions when busyMode==true.
 boolean isTiled()
           
 boolean isVertical()
           
protected  void keyReleased(int k)
           
protected  void keyRepeated(int k)
           
protected  void paint(javax.microedition.lcdui.Graphics sg)
           
protected  void pointerReleased(int x, int y)
           
 void reloadTheme()
           
 void run()
           
 void setBgImageSrc(javax.microedition.lcdui.Image bgImageSrc)
           
 void setBusyMode(boolean busyMode)
          When a FireScreen instance is in busy mode, it displayes a "busy indicator" gauge on the bottom of the screen.
 void setColor(int color)
           
 void setContainerCurrent()
           
 void setCurrent(javax.microedition.lcdui.Displayable c)
          Sets Displayable c as the Current display.
 void setCurrent(Panel p)
          Set a panel to the FireScreen.
 void setCurrent(Panel p, int animDirection)
          Shows the panel p on the screen with the supplied animation direction.
 void setFullScreenMode(boolean v)
          Sets the mode of the screen.
 void setGauge(FGauge g)
          Sets the gauge that is shown when the Screen is set to busy mode.
 void setGradImage(javax.microedition.lcdui.Image gradImage)
           
 void setHpos(int hpos)
           
 void setInteractiveBusyMode(boolean interactiveBusyMode)
          If this FireScreen instance is in interactive busy mode, it will allow user actions when busyMode==true.
 void setLabelFont(javax.microedition.lcdui.Font labelFont)
           
static void setLeftSoftKey(int leftSoftKey)
           
static void setLogoPossition(int pos)
          Sets the possition of the logo (found in the theme file) on the top border of a panel.
 void setOrientation(int o)
          Sets the orientation of the screen.
 void setOrientationChangeKey(java.lang.Integer key)
          Sets the keycode (@see Canvas) that changes the orientation of the screen.
static void setRightSoftKey(int rightSoftKey)
           
 void setTiled(boolean tiled)
           
 void setVertical(boolean vertical)
           
 void setVpos(int vpos)
           
 void showPopup(Popup popup)
          Shows a popup panel on the screen.
protected  void sizeChanged(int ww, int hh)
          This method is called by the vm every time the with and the height of the screen change.
 
Methods inherited from class javax.microedition.lcdui.Canvas
getGameAction, getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, hideNotify, isDoubleBuffered, keyPressed, pointerDragged, pointerPressed, repaint, repaint, serviceRepaints, showNotify
 
Methods inherited from class javax.microedition.lcdui.Displayable
addCommand, getTicker, getTitle, isShown, removeCommand, setCommandListener, setTicker, setTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLOCK_STEP

public static final long CLOCK_STEP
The step of the inner clock in miliseconds.

See Also:
Constant Field Values

THEME_FILE

public static final java.lang.String THEME_FILE
The name of the theme key, used by FireIO.

See Also:
Constant Field Values

THEME_BG

public static final java.lang.String THEME_BG
The name of the backgroung key.

See Also:
Constant Field Values

NONE

public static final int NONE
See Also:
Constant Field Values

CENTRE

public static final int CENTRE
See Also:
Constant Field Values

RIGHT

public static final int RIGHT
See Also:
Constant Field Values

LEFT

public static final int LEFT
See Also:
Constant Field Values

TOP

public static final int TOP
See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
See Also:
Constant Field Values

UP

public static final int UP
See Also:
Constant Field Values

DOWN

public static final int DOWN
See Also:
Constant Field Values

NORMAL

public static final int NORMAL
See Also:
Constant Field Values

LANDSCAPELEFT

public static final int LANDSCAPELEFT
See Also:
Constant Field Values

LANDSCAPERIGHT

public static final int LANDSCAPERIGHT
See Also:
Constant Field Values

SCROLL_COUNT

public static final int SCROLL_COUNT
See Also:
Constant Field Values

ANIMATION_COUNT

public static final int ANIMATION_COUNT
See Also:
Constant Field Values

SCROLLBAR_WIDTH

public static final int SCROLLBAR_WIDTH
See Also:
Constant Field Values

SCROLLBAR_HEIGHT

public static final int SCROLLBAR_HEIGHT
See Also:
Constant Field Values

ALERT_VERTICAL_OFFSET

public static final int ALERT_VERTICAL_OFFSET
See Also:
Constant Field Values

ALERT_HORIZONTAL_OFFSET

public static final int ALERT_HORIZONTAL_OFFSET
See Also:
Constant Field Values

defaultLabel

public static final java.lang.String defaultLabel
See Also:
Constant Field Values

defaultLabelFont

public static final javax.microedition.lcdui.Font defaultLabelFont

defaultPopupFont

public static final javax.microedition.lcdui.Font defaultPopupFont

defaultTickerFont

public static final javax.microedition.lcdui.Font defaultTickerFont

defaultTickerColor

public static final int defaultTickerColor
See Also:
Constant Field Values

defaultVpos

public static final int defaultVpos
See Also:
Constant Field Values

defaultHpos

public static final int defaultHpos
See Also:
Constant Field Values

defaultVertical

public static final boolean defaultVertical
See Also:
Constant Field Values

defaultTiled

public static final boolean defaultTiled
See Also:
Constant Field Values

leftSoftKey

public static int leftSoftKey

rightSoftKey

public static int rightSoftKey

selectedLinkColor

public static int selectedLinkColor

linkColor

public static int linkColor

selectedLinkBgColor

public static java.lang.Integer selectedLinkBgColor

defaultLabelColor

public static int defaultLabelColor

defaultColor

public static int defaultColor

defaultFilledRowColor

public static int defaultFilledRowColor

defaultSecondaryFilledRowColor

public static int defaultSecondaryFilledRowColor

defaultBorderColor

public static int defaultBorderColor

defaultPointerColor

public static int defaultPointerColor

defaultSecondaryPointerColor

public static int defaultSecondaryPointerColor

defaultTooltipFgColor

public static int defaultTooltipFgColor

defaultTooltipBgColor

public static int defaultTooltipBgColor

defaultScrollColor

public static int defaultScrollColor

defaultRulerColor1

public static int defaultRulerColor1

defaultRulerColor2

public static int defaultRulerColor2

defaultScrollRulerColor1

public static int defaultScrollRulerColor1

defaultScrollRulerColor2

public static int defaultScrollRulerColor2

defaultScrollRulerColor3

public static int defaultScrollRulerColor3

defaultGradImage

public static javax.microedition.lcdui.Image defaultGradImage

defaultBgImageSrc

public static javax.microedition.lcdui.Image defaultBgImageSrc

defaultLogo

public static javax.microedition.lcdui.Image defaultLogo

defaultBorder

public static javax.microedition.lcdui.Image defaultBorder

SCROLL_HEIGHT

public static int SCROLL_HEIGHT

SCROLL_STEP

public static int SCROLL_STEP

topOffset

public static int topOffset

bottomOffset

public static int bottomOffset
Method Detail

getScreen

public static FireScreen getScreen(javax.microedition.lcdui.Display display)
Used to create and retrieve the FireScreen singleton.

Returns:
the FireScreen singleton.

paint

protected void paint(javax.microedition.lcdui.Graphics sg)

setCurrent

public void setCurrent(javax.microedition.lcdui.Displayable c)
Sets Displayable c as the Current display.

Parameters:
c - a displayable

getCurrentPanel

public Panel getCurrentPanel()
Returns the current panel set on the FireScreen.

Returns:

setCurrent

public void setCurrent(Panel p)
Set a panel to the FireScreen.

Parameters:
p -

setCurrent

public void setCurrent(Panel p,
                       int animDirection)
Shows the panel p on the screen with the supplied animation direction.

Parameters:
p -
animDirection -

run

public void run()
Specified by:
run in interface java.lang.Runnable

getTopOffset

public static int getTopOffset()

getBottomOffset

public static int getBottomOffset()

getLabelFont

public javax.microedition.lcdui.Font getLabelFont()

setLabelFont

public void setLabelFont(javax.microedition.lcdui.Font labelFont)

isTiled

public boolean isTiled()

setTiled

public void setTiled(boolean tiled)

isVertical

public boolean isVertical()

setVertical

public void setVertical(boolean vertical)

getVpos

public int getVpos()

setVpos

public void setVpos(int vpos)

sizeChanged

protected void sizeChanged(int ww,
                           int hh)
This method is called by the vm every time the with and the height of the screen change. The parameters are the real width and height of the screen.

See Also:
Displayable.sizeChanged(int, int)

getLeftSoftKey

public static int getLeftSoftKey()

setLeftSoftKey

public static void setLeftSoftKey(int leftSoftKey)

getRightSoftKey

public static int getRightSoftKey()

setRightSoftKey

public static void setRightSoftKey(int rightSoftKey)

setContainerCurrent

public void setContainerCurrent()

getBgImageSrc

public javax.microedition.lcdui.Image getBgImageSrc()

setBgImageSrc

public void setBgImageSrc(javax.microedition.lcdui.Image bgImageSrc)

getColor

public int getColor()

setColor

public void setColor(int color)

getGradImage

public javax.microedition.lcdui.Image getGradImage()

setGradImage

public void setGradImage(javax.microedition.lcdui.Image gradImage)

getHpos

public int getHpos()

setHpos

public void setHpos(int hpos)

getBgImage

public javax.microedition.lcdui.Image getBgImage()

pointerReleased

protected void pointerReleased(int x,
                               int y)

keyRepeated

protected void keyRepeated(int k)

keyReleased

protected void keyReleased(int k)

showPopup

public void showPopup(Popup popup)
Shows a popup panel on the screen. The popups can stuck on each other.

Parameters:
popup -

closePopup

public boolean closePopup()
Closes the top-level popup, shown on the FireScreen

Returns:

isBusyMode

public boolean isBusyMode()

setBusyMode

public void setBusyMode(boolean busyMode)
When a FireScreen instance is in busy mode, it displayes a "busy indicator" gauge on the bottom of the screen. If the screen instance is not in interactiveBusyMode, it will not allow user input until the busy mode is set to false.

Parameters:
busyMode -

destroy

public void destroy()
Destroys the FireScreen instance. This method should be called on clean-up in order to stop the animation thread inside the FireScreen Singleton.


reloadTheme

public void reloadTheme()

setLogoPossition

public static void setLogoPossition(int pos)
Sets the possition of the logo (found in the theme file) on the top border of a panel. Valid options are FireScreen.RIGHT, FireScreen.CENTER, FireScreen.LEFT. Default value is RIGHT. All values different than the three mentioned will be ignored.

Parameters:
pos -

getLogoPossition

public static int getLogoPossition()

getOrientation

public int getOrientation()

setOrientation

public void setOrientation(int o)
Sets the orientation of the screen. Possible values: NORMAL, LANDSCAPELEFT, LANDSCAPERIGHT Default value is NORMAL. All values different than the three mentionted will be ignored.


setOrientationChangeKey

public void setOrientationChangeKey(java.lang.Integer key)
Sets the keycode (@see Canvas) that changes the orientation of the screen. If the parameter is null, then no shortcut is set. Repeated presses to the "key" will circle through the orientation modes. Note that the orientationKey event is not sent to the panel(s) inside the FireScreen.

Parameters:
key -

getWidth

public int getWidth()
Returns the width of this FireScreen. If the screen is in landscape mode, it will return the real height of the screen.

See Also:
Displayable.getWidth()

getHeight

public int getHeight()
Returns the height of this FireScreen. If the screen is in landscape mode, it will return the real width of the screen.

See Also:
Displayable.getHeight()

getLeftSoftKeyShortcut

public java.lang.String getLeftSoftKeyShortcut()
Return left softkey shortcut, depending on the screen orientation (left/right landscare or normal)

Returns:

getRightSoftKeyShortcut

public java.lang.String getRightSoftKeyShortcut()
Returns right softkey shortcut, depending on the screen orientation (left/right landscare or normal)

Returns:

isInteractiveBusyMode

public boolean isInteractiveBusyMode()
If this FireScreen instance is in interactive busy mode, it will allow user actions when busyMode==true. (see the setBusyMode() method)

Returns:

setInteractiveBusyMode

public void setInteractiveBusyMode(boolean interactiveBusyMode)
If this FireScreen instance is in interactive busy mode, it will allow user actions when busyMode==true. (see the setBusyMode() method)


setGauge

public void setGauge(FGauge g)
Sets the gauge that is shown when the Screen is set to busy mode.

Parameters:
g -
Throws:
java.lang.NullPointerException - if g is null.

getGauge

public FGauge getGauge()

setFullScreenMode

public void setFullScreenMode(boolean v)
Sets the mode of the screen. Some implementations do not call the sizeChanged after the screen size has changed. We overide the setFullScreenMode to ensure that the sizeChanged method is executed.