| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ComponentEvent |
|
| 1.0;1 |
| 1 | // Copyright 2006, 2007, 2008 The Apache Software Foundation | |
| 2 | // | |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 | // you may not use this file except in compliance with the License. | |
| 5 | // You may obtain a copy of the License at | |
| 6 | // | |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 | // | |
| 9 | // 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.tapestry5.runtime; | |
| 16 | ||
| 17 | import org.apache.tapestry5.ComponentResourcesCommon; | |
| 18 | import org.apache.tapestry5.EventContext; | |
| 19 | ||
| 20 | /** | |
| 21 | * An event that may originate in application logic, or as a result of a client interaction (a GET or POST from the | |
| 22 | * client). | |
| 23 | * | |
| 24 | * @see ComponentResourcesCommon#triggerEvent(String, Object[], org.apache.tapestry5.ComponentEventCallback) | |
| 25 | * @see org.apache.tapestry5.ComponentEventCallback | |
| 26 | */ | |
| 27 | public interface ComponentEvent extends Event | |
| 28 | { | |
| 29 | /** | |
| 30 | * Returns true if the event matches the provided criteria. | |
| 31 | * | |
| 32 | * @param eventType the type of event (case insensitive match) | |
| 33 | * @param componentId component is to match against (case insensitive), or the empty string | |
| 34 | * @param parameterCount minimum number of context values | |
| 35 | * @return true if the event matches. | |
| 36 | */ | |
| 37 | boolean matches(String eventType, String componentId, int parameterCount); | |
| 38 | ||
| 39 | /** | |
| 40 | * Coerces a context value to a particular type. The context is an array of objects; typically it is an array of | |
| 41 | * strings of extra path information encoded into the action URL. | |
| 42 | * | |
| 43 | * @param index the index of the context value | |
| 44 | * @param desiredTypeName the desired type | |
| 45 | * @return the coerced value (a wrapper type if the desired type is a primitive) | |
| 46 | */ | |
| 47 | Object coerceContext(int index, String desiredTypeName); | |
| 48 | ||
| 49 | /** | |
| 50 | * Returns the underlying {@link org.apache.tapestry5.EventContext} as a (possibly empty) array. | |
| 51 | */ | |
| 52 | Object[] getContext(); | |
| 53 | ||
| 54 | /** | |
| 55 | * Returns the underlying event context. | |
| 56 | */ | |
| 57 | EventContext getEventContext(); | |
| 58 | } |