|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.turbine.modules.Assembler
org.apache.turbine.modules.Action
org.apache.turbine.modules.ActionEvent
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:
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. |
Constructor Summary | |
ActionEvent()
C'tor |
Method Summary | |
protected boolean |
considerKey(java.lang.String key,
ParameterParser pp)
Checks whether the selected key really is a valid event. |
abstract void |
doPerform(RunData data)
You need to implement this in your classes that extend this class. |
void |
executeEvents(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(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 |
protected org.apache.commons.logging.Log log
protected static final java.lang.String BUTTON
protected static final int BUTTON_LENGTH
protected static final java.lang.String METHOD_NAME_PREFIX
protected static final int METHOD_NAME_LENGTH
protected static final int LENGTH
Constructor Detail |
public ActionEvent()
Method Detail |
public abstract void doPerform(RunData data) throws java.lang.Exception
doPerform
in class Action
data
- Turbine information.
java.lang.Exception
- a generic exception.protected void perform(RunData data) throws java.lang.Exception
perform
in class Action
data
- Turbine information.
java.lang.Exception
- a generic exception.public void executeEvents(RunData data) throws java.lang.Exception
data
- Turbine information.
java.lang.Exception
- a generic exception.protected final java.lang.String formatString(java.lang.String input)
input
- The unconverted method name.
protected boolean considerKey(java.lang.String key, ParameterParser pp)
key
- The selected keypp
- The parameter parser to look for the key value
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |