Class AbstractMenuMerge
- All Implemented Interfaces:
- IMenuMergeModel
- Direct Known Subclasses:
- DockableBarMerge,- JMenuMerge,- MenuBarMerge,- ToolbarMerge
Abstract base class for all menu merges that represent a collection, for example a menu or a toolbar, as opposed to a single item. This class requires a name which is the logical name of the collection it represents. Remember that the whole point of the menu merge system is that more than one menu merge may represent the same logical name. For example, you might have 3 menu merges for the "file" menu - and they'll all merge together.
The way a menu merge works is to store lists of other menu-merge models. Each list of sub-models forms a group and has its own ordering value, which is used to separate it from other groups. The index value determines the relative ordering of all menu groups. You can add individual items to any group by using its ordering value.
 You can use implicit or explicit group ordering depending on which version of the add functions you use. If
 you use implicit ordering, your first group has a value of 10,000 and you create new groups by calling
 addSeparator()
 
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionAbstractMenuMerge(String name) AbstractMenuMerge(String name, String displayKey) AbstractMenuMerge(String name, String displayKey, Icon icon) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidadd(int separatorGroup, IMenuMergeModel item) Adds a new menu merge model to the specified group numbervoidAdds a new action, wrapped in aActionMenuItemMerge, to the specified group numbervoidadd(IMenuMergeModel item) Adds a new menu merge model to the current implicit groupvoidAdds an action to the current implicit group.voidIncrements the implicit group ID so that subsequent additions will start forming a new groupprotected abstract voidaddSeparator(JComponent menu) Subclasses must define how "separator" components get added to the parent menu item.abstract JComponentCreate the parent menu item represented by this object, that all of its children should be contained in.getName()install(JComponent menu) Merges this model into the menu.protected Iterable<JComponent>iterate(JComponent menu) Creates an Iterable<JComponent> for the menu.voidvoiduninstall(JComponent menu) Reverses the merge of this model into the given menu
- 
Field Details
- 
name
- 
displayKey
- 
icon
- 
groups
- 
currentImplicitGroupprotected int currentImplicitGroup
- 
logprotected org.apache.log4j.Logger log
 
- 
Constructor Details- 
AbstractMenuMerge
- 
AbstractMenuMerge
- 
AbstractMenuMerge
 
- 
- 
Method Details- 
addSeparatorpublic void addSeparator()Increments the implicit group ID so that subsequent additions will start forming a new group
- 
addAdds an action to the current implicit group. Wraps the action in aActionMenuItemMerge
- 
addAdds a new action, wrapped in aActionMenuItemMerge, to the specified group number
- 
installDescription copied from interface:IMenuMergeModelMerges this model into the menu. The JComponent will be either a CommandMenuBar or a JMenu- Specified by:
- installin interface- IMenuMergeModel
 
- 
uninstallDescription copied from interface:IMenuMergeModelReverses the merge of this model into the given menu- Specified by:
- uninstallin interface- IMenuMergeModel
 
- 
addSeparatorSubclasses must define how "separator" components get added to the parent menu item.
- 
createMenuCreate the parent menu item represented by this object, that all of its children should be contained in.
- 
getMenuId
- 
setMenuId
- 
getName
- 
iterateCreates an Iterable<JComponent> for the menu. If menu is a JMenu, it'll iterate over the menu components contained within (menu components don't directly contain their children - they're contained within a private PopupMenu), otherwise it uses normal JComponent iteration.- Parameters:
- menu- the- JMenuto iterate
 
 
-