com.levigo.util.swing.menu
Class ActionFactoryMenuContributor

java.lang.Object
  extended by com.levigo.util.swing.menu.AbstractSubmenuContributor
      extended by com.levigo.util.swing.menu.ActionFactoryMenuContributor
All Implemented Interfaces:
MenuContributor

public class ActionFactoryMenuContributor
extends AbstractSubmenuContributor

MenuContributor which loads Actions using a ActionFactory. The ActionFactory and action keys are passed as parameters to the constructor.


Field Summary
 
Fields inherited from class com.levigo.util.swing.menu.AbstractSubmenuContributor
log
 
Constructor Summary
ActionFactoryMenuContributor(ActionFactory actionFactory, String... actionKeys)
           
 
Method Summary
protected  void doContribute(ContributionContext context, MenuBuilder menuBuilder)
           
 String getGroup()
           
 boolean isHideIfDisabled()
          Whether disabled actions shall be hidden or not.
 void setGroup(String group)
          Specifies to which group the actions shall be contributed.
 void setHideIfDisabled(boolean hideIfDisabled)
          Specify whether actions that are not enabled should be hidden.
 
Methods inherited from class com.levigo.util.swing.menu.AbstractSubmenuContributor
contribute, setTargetSubmenu, setTargetSubmenu
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionFactoryMenuContributor

public ActionFactoryMenuContributor(ActionFactory actionFactory,
                                    String... actionKeys)
Parameters:
actionFactory - the ActionFactory to be used to lookup the specified action keys
actionKeys - the action keys to be used
Throws:
IllegalArgumentException - if one or both of the arguments are null.
Method Detail

getGroup

public String getGroup()

setGroup

public void setGroup(String group)
Specifies to which group the actions shall be contributed. If this value is null (the default) MenuBuilder.GROUP_DEFAULT will be assumed.

Parameters:
group - the group into which the actions shall be added or null if the default group shall be used

doContribute

protected void doContribute(ContributionContext context,
                            MenuBuilder menuBuilder)
Specified by:
doContribute in class AbstractSubmenuContributor

isHideIfDisabled

public boolean isHideIfDisabled()
Whether disabled actions shall be hidden or not. Please see setHideIfDisabled(boolean) for details.

Returns:
true if disabled actions shall not be contributed to the resulting menu.
See Also:
setHideIfDisabled(boolean)

setHideIfDisabled

public void setHideIfDisabled(boolean hideIfDisabled)
Specify whether actions that are not enabled should be hidden.

Parameters:
hideIfDisabled - If the value is true, only the enabled actions will be contributed to the target menu. Otherwise all actions, regardless their enabled state, will be contributed and shown as disabled in the resulting menu.


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.