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.runtime;
16:
17: import org.apache.tapestry.ComponentEventHandler;
18:
19: /**
20: * The core methods related to event handling. Events used in this way exist to gather data from
21: * user code, by invoking user methods and capturing the response. Return values from methods, if
22: * non-null, are passed to a {@link ComponentEventHandler}. The {@link ComponentEvent} subinterface
23: * extends this by providing access to a context, or set of information related to the event, along
24: * with additional data used, at runtime, to match events to user code methods.
25: */
26: public interface Event {
27: /**
28: * Returns true if the event has been aborted (meaning that the return value from some event
29: * handler method was accepted, and processing of the event was terminated).
30: *
31: * @return true if no further event handler methods should be invoked
32: */
33: boolean isAborted();
34:
35: /**
36: * Invoke to identify, to the event, what component and method is being acted upon (used for
37: * some kinds of exception reporting).
38: *
39: * @param component
40: * the component instance from which the result was obtained
41: * @param methodDescription
42: */
43: void setSource(Component component, String methodDescription);
44:
45: /**
46: * Stores a result for the event. Storing a non-null result value may abort the event (at the
47: * discretion of the {@link ComponentEventHandler}).
48: *
49: * @param result
50: * the result obtained from a method invocations
51: * @return true if the event is now aborted
52: */
53: boolean storeResult(Object result);
54: }
|