|
|||||||||
| Home >> All >> org >> apache >> turbine >> [ modules overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.turbine.modules
Class ActionEvent

java.lang.Objectorg.apache.turbine.modules.Assembler
org.apache.turbine.modules.Action
org.apache.turbine.modules.ActionEvent
- public abstract class ActionEvent
- extends Action
This is an alternative to the Action class that allows you to do event based actions. Essentially, you label all your submit buttons with the prefix of "eventSubmit_" and the suffix of "methodName". For example, "eventSubmit_doDelete". Then any class that subclasses this class will get its "doDelete(RunData data)" method executed. If for any reason, it was not able to execute the method, it will fall back to executing the doPeform() method which is required to be implemented.
Limitations:
Because ParameterParser makes all the key values lowercase, we have to do some work to format the string into a method name. For example, a button name eventSubmit_doDelete gets converted into eventsubmit_dodelete. Thus, we need to form some sort of naming convention so that dodelete can be turned into doDelete.
Thus, the convention is this:
- The variable name MUST have the prefix "eventSubmit_".
- The variable name after the prefix MUST begin with the letters "do".
- The first letter after the "do" will be capitalized and the rest will be lowercase
- Version:
- $Id: ActionEvent.java 292717 2005-09-30 12:56:23Z seade $
| Field Summary | |
protected static java.lang.String |
BUTTON
The name of the button to look for. |
protected static int |
BUTTON_LENGTH
The length of the button to look for. |
protected static int |
LENGTH
The length of the button to look for. |
protected org.apache.commons.logging.Log |
log
Logging |
protected static int |
METHOD_NAME_LENGTH
The length of the method name. |
protected static java.lang.String |
METHOD_NAME_PREFIX
The prefix of the method name. |
private static java.lang.Class[] |
methodParams
Constant needed for Reflection |
private boolean |
submitValueKey
If true, the eventSubmit_do |
| Constructor Summary | |
ActionEvent()
C'tor |
|
| Method Summary | |
protected boolean |
considerKey(java.lang.String key,
org.apache.turbine.util.parser.ParameterParser pp)
Checks whether the selected key really is a valid event. |
abstract void |
doPerform(org.apache.turbine.util.RunData data)
You need to implement this in your classes that extend this class. |
void |
executeEvents(org.apache.turbine.util.RunData data)
This method should be called to execute the event based system. |
protected java.lang.String |
formatString(java.lang.String input)
This method does the conversion of the lowercase method name into the proper case. |
protected void |
perform(org.apache.turbine.util.RunData data)
This overrides the default Action.perform() to execute the doEvent() method. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
log
protected org.apache.commons.logging.Log log
- Logging
methodParams
private static final java.lang.Class[] methodParams
- Constant needed for Reflection
BUTTON
protected static final java.lang.String BUTTON
- The name of the button to look for.
- See Also:
- Constant Field Values
BUTTON_LENGTH
protected static final int BUTTON_LENGTH
- The length of the button to look for.
METHOD_NAME_PREFIX
protected static final java.lang.String METHOD_NAME_PREFIX
- The prefix of the method name.
- See Also:
- Constant Field Values
METHOD_NAME_LENGTH
protected static final int METHOD_NAME_LENGTH
- The length of the method name.
LENGTH
protected static final int LENGTH
- The length of the button to look for.
submitValueKey
private boolean submitValueKey
- If true, the eventSubmit_do
variable must contain a not null value to be executed.
| Constructor Detail |
ActionEvent
public ActionEvent()
- C'tor
| Method Detail |
doPerform
public abstract void doPerform(org.apache.turbine.util.RunData data) throws java.lang.Exception
- You need to implement this in your classes that extend this class.
perform
protected void perform(org.apache.turbine.util.RunData data) throws java.lang.Exception
- This overrides the default Action.perform() to execute the
doEvent() method. If that fails, then it will execute the
doPerform() method instead.
executeEvents
public void executeEvents(org.apache.turbine.util.RunData data) throws java.lang.Exception
- This method should be called to execute the event based system.
formatString
protected final java.lang.String formatString(java.lang.String input)
- This method does the conversion of the lowercase method name
into the proper case.
considerKey
protected boolean considerKey(java.lang.String key, org.apache.turbine.util.parser.ParameterParser pp)
- Checks whether the selected key really is a valid event.
|
|||||||||
| Home >> All >> org >> apache >> turbine >> [ modules overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC