org.openide.awt 7.39.1

org.openide.awt
Interface DynamicMenuContent

All Known Implementing Classes:
Actions.MenuItem, Actions.SubMenu, JInlineMenu

public interface DynamicMenuContent

Dynamic result of a Presenter.Menu or Presenter.Popup. If the presenters return an instance of DynamicMenuContent, then the framework code will use it's methods to populate the menu and keep it uptodate.

Since:
org.openide.awt 6.5

Field Summary
static String HIDE_WHEN_DISABLED
          Marker for actions which should be hidden rather than merely disabled.
 
Method Summary
 JComponent[] getMenuPresenters()
          Create main menu/popup menuitems.
 JComponent[] synchMenuPresenters(JComponent[] items)
          update main menu presenters.
 

Field Detail

HIDE_WHEN_DISABLED

static final String HIDE_WHEN_DISABLED
Marker for actions which should be hidden rather than merely disabled. Utilities.actionsToPopup(Action[],Lookup) will skip over any disabled actions which have this property set to true, unless they implement Presenter.Popup. This is a convenient way to make context menu items disappear when disabled; for more complex cases you still need to have a popup presenter with dynamic menu content.

Since:
org.openide.awt 7.22
See Also:
Constant Field Values
Method Detail

getMenuPresenters

JComponent[] getMenuPresenters()
Create main menu/popup menuitems. Null values will be later replaced by JSeparators. This method is called for popups and for menus. It's called each time a popup menu is contructed and just once for the main menu. Main menu updates happen through the synchMenuPresenters() method. If you want different behaviour for menu and popup, use a different implementation returned by Presenter.Popup and Presenter.Menu.


synchMenuPresenters

JComponent[] synchMenuPresenters(JComponent[] items)
update main menu presenters. This method is called only by the main menu processing.

Parameters:
items - the previously used menuitems returned by previous call to getMenuPresenters() or synchMenuPresenters()
Returns:
a new set of items to show in menu. Can be either an updated old set of instances or a completely new one.

org.openide.awt 7.39.1

Built on December 7 2011.  |  Portions Copyright 1997-2011 Oracle. All rights reserved.