KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > core > theme > impl > PortalThemeImpl


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7
8 package org.jboss.portal.core.theme.impl;
9
10 import org.apache.log4j.Logger;
11 import org.jboss.portal.server.ServerRegistrationID;
12 import org.jboss.portal.server.metadata.ThemeRegistrationMetaData;
13 import org.jboss.portal.server.theme.PortalTheme;
14 import org.jboss.portal.server.theme.ThemeLink;
15 import org.jboss.portal.server.theme.ThemeScript;
16
17 import javax.servlet.ServletContext JavaDoc;
18 import java.util.ArrayList JavaDoc;
19 import java.util.List JavaDoc;
20
21 /**
22  * Implementation of a Theme.
23  *
24  * @author <a HREF="mailto:mholzner@novell.com">Martin Holzner</a>.
25  * @version <tt>$Revision: 1.3 $</tt>
26  * @see PortalTheme
27  */

28 public class PortalThemeImpl extends ThemeRegistrationMetaData
29    implements PortalTheme
30 {
31    private static Logger log = Logger.getLogger(PortalThemeImpl.class);
32
33    private String JavaDoc name;
34    private ServletContext JavaDoc context;
35    private List JavaDoc scripts = new ArrayList JavaDoc();
36    private List JavaDoc links = new ArrayList JavaDoc();
37    private String JavaDoc appName;
38    private String JavaDoc contextPath;
39
40    public PortalThemeImpl(ServerRegistrationID id, ServletContext JavaDoc context, String JavaDoc contextPath, String JavaDoc appName, String JavaDoc name)
41    {
42       super(id);
43       log.debug("create theme for context " + context.getServletContextName() + " name " + name);
44       this.name = name;
45       this.context = context;
46       this.appName = appName;
47       this.contextPath = contextPath;
48    }
49
50    /**
51     * @see org.jboss.portal.server.theme.PortalTheme#getServletContext()
52     */

53    public ServletContext JavaDoc getServletContext()
54    {
55       return context;
56    }
57
58    /**
59     * @see org.jboss.portal.server.theme.PortalTheme#getContextPath()
60     */

61    public String JavaDoc getContextPath()
62    {
63       return contextPath;
64    }
65
66    /**
67     * @see org.jboss.portal.server.theme.PortalTheme#getAppName()
68     */

69    public String JavaDoc getAppName()
70    {
71       return appName;
72    }
73
74    /**
75     * @see org.jboss.portal.server.theme.PortalTheme#getName()
76     */

77    public String JavaDoc getName()
78    {
79       return name;
80    }
81
82    /**
83     * @see org.jboss.portal.server.theme.PortalTheme#getScripts()
84     */

85    public List JavaDoc getScripts()
86    {
87       return scripts;
88    }
89
90    /**
91     * @see org.jboss.portal.server.theme.PortalTheme#getLinks()
92     */

93    public List JavaDoc getLinks()
94    {
95       return links;
96    }
97
98    /**
99     * @see org.jboss.portal.server.theme.PortalTheme#addLink
100     */

101    public void addLink(ThemeLink themeLink)
102    {
103       log.debug("theme " + name + " add link " + themeLink);
104       links.add(themeLink);
105    }
106
107    /**
108     * @see org.jboss.portal.server.theme.PortalTheme#addScript
109     */

110    public void addScript(ThemeScript themeScript)
111    {
112       log.debug("theme " + name + " add link " + themeScript);
113       scripts.add(themeScript);
114    }
115
116    /**
117     * @see java.lang.Object#toString
118     */

119    public String JavaDoc toString()
120    {
121       return name;
122    }
123 }
124
Popular Tags