Static Public Member Functions | |
static< T > Optional< T > | visitWithResult (MenuItem item, AbstractMenuItemVisitor< T > visitor) |
static SubMenuItem | asSubMenu (MenuItem item) |
static boolean | isRuntimeStructureNeeded (MenuItem item) |
static MenuItemBuilder | builderWithExisting (MenuItem item) |
static MenuItem | createFromExistingWithId (MenuItem selected, int newId) |
static int | eepromSizeForItem (MenuItem item) |
static AnyMenuState | stateForMenuItem (AnyMenuState existingState, MenuItem item, Object val) |
static AnyMenuState | stateForMenuItem (AnyMenuState existingState, MenuItem item, Object val, boolean changed) |
static Optional< AnyMenuState > | applyIncrementalValueChange (MenuItem item, int delta, MenuTree tree) |
static AnyMenuState | stateForMenuItem (MenuItem item, Object v, boolean changed, boolean active) |
static void | setMenuState (MenuItem item, Object value, MenuTree tree) |
static< T > T | getValueFor (MenuItem item, MenuTree tree, T def) |
static Optional< BootItemMenuCommand<?, ?> > | getBootMsgForItem (MenuItem item, SubMenuItem parent, MenuTree tree) |
static Object | getValueFor (MenuItem item, MenuTree tree) |
static Object | getDefaultFor (MenuItem item) |
A helper class for dealing with MenuItem objects. This class provides helpers for visiting menu items and returning a result. It also provides other helpers for dealing with items.
|
static |
Try and apply an incremental delta value update to a menu tree. This works for integer, enum and scroll items, it loads the existing value and tries to apply the delta offset, if the min/max would not be exceeded.
item | the item to change |
delta | the delta amount |
tree | the tree the item belongs to |
|
static |
Returns the menu item as a sub menu or null
item | the possible sub menu |
|
static |
creates a copy of the menu item chosen, with the ID changed to newId
selected | the item to copy |
newId | the ID for the copy |
|
static |
Gets the size of the eeprom storage for a given element type
item | the item to determine eeprom size for |
|
static |
Can be used during boot sequences to get a suitable boot item for a menu item
item | the item |
parent | the parent |
tree | the tree it belongs to |
|
static |
Gets the default item value for a menu item, such that the value could be used in call to set state.
item | the item |
|
static |
This gets the value from the tree state, if it is not available calls getDefaultValue Same as getValueFor(item, tree, defVal) but this just calls getDefaultFor(..) to get the default.
item | the item to get the state of |
tree | the tree holding the state |
|
static |
Gets the value from the tree or the default provided
item | the item |
tree | the tree to lookup in |
def | the default item (getDefaultFor can get the default automatically) |
<T> | the type is inferred from the default parameter |
|
static |
Check if the item is based on a runtime item
item | the item to check |
|
static |
Set the state in the tree for an item with a new value, setting it changed if it genuinely has.
item | the item |
value | the replacement value |
tree | the tree to change |
|
static |
Get a new state object based on an existing state with a new value keeping all exising other values
existingState | the existing state object |
item | the item |
val | the value |
|
static |
Get the state for an existing state with a new value, changing the changed state
existingState | the existing state object |
item | the item |
val | the changed value |
changed | the new change status |
|
static |
Create a menu state for a given item with a value update. We try pretty hard to convert whatever comes in for the value into a new state.
item | the item to create the state for |
v | the value |
changed | the changed status |
active | the active status |
|
static |
Visits a menu item calling the appropriate function for the type and collects the result that is set by calling your visitor's setResult
method.
item | the item to be visited |
visitor | the visitor that will be used |
<T> | the return type |