org.graffiti.plugins.modes.advanced
Class MenuUtil

java.lang.Object
  extended by org.graffiti.plugins.modes.advanced.MenuUtil

public class MenuUtil
extends Object

Helper-class containing methods for dealing with menus, especially in conjunction with the function-concept.


Constructor Summary
MenuUtil()
           
 
Method Summary
static void addItem(JPopupMenu menu, String text, String functionName, FunctionComponent functionComponent)
          Adds a new menu-item which calls the given function with no parameters to the given popup-menu.
static void addItem(JPopupMenu menu, String text, String functionName, FunctionComponent functionComponent, String paramOneKey, Object paramOneValue)
          Adds a new menu-item which calls the given function with one parameter to the given popup-menu.
static void addItem(JPopupMenu menu, String text, String functionName, FunctionComponent functionComponent, String paramOneKey, Object paramOneValue, String toolTip)
          Adds a new menu-item which calls the given function with one parameter to the given popup-menu.
static void addSubItemWith1Param(JMenu subMenu, String text, String functionName, FunctionComponent functionComponent, String paramOneKey, Object paramOneValue, String toolTipText)
          The method adds the given subMenu the text, tooltip and the function which is called from this menu.
static void addSubItemWith2Params(JMenu subMenu, String text, String functionName, FunctionComponent functionComponent, String paramOneKey1, Object paramOneValue1, String paramOneKey2, Object paramOneValue2, String toolTipText)
          DOCUMENT ME!
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MenuUtil

public MenuUtil()
Method Detail

addItem

public static void addItem(JPopupMenu menu,
                           String text,
                           String functionName,
                           FunctionComponent functionComponent)
                    throws NoSuchFunctionActionException,
                           InvalidParameterException
Adds a new menu-item which calls the given function with no parameters to the given popup-menu.

Parameters:
menu - any popup-menu
text - label for the menu-item
functionName - name of the function
functionComponent - FunctionComponent to be used for accessing the function
Throws:
NoSuchFunctionActionException - if no function with the given name can be found
InvalidParameterException - should never be thrown by this class, as we pass no parameters

addItem

public static void addItem(JPopupMenu menu,
                           String text,
                           String functionName,
                           FunctionComponent functionComponent,
                           String paramOneKey,
                           Object paramOneValue)
                    throws NoSuchFunctionActionException,
                           InvalidParameterException
Adds a new menu-item which calls the given function with one parameter to the given popup-menu.

Parameters:
menu - any popup-menu
text - label for the menu-item
functionName - name of the function
functionComponent - FunctionComponent to be used for accessing the function
paramOneKey - name of the parameter
paramOneValue - value assigned to the parameter
Throws:
NoSuchFunctionActionException - if no function with the given name can be found
InvalidParameterException - if either a given parameter doesn�t exist, or you try to assign an invalid value to it

addItem

public static void addItem(JPopupMenu menu,
                           String text,
                           String functionName,
                           FunctionComponent functionComponent,
                           String paramOneKey,
                           Object paramOneValue,
                           String toolTip)
                    throws NoSuchFunctionActionException,
                           InvalidParameterException
Adds a new menu-item which calls the given function with one parameter to the given popup-menu.

Parameters:
menu - any popup-menu
text - label for the menu-item
functionName - name of the function
functionComponent - FunctionComponent to be used for accessing the function
paramOneKey - name of the parameter
paramOneValue - value assigned to the parameter
toolTip - DOCUMENT ME!
Throws:
NoSuchFunctionActionException - if no function with the given name can be found
InvalidParameterException - if either a given parameter doesn�t exist, or you try to assign an invalid value to it

addSubItemWith1Param

public static void addSubItemWith1Param(JMenu subMenu,
                                        String text,
                                        String functionName,
                                        FunctionComponent functionComponent,
                                        String paramOneKey,
                                        Object paramOneValue,
                                        String toolTipText)
                                 throws NoSuchFunctionActionException,
                                        InvalidParameterException
The method adds the given subMenu the text, tooltip and the function which is called from this menu. [MH]

Parameters:
subMenu - The given menu
text - The text
functionName - The name of the function, which has to be called
functionComponent - The function component
paramOneKey - The key of the first parameter
paramOneValue - The value of the first parameter
toolTipText - The tooltip Text
Throws:
NoSuchFunctionActionException - If for the called function the action doesn't exist
InvalidParameterException - If the parameters of the function are not valid

addSubItemWith2Params

public static void addSubItemWith2Params(JMenu subMenu,
                                         String text,
                                         String functionName,
                                         FunctionComponent functionComponent,
                                         String paramOneKey1,
                                         Object paramOneValue1,
                                         String paramOneKey2,
                                         Object paramOneValue2,
                                         String toolTipText)
                                  throws NoSuchFunctionActionException,
                                         InvalidParameterException
DOCUMENT ME!

Parameters:
subMenu - the given Menu
text - The text
functionName - The name of the function, which has to be called
functionComponent - The function component
paramOneKey1 - The key of the first parameter
paramOneValue1 - The value of the first parameter
paramOneKey2 - The key of the second parameter
paramOneValue2 - The value of the second parameter
toolTipText - The toolTipText
Throws:
NoSuchFunctionActionException - If for the called function the action doesn't exist
InvalidParameterException - If the parameters of the function are not valid


Generated at 2012-05-30 11:01:25 PM CEST