- java.lang.Object
-
- com.thecoderscorner.menu.domain.MenuItem<T>
-
- Type Parameters:
T- the type of the current value
- Direct Known Subclasses:
ActionMenuItem,AnalogMenuItem,BooleanMenuItem,EnumMenuItem,FloatMenuItem,RemoteMenuItem,SubMenuItem,TextMenuItem
public abstract class MenuItem<T> extends java.lang.ObjectThe base class for all menu items, has the most basic operations available on it that are needed by pretty much all menu items.
-
-
Field Summary
Fields Modifier and Type Field Description protected inteepromAddressprotected java.lang.StringfunctionNameprotected intidprotected java.lang.Stringnameprotected booleanreadOnly
-
Constructor Summary
Constructors Constructor Description MenuItem(java.lang.String name, int id, int eepromAddress, java.lang.String functionName, boolean readOnly)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidaccept(MenuItemVisitor visitor)intgetEepromAddress()gets the eeprom storage address for this item.java.lang.StringgetFunctionName()Gets the function name for this itemintgetId()gets the ID for the menu itemjava.lang.StringgetName()gets the name of the menu itembooleanhasChildren()has children indicates if this item can contain child itemsbooleanisReadOnly()gets the read only status of this menu itemabstract MenuState<T>newMenuState(T value, boolean changed, boolean active)java.lang.StringtoString()
-
-
-
Method Detail
-
getName
public java.lang.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
-
getEepromAddress
public int getEepromAddress()
gets the eeprom storage address for this item. -1 indicates no storage.- Returns:
- eeprom address
-
getFunctionName
public java.lang.String getFunctionName()
Gets the function name for this item- Returns:
- the function name
-
hasChildren
public boolean hasChildren()
has children indicates if this item can contain child items- Returns:
- true, if the item can contain child items
-
accept
public abstract void accept(MenuItemVisitor visitor)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-