1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.headerresource;
18
19 import java.util.Map;
20
21 /***
22 * HeaderResource has tags information to put them into <head> tag.
23 *
24 * @author <a href="mailto:shinsuke@yahoo.co.jp">Shinsuke Sugaya</a>
25 * @author <a href="mailto:smilek@apache.org">Steve Milek</a>
26 * @version $Id: HeaderResource.java 188569 2005-05-13 13:35:18Z weaver $
27 */
28 public interface HeaderResource
29 {
30
31 public final static String HEADER_TYPE_SCRIPT_BLOCK_START = "script-start";
32 public final static int HEADER_TYPE_ID_SCRIPT_BLOCK_START = 1;
33
34 public final static String HEADER_TYPE_SCRIPT_BLOCK = "script";
35 public final static int HEADER_TYPE_ID_SCRIPT_BLOCK = 2;
36
37 public final static String HEADER_TYPE_SCRIPT_BLOCK_END = "script-end";
38 public final static int HEADER_TYPE_ID_SCRIPT_BLOCK_END = 3;
39
40 public final static String HEADER_TYPE_SCRIPT_TAG = "script-tag";
41 public final static int HEADER_TYPE_ID_SCRIPT_TAG = 4;
42
43 public final static String HEADER_TYPE_STYLE_BLOCK = "style";
44 public final static int HEADER_TYPE_ID_STYLE_BLOCK = 5;
45
46 public final static String HEADER_TYPE_LINK_TAG = "link-tag";
47 public final static int HEADER_TYPE_ID_LINK_TAG = 6;
48
49 public final static String HEADER_TYPE_BASE_TAG = "base-tag";
50 public final static int HEADER_TYPE_ID_BASE_TAG = 7;
51
52
53 public final static String HEADER_CONFIG_ORDER = "header.order";
54 public final static String HEADER_CONFIG_TYPES = "header.types";
55 public final static String HEADER_CONFIG_REQUIREDFLAG = "header.requiredflag";
56 public final static String HEADER_CONFIG_DOJO = "dojo";
57 public final static String HEADER_CONFIG_DESKTOP = "desktop";
58
59 public final static String HEADER_INTERNAL_INCLUDED_NAMES = "header.internal.names";
60
61
62 public final static String HEADER_SECTION_BASE_TAG = "header.basetag";
63 public final static String HEADER_SECTION_NAME_PREFIX_DOJO = "header.dojo.";
64 public final static String HEADER_SECTION_DOJO_PARAMETERS = "header.dojo.parameters";
65 public final static String HEADER_SECTION_DOJO_PREINIT = "header.dojo.preinit";
66 public final static String HEADER_SECTION_DOJO_CONFIG = "header.dojo.config";
67 public final static String HEADER_SECTION_DOJO_INIT = "header.dojo.init";
68 public final static String HEADER_SECTION_DOJO_REQUIRES_CORE = "header.dojo.requires.core";
69 public final static String HEADER_SECTION_DOJO_MODULES_PATH = "header.dojo.modules.path";
70 public final static String HEADER_SECTION_DOJO_REQUIRES_MODULES = "header.dojo.requires.modules";
71 public final static String HEADER_SECTION_DOJO_WRITEINCLUDES = "header.dojo.writeincludes";
72 public final static String HEADER_SECTION_DOJO_MODULES_NAMESPACE = "header.dojo.modules.namespace";
73 public final static String HEADER_SECTION_DOJO_STYLE_BODYEXPAND = "header.dojo.style.bodyexpand";
74 public final static String HEADER_SECTION_DOJO_STYLE_BODYEXPAND_NOSCROLL = "header.dojo.style.bodyexpand.noscroll";
75 public final static String HEADER_SECTION_DESKTOP_STYLE_LAYOUT = "header.desktop.style.layout";
76 public final static String HEADER_SECTION_DESKTOP_INIT = "header.desktop.init";
77
78 public final static String HEADER_INTERNAL_JETSPEED_VAR_NAME = "jetspeed";
79 public final static String HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME = "djConfig." + HEADER_INTERNAL_JETSPEED_VAR_NAME;
80
81
82 public final static String HEADER_CONFIG_DOJO_ENABLE = "dojo.enable";
83 public final static String HEADER_CONFIG_DOJO_PATH = "dojo.path";
84 public final static String HEADER_CONFIG_DOJO_PARAM_ISDEBUG = "dojo.parameter.isDebug";
85 public final static String HEADER_CONFIG_DOJO_PARAM_DEBUGALLCOSTS = "dojo.parameter.debugAtAllCosts";
86 public final static String HEADER_CONFIG_DOJO_PARAM_PREVENT_BACKBUTTON_FIX = "dojo.parameter.preventBackButtonFix";
87 public final static String HEADER_CONFIG_DOJO_PARAMS = "dojo.parameters";
88 public final static String HEADER_CONFIG_DOJO_REQUIRES_CORE = "dojo.requires.core";
89 public final static String HEADER_CONFIG_DOJO_MODULES_PATH = "dojo.modules.path";
90 public final static String HEADER_CONFIG_DOJO_MODULES_NAMESPACE = "dojo.modules.namespace";
91 public final static String HEADER_CONFIG_DOJO_REQUIRES_MODULES = "dojo.requires.modules";
92
93
94 public final static String HEADER_CONFIG_DESKTOP_LAYOUT_DECORATION_DEFAULT = "desktop.decoration.layout";
95 public final static String HEADER_CONFIG_DESKTOP_PORTLET_DECORATION_DEFAULT = "desktop.decoration.portlet";
96 public final static String HEADER_CONFIG_DESKTOP_PAGE_AJAXNAVIGATION = "desktop.page.ajaxnavigation";
97 public final static String HEADER_CONFIG_DESKTOP_WINDOW_TILING = "desktop.window.tiling";
98 public final static String HEADER_CONFIG_DESKTOP_WINDOW_HEIGHT_EXPAND = "desktop.window.heightexpand";
99 public final static String HEADER_CONFIG_DESKTOP_WINDOW_HEIGHT = "desktop.window.height";
100 public final static String HEADER_CONFIG_DESKTOP_WINDOW_WIDTH = "desktop.window.width";
101 public final static String HEADER_CONFIG_DESKTOP_WINDOW_ACTION_BUTTON_ORDER = "desktop.window.action.button.order";
102 public final static String HEADER_CONFIG_DESKTOP_WINDOW_ACTION_NOIMAGE = "desktop.window.action.noimage";
103 public final static String HEADER_CONFIG_DESKTOP_WINDOW_ACTION_MENU_ORDER = "desktop.window.action.menu.order";
104 public final static String HEADER_CONFIG_DESKTOP_WINDOW_ACTION_BUTTON_HIDE = "desktop.window.action.button.hide";
105 public final static String HEADER_CONFIG_DESKTOP_WINDOW_ACTION_BUTTON_TOOLTIP = "desktop.window.action.button.tooltip";
106 public final static String HEADER_CONFIG_DESKTOP_WINDOW_ACTION_BUTTON_MAX = "desktop.window.action.button.maximum";
107 public final static String HEADER_CONFIG_DESKTOP_WINDOW_ICON_ENABLED = "desktop.window.icon.enabled";
108 public final static String HEADER_CONFIG_DESKTOP_WINDOW_ICON_PATH = "desktop.window.icon.path";
109 public final static String HEADER_CONFIG_DESKTOP_PAGE_ACTION_BUTTON_TOOLTIP = "desktop.page.action.button.tooltip";
110
111 public final static String HEADER_INTERNAL_CONFIG_DESKTOP_WINDOW_ACTION = "desktop.window.action";
112
113 /***
114 * Output all content (that has not already been output)
115 *
116 * @return content string for inclusion in html <head>
117 */
118 public String toString();
119
120 /***
121 * Output all content (that has not already been output)
122 *
123 * @return content string for inclusion in html <head>
124 */
125 public String getContent();
126
127 /***
128 * Output all unnamed content (that has not already been output)
129 *
130 * @return content string for inclusion in html <head>
131 */
132 public String getUnnamedContent();
133
134 /***
135 * Output all getHeaderSections() content (that has not already been output)
136 *
137 * @return content string for inclusion in html <head>
138 */
139 public String getNamedContent();
140
141 /***
142 * Output the one getHeaderSections() content entry with a key that matches headerName (if it has not already been output)
143 *
144 * @return content string for inclusion in html <head>
145 */
146 public String getNamedContent( String headerName );
147
148 /***
149 * Output getHeaderSections() content entries with key prefixes that match headerNamePrefix (if it has not already been output)
150 *
151 * @return content string for inclusion in html <head>
152 */
153 public String getNamedContentForPrefix( String headerNamePrefix );
154
155 /***
156 * Add text argument to the getHeaderSections() content entry with a key that matches addToHeaderName argument
157 *
158 */
159 public void addHeaderSectionFragment( String addToHeaderName, String text );
160
161 /***
162 * If no previous call using value of headerFragmentName argument has been added to any getHeaderSections() content entry,
163 * add text argument to the getHeaderSections() content entry with a key that matches addToHeaderName argument
164 *
165 */
166 public void addHeaderSectionFragment( String headerFragmentName, String addToHeaderName, String text );
167
168 /***
169 * Indicate whether value of headerFragmentName argument has been used to add to any getHeaderSections() content entry
170 *
171 * @return true if headerFragmentName argument has been used to add to any getHeaderSections() content entry
172 */
173 public boolean hasHeaderSectionFragment( String headerFragmentName );
174
175 /***
176 * Indicate whether value of headerName is an included header section
177 *
178 * @return true if headerName argument is an included header section
179 */
180 public boolean isHeaderSectionIncluded( String headerName );
181
182 /***
183 * Get the type of the getHeaderSections() content entry with a key that matches headerName argument
184 *
185 * @return type of header section
186 */
187 public String getHeaderSectionType( String headerName );
188
189 /***
190 * Set the type of the getHeaderSections() content entry with a key that matches headerName argument
191 * to the value of the headerType argument
192 */
193 public void setHeaderSectionType( String headerName, String headerType );
194
195 /***
196 * Get the requiredflag of the getHeaderSections() content entry with a key that matches headerName argument
197 *
198 * @return requiredflag for header section
199 */
200 public String getHeaderSectionRequiredFlag( String headerName );
201
202
203 /***
204 * Set the requiredflag of the getHeaderSections() content entry with a key that matches headerName argument
205 * to the value of the headerReqFlag argument
206 */
207 public void setHeaderSectionRequiredFlag( String headerName, String headerReqFlag );
208
209 /***
210 * Access modifiable header configuration settings
211 *
212 * @return Map containing modifiable header configuration settings
213 */
214 public Map getHeaderDynamicConfiguration();
215
216 /***
217 * Access complete header configuration settings
218 *
219 * @return unmodifiable Map containing complete header configuration settings
220 */
221 public Map getHeaderConfiguration();
222
223 /***
224 * Is request for /desktop rather than /portal
225 *
226 * @return true if request is for /desktop, false if request is for /portal
227 */
228 public boolean isDesktop();
229
230 /***
231 * Portal base url ( e.g. http://localhost:8080/jetspeed )
232 *
233 * @return portal base url
234 */
235 public String getPortalBaseUrl();
236
237 /***
238 * Portal base url ( e.g. http://localhost:8080/jetspeed )
239 *
240 * @return portal base url
241 */
242 public String getPortalBaseUrl( boolean encode );
243
244 /***
245 * Portal base url with relativePath argument appended ( e.g. http://localhost:8080/jetspeed/javascript/dojo/ )
246 *
247 * @return portal base url with relativePath argument appended
248 */
249 public String getPortalResourceUrl( String relativePath );
250
251 /***
252 * Portal base url with relativePath argument appended ( e.g. http://localhost:8080/jetspeed/javascript/dojo/ )
253 *
254 * @return portal base url with relativePath argument appended
255 */
256 public String getPortalResourceUrl( String relativePath, boolean encode );
257
258 /***
259 * Portal base servlet url ( e.g. http://localhost:8080/jetspeed/desktop/ )
260 *
261 * @return portal base servlet url
262 */
263 public String getPortalUrl();
264
265 /***
266 * Portal base servlet url ( e.g. http://localhost:8080/jetspeed/desktop/ )
267 *
268 * @return portal base servlet url
269 */
270 public String getPortalUrl( boolean encode );
271
272 /***
273 * Portal base servlet url with relativePath argument appended ( e.g. http://localhost:8080/jetspeed/desktop/default-page.psml )
274 *
275 * @return portal base servlet url with relativePath argument appended
276 */
277 public String getPortalUrl( String relativePath );
278
279 /***
280 * Portal base servlet url with relativePath argument appended ( e.g. http://localhost:8080/jetspeed/desktop/default-page.psml )
281 *
282 * @return portal base servlet url with relativePath argument appended
283 */
284 public String getPortalUrl( String relativePath, boolean encode );
285
286
287
288
289
290 /***
291 * If no previous call using value of dojoRequire argument has been added to any getHeaderSections() content entry,
292 * add text argument to getHeaderSections() content entry for dojo core require statements
293 *
294 */
295 public void dojoAddCoreLibraryRequire( String dojoRequire );
296
297 /***
298 * Split dojoRequires argument using ';' delimiter and for each resulting dojoRequire value, if no previous call
299 * using dojoRequire value has been added to any getHeaderSections() content entry,
300 * add text argument to getHeaderSections() content entry for dojo core require statements
301 *
302 */
303 public void dojoAddCoreLibraryRequires( String dojoRequires );
304
305 /***
306 * If no previous call using value of dojoRequire argument has been added to any getHeaderSections() content entry,
307 * add text argument to getHeaderSections() content entry for dojo library module require statements
308 *
309 */
310 public void dojoAddModuleLibraryRequire( String dojoRequire );
311
312 /***
313 * Split dojoRequires argument using ';' delimiter and for each resulting dojoRequire value, if no previous call
314 * using dojoRequire value has been added to any getHeaderSections() content entry,
315 * add text argument to getHeaderSections() content entry for dojo library module require statements
316 *
317 */
318 public void dojoAddModuleLibraryRequires( String dojoRequires );
319
320 /***
321 * Assure that header section name for dojo body expand style is included
322 *
323 */
324 public void dojoAddBodyExpandStyle( boolean omitWindowScrollbars );
325
326 /***
327 * Enable dojo by setting appropriate modifiable header configuration setting
328 *
329 */
330 public void dojoEnable();
331
332
333
334
335 /***
336 * Add tag information to this instance.
337 *
338 * For example, if you want to add the following tag into <head>,
339 *
340 * <foo a="1" b="2">FOO FOO</foo>
341 *
342 * Java code is:
343 *
344 * HashMap map=new HashMap();
345 * map.put("a","1");
346 * map.put("b","2");
347 * headerResouce.addHeaderInfo("foo",map,"FOO FOO");
348 *
349 * @param elementName Tag's name
350 * @param attributes Tag's attributes
351 * @param text Tag's content
352 */
353 public void addHeaderInfo(String elementName, Map attributes, String text);
354
355 /***
356 * Add text as-is to this instance.
357 *
358 * @param text content
359 */
360 public void addHeaderInfo(String text);
361
362 /***
363 * Convenient method to add <script> tag with defer option.
364 *
365 * @param path Javascript file path
366 * @param defer defer attributes for <script> tag.
367 */
368 public void addJavaScript(String path, boolean defer);
369
370 /***
371 * Convenient method to add <script> tag.
372 *
373 * @param path Javascript file path
374 */
375 public void addJavaScript(String path);
376
377 /***
378 * Convenient method to add <link> tag.
379 *
380 * @param path CSS file path
381 */
382 public void addStyleSheet(String path);
383 }