|
|||||||||||||||||||
30 day Evaluation License registered to hlship@comcast.net Your 30 day evaluation period has expired. Please visit http://www.cenqua.com to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ComponentPropertySource.java | - | - | - | - |
|
1 | // Copyright 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 java.util.Locale; | |
18 | ||
19 | import org.apache.tapestry.IComponent; | |
20 | import org.apache.tapestry.INamespace; | |
21 | ||
22 | /** | |
23 | * Enapsulates the logic for searching for component meta-data. Deployed as service | |
24 | * tapestry.props.ComponentPropertySource. | |
25 | * <p> | |
26 | * TODO: Adjust name, since it now provides access to namespace properties as well as component | |
27 | * properties. | |
28 | * | |
29 | * @author Howard M. Lewis Ship | |
30 | * @since 4.0 | |
31 | */ | |
32 | public interface ComponentPropertySource | |
33 | { | |
34 | /** | |
35 | * Returns the property value for a particular named meta-data property of the component. The | |
36 | * search order is: | |
37 | * <ul> | |
38 | * <li>The component's specification</li> | |
39 | * <li>The specification of the application (or the library containing the component).</li> | |
40 | * <li>The chain of global property sources.</li> | |
41 | * </ul> | |
42 | * | |
43 | * @return the value of the given key, or null if not found. | |
44 | */ | |
45 | ||
46 | public String getComponentProperty(IComponent component, String propertyName); | |
47 | ||
48 | /** | |
49 | * Like {@link #getComponentProperty(IComponent, String)}, but the property name will be | |
50 | * localized to the component's current locale (determined from its page). Localizing the | |
51 | * property name means that a suffix may be appended to it. If the fully localized name is not | |
52 | * found, then the locale is generalized (i.e., from "en_UK" to "en" to nothing) until a match | |
53 | * is found. | |
54 | * | |
55 | * @return the value of the given property name, or null if not found. | |
56 | */ | |
57 | public String getLocalizedComponentProperty(IComponent component, Locale locale, | |
58 | String propertyName); | |
59 | ||
60 | /** | |
61 | * Returns the property value for a particular named meta-data property of the namespace. The | |
62 | * search order is: | |
63 | * <ul> | |
64 | * <li>The library or application specification for the namespace.</li> | |
65 | * <li>The chain of global property sources.</li> | |
66 | * </ul> | |
67 | * | |
68 | * @return the value of the given key, or null if not found. | |
69 | */ | |
70 | ||
71 | public String getNamespaceProperty(INamespace namespace, String propertyName); | |
72 | ||
73 | /** | |
74 | * As with {@link #getLocalizedComponentProperty(IComponent, Locale, String)}, but with a | |
75 | * {@link INamespace}. | |
76 | */ | |
77 | ||
78 | public String getLocalizedNamespaceProperty(INamespace namespace, Locale locale, | |
79 | String propertyName); | |
80 | } |
|