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.headerresource;
018:
019: import java.util.Map;
020:
021: /**
022: * HeaderResource has tags information to put them into <head> tag.
023: *
024: * @author <a href="mailto:shinsuke@yahoo.co.jp">Shinsuke Sugaya</a>
025: * @author <a href="mailto:smilek@apache.org">Steve Milek</a>
026: * @version $Id: HeaderResource.java 188569 2005-05-13 13:35:18Z weaver $
027: */
028: public interface HeaderResource {
029: // header section types
030: public final static String HEADER_TYPE_SCRIPT_BLOCK_START = "script-start";
031: public final static int HEADER_TYPE_ID_SCRIPT_BLOCK_START = 1;
032:
033: public final static String HEADER_TYPE_SCRIPT_BLOCK = "script";
034: public final static int HEADER_TYPE_ID_SCRIPT_BLOCK = 2;
035:
036: public final static String HEADER_TYPE_SCRIPT_BLOCK_END = "script-end";
037: public final static int HEADER_TYPE_ID_SCRIPT_BLOCK_END = 3;
038:
039: public final static String HEADER_TYPE_SCRIPT_TAG = "script-tag";
040: public final static int HEADER_TYPE_ID_SCRIPT_TAG = 4;
041:
042: public final static String HEADER_TYPE_STYLE_BLOCK = "style";
043: public final static int HEADER_TYPE_ID_STYLE_BLOCK = 5;
044:
045: public final static String HEADER_TYPE_LINK_TAG = "link-tag";
046: public final static int HEADER_TYPE_ID_LINK_TAG = 6;
047:
048: public final static String HEADER_TYPE_BASE_TAG = "base-tag";
049: public final static int HEADER_TYPE_ID_BASE_TAG = 7;
050:
051: // header section configuration
052: public final static String HEADER_CONFIG_ORDER = "header.order";
053: public final static String HEADER_CONFIG_TYPES = "header.types";
054: public final static String HEADER_CONFIG_REQUIREDFLAG = "header.requiredflag";
055: public final static String HEADER_CONFIG_DOJO = "dojo";
056: public final static String HEADER_CONFIG_DESKTOP = "desktop";
057:
058: public final static String HEADER_INTERNAL_INCLUDED_NAMES = "header.internal.names"; // internal use - not a configuration entry name
059:
060: // header section predefined names
061: public final static String HEADER_SECTION_BASE_TAG = "header.basetag";
062: public final static String HEADER_SECTION_NAME_PREFIX_DOJO = "header.dojo.";
063: public final static String HEADER_SECTION_DOJO_PARAMETERS = "header.dojo.parameters";
064: public final static String HEADER_SECTION_DOJO_PREINIT = "header.dojo.preinit";
065: public final static String HEADER_SECTION_DOJO_CONFIG = "header.dojo.config";
066: public final static String HEADER_SECTION_DOJO_INIT = "header.dojo.init";
067: public final static String HEADER_SECTION_DOJO_REQUIRES_CORE = "header.dojo.requires.core";
068: public final static String HEADER_SECTION_DOJO_MODULES_PATH = "header.dojo.modules.path";
069: public final static String HEADER_SECTION_DOJO_REQUIRES_MODULES = "header.dojo.requires.modules";
070: public final static String HEADER_SECTION_DOJO_WRITEINCLUDES = "header.dojo.writeincludes";
071: public final static String HEADER_SECTION_DOJO_MODULES_NAMESPACE = "header.dojo.modules.namespace";
072: public final static String HEADER_SECTION_DOJO_STYLE_BODYEXPAND = "header.dojo.style.bodyexpand";
073: public final static String HEADER_SECTION_DOJO_STYLE_BODYEXPAND_NOSCROLL = "header.dojo.style.bodyexpand.noscroll";
074: public final static String HEADER_SECTION_DESKTOP_STYLE_LAYOUT = "header.desktop.style.layout";
075: public final static String HEADER_SECTION_DESKTOP_INIT = "header.desktop.init";
076:
077: public final static String HEADER_INTERNAL_JETSPEED_VAR_NAME = "jetspeed";
078: public final static String HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME = "djConfig."
079: + HEADER_INTERNAL_JETSPEED_VAR_NAME; // internal use - not a configuration entry name
080: public final static String HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME_SCOPE = HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME
081: + "."; // internal use - not a configuration entry name
082:
083: // header configuration - dojo
084: public final static String HEADER_CONFIG_DOJO_ENABLE = "dojo.enable";
085: public final static String HEADER_CONFIG_DOJO_PATH = "dojo.path";
086: public final static String HEADER_CONFIG_DOJO_PARAM_ISDEBUG = "dojo.parameter.isDebug";
087: public final static String HEADER_CONFIG_DOJO_PARAM_DEBUGALLCOSTS = "dojo.parameter.debugAtAllCosts";
088: public final static String HEADER_CONFIG_DOJO_PARAM_PREVENT_BACKBUTTON_FIX = "dojo.parameter.preventBackButtonFix";
089: public final static String HEADER_CONFIG_DOJO_PARAMS = "dojo.parameters";
090: public final static String HEADER_CONFIG_DOJO_REQUIRES_CORE = "dojo.requires.core";
091: public final static String HEADER_CONFIG_DOJO_MODULES_PATH = "dojo.modules.path";
092: public final static String HEADER_CONFIG_DOJO_MODULES_NAMESPACE = "dojo.modules.namespace";
093: public final static String HEADER_CONFIG_DOJO_REQUIRES_MODULES = "dojo.requires.modules";
094:
095: // header configuration - desktop
096: public final static String HEADER_CONFIG_DESKTOP_LAYOUT_DECORATION_DEFAULT = "decoration.layout";
097: public final static String HEADER_CONFIG_DESKTOP_PORTLET_DECORATION_DEFAULT = "decoration.portlet";
098: public final static String HEADER_CONFIG_DESKTOP_PAGE_AJAXNAVIGATION = "page.ajaxnavigation";
099: 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: public final static String HEADER_INTERNAL_CONFIG_DESKTOP_WINDOW_ACTION = "desktop.window.action";
125:
126: public final static String HEADER_DEBUG_REQUIRES = "jetspeed.desktop.debug";
127:
128: /**
129: * Output all content (that has not already been output)
130: *
131: * @return content string for inclusion in html <head>
132: */
133: public String toString();
134:
135: /**
136: * Output all content (that has not already been output)
137: *
138: * @return content string for inclusion in html <head>
139: */
140: public String getContent();
141:
142: /**
143: * Output all unnamed content (that has not already been output)
144: *
145: * @return content string for inclusion in html <head>
146: */
147: public String getUnnamedContent();
148:
149: /**
150: * Output all getHeaderSections() content (that has not already been output)
151: *
152: * @return content string for inclusion in html <head>
153: */
154: public String getNamedContent();
155:
156: /**
157: * Output the one getHeaderSections() content entry with a key that matches headerName (if it has not already been output)
158: *
159: * @return content string for inclusion in html <head>
160: */
161: public String getNamedContent(String headerName);
162:
163: /**
164: * Output getHeaderSections() content entries with key prefixes that match headerNamePrefix (if it has not already been output)
165: *
166: * @return content string for inclusion in html <head>
167: */
168: public String getNamedContentForPrefix(String headerNamePrefix);
169:
170: /**
171: * Add text argument to the getHeaderSections() content entry with a key that matches addToHeaderName argument
172: *
173: */
174: public void addHeaderSectionFragment(String addToHeaderName,
175: 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,
183: String addToHeaderName, String text);
184:
185: /**
186: * Indicate whether value of headerFragmentName argument has been used to add to any getHeaderSections() content entry
187: *
188: * @return true if headerFragmentName argument has been used to add to any getHeaderSections() content entry
189: */
190: public boolean hasHeaderSectionFragment(String headerFragmentName);
191:
192: /**
193: * Indicate whether value of headerName is an included header section
194: *
195: * @return true if headerName argument is an included header section
196: */
197: public boolean isHeaderSectionIncluded(String headerName);
198:
199: /**
200: * Get the type of the getHeaderSections() content entry with a key that matches headerName argument
201: *
202: * @return type of header section
203: */
204: public String getHeaderSectionType(String headerName);
205:
206: /**
207: * Set the type of the getHeaderSections() content entry with a key that matches headerName argument
208: * to the value of the headerType argument
209: */
210: public void setHeaderSectionType(String headerName,
211: String headerType);
212:
213: /**
214: * Get the requiredflag of the getHeaderSections() content entry with a key that matches headerName argument
215: *
216: * @return requiredflag for header section
217: */
218: public String getHeaderSectionRequiredFlag(String headerName);
219:
220: /**
221: * Set the requiredflag of the getHeaderSections() content entry with a key that matches headerName argument
222: * to the value of the headerReqFlag argument
223: */
224: public void setHeaderSectionRequiredFlag(String headerName,
225: String headerReqFlag);
226:
227: /**
228: * Access modifiable header configuration settings
229: *
230: * @return Map containing modifiable header configuration settings
231: */
232: public Map getHeaderDynamicConfiguration();
233:
234: /**
235: * Access complete header configuration settings
236: *
237: * @return unmodifiable Map containing complete header configuration settings
238: */
239: public Map getHeaderConfiguration();
240:
241: /**
242: * Is request for /desktop rather than /portal
243: *
244: * @return true if request is for /desktop, false if request is for /portal
245: */
246: public boolean isDesktop();
247:
248: /**
249: * Portal base url ( e.g. http://localhost:8080/jetspeed )
250: *
251: * @return portal base url
252: */
253: public String getPortalBaseUrl();
254:
255: /**
256: * Portal base url ( e.g. http://localhost:8080/jetspeed )
257: *
258: * @return portal base url
259: */
260: public String getPortalBaseUrl(boolean encode);
261:
262: /**
263: * Portal base url with relativePath argument appended ( e.g. http://localhost:8080/jetspeed/javascript/dojo/ )
264: *
265: * @return portal base url with relativePath argument appended
266: */
267: public String getPortalResourceUrl(String relativePath);
268:
269: /**
270: * Portal base url with relativePath argument appended ( e.g. http://localhost:8080/jetspeed/javascript/dojo/ )
271: *
272: * @return portal base url with relativePath argument appended
273: */
274: public String getPortalResourceUrl(String relativePath,
275: boolean encode);
276:
277: /**
278: * Portal base servlet url ( e.g. http://localhost:8080/jetspeed/desktop/ )
279: *
280: * @return portal base servlet url
281: */
282: public String getPortalUrl();
283:
284: /**
285: * Portal base servlet url ( e.g. http://localhost:8080/jetspeed/desktop/ )
286: *
287: * @return portal base servlet url
288: */
289: public String getPortalUrl(boolean encode);
290:
291: /**
292: * Portal base servlet url with relativePath argument appended ( e.g. http://localhost:8080/jetspeed/desktop/default-page.psml )
293: *
294: * @return portal base servlet url with relativePath argument appended
295: */
296: public String getPortalUrl(String relativePath);
297:
298: /**
299: * Portal base servlet url with relativePath argument appended ( e.g. http://localhost:8080/jetspeed/desktop/default-page.psml )
300: *
301: * @return portal base servlet url with relativePath argument appended
302: */
303: public String getPortalUrl(String relativePath, boolean encode);
304:
305: // dojo - special convenience methods
306:
307: /**
308: * If no previous call using value of dojoRequire argument has been added to any getHeaderSections() content entry,
309: * add text argument to getHeaderSections() content entry for dojo core require statements
310: *
311: */
312: public void dojoAddCoreLibraryRequire(String dojoRequire);
313:
314: /**
315: * Split dojoRequires argument using ';' delimiter and for each resulting dojoRequire value, if no previous call
316: * using dojoRequire value has been added to any getHeaderSections() content entry,
317: * add text argument to getHeaderSections() content entry for dojo core require statements
318: *
319: */
320: public void dojoAddCoreLibraryRequires(String dojoRequires);
321:
322: /**
323: * If no previous call using value of dojoRequire argument has been added to any getHeaderSections() content entry,
324: * add text argument to getHeaderSections() content entry for dojo library module require statements
325: *
326: */
327: public void dojoAddModuleLibraryRequire(String dojoRequire);
328:
329: /**
330: * Split dojoRequires argument using ';' delimiter and for each resulting dojoRequire value, if no previous call
331: * using dojoRequire value has been added to any getHeaderSections() content entry,
332: * add text argument to getHeaderSections() content entry for dojo library module require statements
333: *
334: */
335: public void dojoAddModuleLibraryRequires(String dojoRequires);
336:
337: /**
338: * Assure that header section name for dojo body expand style is included
339: *
340: */
341: public void dojoAddBodyExpandStyle(boolean omitWindowScrollbars);
342:
343: /**
344: * Enable dojo by setting appropriate modifiable header configuration setting
345: *
346: */
347: public void dojoEnable();
348:
349: /**
350: * Add tag information to this instance.
351: *
352: * For example, if you want to add the following tag into <head>,
353: *
354: * <foo a="1" b="2">FOO FOO</foo>
355: *
356: * Java code is:
357: *
358: * HashMap map=new HashMap();
359: * map.put("a","1");
360: * map.put("b","2");
361: * headerResouce.addHeaderInfo("foo",map,"FOO FOO");
362: *
363: * @param elementName Tag's name
364: * @param attributes Tag's attributes
365: * @param text Tag's content
366: */
367: public void addHeaderInfo(String elementName, Map attributes,
368: String text);
369:
370: /**
371: * Add text as-is to this instance.
372: *
373: * @param text content
374: */
375: public void addHeaderInfo(String text);
376:
377: /**
378: * Convenient method to add <script> tag with defer option.
379: *
380: * @param path Javascript file path
381: * @param defer defer attributes for <script> tag.
382: */
383: public void addJavaScript(String path, boolean defer);
384:
385: /**
386: * Convenient method to add <script> tag.
387: *
388: * @param path Javascript file path
389: */
390: public void addJavaScript(String path);
391:
392: /**
393: * Convenient method to add <link> tag.
394: *
395: * @param path CSS file path
396: */
397: public void addStyleSheet(String path);
398: }
|