com.explodingpixels.macwidgets
public interface SourceListContextMenuProvider
An interface to hook into the context-menu showing process. When installed on a
SourceList
, this interface will be notified just prior to a context menu being shown.
Here's a sample implementation and installation of this interface:
SourceListContextMenuProvider menuProvider = new SourceListContextMenuProvider() { public JPopupMenu createContextMenu() { // create and install your custom menu items for context-menu's on the SourceList. JPopupMenu menu = new JPopupMenu(); popupMenu.add(new JMenuItem("Generic Menu for SourceList")); return popupMenu; } public JPopupMenu createContextMenu(JPopupMenu popupMenu, SourceListItem item) { // create and install your custom menu items for context-menu's on a SourceListItem. JPopupMenu menu = new JPopupMenu(); popupMenu.add(new JMenuItem("Menu for " + item.getText())); return menu; } public JPopupMenu createContextMenu(SourceListCategory category) { // create and install your custom menu items for context-menu's on a SourceListCategory. JPopupMenu menu = new JPopupMenu(); popupMenu.add(new JMenuItem("Menu for " + category.getText())); return menu; } }; mySourceList.setSourceListContextMenuProvider(menuProvider);
Modifier and Type | Method and Description |
---|---|
JPopupMenu |
createContextMenu()
Called when the user requests that a context-menu be shown on the
SourceList itself. |
JPopupMenu |
createContextMenu(SourceListCategory category)
Called when the user requests that a context-menu be shown on a
SourceListCategory . |
JPopupMenu |
createContextMenu(SourceListItem item)
Called when the user requests that a context-menu be shown on a
SourceListItem . |
JPopupMenu createContextMenu()
SourceList
itself.
This will only be called if the SourceList
does not fill the entire view (doesn't
have scroll bars) and the user clicks below any item or category. If the returned menu is
null or if no menu items are added to the menu, then the menu will not be shown.SourceList
. Can be null or have no menu
items to indicate no menu should be shown.JPopupMenu createContextMenu(SourceListItem item)
SourceListItem
.
If the returned menu is null or if no menu items are added to the menu, then the menu will
not be shown.item
- the SourceListItem
that the context-menu was requested for.SourceListItem
. Can be null or have no
menu items to indicate no menu should be shown.JPopupMenu createContextMenu(SourceListCategory category)
SourceListCategory
.
If the returned menu is null or no menu items are added to the menu, then the menu will not
be shown.category
- the SourceListCategory
that the context-menu was requested for.SourceListCategory
. Can be null or have
no menu items to indicate no menu should be shown.