Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
TemplateSource |
|
| 1.0;1 |
1 | // Copyright 2004, 2005 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.services; | |
16 | ||
17 | import org.apache.tapestry.IComponent; | |
18 | import org.apache.tapestry.IRequestCycle; | |
19 | import org.apache.tapestry.parse.ComponentTemplate; | |
20 | ||
21 | /** | |
22 | * A source of localized HTML templates for components. | |
23 | * The cache is the means of access for components to load thier templates, | |
24 | * which they need not do until just before rendering. | |
25 | * | |
26 | * <p>The template cache must be able to locate and parse templates as needed. | |
27 | * It may maintain templates in memory. | |
28 | * | |
29 | * @author Howard Ship | |
30 | */ | |
31 | ||
32 | public interface TemplateSource | |
33 | { | |
34 | /** | |
35 | * Name of an {@link org.apache.tapestry.IAsset} of a component that provides the template | |
36 | * for the asset. This overrides the default (that the template is in | |
37 | * the same directory as the specification). This allows | |
38 | * pages or component templates to be located properly, relative to static | |
39 | * assets (such as images and stylesheets). | |
40 | * | |
41 | * @since 2.2 | |
42 | * | |
43 | */ | |
44 | ||
45 | String TEMPLATE_ASSET_NAME = "$template"; | |
46 | ||
47 | /** | |
48 | * Name of the component parameter that will be automatically bound to | |
49 | * the HTML tag that is used to insert the component in the parent template. | |
50 | * If the parent component does not have a template (i.e. it extends | |
51 | * AbstractComponent, not BaseComponent), then this parameter is bound to null. | |
52 | * | |
53 | * @since 3.0 | |
54 | * @deprecated To be removed in 4.2. Use the new {@link IComponent#getTemplateTagName()} method | |
55 | * instead. | |
56 | */ | |
57 | ||
58 | String TEMPLATE_TAG_PARAMETER_NAME = "templateTag"; | |
59 | ||
60 | /** | |
61 | * Locates the template for the component. | |
62 | * | |
63 | * @param cycle The request cycle loading the template; this is required | |
64 | * in some cases when the template is loaded from an {@link org.apache.tapestry.IAsset}. | |
65 | * @param component The component for which a template should be loaded. | |
66 | */ | |
67 | ||
68 | ComponentTemplate getTemplate(IRequestCycle cycle, IComponent component); | |
69 | ||
70 | } |