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.container.table;
06:
07: import javax.servlet.jsp.JspException;
08: import java.util.Map;
09:
10: import com.sun.portal.desktop.taglib.DesktopTaglibException;
11: import com.sun.portal.desktop.taglib.DesktopTaglibConstants;
12: import com.sun.portal.desktop.taglib.BaseDesktopTagSupport;
13: import com.sun.portal.providers.Provider;
14: import com.sun.portal.providers.containers.jsp.table.JSPTableContainerProvider;
15: import com.sun.portal.providers.context.ProviderContext;
16: import com.sun.portal.providers.context.ProviderContextException;
17:
18: public class BaseTableContainerTagSupport extends BaseDesktopTagSupport
19: implements DesktopTaglibConstants {
20: public String getChannelName() throws JspException {
21: Provider p = getProvider();
22: if (p == null) {
23: throw new DesktopTaglibException(
24: DesktopTaglibException.INVALID_TAG_SEQUENCE,
25: "channel is empty");
26: }
27:
28: return p.getName();
29: }
30:
31: protected String getStringProperty(String key, String propName)
32: throws JspException {
33: JSPTableContainerProvider tcp = (JSPTableContainerProvider) getContainer();
34:
35: String s = (String) getCachedObj(key);
36: if (s == null) {
37: try {
38: s = tcp.getProviderContext().getStringProperty(
39: tcp.getName(), propName);
40: } catch (ProviderContextException pce) {
41: throw new DesktopTaglibException(pce);
42: }
43: cacheObj(key, s);
44: }
45: return s;
46: }
47:
48: protected Map getMapProperty(String key, String propName)
49: throws JspException {
50: JSPTableContainerProvider tcp = (JSPTableContainerProvider) getContainer();
51:
52: Map m = (Map) getCachedObj(key);
53: if (m == null) {
54: try {
55: m = tcp.getProviderContext().getCollectionProperty(
56: tcp.getName(), propName);
57: } catch (ProviderContextException pce) {
58: throw new DesktopTaglibException(pce);
59: }
60: cacheObj(key, m);
61: }
62: return m;
63: }
64:
65: protected boolean getBooleanProperty(String key, String propName)
66: throws JspException {
67: JSPTableContainerProvider tcp = (JSPTableContainerProvider) getContainer();
68: boolean bProp = false;
69:
70: Boolean b = (Boolean) getCachedObj(key);
71: if (b == null) {
72: try {
73: bProp = tcp.getProviderContext().getBooleanProperty(
74: tcp.getName(), propName);
75: } catch (ProviderContextException pce) {
76: throw new DesktopTaglibException(pce);
77: }
78: if (bProp) {
79: b = Boolean.TRUE;
80: } else {
81: b = Boolean.FALSE;
82: }
83: cacheObj(key, b);
84: }
85: return b.booleanValue();
86: }
87: }
|