org.netbeans.microedition.svg
Class SVGMenu

java.lang.Object
  extended by javax.microedition.lcdui.Displayable
      extended by javax.microedition.lcdui.Canvas
          extended by org.netbeans.microedition.svg.SVGPlayer
              extended by org.netbeans.microedition.svg.SVGAnimatorWrapper
                  extended by org.netbeans.microedition.svg.SVGMenu
All Implemented Interfaces:
javax.microedition.lcdui.CommandListener

public class SVGMenu
extends SVGAnimatorWrapper

Screen representing a menu component. SVG animation can contain named elements, which are being focused while the users moves up/down. In the case SVG image contains animation on the focus event, the user can see the animated transition between the named elements.

By default this component starts the animation automatically and runs in full screen mode.


Field Summary
static javax.microedition.lcdui.Command SELECT_COMMAND
          Command fired when the user chooses a menu element.
static int SELECTED_INDEX_NONE
          value of selected index when no menu item is selected
 
Fields inherited from class org.netbeans.microedition.svg.SVGPlayer
BOTTOM, BOTTOM_LEFT, BOTTOM_RIGHT, CENTER, LEFT, PAUSED, PLAYING, RIGHT, STOPPED, TOP, TOP_LEFT, TOP_RIGHT
 
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, UP
 
Constructor Summary
SVGMenu(javax.microedition.m2g.SVGImage svgImage, javax.microedition.lcdui.Display display)
          Creates a new instance of SVGMenu.
 
Method Summary
 void addMenuElement(java.lang.String svgElementId)
          Adds a menu element to the menu component.
 void focusNext()
          By default, focusNext simply moves the focus on the next focusable element in the focus ring.
 void focusPrev()
          By default, focusNext simply moves the focus on the previous focusable element in the focus ring.
 java.lang.String getMenuElementID(int index)
          Gets menu element id for given index.
 int getSelectedIndex()
          Gets index of selected menu element
 void resetFocus()
          focus on the first element if applicable;
 
Methods inherited from class org.netbeans.microedition.svg.SVGPlayer
addCommand, commandAction, computeAnchorTranslate, getAnimator, getAnimatorState, getCommandListener, getDisplay, getDocument, getSafeSVGEventListener, getScreenBBox, getSVGAnimationElementById, getSvgCanvas, getSVGElementById, getSVGEventListener, getSVGImage, getSVGLocatableElementById, getTicker, getTimeIncrement, getTitle, invokeAndWait, invokeAndWaitSafely, invokeLater, invokeLaterSafely, isResetAnimationWhenStopped, paint, pause, play, removeCommand, reset, rotate, rotate, rotateAbout, rotateAbout, rotateAboutSafely, rotateSafely, scale, scale, scaleAbout, scaleAbout, scaleAboutSafely, scaleSafely, screenTranslate, screenTranslate, screenTranslateSafely, setCommandListener, setFloatTrait, setFloatTraitSafely, setFullScreenMode, setResetAnimationWhenStopped, setRGBTrait, setRGBTrait, setRGBTraitSafely, setRGBTraitSafely, setSafeSVGEventListener, setStartAnimationImmediately, setSVGEventListener, setTicker, setTimeIncrement, setTitle, setTrait, setTraitSafely, startAnimation, startAnimation, startAnimationSafely, stop, stopAnimation, stopAnimation, stopAnimationSafely, translate, translate, translateSafely
 
Methods inherited from class javax.microedition.lcdui.Canvas
getGameAction, getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, hideNotify, isDoubleBuffered, keyPressed, keyReleased, keyRepeated, pointerDragged, pointerPressed, pointerReleased, repaint, repaint, serviceRepaints, showNotify, sizeChanged
 
Methods inherited from class javax.microedition.lcdui.Displayable
getHeight, getWidth, isShown
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SELECT_COMMAND

public static final javax.microedition.lcdui.Command SELECT_COMMAND
Command fired when the user chooses a menu element.


SELECTED_INDEX_NONE

public static final int SELECTED_INDEX_NONE
value of selected index when no menu item is selected

See Also:
Constant Field Values
Constructor Detail

SVGMenu

public SVGMenu(javax.microedition.m2g.SVGImage svgImage,
               javax.microedition.lcdui.Display display)
Creates a new instance of SVGMenu. It requires SVGImage to be displayed as menu and display.

Please note, supplied SVGImage shouldn't be reused in other SVGAnimator.

Method Detail

addMenuElement

public void addMenuElement(java.lang.String svgElementId)
Adds a menu element to the menu component. The menu element is identified by SVG element ID, so when the menu element is being selected, the element with given ID is being focused.


getMenuElementID

public java.lang.String getMenuElementID(int index)
                                  throws java.lang.IndexOutOfBoundsException
Gets menu element id for given index.

Returns:
string element ID
Throws:
IndexOutOfBoundException - when a wrong index is used
java.lang.IndexOutOfBoundsException

getSelectedIndex

public int getSelectedIndex()
Gets index of selected menu element


resetFocus

public void resetFocus()
focus on the first element if applicable;


focusNext

public void focusNext()
By default, focusNext simply moves the focus on the next focusable element in the focus ring.


focusPrev

public void focusPrev()
By default, focusNext simply moves the focus on the previous focusable element in the focus ring.