Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
JavascriptManager |
|
| 1.0;1 |
1 | // Copyright 2007 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.tapestry.javascript; | |
16 | ||
17 | import java.util.List; | |
18 | ||
19 | import org.apache.tapestry.IAsset; | |
20 | import org.apache.tapestry.IMarkupWriter; | |
21 | import org.apache.tapestry.IRequestCycle; | |
22 | ||
23 | /** | |
24 | * Manages javascript files of 3rd party libraries. | |
25 | */ | |
26 | public interface JavascriptManager | |
27 | { | |
28 | /** | |
29 | * The javascript files that should always be included. | |
30 | * | |
31 | * @return A not-null (but possibly empty) list of {@link IAsset}s. | |
32 | */ | |
33 | List getAssets(); | |
34 | ||
35 | IAsset getFirstAsset(); | |
36 | ||
37 | /** | |
38 | * The javascript files that provide form-related functionality. | |
39 | * They're dynamically included when the page contains forms. | |
40 | * | |
41 | * @return A not-null (but possibly empty) list of {@link IAsset}s. | |
42 | */ | |
43 | List getFormAssets(); | |
44 | ||
45 | IAsset getFirstFormAsset(); | |
46 | ||
47 | /** | |
48 | * The javascript files that provide widget-related functionality. | |
49 | * They're dynamically included when the page contains widgets. | |
50 | * | |
51 | * @return A not-null (but possibly empty) list of {@link IAsset}s. | |
52 | */ | |
53 | List getWidgetAssets(); | |
54 | ||
55 | IAsset getFirstWidgetAsset(); | |
56 | ||
57 | /** | |
58 | * The base path to the javascript files. | |
59 | * | |
60 | * @return if null, it is left unused. | |
61 | */ | |
62 | IAsset getPath(); | |
63 | ||
64 | /** | |
65 | * The tapestry js file. | |
66 | * | |
67 | * @return if null then no tapestry file is included. | |
68 | */ | |
69 | IAsset getTapestryAsset(); | |
70 | ||
71 | /** | |
72 | * The base path to the tapestry js files. | |
73 | * | |
74 | * @return if null, it is left unused. | |
75 | */ | |
76 | IAsset getTapestryPath(); | |
77 | ||
78 | /** | |
79 | * Output the resources (could be .js, .css, e.t.c. files) needed for the current javascript library. | |
80 | * | |
81 | * @param writer | |
82 | * @param cycle | |
83 | * @param hasForm true if current page includes forms. | |
84 | * @param hasWidget true if current page includes widgets. | |
85 | */ | |
86 | void renderLibraryResources(IMarkupWriter writer, IRequestCycle cycle, boolean hasForm, boolean hasWidget); | |
87 | ||
88 | /** | |
89 | * Output the resources needed for tapestry in order to use the current | |
90 | * javascript library. | |
91 | * | |
92 | * @param writer | |
93 | * @param cycle | |
94 | */ | |
95 | void renderLibraryAdaptor(IMarkupWriter writer, IRequestCycle cycle); | |
96 | } |