Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||
IDynamicInvoker |
|
| 1.0;1 |
1 | // Copyright Aug 27, 2006 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 | package org.apache.tapestry; |
|
15 | ||
16 | import java.util.List; |
|
17 | ||
18 | import org.apache.tapestry.components.Any; |
|
19 | import org.apache.tapestry.link.DirectLink; |
|
20 | ||
21 | ||
22 | /** |
|
23 | * Represents "something" that can cause dynamic XHR/JSON requests to be executed |
|
24 | * as a result of whatever actions the thing that it is attached to normally |
|
25 | * does. |
|
26 | * |
|
27 | * <p> |
|
28 | * This interface is more commonly implemented by components like {@link DirectLink} or |
|
29 | * {@Form} to decorate existing functionality. |
|
30 | * </p> |
|
31 | * |
|
32 | * @author jkuhnert |
|
33 | */ |
|
34 | public interface IDynamicInvoker |
|
35 | { |
|
36 | ||
37 | /** |
|
38 | * If set, will be used to update/refresh portions of a response during XHR requests. |
|
39 | * |
|
40 | * <p> |
|
41 | * For instance, if you have a page listing projects and you wanted to update an |
|
42 | * {@link Any} components contents whenever one of the project links was clicked |
|
43 | * you would use a {@link DirectLink} with the parameters: |
|
44 | * </p> |
|
45 | * |
|
46 | * <pre> |
|
47 | * updateComponents="{'projectDetails'}" |
|
48 | * async="true" |
|
49 | * </pre> |
|
50 | * |
|
51 | * @return The list of components to update, if any. |
|
52 | */ |
|
53 | List getUpdateComponents(); |
|
54 | ||
55 | /** |
|
56 | * Used to specify whether or not the result of this invocation should be returned asynchronously |
|
57 | * or use normal browser page reload semantics. |
|
58 | * |
|
59 | * <p> |
|
60 | * Async being true means responses will be encoded as XML using XmlHttpRequests. If you would like |
|
61 | * your request/response to be in another format - like JSON - you must also specify the additional |
|
62 | * parameter {@link #isJson()}. Without setting the {@link #getUpdateComponents()} parameter |
|
63 | * this parameter is pretty useless. |
|
64 | * </p> |
|
65 | * |
|
66 | * @see #isJson() |
|
67 | * @return True if invocation should be processed asynchronously. |
|
68 | */ |
|
69 | boolean isAsync(); |
|
70 | ||
71 | /** |
|
72 | * Used to specify that the return invocation of the response created should be in the |
|
73 | * {@linkplain "http://json.org"} format. Without setting the {@link #getUpdateComponents} parameter |
|
74 | * this parameter is pretty useless. |
|
75 | * |
|
76 | * @see {@link org.apache.tapestry.IJSONRender} |
|
77 | * @return True if response should be encoded using JSON semantics. |
|
78 | */ |
|
79 | boolean isJson(); |
|
80 | } |