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.tab;
06:
07: import javax.servlet.jsp.JspException;
08:
09: import com.sun.portal.desktop.taglib.BaseDesktopTagSupport;
10: import com.sun.portal.desktop.taglib.DesktopTaglibException;
11: import com.sun.portal.providers.containers.jsp.tab.UnmodifiableTab;
12:
13: public class BaseTabContainerTagSupport extends BaseDesktopTagSupport {
14: private static final String TAB = "__TAB__";
15:
16: protected void setCurrentTab(UnmodifiableTab tab)
17: throws DesktopTaglibException {
18: UnmodifiableTab tmpTab = getCurrentTab();
19: if ((tmpTab != null && tab != null)
20: || (tmpTab == null && tab == null))
21: throw new DesktopTaglibException(
22: DesktopTaglibException.INVALID_TAG_SEQUENCE);
23:
24: if (tab == null) {
25: pageContext.removeAttribute(TAB);
26: } else {
27: pageContext.setAttribute(TAB, tab);
28: }
29: }
30:
31: protected UnmodifiableTab getCurrentTab()
32: throws DesktopTaglibException {
33: UnmodifiableTab tab = (UnmodifiableTab) pageContext
34: .getAttribute(TAB);
35:
36: return tab;
37: }
38: }
|