# Class ActionRouter

java.lang.Object
org.apache.jmeter.gui.action.ActionRouter

All Implemented Interfaces:
  `ActionListener, EventListener`

public final class ActionRouter extends Object implements ActionListener

## Method Summary

Modifier and Type
Method
Description
`void`
`actionPerformed(ActionEvent e)`
`void`
`addPostActionListener(Class<?> action, ActionListener listener)`
Allows an ActionListener to receive notification of a command being executed after the command has executed.
`void`
`addPreActionListener(Class<?> action, ActionListener listener)`
Allows an ActionListener to receive notification of a command being executed prior to the actual execution of the command.
`void`
`doActionNow(ActionEvent e)`
To execute an action immediately in the current thread.
`Set<Command>`
`getAction(String actionName)`
Get the set of `Command`s registered under the name `actionName`
`Command`
`getAction(String actionName, Class<?> actionClass)`
Get the `Command` registered under the name `actionName`, that is of `Class` `actionClass`
`Command`
`getAction(String actionName, String className)`
Get the `Command` registered under the name `actionName` , which class names are equal to `className`
`static ActionRouter`
`getInstance()`
Gets the Instance attribute of the ActionRouter class
`protected void`
`postActionPerformed(Class<? extends Command> action, ActionEvent e)`
`protected void`
`preActionPerformed(Class<? extends Command> action, ActionEvent e)`
`void`
`removePostActionListener(Class<?> action, ActionListener listener)`
Allows an ActionListener to be removed from receiving notifications of a command being executed after the command has executed.
`void`
`removePreActionListener(Class<?> action, ActionListener listener)`
Allows an ActionListener to be removed from receiving notifications of a command being executed prior to the actual execution of the command.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### actionPerformed

public void actionPerformed(ActionEvent e)

Specified by:
  `actionPerformed` in interface `ActionListener`

### doActionNow

public void doActionNow(ActionEvent e)
To execute an action immediately in the current thread.

Parameters:
  `e` - the action to execute

### getAction

public Set<Command> getAction(String actionName)
Get the set of `Command`s registered under the name `actionName`

Parameters:
  `actionName` - The name the `Command`s were registered
Returns:
  a set with all registered `Command`s for `actionName`

### getAction

public Command getAction(String actionName, Class<?> actionClass)
Get the `Command` registered under the name `actionName`, that is of `Class` `actionClass`

Parameters:
  `actionName` - The name the `Command`s were registered
  `actionClass` - The class the `Command`s should be equal to
Returns:
  The registered `Command` for `actionName`, or `null` if none could be found

### getAction

public Command getAction(String actionName, String className)
Get the `Command` registered under the name `actionName` , which class names are equal to `className`

Parameters:
  `actionName` - The name the `Command`s were registered
  `className` - The name of the class the `Command`s should be equal to
Returns:
  The `Command` for `actionName` or `null` if none could be found

### addPreActionListener

public void addPreActionListener(Class<?> action, ActionListener listener)
Allows an ActionListener to receive notification of a command being executed prior to the actual execution of the command.

Parameters:
  `action` - the Class of the command for which the listener will notifications for. Class must extend org.apache.jmeter.gui.action.Command.
  `listener` - the ActionListener to receive the notifications

### removePreActionListener

public void removePreActionListener(Class<?> action, ActionListener listener)
Allows an ActionListener to be removed from receiving notifications of a command being executed prior to the actual execution of the command.

Parameters:
  `action` - the Class of the command for which the listener will notifications for. Class must extend org.apache.jmeter.gui.action.Command.
  `listener` - the ActionListener to receive the notifications

### addPostActionListener

public void addPostActionListener(Class<?> action, ActionListener listener)
Allows an ActionListener to receive notification of a command being executed after the command has executed.

Parameters:
  `action` - the Class of the command for which the listener will notifications for. Class must extend org.apache.jmeter.gui.action.Command.
  `listener` - The `ActionListener` to be registered

### removePostActionListener

public void removePostActionListener(Class<?> action, ActionListener listener)
Allows an ActionListener to be removed from receiving notifications of a command being executed after the command has executed.

Parameters:
  `action` - the Class of the command for which the listener will notifications for. Class must extend org.apache.jmeter.gui.action.Command.
  `listener` - The `ActionListener` that should be deregistered

### preActionPerformed

protected void preActionPerformed(Class<? extends Command> action, ActionEvent e)

### postActionPerformed

protected void postActionPerformed(Class<? extends Command> action, ActionEvent e)

### getInstance

public static ActionRouter getInstance()
Gets the Instance attribute of the ActionRouter class

Returns:
  The Instance value