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 public final static String HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME_SCOPE = HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME + ".";
81
82
83
84 public final static String HEADER_CONFIG_DOJO_ENABLE = "dojo.enable";
85 public final static String HEADER_CONFIG_DOJO_PATH = "dojo.path";
86 public final static String HEADER_CONFIG_DOJO_PARAM_ISDEBUG = "dojo.parameter.isDebug";
87 public final static String HEADER_CONFIG_DOJO_PARAM_DEBUGALLCOSTS = "dojo.parameter.debugAtAllCosts";
88 public final static String HEADER_CONFIG_DOJO_PARAM_PREVENT_BACKBUTTON_FIX = "dojo.parameter.preventBackButtonFix";
89 public final static String HEADER_CONFIG_DOJO_PARAMS = "dojo.parameters";
90 public final static String HEADER_CONFIG_DOJO_REQUIRES_CORE = "dojo.requires.core";
91 public final static String HEADER_CONFIG_DOJO_MODULES_PATH = "dojo.modules.path";
92 public final static String HEADER_CONFIG_DOJO_MODULES_NAMESPACE = "dojo.modules.namespace";
93 public final static String HEADER_CONFIG_DOJO_REQUIRES_MODULES = "dojo.requires.modules";
94
95
96 public final static String HEADER_CONFIG_DESKTOP_LAYOUT_DECORATION_DEFAULT = "decoration.layout";
97 public final static String HEADER_CONFIG_DESKTOP_PORTLET_DECORATION_DEFAULT = "decoration.portlet";
98 public final static String HEADER_CONFIG_DESKTOP_PAGE_AJAXNAVIGATION = "page.ajaxnavigation";
99 public final static String HEADER_CONFIG_DESKTOP_PAGE_ACTION_BUTTON_TOOLTIP = "page.action.button.tooltip";
100 public final static String HEADER_CONFIG_DESKTOP_WINDOW_TILING = "window.tiling";
101 public final static String HEADER_CONFIG_DESKTOP_WINDOW_HEIGHT_EXPAND = "window.heightexpand";
102 public final static String HEADER_CONFIG_DESKTOP_WINDOW_HEIGHT = "window.height";
103 public final static String HEADER_CONFIG_DESKTOP_WINDOW_WIDTH = "window.width";
104 public final static String HEADER_CONFIG_DESKTOP_WINDOW_ACTION_BUTTON_ORDER = "window.action.button.order";
105 public final static String HEADER_CONFIG_DESKTOP_WINDOW_ACTION_NOIMAGE = "window.action.noimage";
106 public final static String HEADER_CONFIG_DESKTOP_WINDOW_ACTION_MENU_ORDER = "window.action.menu.order";
107 public final static String HEADER_CONFIG_DESKTOP_WINDOW_ACTION_BUTTON_MAX = "window.action.button.maximum";
108 public final static String HEADER_CONFIG_DESKTOP_WINDOW_ACTION_BUTTON_TOOLTIP = "window.action.button.tooltip";
109 public final static String HEADER_CONFIG_DESKTOP_WINDOW_ICON_ENABLED = "window.icon.enabled";
110 public final static String HEADER_CONFIG_DESKTOP_WINDOW_ICON_PATH = "window.icon.path";
111 public final static String HEADER_CONFIG_DESKTOP_WINDOW_TITLEBAR_ENABLED = "window.titlebar.enabled";
112 public final static String HEADER_CONFIG_DESKTOP_WINDOW_RESIZEBAR_ENABLED = "window.resizebar.enabled";
113
114 public final static String DESKTOP_JSON_WINDOW_ACTION_BUTTON_ORDER = "windowActionButtonOrder";
115 public final static String DESKTOP_JSON_WINDOW_ACTION_NOIMAGE = "windowActionNoImage";
116 public final static String DESKTOP_JSON_WINDOW_ACTION_MENU_ORDER = "windowActionMenuOrder";
117 public final static String DESKTOP_JSON_WINDOW_ACTION_BUTTON_MAX = "windowActionButtonMax";
118 public final static String DESKTOP_JSON_WINDOW_ACTION_BUTTON_TOOLTIP = "windowActionButtonTooltip";
119 public final static String DESKTOP_JSON_WINDOW_ICON_ENABLED = "windowIconEnabled";
120 public final static String DESKTOP_JSON_WINDOW_ICON_PATH = "windowIconPath";
121 public final static String DESKTOP_JSON_WINDOW_TITLEBAR_ENABLED = "windowTitlebar";
122 public final static String DESKTOP_JSON_WINDOW_RESIZEBAR_ENABLED = "windowResizebar";
123
124
125 public final static String HEADER_INTERNAL_CONFIG_DESKTOP_WINDOW_ACTION = "desktop.window.action";
126
127 public final static String HEADER_DEBUG_REQUIRES = "jetspeed.desktop.debug";
128
129 /***
130 * Output all content (that has not already been output)
131 *
132 * @return content string for inclusion in html <head>
133 */
134 public String toString();
135
136 /***
137 * Output all content (that has not already been output)
138 *
139 * @return content string for inclusion in html <head>
140 */
141 public String getContent();
142
143 /***
144 * Output all unnamed content (that has not already been output)
145 *
146 * @return content string for inclusion in html <head>
147 */
148 public String getUnnamedContent();
149
150 /***
151 * Output all getHeaderSections() content (that has not already been output)
152 *
153 * @return content string for inclusion in html <head>
154 */
155 public String getNamedContent();
156
157 /***
158 * Output the one getHeaderSections() content entry with a key that matches headerName (if it has not already been output)
159 *
160 * @return content string for inclusion in html <head>
161 */
162 public String getNamedContent( String headerName );
163
164 /***
165 * Output getHeaderSections() content entries with key prefixes that match headerNamePrefix (if it has not already been output)
166 *
167 * @return content string for inclusion in html <head>
168 */
169 public String getNamedContentForPrefix( String headerNamePrefix );
170
171 /***
172 * Add text argument to the getHeaderSections() content entry with a key that matches addToHeaderName argument
173 *
174 */
175 public void addHeaderSectionFragment( String addToHeaderName, String text );
176
177 /***
178 * If no previous call using value of headerFragmentName argument has been added to any getHeaderSections() content entry,
179 * add text argument to the getHeaderSections() content entry with a key that matches addToHeaderName argument
180 *
181 */
182 public void addHeaderSectionFragment( String headerFragmentName, String addToHeaderName, String text );
183
184 /***
185 * Indicate whether value of headerFragmentName argument has been used to add to any getHeaderSections() content entry
186 *
187 * @return true if headerFragmentName argument has been used to add to any getHeaderSections() content entry
188 */
189 public boolean hasHeaderSectionFragment( String headerFragmentName );
190
191 /***
192 * Indicate whether value of headerName is an included header section
193 *
194 * @return true if headerName argument is an included header section
195 */
196 public boolean isHeaderSectionIncluded( String headerName );
197
198 /***
199 * Get the type of the getHeaderSections() content entry with a key that matches headerName argument
200 *
201 * @return type of header section
202 */
203 public String getHeaderSectionType( String headerName );
204
205 /***
206 * Set the type of the getHeaderSections() content entry with a key that matches headerName argument
207 * to the value of the headerType argument
208 */
209 public void setHeaderSectionType( String headerName, String headerType );
210
211 /***
212 * Get the requiredflag of the getHeaderSections() content entry with a key that matches headerName argument
213 *
214 * @return requiredflag for header section
215 */
216 public String getHeaderSectionRequiredFlag( String headerName );
217
218
219 /***
220 * Set the requiredflag of the getHeaderSections() content entry with a key that matches headerName argument
221 * to the value of the headerReqFlag argument
222 */
223 public void setHeaderSectionRequiredFlag( String headerName, String headerReqFlag );
224
225 /***
226 * Access modifiable header configuration settings
227 *
228 * @return Map containing modifiable header configuration settings
229 */
230 public Map getHeaderDynamicConfiguration();
231
232 /***
233 * Access complete header configuration settings
234 *
235 * @return unmodifiable Map containing complete header configuration settings
236 */
237 public Map getHeaderConfiguration();
238
239 /***
240 * Is request for /desktop rather than /portal
241 *
242 * @return true if request is for /desktop, false if request is for /portal
243 */
244 public boolean isDesktop();
245
246 /***
247 * Portal base url ( e.g. http://localhost:8080/jetspeed )
248 *
249 * @return portal base url
250 */
251 public String getPortalBaseUrl();
252
253 /***
254 * Portal base url ( e.g. http://localhost:8080/jetspeed )
255 *
256 * @return portal base url
257 */
258 public String getPortalBaseUrl( boolean encode );
259
260 /***
261 * Portal base url with relativePath argument appended ( e.g. http://localhost:8080/jetspeed/javascript/dojo/ )
262 *
263 * @return portal base url with relativePath argument appended
264 */
265 public String getPortalResourceUrl( String relativePath );
266
267 /***
268 * Portal base url with relativePath argument appended ( e.g. http://localhost:8080/jetspeed/javascript/dojo/ )
269 *
270 * @return portal base url with relativePath argument appended
271 */
272 public String getPortalResourceUrl( String relativePath, boolean encode );
273
274 /***
275 * Portal base servlet url ( e.g. http://localhost:8080/jetspeed/desktop/ )
276 *
277 * @return portal base servlet url
278 */
279 public String getPortalUrl();
280
281 /***
282 * Portal base servlet url ( e.g. http://localhost:8080/jetspeed/desktop/ )
283 *
284 * @return portal base servlet url
285 */
286 public String getPortalUrl( boolean encode );
287
288 /***
289 * Portal base servlet url with relativePath argument appended ( e.g. http://localhost:8080/jetspeed/desktop/default-page.psml )
290 *
291 * @return portal base servlet url with relativePath argument appended
292 */
293 public String getPortalUrl( String relativePath );
294
295 /***
296 * Portal base servlet url with relativePath argument appended ( e.g. http://localhost:8080/jetspeed/desktop/default-page.psml )
297 *
298 * @return portal base servlet url with relativePath argument appended
299 */
300 public String getPortalUrl( String relativePath, boolean encode );
301
302
303
304
305
306 /***
307 * If no previous call using value of dojoRequire argument has been added to any getHeaderSections() content entry,
308 * add text argument to getHeaderSections() content entry for dojo core require statements
309 *
310 */
311 public void dojoAddCoreLibraryRequire( String dojoRequire );
312
313 /***
314 * Split dojoRequires argument using ';' delimiter and for each resulting dojoRequire value, if no previous call
315 * using dojoRequire value has been added to any getHeaderSections() content entry,
316 * add text argument to getHeaderSections() content entry for dojo core require statements
317 *
318 */
319 public void dojoAddCoreLibraryRequires( String dojoRequires );
320
321 /***
322 * If no previous call using value of dojoRequire argument has been added to any getHeaderSections() content entry,
323 * add text argument to getHeaderSections() content entry for dojo library module require statements
324 *
325 */
326 public void dojoAddModuleLibraryRequire( String dojoRequire );
327
328 /***
329 * Split dojoRequires argument using ';' delimiter and for each resulting dojoRequire value, if no previous call
330 * using dojoRequire value has been added to any getHeaderSections() content entry,
331 * add text argument to getHeaderSections() content entry for dojo library module require statements
332 *
333 */
334 public void dojoAddModuleLibraryRequires( String dojoRequires );
335
336 /***
337 * Assure that header section name for dojo body expand style is included
338 *
339 */
340 public void dojoAddBodyExpandStyle( boolean omitWindowScrollbars );
341
342 /***
343 * Enable dojo by setting appropriate modifiable header configuration setting
344 *
345 */
346 public void dojoEnable();
347
348
349
350
351 /***
352 * Add tag information to this instance.
353 *
354 * For example, if you want to add the following tag into <head>,
355 *
356 * <foo a="1" b="2">FOO FOO</foo>
357 *
358 * Java code is:
359 *
360 * HashMap map=new HashMap();
361 * map.put("a","1");
362 * map.put("b","2");
363 * headerResouce.addHeaderInfo("foo",map,"FOO FOO");
364 *
365 * @param elementName Tag's name
366 * @param attributes Tag's attributes
367 * @param text Tag's content
368 */
369 public void addHeaderInfo(String elementName, Map attributes, String text);
370
371 /***
372 * Add text as-is to this instance.
373 *
374 * @param text content
375 */
376 public void addHeaderInfo(String text);
377
378 /***
379 * Convenient method to add <script> tag with defer option.
380 *
381 * @param path Javascript file path
382 * @param defer defer attributes for <script> tag.
383 */
384 public void addJavaScript(String path, boolean defer);
385
386 /***
387 * Convenient method to add <script> tag.
388 *
389 * @param path Javascript file path
390 */
391 public void addJavaScript(String path);
392
393 /***
394 * Convenient method to add <link> tag.
395 *
396 * @param path CSS file path
397 */
398 public void addStyleSheet(String path);
399 }