01: // Copyright 2007 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14:
15: package org.apache.tapestry.integration.app1.base;
16:
17: import java.util.List;
18:
19: import org.apache.tapestry.annotations.OnEvent;
20: import org.apache.tapestry.annotations.Persist;
21: import org.apache.tapestry.ioc.internal.util.CollectionFactory;
22:
23: public abstract class BaseEventHandlerDemo {
24: @Persist
25: private List<String> _methodNames;
26:
27: protected final void addMethodName(String name) {
28: List<String> methodNames = _methodNames;
29:
30: if (methodNames == null)
31: methodNames = CollectionFactory.newList();
32:
33: methodNames.add(name);
34:
35: _methodNames = methodNames;
36: }
37:
38: void onActivate(String placeholder) {
39: _methodNames = null;
40: }
41:
42: public List<String> getMethodNames() {
43: return _methodNames;
44: }
45:
46: @SuppressWarnings("unused")
47: private void onAction() {
48: addMethodName("parent.onAction()");
49: }
50:
51: @SuppressWarnings("unused")
52: private void onAction(String value) {
53: addMethodName("parent.onAction(String)");
54:
55: }
56:
57: @OnEvent("action")
58: void eventHandlerZero() {
59: addMethodName("parent.eventHandlerZero()");
60: }
61:
62: @OnEvent(value="action")
63: void eventHandlerOne(String value) {
64: addMethodName("parent.eventHandlerOne(String)");
65: }
66:
67: }
|