com.incrediblesoft.redjey
Class UIManager

java.lang.Object
  extended by com.incrediblesoft.redjey.UIManager

public class UIManager
extends java.lang.Object


Field Summary
static java.lang.String APPLY_CMD
           
static java.lang.String CANCEL_CMD
           
static java.lang.String DEFAULT_SET
           
static boolean downKeyPressed
           
static int KEY_CLEAR
          Key code for CLEAR key
static int KEY_DOWN
          Key code for the DOWN game action.
static int KEY_LEFT
          Key code for the LEFT game action.
static int KEY_RIGHT
          Key code for the RIGHT game action.
static int KEY_SELECT
          Key code for selection key
static int KEY_SOFT_LEFT
           
static int KEY_SOFT_RIGHT
           
static int KEY_UP
          Key code for the UP game action.
static boolean leftKeyPressed
          Key pressed flags
static java.lang.String MENU_CMD
           
static boolean rightKeyPressed
           
static boolean selectKeyPressed
           
static boolean upKeyPressed
           
 
Method Summary
static void addWindow(Window window)
           
static void cacheImage(java.lang.String imagePath)
           
static int floor(int a, int b)
           
static javax.microedition.lcdui.Canvas getCanvas()
           
static CustomImage getCursorImage()
           
static int getCursorPosX()
           
static int getCursorPosY()
           
static CustomImage getCustomImage(java.lang.String imagePath)
           
static javax.microedition.lcdui.Display getDisplay()
           
static javax.microedition.lcdui.Image getImage(java.lang.String imagePath)
           
static javax.microedition.midlet.MIDlet getMIDlet()
           
static int getNumWindows()
           
static Style getStyle(java.lang.String componentName, java.lang.String className, int componentState)
           
static Style[] getStyleClass(java.lang.String componentName)
           
static Style[] getStyleClass(java.lang.String componentName, java.lang.String className)
           
static java.util.Hashtable getStylesScheme()
           
static void hideNotify()
           
static int indexOf(Window window)
           
static int indexOfIgnoringBrackets(java.lang.String s, char ch, int fromIndex)
          Searches for character in the { ..
static void insertWindowAt(Window window, int index)
           
static boolean isCursorMoving()
           
static void keyPressed(int keycode)
           
static void keyReleased(int keycode)
           
static void keyRepeated(int keycode)
           
static void loadStyles(java.lang.String temptext, boolean printDebugInfo)
           
static void loadStylesFromResource(java.lang.String path, boolean printDebugInfo)
          Parses styles description file and registers all styles listed in that
static void paint(javax.microedition.lcdui.Graphics g)
           
static java.lang.Object parseValue(java.lang.String s)
           
static java.lang.Object parseValue(java.lang.String s, int fromIndex, int toIndex)
          Parses some value
static void pointerDragged(int x, int y)
           
static void pointerPressed(int x, int y)
           
static void pointerReleased(int x, int y)
           
static void postEvent(AbstractEvent event)
           
static void postPaintEvent(PaintEvent event)
           
static void registerStyle(java.lang.String componentName, java.lang.String className, int componentState, Style style)
          Registers single style
static void registerStyleClass(java.lang.String componentName, java.lang.String className, Style[] styles)
          Registers style class
static void removeAllRegisteredStyles()
           
static void removeAllWindows()
          Resets screen stack
static void removeWindow(Window window)
           
static void repaint()
           
static MouseEvent retargetMouseEvent(MouseEvent origEvent, Component newSource)
           
static void setBackgroundColor(int color)
           
static void setCanvas(javax.microedition.lcdui.Canvas canvas_)
           
static void setCursorImage(CustomImage cursorImage_)
           
static void setCursorPos(int x, int y)
           
static void setCursorPosX(int x)
           
static void setCursorPosY(int y)
           
static void setCursorVisible(boolean b)
           
static void setMIDlet(javax.microedition.midlet.MIDlet midlet_)
          Assignes MIDlet class.
static void setStylesScheme(java.util.Hashtable scheme)
           
static void showNotify()
           
static void switchBackgroundColor(boolean enable)
           
static void tick(int dt)
          Called every frame.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_SOFT_LEFT

public static int KEY_SOFT_LEFT

KEY_SOFT_RIGHT

public static int KEY_SOFT_RIGHT

KEY_SELECT

public static int KEY_SELECT
Key code for selection key


KEY_LEFT

public static int KEY_LEFT
Key code for the LEFT game action.


KEY_RIGHT

public static int KEY_RIGHT
Key code for the RIGHT game action.


KEY_UP

public static int KEY_UP
Key code for the UP game action.


KEY_DOWN

public static int KEY_DOWN
Key code for the DOWN game action.


KEY_CLEAR

public static int KEY_CLEAR
Key code for CLEAR key


leftKeyPressed

public static boolean leftKeyPressed
Key pressed flags


rightKeyPressed

public static boolean rightKeyPressed

upKeyPressed

public static boolean upKeyPressed

downKeyPressed

public static boolean downKeyPressed

selectKeyPressed

public static boolean selectKeyPressed

APPLY_CMD

public static java.lang.String APPLY_CMD

MENU_CMD

public static java.lang.String MENU_CMD

CANCEL_CMD

public static java.lang.String CANCEL_CMD

DEFAULT_SET

public static final java.lang.String DEFAULT_SET
See Also:
Constant Field Values
Method Detail

setMIDlet

public static void setMIDlet(javax.microedition.midlet.MIDlet midlet_)
Assignes MIDlet class. Neccessary for operating.

Parameters:
midlet_ -

getMIDlet

public static javax.microedition.midlet.MIDlet getMIDlet()

getDisplay

public static javax.microedition.lcdui.Display getDisplay()

getCanvas

public static javax.microedition.lcdui.Canvas getCanvas()

setCanvas

public static void setCanvas(javax.microedition.lcdui.Canvas canvas_)

setCursorImage

public static void setCursorImage(CustomImage cursorImage_)

getCursorImage

public static CustomImage getCursorImage()

setCursorVisible

public static void setCursorVisible(boolean b)

setCursorPos

public static void setCursorPos(int x,
                                int y)

setCursorPosX

public static void setCursorPosX(int x)

setCursorPosY

public static void setCursorPosY(int y)

getCursorPosX

public static int getCursorPosX()

getCursorPosY

public static int getCursorPosY()

postEvent

public static void postEvent(AbstractEvent event)

addWindow

public static void addWindow(Window window)

insertWindowAt

public static void insertWindowAt(Window window,
                                  int index)

indexOf

public static int indexOf(Window window)

removeWindow

public static void removeWindow(Window window)

getNumWindows

public static int getNumWindows()

removeAllWindows

public static void removeAllWindows()
Resets screen stack


postPaintEvent

public static void postPaintEvent(PaintEvent event)

tick

public static void tick(int dt)
Called every frame.

Parameters:
dt - milliseconds passed from previous call

retargetMouseEvent

public static MouseEvent retargetMouseEvent(MouseEvent origEvent,
                                            Component newSource)

keyPressed

public static void keyPressed(int keycode)

keyRepeated

public static void keyRepeated(int keycode)

keyReleased

public static void keyReleased(int keycode)

pointerPressed

public static void pointerPressed(int x,
                                  int y)

pointerReleased

public static void pointerReleased(int x,
                                   int y)

pointerDragged

public static void pointerDragged(int x,
                                  int y)

repaint

public static void repaint()

isCursorMoving

public static boolean isCursorMoving()

showNotify

public static void showNotify()

hideNotify

public static void hideNotify()

setBackgroundColor

public static void setBackgroundColor(int color)

switchBackgroundColor

public static void switchBackgroundColor(boolean enable)

paint

public static void paint(javax.microedition.lcdui.Graphics g)

cacheImage

public static void cacheImage(java.lang.String imagePath)
                       throws java.io.IOException
Throws:
java.io.IOException

getImage

public static javax.microedition.lcdui.Image getImage(java.lang.String imagePath)

getCustomImage

public static CustomImage getCustomImage(java.lang.String imagePath)

removeAllRegisteredStyles

public static void removeAllRegisteredStyles()

getStylesScheme

public static java.util.Hashtable getStylesScheme()

setStylesScheme

public static void setStylesScheme(java.util.Hashtable scheme)

registerStyleClass

public static void registerStyleClass(java.lang.String componentName,
                                      java.lang.String className,
                                      Style[] styles)
Registers style class

Parameters:
componentName - component name. See Component.getName()
className - class name. The default is UIManager.DEFAULT_SET
styles - Styles array. Each element in array corresponds to the specific state of component. See Component.getState()

registerStyle

public static void registerStyle(java.lang.String componentName,
                                 java.lang.String className,
                                 int componentState,
                                 Style style)
Registers single style

Parameters:
componentName - Component name. see Component.getName()
className - Class name to register the style in.
componentState - Component state.
style - Style itself.

getStyleClass

public static Style[] getStyleClass(java.lang.String componentName)

getStyleClass

public static Style[] getStyleClass(java.lang.String componentName,
                                    java.lang.String className)

getStyle

public static Style getStyle(java.lang.String componentName,
                             java.lang.String className,
                             int componentState)

loadStylesFromResource

public static void loadStylesFromResource(java.lang.String path,
                                          boolean printDebugInfo)
                                   throws java.io.IOException
Parses styles description file and registers all styles listed in that

Parameters:
path - File path
printDebugInfo - Prints debug info to System.out
Throws:
java.io.IOException - As usual

loadStyles

public static void loadStyles(java.lang.String temptext,
                              boolean printDebugInfo)

parseValue

public static java.lang.Object parseValue(java.lang.String s)

parseValue

public static java.lang.Object parseValue(java.lang.String s,
                                          int fromIndex,
                                          int toIndex)
Parses some value

Parameters:
s - Text that represents value
fromIndex - Index to start with
toIndex - Index to end with
Returns:
Hashtable if value has nested attributes, else returns the same 's' variable that was mentioned above

indexOfIgnoringBrackets

public static int indexOfIgnoringBrackets(java.lang.String s,
                                          char ch,
                                          int fromIndex)
Searches for character in the { .. } scope

Parameters:
s - Text to search in
ch - Character to find
fromIndex - Index to begin with
Returns:
Index of character, or -1 if it was not found in the current scope.

floor

public static int floor(int a,
                        int b)