[Ejtools-cvs] applications/jndi.browser/src/main/org/ejtools/jndi/browser/web/taglib ConnectTag.java
Brought to you by:
letiemble
|
From: <let...@us...> - 2003-11-27 01:30:33
|
Update of /cvsroot/ejtools/applications/jndi.browser/src/main/org/ejtools/jndi/browser/web/taglib In directory sc8-pr-cvs1:/tmp/cvs-serv17169/jndi.browser/src/main/org/ejtools/jndi/browser/web/taglib Modified Files: ConnectTag.java TreeRendererImpl.java Log Message: Address Todo #755528 Address Todo #800902 Index: ConnectTag.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/org/ejtools/jndi/browser/web/taglib/ConnectTag.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ConnectTag.java 24 Feb 2003 22:32:30 -0000 1.2 --- ConnectTag.java 27 Nov 2003 01:30:30 -0000 1.3 *************** *** 1,137 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jndi.browser.web.taglib; ! ! import javax.servlet.ServletContext; ! import javax.servlet.jsp.JspException; ! import javax.servlet.jsp.tagext.TagSupport; ! ! import org.ejtools.jndi.browser.web.Constants; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 1 mars 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! * @jsp:tag name="connect" ! * body-content="empty" ! */ ! public class ConnectTag extends TagSupport ! { ! /** The key of the application-scope bean we look for. */ ! private String name = Constants.GLOBAL_TREE; ! /** The page to which we should forward for the user to log on. */ ! private String page = "/refresh.do"; ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Returned Value ! * @exception JspException Description of Exception ! */ ! public int doEndTag() ! throws JspException ! { ! boolean valid = false; ! ! ServletContext context = pageContext.getServletContext(); ! ! if (context.getAttribute(name) != null) ! { ! valid = true; ! } ! ! // Forward control based on the results ! if (valid) ! { ! return (EVAL_PAGE); ! } ! else ! { ! try ! { ! pageContext.forward(page); ! } ! catch (Exception e) ! { ! throw new JspException(e.toString()); ! } ! return (SKIP_PAGE); ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Returned Value ! * @exception JspException Description of Exception ! */ ! public int doStartTag() ! throws JspException ! { ! return SKIP_BODY; ! } ! ! ! /** ! * Getter for the name attribute ! * ! * @return The value of name attribute ! * @jsp:attribute name="name" required="false" rtexprvalue="true" ! */ ! public String getName() ! { ! return this.name; ! } ! ! ! /** ! * Getter for the page attribute ! * ! * @return The value of page attribute ! * @jsp:attribute name="page" required="false" rtexprvalue="true" ! */ ! public String getPage() ! { ! return this.page; ! } ! ! ! /** Description of the Method */ ! public void release() ! { ! super.release(); ! this.name = Constants.GLOBAL_TREE; ! this.page = "/refresh.do"; ! } ! ! ! /** ! * Setter for the name attribute ! * ! * @param name The new value for name attribute ! */ ! public void setName(String name) ! { ! this.name = name; ! } ! ! ! /** ! * Setter for the page attribute ! * ! * @param page The new value for page attribute ! */ ! public void setPage(String page) ! { ! this.page = page; ! } ! } --- 1,137 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jndi.browser.web.taglib; ! ! import javax.servlet.ServletContext; ! import javax.servlet.jsp.JspException; ! import javax.servlet.jsp.tagext.TagSupport; ! ! import org.ejtools.jndi.browser.web.Constants; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 1 mars 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! * @jsp:tag name="connect" ! * body-content="empty" ! */ ! public class ConnectTag extends TagSupport ! { ! /** The key of the application-scope bean we look for. */ ! private String name = Constants.GLOBAL_TREE; ! /** The page to which we should forward for the user to log on. */ ! private String page = "/refresh.do"; ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Returned Value ! * @exception JspException Description of Exception ! */ ! public int doEndTag() ! throws JspException ! { ! boolean valid = false; ! ! ServletContext context = pageContext.getServletContext(); ! ! if (context.getAttribute(name) != null) ! { ! valid = true; ! } ! ! // Forward control based on the results ! if (valid) ! { ! return (EVAL_PAGE); ! } ! else ! { ! try ! { ! pageContext.forward(page); ! } ! catch (Exception e) ! { ! throw new JspException(e.toString()); ! } ! return (SKIP_PAGE); ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Returned Value ! * @exception JspException Description of Exception ! */ ! public int doStartTag() ! throws JspException ! { ! return SKIP_BODY; ! } ! ! ! /** ! * Getter for the name attribute ! * ! * @return The value of name attribute ! * @jsp:attribute name="name" required="false" rtexprvalue="true" ! */ ! public String getName() ! { ! return this.name; ! } ! ! ! /** ! * Getter for the page attribute ! * ! * @return The value of page attribute ! * @jsp:attribute name="page" required="false" rtexprvalue="true" ! */ ! public String getPage() ! { ! return this.page; ! } ! ! ! /** Description of the Method */ ! public void release() ! { ! super.release(); ! this.name = Constants.GLOBAL_TREE; ! this.page = "/refresh.do"; ! } ! ! ! /** ! * Setter for the name attribute ! * ! * @param name The new value for name attribute ! */ ! public void setName(String name) ! { ! this.name = name; ! } ! ! ! /** ! * Setter for the page attribute ! * ! * @param page The new value for page attribute ! */ ! public void setPage(String page) ! { ! this.page = page; ! } ! } Index: TreeRendererImpl.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/org/ejtools/jndi/browser/web/taglib/TreeRendererImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TreeRendererImpl.java 10 Feb 2003 21:18:32 -0000 1.1 --- TreeRendererImpl.java 27 Nov 2003 01:30:30 -0000 1.2 *************** *** 1,127 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jndi.browser.web.taglib; ! ! import java.util.Hashtable; ! ! import org.ejtools.jndi.browser.model.JNDIEntry; ! import org.ejtools.jndi.browser.model.JNDIEnvEntry; ! import org.ejtools.jndi.browser.model.JNDILinkRef; ! import org.ejtools.jndi.browser.model.Proxy; ! import org.ejtools.servlet.http.jsp.tagext.tree.TreeRenderer; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 25 avril 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class TreeRendererImpl implements TreeRenderer ! { ! /** Description of the Field */ ! protected static Hashtable icons = new Hashtable(); ! ! ! /** ! * @param o Description of the Parameter ! * @return The displayName value ! */ ! public String getDisplayName(Object o) ! { ! if (o != null) ! { ! StringBuffer buffer = new StringBuffer(); ! ! if (o instanceof JNDILinkRef) ! { ! JNDILinkRef entry = (JNDILinkRef) o; ! buffer.append(entry.getName()); ! buffer.append(" => {"); ! buffer.append(entry.getLinkName()); ! buffer.append("}"); ! ! return buffer.toString(); ! } ! if (o instanceof JNDIEnvEntry) ! { ! JNDIEnvEntry entry = (JNDIEnvEntry) o; ! buffer.append(entry.getName()); ! buffer.append(" ("); ! buffer.append(entry.getClassName()); ! buffer.append(") = "); ! buffer.append(entry.getValue()); ! ! return buffer.toString(); ! } ! if (o instanceof Proxy) ! { ! Proxy entry = (Proxy) o; ! buffer.append(entry.getName()); ! buffer.append(" ("); ! for (int i = 0; i < entry.getInterfaces().length; i++) ! { ! if (i > 0) ! { ! buffer.append(","); ! } ! buffer.append(entry.getClassName()); ! } ! buffer.append(")"); ! ! return buffer.toString(); ! } ! if (o instanceof JNDIEntry) ! { ! JNDIEntry entry = (JNDIEntry) o; ! buffer.append(entry.getName()); ! buffer.append(" ("); ! buffer.append(entry.getClassName()); ! buffer.append(")"); ! ! return buffer.toString(); ! } ! ! return o.toString(); ! } ! return null; ! } ! ! ! /** ! * Gets the icon attribute of the TreeRendererImpl object ! * ! * @param o Description of the Parameter ! * @return The icon value ! */ ! public String getIcon(Object o) ! { ! String icon = (String) icons.get(o.getClass()); ! ! if (icon == null) ! { ! icon = "images/toolbarButtonGraphics/general/File16.gif"; ! } ! return icon; ! } ! ! /** Map of the class/icons */ ! static ! { ! icons.put(org.ejtools.jndi.browser.model.JNDIContext.class, "images/toolbarButtonGraphics/general/Folder16.gif"); ! icons.put(org.ejtools.jndi.browser.model.JNDIEnvEntry.class, "images/toolbarButtonGraphics/general/File16.gif"); ! icons.put(org.ejtools.jndi.browser.model.JNDILinkRef.class, "images/toolbarButtonGraphics/general/File16.gif"); ! icons.put(org.ejtools.jndi.browser.model.ejb.EJBHomeProxy.class, "images/toolbarButtonGraphics/development/EJB16.gif"); ! icons.put(org.ejtools.jndi.browser.model.ejb.EJBLocalHomeProxy.class, "images/toolbarButtonGraphics/development/EJB16.gif"); ! icons.put(org.ejtools.jndi.browser.model.jms.QueueProxy.class, "images/toolbarButtonGraphics/development/JMSQueue16.gif"); ! icons.put(org.ejtools.jndi.browser.model.jms.TopicProxy.class, "images/toolbarButtonGraphics/development/JMSTopic16.gif"); ! icons.put(org.ejtools.jndi.browser.model.jms.ConnectionFactoryProxy.class, "images/toolbarButtonGraphics/development/Node16.gif"); ! icons.put(org.ejtools.jndi.browser.model.mail.SessionProxy.class, "images/toolbarButtonGraphics/development/JavaMailResource16.gif"); ! icons.put(org.ejtools.jndi.browser.model.sql.DataSourceProxy.class, "images/toolbarButtonGraphics/development/JDBCDataSource16.gif"); ! } ! } --- 1,127 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jndi.browser.web.taglib; ! ! import java.util.Hashtable; ! ! import org.ejtools.jndi.browser.model.JNDIEntry; ! import org.ejtools.jndi.browser.model.JNDIEnvEntry; ! import org.ejtools.jndi.browser.model.JNDILinkRef; ! import org.ejtools.jndi.browser.model.Proxy; ! import org.ejtools.servlet.http.jsp.tagext.tree.TreeRenderer; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 25 avril 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class TreeRendererImpl implements TreeRenderer ! { ! /** Description of the Field */ ! protected static Hashtable icons = new Hashtable(); ! ! ! /** ! * @param o Description of the Parameter ! * @return The displayName value ! */ ! public String getDisplayName(Object o) ! { ! if (o != null) ! { ! StringBuffer buffer = new StringBuffer(); ! ! if (o instanceof JNDILinkRef) ! { ! JNDILinkRef entry = (JNDILinkRef) o; ! buffer.append(entry.getName()); ! buffer.append(" => {"); ! buffer.append(entry.getLinkName()); ! buffer.append("}"); ! ! return buffer.toString(); ! } ! if (o instanceof JNDIEnvEntry) ! { ! JNDIEnvEntry entry = (JNDIEnvEntry) o; ! buffer.append(entry.getName()); ! buffer.append(" ("); ! buffer.append(entry.getClassName()); ! buffer.append(") = "); ! buffer.append(entry.getValue()); ! ! return buffer.toString(); ! } ! if (o instanceof Proxy) ! { ! Proxy entry = (Proxy) o; ! buffer.append(entry.getName()); ! buffer.append(" ("); ! for (int i = 0; i < entry.getInterfaces().length; i++) ! { ! if (i > 0) ! { ! buffer.append(","); ! } ! buffer.append(entry.getClassName()); ! } ! buffer.append(")"); ! ! return buffer.toString(); ! } ! if (o instanceof JNDIEntry) ! { ! JNDIEntry entry = (JNDIEntry) o; ! buffer.append(entry.getName()); ! buffer.append(" ("); ! buffer.append(entry.getClassName()); ! buffer.append(")"); ! ! return buffer.toString(); ! } ! ! return o.toString(); ! } ! return null; ! } ! ! ! /** ! * Gets the icon attribute of the TreeRendererImpl object ! * ! * @param o Description of the Parameter ! * @return The icon value ! */ ! public String getIcon(Object o) ! { ! String icon = (String) icons.get(o.getClass()); ! ! if (icon == null) ! { ! icon = "images/toolbarButtonGraphics/general/File16.gif"; ! } ! return icon; ! } ! ! /** Map of the class/icons */ ! static ! { ! icons.put(org.ejtools.jndi.browser.model.JNDIContext.class, "images/toolbarButtonGraphics/general/Folder16.gif"); ! icons.put(org.ejtools.jndi.browser.model.JNDIEnvEntry.class, "images/toolbarButtonGraphics/general/File16.gif"); ! icons.put(org.ejtools.jndi.browser.model.JNDILinkRef.class, "images/toolbarButtonGraphics/general/File16.gif"); ! icons.put(org.ejtools.jndi.browser.model.ejb.EJBHomeProxy.class, "images/toolbarButtonGraphics/development/EJB16.gif"); ! icons.put(org.ejtools.jndi.browser.model.ejb.EJBLocalHomeProxy.class, "images/toolbarButtonGraphics/development/EJB16.gif"); ! icons.put(org.ejtools.jndi.browser.model.jms.QueueProxy.class, "images/toolbarButtonGraphics/development/JMSQueue16.gif"); ! icons.put(org.ejtools.jndi.browser.model.jms.TopicProxy.class, "images/toolbarButtonGraphics/development/JMSTopic16.gif"); ! icons.put(org.ejtools.jndi.browser.model.jms.ConnectionFactoryProxy.class, "images/toolbarButtonGraphics/development/Node16.gif"); ! icons.put(org.ejtools.jndi.browser.model.mail.SessionProxy.class, "images/toolbarButtonGraphics/development/JavaMailResource16.gif"); ! icons.put(org.ejtools.jndi.browser.model.sql.DataSourceProxy.class, "images/toolbarButtonGraphics/development/JDBCDataSource16.gif"); ! } ! } |