Class FrcChoiceMenu<T>

java.lang.Object
frclib.driverio.FrcChoiceMenu<T>

public class FrcChoiceMenu<T> extends Object
This class implements a choice menu where a number of choices are presented to the user on the dashboard. The user can make the selection.
  • Constructor Details

    • FrcChoiceMenu

      public FrcChoiceMenu(String menuTitle)
      Constructor: Creates an instance of the object.
      Parameters:
      menuTitle - specifies the title of the menu.
  • Method Details

    • getTitle

      public String getTitle()
      This method returns the title text of this menu.
      Returns:
      title text.
    • addChoice

      public void addChoice(String choiceText, T choiceObject, boolean defChoice, boolean lastChoice)
      This method adds a choice to the menu. The choices will be displayed in the order of them being added.
      Parameters:
      choiceText - specifies the choice text that will be displayed on the dashboard.
      choiceObject - specifies the object to be returned if the choice is selected.
      defChoice - specifies true to set it the default choice, false otherwise.
      lastChoice - specifies true if this is the last choice added to the choice menu, false otherwise.
    • addChoice

      public void addChoice(String choiceText, T choiceObject)
      This method adds a choice to the menu. The choices will be displayed in the order of them being added.
      Parameters:
      choiceText - specifies the choice text that will be displayed on the dashboard.
      choiceObject - specifies the object to be returned if the choice is selected.
    • getCurrentChoiceObject

      public T getCurrentChoiceObject()
      This method returns the current selected choice item. Every menu has a current choice even if the user hasn't picked a choice. In that case, the current choice is the default selection of the menu.
      Returns:
      current selected choice object.
    • getCurrentChoiceText

      public String getCurrentChoiceText()
      This method returns the text of the current choice. Every menu has a current choice even if the menu hasn't been displayed and the user hasn't picked a choice. In that case, the current choice is the default selection of the menu which is the first choice in the menu. If the menu is empty, the current choice is null.
      Returns:
      current selected choice text, null if menu is empty.