01: /******************************************************************************
02: * JBoss, a division of Red Hat *
03: * Copyright 2006, Red Hat Middleware, LLC, and individual *
04: * contributors as indicated by the @authors tag. See the *
05: * copyright.txt in the distribution for a full listing of *
06: * individual contributors. *
07: * *
08: * This is free software; you can redistribute it and/or modify it *
09: * under the terms of the GNU Lesser General Public License as *
10: * published by the Free Software Foundation; either version 2.1 of *
11: * the License, or (at your option) any later version. *
12: * *
13: * This software is distributed in the hope that it will be useful, *
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16: * Lesser General Public License for more details. *
17: * *
18: * You should have received a copy of the GNU Lesser General Public *
19: * License along with this software; if not, write to the Free *
20: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
21: * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
22: ******************************************************************************/package org.jboss.portal.core.metadata.portlet;
23:
24: import org.jboss.portal.common.markup.MarkupElement;
25:
26: /**
27: * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
28: * @version $Revision: 8786 $
29: */
30: public abstract class ElementMetaData {
31:
32: /** . */
33: protected String bodyContent;
34:
35: /** . */
36: protected MarkupElement element;
37:
38: protected ElementMetaData() {
39: }
40:
41: public void init() {
42: element = buildElement();
43: }
44:
45: protected abstract MarkupElement buildElement();
46:
47: public MarkupElement getElement() {
48: return element;
49: }
50:
51: public String getBodyContent() {
52: return bodyContent;
53: }
54:
55: public void setBodyContent(String bodyContent) {
56: this .bodyContent = bodyContent;
57: }
58:
59: /**
60: * Create a meta header element. <p>This element will create a meta tag.</p>
61: *
62: * @param name name attribute of the meta element
63: * @param content content attribute of the meta element
64: * @return a new meta header element
65: */
66: public static ElementMetaData createNamedMetaElement(String name,
67: String content) {
68: return new NamedMetaElementMetaData(name, content);
69: }
70:
71: /**
72: * Create a link header element. <p>This element will create a link tag.</p>
73: *
74: * @param type the type attribute of the link
75: * @param rel the rel attribute of the link
76: * @param href the href attribute of the link
77: * @param media the media attribute of the link
78: * @return a new link header element
79: */
80: public static ElementMetaData createLinkElement(String type,
81: String rel, String href, String media, String title) {
82: return new LinkElementMetaData(rel, type, href, media, title);
83: }
84:
85: /**
86: * Create a script header element. <p>This element will create a script tag.</p>
87: *
88: * @param type the type attribute of this script
89: * @param src the src attribute of this script
90: * @return a new script header element
91: */
92: public static ElementMetaData createScriptElement(String type,
93: String src) {
94: return new ScriptElementMetaData(type, src);
95: }
96: }
|