01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.desktop.taglib.theme;
06:
07: import javax.servlet.jsp.JspException;
08: import java.util.Map;
09:
10: import com.sun.portal.providers.Provider;
11: import com.sun.portal.providers.context.ProviderContext;
12: import com.sun.portal.providers.context.ProviderContextException;
13: import com.sun.portal.providers.context.Theme;
14:
15: import com.sun.portal.desktop.taglib.DesktopTaglibException;
16: import com.sun.portal.desktop.taglib.DesktopTaglibConstants;
17: import com.sun.portal.desktop.taglib.providerContext.BaseProviderContextTagSupport;
18:
19: public class BaseThemeTagSupport extends BaseProviderContextTagSupport
20: implements DesktopTaglibConstants {
21: protected String mTheme = null;
22: protected String mValue = null;
23: protected String mName = null;
24:
25: public void setTheme(String theme) throws JspException {
26: if (theme != null && theme.length() > 0) {
27: this .mTheme = (String) resolveParameter(theme);
28: } else {
29: throw new DesktopTaglibException(
30: DesktopTaglibException.INVALID_PARAMETER,
31: "theme is null");
32: }
33: }
34:
35: public void setValue(String value) throws JspException {
36: if (value != null && value.length() > 0) {
37: this .mValue = (String) resolveParameter(value);
38: } else {
39: throw new DesktopTaglibException(
40: DesktopTaglibException.INVALID_PARAMETER,
41: "value is null");
42: }
43: }
44:
45: public void setName(String name) throws JspException {
46: if (name != null && name.length() > 0) {
47: this .mName = (String) resolveParameter(name);
48: } else {
49: throw new DesktopTaglibException(
50: DesktopTaglibException.INVALID_PARAMETER,
51: "name is null");
52: }
53: }
54:
55: protected String getSelectedTheme() throws JspException {
56:
57: String selectedTheme = null;
58: ProviderContext pc = getCurrentProviderContext();
59: Provider p = getCurrentObj();
60:
61: selectedTheme = (String) getCachedObj(_ThemeName);
62: if (selectedTheme == null) {
63: try {
64: selectedTheme = Theme.getSelectedName(p.getName(), pc);
65: } catch (ProviderContextException pce) {
66: throw new DesktopTaglibException(pce);
67: }
68: cacheObj(_ThemeName, selectedTheme);
69: }
70: return selectedTheme;
71: }
72:
73: }
|