T
- type of the menu entries of the sub menupublic class SubmenuBuilder<T extends MenuEntry> extends Object
PositionDescriptor
.Constructor and Description |
---|
SubmenuBuilder() |
Modifier and Type | Method and Description |
---|---|
void |
addAll(List<T> entries,
PositionDescriptor positionDescriptor)
Add all of the given entries with the same position descriptor.
|
boolean |
addEntry(T entry,
PositionDescriptor positionDescriptor)
Add an entry to the sub-menu.
|
List<T> |
buildSubmenu()
Build the resulting sub-menu
|
T |
getEntry(String entryId)
Return an entry by its ID.
|
T |
removeEntry(String entryId)
Remove an entry from the sub-menu.
|
T |
removeEntry(T entry)
Remove an entry from the sub-menu.
|
public void addAll(List<T> entries, PositionDescriptor positionDescriptor)
entries
- the entries to add to the sub-menupositionDescriptor
- descriptor of the position of each entry within the sub-menupublic boolean addEntry(T entry, PositionDescriptor positionDescriptor)
If called several times with position type TOP
the entries which were added
later will be positioned before those added earlier. If called several times with position
type BOTTOM
or AFTER
(and the same menu entry ID to position
after), the entries which were added later will be positioned after those added earlier.
Entries with position type TOP
are always before the BOTTOM
positioned entries. Entries with position type AFTER
will not appear in the
resulting menu if the referenced menu entry does not exist. However, if that referenced entry
is added later on, the entries to position after that entry will than be contained in the
sub-menu.
To get the resulting sub-menu the build method needs to be called.
entry
- the entry to addpositionDescriptor
- descriptor of the position of the entry within the sub-menu, can be null for
default positioning at bottompublic List<T> buildSubmenu()
public T getEntry(String entryId)
entryId
- the ID of the entry to returnpublic T removeEntry(String entryId)
entryId
- the ID of the entry to removeCopyright © 2019 Communote team. All rights reserved.