- 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,RuntimeListMenuItem,SubMenuItem
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 booleanlocalOnlyprotected java.lang.Stringnameprotected booleanreadOnlyprotected booleanvisible
-
Constructor Summary
Constructors Constructor Description MenuItem(java.lang.String name, int id, int eepromAddress, java.lang.String functionName, boolean readOnly, boolean localOnly, boolean visible)
-
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 itemsbooleanisLocalOnly()Returns if this menu item is only for local viewing and not to be sent remotelybooleanisReadOnly()gets the read only status of this menu itembooleanisVisible()Flag indicates if the item should be visible on the UIabstract MenuState<T>newMenuState(T value, boolean changed, boolean active)java.lang.StringtoString()
-
-
-
Field Detail
-
name
protected final java.lang.String name
-
id
protected final int id
-
eepromAddress
protected final int eepromAddress
-
functionName
protected final java.lang.String functionName
-
readOnly
protected final boolean readOnly
-
localOnly
protected final boolean localOnly
-
visible
protected final boolean visible
-
-
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
-
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 java.lang.String getFunctionName()
Gets the function name for this item- Returns:
- the function name
-
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
-
accept
public abstract void accept(MenuItemVisitor visitor)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-