|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.scijava.AbstractContextual
org.scijava.menu.ShadowMenu
public class ShadowMenu
A tree representing a menu structure independent of any particular user interface.
A ShadowMenu is a tree node with links to other tree nodes. It is
possible to traverse the entire menu structure from any given node, though by
convention the root node is used to represent the menu as a whole.
The class is implemented as a Collection of modules (i.e.,
ModuleInfo objects), with the tree structure generated from the
modules' menu paths (see UIDetails.getMenuPath()). The class also
implements Runnable, with each leaf node retaining a link to its
corresponding ModuleInfo, and executing that module when
run() is called.
MenuCreator,
MenuPath,
MenuEntry| Constructor Summary | |
|---|---|
ShadowMenu(Context context,
Collection<? extends ModuleInfo> modules)
Constructs a root menu node populated with the given modules. |
|
| Method Summary | ||
|---|---|---|
boolean |
add(ModuleInfo o)
Adds the given module to the menu structure. |
|
boolean |
addAll(Collection<? extends ModuleInfo> c)
Adds the given modules to the menu structure. |
|
void |
clear()
|
|
int |
compareTo(ShadowMenu c)
|
|
boolean |
contains(Object o)
|
|
boolean |
containsAll(Collection<?> c)
|
|
List<ShadowMenu> |
getChildren()
Gets this node's children, sorted by weight. |
|
URL |
getIconURL()
Gets the URL of the icon associated with this node's MenuEntry. |
|
ShadowMenu |
getMenu(MenuPath menuPath)
Gets the node with the given menu path (relative to this node), or null if no such menu node. |
|
ShadowMenu |
getMenu(String path)
|
|
int |
getMenuDepth()
Gets how deep into the menu structure this node is. |
|
MenuEntry |
getMenuEntry()
Gets the menu entry corresponding to this node. |
|
ModuleInfo |
getModuleInfo()
Gets the module linked to this node, or null if node is not a leaf. |
|
String |
getName()
Gets the name of the menu. |
|
ShadowMenu |
getParent()
Gets this node's parent, or null if it is a root node. |
|
boolean |
isCheckBox()
Returns true if this node is a checkbox. |
|
boolean |
isEmpty()
|
|
boolean |
isLeaf()
Returns true if this node has no children. |
|
boolean |
isRadioButton()
Returns true if this node is a radio button. |
|
boolean |
isToggle()
Returns true if this node is selectable (checkbox or radio button). |
|
ShadowMenuIterator |
iterator()
|
|
boolean |
remove(Object o)
|
|
boolean |
removeAll(Collection<?> c)
|
|
boolean |
retainAll(Collection<?> c)
|
|
void |
run()
Executes the module linked to this node. |
|
int |
size()
|
|
Object[] |
toArray()
|
|
|
toArray(T[] a)
|
|
String |
toString()
|
|
boolean |
update(ModuleInfo module)
Updates the menu structure to reflect changes in the given module. |
|
boolean |
updateAll(Collection<? extends ModuleInfo> c)
Updates the menu structure to reflect changes in the given modules. |
|
| Methods inherited from class org.scijava.AbstractContextual |
|---|
context, getContext, setContext |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public ShadowMenu(Context context,
Collection<? extends ModuleInfo> modules)
| Method Detail |
|---|
public ModuleInfo getModuleInfo()
public ShadowMenu getMenu(MenuPath menuPath)
For example, asking for "File > New > Image..." from the root application menu node would retrieve the node for "Image...", as would asking for "New > Image..." from the "File" node.
public ShadowMenu getMenu(String path)
public MenuEntry getMenuEntry()
public int getMenuDepth()
public String getName()
public ShadowMenu getParent()
public List<ShadowMenu> getChildren()
public boolean isLeaf()
public boolean isToggle()
public boolean isCheckBox()
public boolean isRadioButton()
public URL getIconURL()
MenuEntry.
PluginInfo.getIconURL()public boolean update(ModuleInfo module)
public boolean updateAll(Collection<? extends ModuleInfo> c)
public int compareTo(ShadowMenu c)
compareTo in interface Comparable<ShadowMenu>public String toString()
toString in class Objectpublic void run()
run in interface Runnablepublic boolean add(ModuleInfo o)
UIDetails.isVisible() returns false), it is ignored.
add in interface Collection<ModuleInfo>public boolean addAll(Collection<? extends ModuleInfo> c)
UIDetails.isVisible() returns false), it is ignored.
addAll in interface Collection<ModuleInfo>public void clear()
clear in interface Collection<ModuleInfo>public boolean contains(Object o)
contains in interface Collection<ModuleInfo>public boolean containsAll(Collection<?> c)
containsAll in interface Collection<ModuleInfo>public boolean isEmpty()
isEmpty in interface Collection<ModuleInfo>public ShadowMenuIterator iterator()
iterator in interface Iterable<ModuleInfo>iterator in interface Collection<ModuleInfo>public boolean remove(Object o)
remove in interface Collection<ModuleInfo>public boolean removeAll(Collection<?> c)
removeAll in interface Collection<ModuleInfo>public boolean retainAll(Collection<?> c)
retainAll in interface Collection<ModuleInfo>public int size()
size in interface Collection<ModuleInfo>public Object[] toArray()
toArray in interface Collection<ModuleInfo>public <T> T[] toArray(T[] a)
toArray in interface Collection<ModuleInfo>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||