001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.jetspeed.decoration;
018:
019: import java.util.List;
020: import java.util.Locale;
021: import java.util.ResourceBundle;
022:
023: /**
024: *
025: * @author <href a="mailto:weaver@apache.org">Scott T. Weaver</a>
026: *
027: */
028: public interface Decoration {
029: /** Default style sheet location */
030: String DEFAULT_COMMON_STYLE_SHEET = "css/styles.css";
031: String DEFAULT_PORTAL_STYLE_SHEET = "css/portal.css";
032: String DEFAULT_DESKTOP_STYLE_SHEET = "css/desktop.css";
033:
034: /** Decoration configuration filename */
035: String CONFIG_FILE_NAME = "decorator.properties";
036:
037: /** Decoration desktop configuration filename */
038: String CONFIG_DESKTOP_FILE_NAME = "decoratordesktop.properties";
039:
040: /** Property which indicates whether or not decoration supports desktop mode */
041: String DESKTOP_SUPPORTED_PROPERTY = "desktop.supported";
042:
043: /**
044: * Property for specifying the base CSS class to be used to
045: * create a proper CSS cascade and style isolation for a decoration.
046: */
047: String BASE_CSS_CLASS_PROP = "base.css.class";
048:
049: /** Property which specifies the resource bundle locator prefix */
050: String RESOURCE_BUNDLE_PROP = "resource.file";
051:
052: /** Property which specifies the directory name for resource bundle */
053: String RESOURCES_DIRECTORY_NAME = "resources";
054:
055: /**
056: * The name of this Decoration.
057: *
058: * @return Name of this decoration.
059: */
060: String getName();
061:
062: /**
063: * <p>
064: * Returns the base path for the decoration.
065: * </p>
066: *
067: * @return the base path for the decoration.
068: */
069: String getBasePath();
070:
071: /**
072: * <p>
073: * Returns the base path for the decoration
074: * with the relativePath argument added.
075: * </p>
076: *
077: * @param relativePath
078: * @return the base path for the decoration with the relativePath argument added.
079: */
080: String getBasePath(String relativePath);
081:
082: /**
083: * <p>
084: * Returns the correct path to the resource based on the
085: * relative <code>path</code> argument. This usually entails
086: * locating the resource that is most appropriate for the
087: * current users client and locale.
088: * </p>
089: * <pre>
090: * Example Criterion:
091: *
092: * Relative Path: images/myimage.gif
093: * Client: web browser
094: * Language: en
095: * Country: US
096: *
097: * </pre>
098: *
099: * <p>
100: * The implementation should now attempt to resolve the resource using
101: * logic that starts at the most specific and ends at the most general
102: * path.
103: * </p>
104: *
105: * <p>
106: * For exmaples sake, lets say we are concerned with finding the image,
107: * myimage.gif, within the layout decoration, tigris. The logical progression
108: * to find the resourc, myimage.gif, would be as follows:
109: * </p>
110: *
111: * <pre>
112: * /decorations/layout/tigris/html/en/US/images/myimage.gif
113: * /decorations/layout/tigris/html/en/images/myimage.gif
114: * /decorations/layout/tigris/html/images/myimage.gif
115: * /decorations/layout/tigris/images/myimage.gif
116: * /decorations/layout/images/myimage.gif
117: * /decorations/layout/images/myimage.gif
118: * </pre>
119: *
120: * @param path
121: * @return the correct path to the resource based on the
122: * relative <code>path</code> argument.
123: */
124: String getResource(String path);
125:
126: /**
127: *
128: * @return The appropriate stylesheet to be used with this
129: * decoration.
130: */
131: String getStyleSheet();
132:
133: /**
134: *
135: * @return the /portal specific stylesheet to be used with this
136: * decoration; defined only when decoration supports /desktop.
137: */
138: String getStyleSheetPortal();
139:
140: /**
141: *
142: * @return the /desktop specific stylesheet to be used with this
143: * decoration; defined only when decoration supports /desktop.
144: */
145: String getStyleSheetDesktop();
146:
147: /**
148: * Returns the list of <code>DecoratorAction</code>s to be displayed
149: * within the portlet window.
150: *
151: * @see org.apache.jetspeed.decoration.DecoratorAction
152: *
153: * @return the list of <code>DecoratorAction</code>s to be displayed
154: * within the portlet window.
155: */
156: List getActions();
157:
158: /**
159: * Set the list of <code>DecoratorAction</code>s to be displayed
160: * within the portlet window.
161: * @see org.apache.jetspeed.decoration.DecoratorAction
162: *
163: * @param actions actions to displayed within this portlet window.
164: */
165: void setActions(List actions);
166:
167: /**
168: * Allows access to abritrary properties configured
169: * within your <code>decorator.properties</code> config
170: * file.
171: * @param name
172: * @return value of decoration property which matches name argument.
173: */
174: String getProperty(String name);
175:
176: /**
177: * Returns the base CSS class the template should use to
178: * create a proper CSS cascade and style isolation for a
179: * decoration.
180: *
181: * @return the base CSS class the template should use.
182: */
183: String getBaseCSSClass();
184:
185: /**
186: * Returns the name of the currently active mode action
187: *
188: * @return the name of the currently active mode action
189: */
190: String getCurrentModeAction();
191:
192: /**
193: * Set the name of the currently active mode action
194: *
195: */
196: void setCurrentModeAction(String currentModeAction);
197:
198: /**
199: * Returns the name of the currently active state action
200: *
201: * @return the name of the currently active state action
202: */
203: String getCurrentStateAction();
204:
205: /**
206: * Set the name of the currently active state action
207: *
208: */
209: void setCurrentStateAction(String currentStateAction);
210:
211: /**
212: * @return the resource bundle locator prefix.
213: */
214: String getResourceBundleName();
215:
216: /**
217: * @return the resource bundle for the given Locale and RequestContext.
218: */
219: ResourceBundle getResourceBundle(Locale locale,
220: org.apache.jetspeed.request.RequestContext context);
221:
222: /**
223: * Indicates whether the decorator supports /desktop
224: *
225: */
226: boolean supportsDesktop();
227: }
|