001: /*
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: WhereAreYouTag.java 4408 2004-03-19 14:31:54Z sauthieg $
023: * --------------------------------------------------------------------------
024: */
025:
026: package org.objectweb.jonas.webapp.taglib;
027:
028: import javax.servlet.http.HttpServletRequest;
029: import javax.servlet.http.HttpServletResponse;
030: import javax.servlet.jsp.tagext.BodyTagSupport;
031:
032: import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
033:
034: /**
035: * @author Michel-Ange ANTON
036: */
037: public class WhereAreYouTag extends BodyTagSupport {
038:
039: // ----------------------------------------------------- Instance Variables
040:
041: // ----------------------------------------------------- Properties
042:
043: private boolean usingWhere = false;
044:
045: public boolean isUsingWhere() {
046: return usingWhere;
047: }
048:
049: public boolean getUsingWhere() {
050: return usingWhere;
051: }
052:
053: public void setUsingWhere(boolean usingWhere) {
054: this .usingWhere = usingWhere;
055: }
056:
057: // --------------------------------------------------------- Public Methods
058:
059: public String getSelectedNameNode() {
060: String sName = null;
061: WhereAreYou oWhere = getWhereAreYouInstance();
062: if (oWhere != null) {
063: sName = oWhere.getSelectedNameNode();
064: }
065: return sName;
066: }
067:
068: public TreeControlNode getSelectedTreeControlNode() {
069: TreeControlNode oNode = null;
070: WhereAreYou oWhere = getWhereAreYouInstance();
071: if (oWhere != null) {
072: oNode = oWhere.getSelectedTreeControlNode();
073: }
074: return oNode;
075: }
076:
077: public String getImagesRoot() {
078: String sImagesRoot = null;
079: WhereAreYou oWhere = getWhereAreYouInstance();
080: if (oWhere != null) {
081: sImagesRoot = oWhere.getImagesRoot();
082: }
083: return sImagesRoot;
084: }
085:
086: public boolean isTreeToRefresh() {
087: boolean bRefresh = false;
088: WhereAreYou oWhere = getWhereAreYouInstance();
089: if (oWhere != null) {
090: bRefresh = oWhere.isTreeToRefresh();
091: }
092: return bRefresh;
093: }
094:
095: public String getUrlToRefreshSelectedNode() {
096: String sUrl = null;
097: WhereAreYou oWhere = getWhereAreYouInstance();
098: if (oWhere != null) {
099: sUrl = oWhere.getUrlToRefreshSelectedNode(
100: (HttpServletRequest) pageContext.getRequest(),
101: (HttpServletResponse) pageContext.getResponse());
102: }
103: return sUrl;
104: }
105:
106: // --------------------------------------------------------- Protected Methods
107:
108: protected WhereAreYou getWhereAreYouInstance() {
109: return (WhereAreYou) pageContext.getSession().getAttribute(
110: WhereAreYou.SESSION_NAME);
111: }
112: }
|