org.graffiti.plugins.modes.advanced
Class FunctionManager

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

public class FunctionManager
extends Object

Keeps track of all functions a FunctionComponent offers, including all bindings for these functions.


Constructor Summary
FunctionManager(FunctionComponent functionComponent)
          Constructs a new FunctionManager, associated to the given FunctionComponent.
 
Method Summary
 void activateAllFunctions(JComponent jComponent)
           
 void activateAllKeyBindings(JComponent component)
           
 void activateAllMouseBindings(JComponent jComponent)
           
 void addFunction(Set<String> events, String functionName, Map<String,Object> parameters)
          Adds a new Function with the given properties to this FunctionManager.
 void addFunction(String event, String functionName)
           
 void addFunction(String event, String functionName, Map<String,Object> parameters)
           
 void addFunction(String event, String functionName, String paramOneKey, Object paramOneValue)
           
 void addFunction(String event, String functionName, String paramOneKey, Object paramOneValue, String paramTwoKey, Object paramTwoValue)
           
 void addFunction(String event, String functionName, String paramOneKey, Object paramOneValue, String paramTwoKey, Object paramTwoValue, String paramThreeKey, Object paramThreeValue)
           
static void addSuperComponentPrefix(Set<Function> functions, String prefix)
          Adds the given prefix naming a super-component to all Functions stored in the given Set.
static String cutSuperComponentPrefix(String functionName, String prefix)
          Cuts the given super-component-prefix from the given function-name.
 void deactivateAllFunctions(JComponent jComponent)
           
 void deactivateAllKeyBindings(JComponent component)
           
 void deactivateAllMouseBindings(JComponent jComponent)
           
static String getDirectSubComponentName(String subComponentString)
          Returns the name of that first sub-component as specified by the subComponentString.
static FunctionAction getFunctionAction(String functionName, FunctionComponent functionComponent)
          Gets the FunctionAction assigned to the given function within the given FunctionComponent.
static FunctionComponent getProvidingComponent(FunctionComponent start, String function)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FunctionManager

public FunctionManager(FunctionComponent functionComponent)
Constructs a new FunctionManager, associated to the given FunctionComponent.

Parameters:
functionComponent - any FunctionComponent
Method Detail

addFunction

public void addFunction(String event,
                        String functionName)
                 throws InvalidInputEventException,
                        NoSuchFunctionActionException,
                        InvalidParameterException
Throws:
InvalidInputEventException
NoSuchFunctionActionException
InvalidParameterException

addFunction

public void addFunction(String event,
                        String functionName,
                        String paramOneKey,
                        Object paramOneValue)
                 throws InvalidInputEventException,
                        NoSuchFunctionActionException,
                        InvalidParameterException
Throws:
InvalidInputEventException
NoSuchFunctionActionException
InvalidParameterException

addFunction

public void addFunction(String event,
                        String functionName,
                        String paramOneKey,
                        Object paramOneValue,
                        String paramTwoKey,
                        Object paramTwoValue)
                 throws InvalidInputEventException,
                        NoSuchFunctionActionException,
                        InvalidParameterException
Throws:
InvalidInputEventException
NoSuchFunctionActionException
InvalidParameterException

addFunction

public void addFunction(String event,
                        String functionName,
                        String paramOneKey,
                        Object paramOneValue,
                        String paramTwoKey,
                        Object paramTwoValue,
                        String paramThreeKey,
                        Object paramThreeValue)
                 throws InvalidInputEventException,
                        NoSuchFunctionActionException,
                        InvalidParameterException
Throws:
InvalidInputEventException
NoSuchFunctionActionException
InvalidParameterException

addFunction

public void addFunction(String event,
                        String functionName,
                        Map<String,Object> parameters)
                 throws InvalidInputEventException,
                        NoSuchFunctionActionException,
                        InvalidParameterException
Throws:
InvalidInputEventException
NoSuchFunctionActionException
InvalidParameterException

addFunction

public void addFunction(Set<String> events,
                        String functionName,
                        Map<String,Object> parameters)
                 throws InvalidInputEventException,
                        NoSuchFunctionActionException,
                        InvalidParameterException
Adds a new Function with the given properties to this FunctionManager. Afterwards, the given JComponent will execute the FunctionAction assigned to the new Function whenever one of the given events happens.

Parameters:
events - Set of event-Strings
functionName - name of the new Function
parameters - parameters for the new FunctionAction
Throws:
InvalidInputEventException - if one of the given events has invalid syntax
NoSuchFunctionActionException - if the FunctionAction assigned to the new function can't be found
InvalidParameterException

activateAllFunctions

public void activateAllFunctions(JComponent jComponent)

activateAllKeyBindings

public void activateAllKeyBindings(JComponent component)

activateAllMouseBindings

public void activateAllMouseBindings(JComponent jComponent)

deactivateAllFunctions

public void deactivateAllFunctions(JComponent jComponent)

deactivateAllKeyBindings

public void deactivateAllKeyBindings(JComponent component)

deactivateAllMouseBindings

public void deactivateAllMouseBindings(JComponent jComponent)

getDirectSubComponentName

public static String getDirectSubComponentName(String subComponentString)
Returns the name of that first sub-component as specified by the subComponentString. If subComponentString is built up like "component1.component2...componentN.function", this function returns "component1". If N=0 in the example (String names just a function), null is returned.

Parameters:
subComponentString - String naming a "path" of components, ending in a function
Returns:
name of the first sub-component as described, null if no such component exists

getProvidingComponent

public static FunctionComponent getProvidingComponent(FunctionComponent start,
                                                      String function)

addSuperComponentPrefix

public static void addSuperComponentPrefix(Set<Function> functions,
                                           String prefix)
Adds the given prefix naming a super-component to all Functions stored in the given Set.

Parameters:
functions - Set of Functions, may not contain anything else
prefix - prefix to add

cutSuperComponentPrefix

public static String cutSuperComponentPrefix(String functionName,
                                             String prefix)
Cuts the given super-component-prefix from the given function-name. Returns the result of that operation, if the function-name really starts with the given prefix, null otherwise.

Parameters:
functionName - function-name
prefix - prefix of the function-name
Returns:
function-name minus prefix, if it starts with the prefix, null otherwise

getFunctionAction

public static FunctionAction getFunctionAction(String functionName,
                                               FunctionComponent functionComponent)
Gets the FunctionAction assigned to the given function within the given FunctionComponent. The function-name may contain subcomponent-prefixes, in this case. The given FunctionComponent (or its sub-components will be asked for the FunctionAction.

Parameters:
functionName - name of a function as described
functionComponent - any FunctionComponent
Returns:
FunctionAction assigned to the given function, if it can be found, null otherwise


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