java.lang.Object
com.thecoderscorner.menu.domain.MenuItem<T>
Type Parameters:
T - the type of the current value
Direct Known Subclasses:
ActionMenuItem, AnalogMenuItem, BooleanMenuItem, EditableLargeNumberMenuItem, EditableTextMenuItem, EnumMenuItem, FloatMenuItem, Rgb32MenuItem, RuntimeListMenuItem, ScrollChoiceMenuItem, SubMenuItem

public abstract class MenuItem<T> extends Object
The base class for all menu items, has the most basic operations available on it that are needed by pretty much all menu items.
  • Field Details

    • name

      protected final String name
    • variableName

      protected final String variableName
    • id

      protected final int id
    • eepromAddress

      protected final int eepromAddress
    • functionName

      protected final String functionName
    • readOnly

      protected final boolean readOnly
    • localOnly

      protected final boolean localOnly
    • visible

      protected final boolean visible
  • Constructor Details

    • MenuItem

      public MenuItem(String name, String variableName, int id, int eepromAddress, String functionName, boolean readOnly, boolean localOnly, boolean visible)
  • Method Details

    • getName

      public String getName()
      gets the name of the menu item
      Returns:
      menu item name
    • isReadOnly

      public boolean isReadOnly()
      gets the read only status of this menu item
      Returns:
      true if read only
    • getId

      public int getId()
      gets the ID for the menu item
      Returns:
      item ID
    • isLocalOnly

      public boolean isLocalOnly()
      Returns if this menu item is only for local viewing and not to be sent remotely
      Returns:
      true if for local only, otherwise false.
    • getEepromAddress

      public int getEepromAddress()
      gets the eeprom storage address for this item. -1 indicates no storage.
      Returns:
      eeprom address
    • getFunctionName

      public String getFunctionName()
      Gets the function name for this item
      Returns:
      the function name
    • getVariableName

      public String getVariableName()
      Gets the variable name that should be used during generation
      Returns:
      the variable name to use during generation
    • isVisible

      public boolean isVisible()
      Flag indicates if the item should be visible on the UI
      Returns:
      true if visible, otherwise false.
    • hasChildren

      public boolean hasChildren()
      has children indicates if this item can contain child items
      Returns:
      true, if the item can contain child items
    • newMenuState

      public abstract MenuState<T> newMenuState(T value, boolean changed, boolean active)
    • accept

      public abstract void accept(MenuItemVisitor visitor)
    • toString

      public String toString()
      Overrides:
      toString in class Object