public interface DynamicMenuContent
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.Modifier and Type | Field and Description |
---|---|
static String |
HIDE_WHEN_DISABLED
Marker for actions which should be hidden rather than merely disabled.
|
Modifier and Type | Method and Description |
---|---|
JComponent[] |
getMenuPresenters()
Create main menu/popup menuitems.
|
JComponent[] |
synchMenuPresenters(JComponent[] items)
update main menu presenters.
|
static final String HIDE_WHEN_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.JComponent[] getMenuPresenters()
synchMenuPresenters()
method.
If you want different behaviour for menu and popup,
use a different implementation returned by Presenter.Popup
and Presenter.Menu
.JComponent[] synchMenuPresenters(JComponent[] items)
items
- the previously used menuitems returned by previous call to getMenuPresenters()
or synchMenuPresenters()