public class AutoGenMenuItem extends MenuItem
MenuItem
that will replace itself with a List of auto generated MenuItem
s.
The generated List will be added to the MenuItem
root mentioned in the configuration.this#scanAndReplace()
method to trigger the operation.Constructor and Description |
---|
AutoGenMenuItem() |
Modifier and Type | Method and Description |
---|---|
MenuItem |
getContainer()
Name of the MenuItem which is the container of this.
|
IMenuGenerator |
getGenerator()
The instance of the generator that will produce the replacement actual
MenuItem s |
IMenuPathMapper |
getMapper() |
Map<String,MenuItem> |
getRefMenuMapping() |
void |
refresh()
Once Auto generated in
scanAndReplace() the proxy/dummy reference of this is removed
from the main menu. |
protected boolean |
replaceable(MenuItem existingItem,
MenuItem replacingItem)
Checks on a criteria that one
MenuItem is replaceable by another. |
void |
scanAndReplace()
Scan for this item in the container and replace it with the auto generated version.
Use first time, like init or start up conditions. |
void |
scanAndReplaceUpdate()
Deprecated.
: Could only replace menu items if the hierarchical structure was not changed
|
protected void |
scanAndReplaceUpdate(MenuItem generatedMenu,
MenuItem existing)
Deprecated.
: Could only replace menu items if the hierarchical structure was not changed
|
void |
setContainer(MenuItem container)
Name of the MenuItem which is the container of this.
|
void |
setGenerator(IMenuGenerator generator)
The instance of the generator that will produce the replacement actual
MenuItem s |
void |
setMapper(IMenuPathMapper mapper) |
void |
setRefMenuMapping(Map<String,MenuItem> refMenuMapping)
pageMenuMap (reference to Menu) mapping needs to be also auto generated if the menu is auto-gen.
|
compareTo, equals, getChildren, getLevel, getName, getParent, getRefId, hashCode, isNavigable, setChildren, setLevel, setName, setNavigable, setParent, setRefId, toString
@OnApplicationStartup(state=INIT_AT_START) public void scanAndReplace()
public void refresh()
scanAndReplace()
the proxy/dummy reference of this is removed
from the main menu. However the children that are added are real.
This method will replace the ones added by this AutoGenMenuItem
TODO: Add unit test case + unit Test case for when container.getChildren() is Empty@Deprecated public void scanAndReplaceUpdate()
scanAndReplace()
the proxy/dummy reference of this is removed
from the main menu. However the children that are added are real. This method, scans for matching children nodes and
replaces them with newly generated child nodes. it matches the one level below container only (since the auto-gen menus would be added one level below the set container)
@Deprecated protected final void scanAndReplaceUpdate(MenuItem generatedMenu, MenuItem existing)
protected boolean replaceable(MenuItem existingItem, MenuItem replacingItem)
MenuItem
is replaceable by another.
MenuItem
one can override for custom logic.public MenuItem getContainer()
public void setContainer(MenuItem container)
public IMenuGenerator getGenerator()
MenuItem
spublic void setGenerator(IMenuGenerator generator)
MenuItem
spublic void setRefMenuMapping(Map<String,MenuItem> refMenuMapping)
AutoGenMenuItem
public IMenuPathMapper getMapper()
public void setMapper(IMenuPathMapper mapper)
Copyright © 2018. All rights reserved.