View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.jetspeed.decoration;
18  
19  import java.util.List;
20  import java.util.Locale;
21  import java.util.ResourceBundle;
22  
23  /***
24   * 
25   * @author <href a="mailto:weaver@apache.org">Scott T. Weaver</a>
26   *
27   */
28  public interface Decoration
29  {
30      /*** Default style sheet location */
31      String DEFAULT_COMMON_STYLE_SHEET = "css/styles.css";
32      String DEFAULT_PORTAL_STYLE_SHEET = "css/portal.css";
33      String DEFAULT_DESKTOP_STYLE_SHEET = "css/desktop.css";
34      
35      /*** Decoration configuration filename */
36      String CONFIG_FILE_NAME = "decorator.properties";
37      
38      /*** Decoration desktop configuration filename */
39      String CONFIG_DESKTOP_FILE_NAME = "decoratordesktop.properties";
40      
41      /*** Property which indicates whether or not decoration supports desktop mode */
42      String DESKTOP_SUPPORTED_PROPERTY = "desktop.supported";
43  
44      /***
45       * Property for specifying the base CSS class to be used to
46       * create a proper CSS cascade and style isolation for a decoration.
47       */
48      String BASE_CSS_CLASS_PROP = "base.css.class";
49  
50      /*** Property which specifies the resource bundle locator prefix */
51      String RESOURCE_BUNDLE_PROP = "resource.file";
52      
53      /*** Property which specifies the directory name for resource bundle */
54      String RESOURCES_DIRECTORY_NAME = "resources";
55  
56      
57      /***
58       * The name of this Decoration.
59       *  
60       * @return Name of this decoration.
61       */
62      String getName();
63      
64      /***
65       * <p>
66       * Returns the base path for the decoration.
67       * </p>
68       * 
69       * @return the base path for the decoration.
70       */
71      String getBasePath();
72      
73      /***
74       * <p>
75       * Returns the base path for the decoration
76       * with the relativePath argument added.
77       * </p>
78       * 
79       * @param relativePath
80       * @return the base path for the decoration with the relativePath argument added.
81       */
82      String getBasePath( String relativePath );
83      
84      /***
85       * <p>
86       * Returns the correct path to the resource based on the
87       * relative <code>path</code> argument.  This usually entails
88       * locating the resource that is most appropriate for the
89       * current users client and locale.
90       * </p>
91       * <pre>
92       * Example Criterion:
93       * 
94       * Relative Path: images/myimage.gif
95       * Client:        web browser
96       * Language:      en 
97       * Country:       US 
98       * 
99       * </pre>
100      * 
101      * <p>
102      * The implementation should now attempt to resolve the resource using
103      * logic that starts at the most specific and ends at the most general 
104      * path.
105      * </p>
106      * 
107      * <p>
108      * For exmaples sake, lets say we are concerned with finding the image,
109      * myimage.gif, within the layout decoration, tigris.  The logical progression
110      * to find the resourc, myimage.gif, would be as follows:
111      * </p>
112      * 
113      * <pre> 
114      * /decorations/layout/tigris/html/en/US/images/myimage.gif
115      * /decorations/layout/tigris/html/en/images/myimage.gif
116      * /decorations/layout/tigris/html/images/myimage.gif
117      * /decorations/layout/tigris/images/myimage.gif
118      * /decorations/layout/images/myimage.gif
119      * /decorations/layout/images/myimage.gif
120      * </pre>
121      * 
122      * @param path
123      * @return the correct path to the resource based on the
124      * relative <code>path</code> argument.
125      */
126     String getResource(String path);
127     
128     /***
129      * 
130      * @return The appropriate stylesheet to be used with this 
131      * decoration.
132      */
133     String getStyleSheet();
134     
135     /***
136      * 
137      * @return the /portal specific stylesheet to be used with this 
138      * decoration; defined only when decoration supports /desktop.
139      */
140     String getStyleSheetPortal();
141     
142     /***
143      * 
144      * @return the /desktop specific stylesheet to be used with this 
145      * decoration; defined only when decoration supports /desktop.
146      */
147     String getStyleSheetDesktop();
148             
149     /***
150      * Returns the list of <code>DecoratorAction</code>s to be displayed
151      * within the portlet window.
152      * 
153      * @see org.apache.jetspeed.decoration.DecoratorAction
154      * 
155      * @return the list of <code>DecoratorAction</code>s to be displayed
156      * within the portlet window.
157      */
158     List getActions();
159     
160     /***
161      * Set the list of <code>DecoratorAction</code>s to be displayed
162      * within the portlet window.
163      * @see org.apache.jetspeed.decoration.DecoratorAction
164      * 
165      * @param actions actions to displayed within this portlet window. 
166      */
167     void setActions(List actions);
168     
169     /***
170      * Allows access to abritrary properties configured
171      * within your <code>decorator.properties</code> config
172      * file.
173      * @param name
174      * @return value of decoration property which matches name argument.
175      */
176     String getProperty(String name);
177     
178     /***
179      * Returns the base CSS class the template should use to
180      * create a proper CSS cascade and style isolation for a 
181      * decoration.
182      * 
183      * @return the base CSS class the template should use.
184      */
185     String getBaseCSSClass();
186 
187     /***
188      * Returns the name of the currently active mode action
189      * 
190      * @return the name of the currently active mode action
191      */
192     String getCurrentModeAction();
193 
194     /***
195      * Set the name of the currently active mode action
196      * 
197      */
198     void setCurrentModeAction( String currentModeAction );
199     
200     /***
201      * Returns the name of the currently active state action
202      * 
203      * @return the name of the currently active state action
204      */
205     String getCurrentStateAction();
206     
207     /***
208      * Set the name of the currently active state action
209      * 
210      */
211     void setCurrentStateAction( String currentStateAction );
212     
213     /***
214      * @return the resource bundle locator prefix.
215      */
216     String getResourceBundleName();
217     
218     /***
219      * @return the resource bundle for the given Locale and RequestContext.
220      */
221     ResourceBundle getResourceBundle( Locale locale, org.apache.jetspeed.request.RequestContext context );
222 
223     /***
224      * Indicates whether the decorator supports /desktop
225      * 
226      */
227     boolean supportsDesktop();
228 }