01: /*
02: * $Id: DefaultEventProcessorStrategy.java 461190 2006-06-28 06:35:51Z ehillenius $
03: * $Revision: 461190 $ $Date: 2006-06-28 08:35:51 +0200 (Wed, 28 Jun 2006) $
04: *
05: * ==============================================================================
06: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
07: * use this file except in compliance with the License. You may obtain a copy of
08: * the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15: * License for the specific language governing permissions and limitations under
16: * the License.
17: */
18: package wicket.request.compound;
19:
20: import org.apache.commons.logging.Log;
21: import org.apache.commons.logging.LogFactory;
22:
23: import wicket.Application;
24: import wicket.IRequestTarget;
25: import wicket.RequestCycle;
26: import wicket.request.target.IEventProcessor;
27:
28: /**
29: * The default event processing strategy looks whether the current target is of
30: * type {@link wicket.request.target.IEventProcessor} and, if so, calls
31: * method
32: * {@link wicket.request.target.IEventProcessor#processEvents(RequestCycle)}
33: * on them.
34: *
35: * @author Eelco Hillenius
36: */
37: public final class DefaultEventProcessorStrategy implements
38: IEventProcessorStrategy {
39: /** log. */
40: private static final Log log = LogFactory
41: .getLog(DefaultEventProcessorStrategy.class);
42:
43: /**
44: * Construct.
45: */
46: public DefaultEventProcessorStrategy() {
47: }
48:
49: /**
50: * @see wicket.request.compound.IEventProcessorStrategy#processEvents(wicket.RequestCycle)
51: */
52: public final void processEvents(final RequestCycle requestCycle) {
53: IRequestTarget target = requestCycle.getRequestTarget();
54:
55: if (target instanceof IEventProcessor) {
56: if (log.isDebugEnabled()) {
57: log.debug("commencing event handling for " + target);
58: }
59:
60: Application.get().logEventTarget(target);
61:
62: ((IEventProcessor) target).processEvents(requestCycle);
63: }
64: }
65: }
|