RoboJDETM v2.0

com.ridgesoft.ui
Class TwoLineDisplayMenuController

java.lang.Object
  extended by com.ridgesoft.ui.TwoLineDisplayMenuController
All Implemented Interfaces:
MenuController

public class TwoLineDisplayMenuController
extends Object
implements MenuController

Implements a simple menuing system contoller for a two line display such as a 16x2 LCD.


Constructor Summary
TwoLineDisplayMenuController(Display display, PushButton selectButton, PushButton exitButton, AnalogInput scrollInput, Speaker speaker, MenuItemList menuItemList)
          Constructs a two line display menuing controller.
 
Method Summary
 void buttonPressed()
          Provides feedback to the user that a button has been pressed.
 int getScrollIndex(int numberOfValues)
          Samples the scroll input and scales the result such that this method returns an index from the specified number of values.
 void printStatus(String string)
          Replaces the text on the status line with the text provided.
 void show()
          Show the top level menu.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait
 

Constructor Detail

TwoLineDisplayMenuController

public TwoLineDisplayMenuController(Display display,
                                    PushButton selectButton,
                                    PushButton exitButton,
                                    AnalogInput scrollInput,
                                    Speaker speaker,
                                    MenuItemList menuItemList)
Constructs a two line display menuing controller.

Parameters:
display - display to output to
selectButton - button which indicates user has made a selection
exitButton - button which indicates user wants to go up a level
scrollInput - input to control scrolling through choices
speaker - speaker to provide button press feedback to, may be null
menuItemList - top level menu
Method Detail

buttonPressed

public void buttonPressed()
Provides feedback to the user that a button has been pressed.

Specified by:
buttonPressed in interface MenuController

getScrollIndex

public int getScrollIndex(int numberOfValues)
Samples the scroll input and scales the result such that this method returns an index from the specified number of values.

Specified by:
getScrollIndex in interface MenuController
Parameters:
numberOfValues - the number values to scale the scroll input into. For example, providing the value 3 would cause this function to return 0, 1, or 2 depending on the position of the scroll input
Returns:
a value based on the scroll input position where 0 <= value < numberOfValues

printStatus

public void printStatus(String string)
Replaces the text on the status line with the text provided.

Specified by:
printStatus in interface MenuController
Parameters:
string - String to display on status line

show

public void show()
Show the top level menu. Doesn't return until user exits.


RoboJDETM v2.0

Copyright (c) 2003-2009 RidgeSoft, LLC. All rights reserved.
www.ridgesoft.com