Please commit my changes to the HEAD branch. Thanks! --Manveen
Comments: ------------ * Created a new tag that renders HTML tables containing property values, a property, value pair per row. * Created a buttons.jsp file that renders the save and cancel buttons and included this in the server and serivce screens. New files to be added: ----------------------- TableTag, RowTag, LabelTag, ValueTag.java --> webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ buttons.jsp --> webapps/admin
Index: server.jsp =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/admin/server.jsp,v retrieving revision 1.3 diff -u -r1.3 server.jsp --- server.jsp 20 Dec 2001 09:31:51 -0000 1.3 +++ server.jsp 3 Jan 2002 15:13:44 -0000 @@ -16,6 +16,7 @@ <!--Form --> <html:errors/> + <html:form method="POST" action="/server" focus="portNumberText"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr class="page-title-row"> @@ -34,96 +35,53 @@ </div> </td> </tr> - <tr> - <td> </td> - </tr> - <tr> - <td colspan="2" align="right" nowrap> - <html:submit styleClass="button"> - <bean:message key="button.save"/> - </html:submit> - - <html:reset styleClass="button"> - <bean:message key="button.cancel"/> - </html:reset> - </td> - </tr> - <tr> - <td> </td> - </tr> </table> + + <%@ include file="buttons.jsp" %> +<br> + <table class="back-table" border="0" cellspacing="0" cellpadding="1" width="100%"> <tr> <td> - <table class="front-table" border="0" cellspacing="0" cellpadding="0" width="100%"> - <tr class="header-row"> - <td width="27%"> - <div class="table-header-text" align="left">Properties</div> - </td> - <td width="73%"> - <div class="table-header-text" align="left"> </div> - </td> - </tr> - <tr> - <td> - <div class="table-label-text"><bean:message key="server.portnumber"/>:</div> - </td> - <td> - <div class="table-normal-text" > - <html:text property="portNumberText" size="24" maxlength="24"/> - </div> - </td> - </tr> - <tr> - <td class="line-row" colspan="2"><img src="" alt="" width="1" height="1" border="0"></td> - </tr> - <tr> - <td> - <div class="table-label-text"><bean:message key="server.debuglevel"/>:</div> - </td> - <td> - <div class="table-normal-text" > + <controls:table tableStyle="front-table" lineStyle="line-row"> + <controls:row header="true" + labelStyle="table-header-text" dataStyle="table-header-text"> + <controls:label><bean:message key="server.properties"/></controls:label> + <controls:data> </controls:data> + </controls:row> + + <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> + <controls:label><bean:message key="server.portnumber"/>:</controls:label> + <controls:data> + <html:text property="portNumberText" size="24" maxlength="24"/> + </controls:data> + </controls:row> + + <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> + <controls:label><bean:message key="server.debuglevel"/>:</controls:label> + <controls:data> <html:select property="debugLvl"> - <bean:define id="debugLvlVals" name="serverForm" property="debugLvlVals"/> + <bean:define id="debugLvlVals" name="serviceForm" +property="debugLvlVals"/> <html:options collection="debugLvlVals" property="value" labelProperty="label"/> </html:select> - </div> - </td> - </tr> - <tr> - <td class="line-row" colspan="2"><img src="" alt="" width="1" height="1" border="0"></td> - </tr> - <tr> - <td> - <div class="table-label-text"><bean:message key="server.shutdown"/>:</div> - </td> - <td> - <div class="table-normal-text" > - <html:text property="shutdownText" size="24" maxlength="24"/> - </div> - </td> - </tr> - </table> - </td> - </tr> - </table> - <table width="100%" border="0" cellspacing="0" cellpadding="0"> - <tr> - <td> </td> - </tr> - <tr> - <td colspan="2" align="right" nowrap> - <html:submit styleClass="button"> - <bean:message key="button.save"/> - </html:submit> - - <html:reset styleClass="button"> - <bean:message key="button.cancel"/> - </html:reset> + </controls:data> + </controls:row> + + <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> + <controls:label><bean:message key="server.shutdown"/>:</controls:label> + <controls:data> + <html:text property="shutdownText" size="24" maxlength="24"/> + </controls:data> + </controls:row> + </controls:table> + </td> </tr> </table> + + <%@ include file="buttons.jsp" %> + </html:form> <!-- Standard Footer --> Index: service.jsp =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/admin/service.jsp,v retrieving revision 1.2 diff -u -r1.2 service.jsp --- service.jsp 20 Dec 2001 09:31:51 -0000 1.2 +++ service.jsp 3 Jan 2002 15:13:45 -0000 @@ -60,161 +60,98 @@ </td> </tr> </table> - <table width="100%" border="0" cellspacing="0" cellpadding="0"> - <tr> - <td> </td> - </tr> - <tr> - <td colspan="2" align="right" nowrap> - <html:submit styleClass="button"> - <bean:message key="button.save"/> - </html:submit> - - <html:reset styleClass="button"> - <bean:message key="button.cancel"/> - </html:reset> - </td> - </tr> - </table> - <table border="0" cellspacing="0" cellpadding="0" width="100%"> - <tr> - <td> - <div class="table-title-text"> + + <%@ include file="buttons.jsp" %> + + <%-- Heading --%> + + <table border="0" cellspacing="0" cellpadding="0" width="100%"> + <tr> <td> <div class="table-title-text"> <bean:message key="service.properties"/> - </div> - </td> - </tr> + </div> </td> </tr> </table> + <table class="back-table" border="0" cellspacing="0" cellpadding="1" width="100%"> <tr> <td> - <table class="front-table" border="0" cellspacing="0" cellpadding="0" width="100%"> - <tr class="header-row"> - <td width="27%"> - <div class="table-header-text" align="left"><bean:message key="service.property"/></div> - </td> - <td width="73%"> - <div class="table-header-text" align="left"><bean:message key="service.value"/></div> - </td> - </tr> - <tr height="1"> - <td class="line-row" colspan="2"><img src="../images/dot.gif" alt="" width="1" height="1" border="0"></td> - </tr> - <tr> - <td width="27%" valign="top"> - <div class="table-label-text"> <bean:message key="service.name"/>: - </div> - </td> - <td valign="bottom" width="73%"> - - <div class="table-normal-text"> + <controls:table tableStyle="front-table" lineStyle="line-row"> + <controls:row header="true" + labelStyle="table-header-text" dataStyle="table-header-text"> + <controls:label><bean:message key="service.property"/></controls:label> + <controls:data><bean:message key="service.value"/> </controls:data> + </controls:row> + + <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> + <controls:label><bean:message key="service.name"/>:</controls:label> + <controls:data> <html:hidden property="serviceName"/> <bean:write name="serviceForm" property="serviceName" - scope="session"/> - </div> - </td> - </tr></table> - </td> + scope="session"/> + </controls:data> + </controls:row> + + </controls:table> + + </td> </tr> </table> - <br> + +<br> + <table border="0" cellspacing="0" cellpadding="0" width="100%"> - <tr> - <td> - <div class="table-title-text"> - <bean:message key="service.engine.props"/> - </div> - </td> - </tr> + <tr> <td> <div class="table-title-text"> + <bean:message key="service.engine.props"/> + </div> </td> </tr> </table> + <table class="back-table" border="0" cellspacing="0" cellpadding="1" width="100%"> <tr> <td> - <table class="front-table" border="0" cellspacing="0" cellpadding="0" width="100%"> - <tr class="header-row"> - <td width="27%"> - <div class="table-header-text" align="left"> <bean:message key="service.property"/></div> - </td> - <td width="73%"> - <div class="table-header-text" align="left"> <bean:message key="service.value"/></div> - </td> - </tr> - <tr height="1"> - <td class="line-row" colspan="2"><img src="../images/dot.gif" alt="" width="1" height="1" border="0"></td> - </tr> - <tr> - <td width="27%" valign="top"> - <div class="table-label-text"> - <bean:message key="service.name"/>: - </div> - </td> - <td width="73%" valign="bottom"> - <div class="table-normal-text"> + <controls:table tableStyle="front-table" lineStyle="line-row"> + <controls:row header="true" + labelStyle="table-header-text" dataStyle="table-header-text"> + <controls:label><bean:message key="service.property"/></controls:label> + <controls:data><bean:message key="service.value"/> </controls:data> + </controls:row> + + <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> + <controls:label><bean:message key="service.name"/>:</controls:label> + <controls:data> <html:text property="engineName" size="24" maxlength="24"/> - </div> - </td> - </tr> - <tr height="1"> - <td class="line-row" colspan="2"><img src="../images/dot.gif" alt="" width="1" height="1" border="0"></td> - </tr> - <tr> - <td width="27%" valign="top"> - <div class="table-label-text"> - <bean:message key="server.debuglevel"/>: - </div> - </td> - <td valign="bottom" width="73%"> - <div class="table-normal-text"> + </controls:data> + </controls:row> + + <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> + <controls:label><bean:message key="server.debuglevel"/>:</controls:label> + <controls:data> <html:select property="debugLvl"> <bean:define id="debugLvlVals" name="serviceForm" property="debugLvlVals"/> <html:options collection="debugLvlVals" property="value" labelProperty="label"/> </html:select> + </controls:data> + </controls:row> - </div> - </td> - </tr> - <tr height="1"> - <td class="line-row" colspan="2"><img src="../images/dot.gif" alt="" width="1" height="1" border="0"></td> - </tr> - <tr> - <td width="27%" valign="top"> - <div class="table-label-text"> - <bean:message key="service.defaulthostname"/>: - </div> - </td> - <td width="73%" valign="bottom"> - <div class="table-normal-text"> + <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> + <controls:label><bean:message +key="service.defaulthostname"/>:</controls:label> + <controls:data> <html:select property="defaultHost"> <bean:define id="hostNameVals" name="serviceForm" property="hostNameVals"/> <html:options collection="hostNameVals" property="value" labelProperty="label"/> </html:select> + </controls:data> + </controls:row> - </div> - </td> - </tr></table> - </td> + </controls:table> + </td> </tr> </table> <br> - <table width="100%" border="0" cellspacing="0" cellpadding="0"> - <tr> - <td> </td> - </tr> - <tr> - <td colspan="2" align="right" nowrap> - <html:submit styleClass="button"> - <bean:message key="button.save"/> - </html:submit> - - <html:reset styleClass="button"> - <bean:message key="button.cancel"/> - </html:reset> - </td> - </tr> - </table> + + <%@ include file="buttons.jsp" %> + </html:form> <!-- Standard Footer --> cvs server: Diffing WEB-INF Index: WEB-INF/controls.tld =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/admin/WEB-INF/controls.tld,v retrieving revision 1.2 diff -u -r1.2 controls.tld --- WEB-INF/controls.tld 19 Dec 2001 01:58:10 -0000 1.2 +++ WEB-INF/controls.tld 3 Jan 2002 15:13:46 -0000 @@ -13,10 +13,130 @@ Tomcat Administrative Application. </description> - <!-- ========== Instant Actions Tag ===================================== --> + <!-- ========== Instant Table Tag ===================================== --> <tag> + <name>table</name> + <tag-class>org.apache.webapp.admin.TableTag</tag-class> + <body-content>JSP</body-content> + <description> + Render a "table" object, which is rendered as an HTML + "table" element. + + NOTE: The only valid nested content for this tag is + "row" tags from this library. Anything else will cause + the rendered HTML to be invalid. + + NOTE: To be usable, this tag must be nested inside an + HTML <form> element. + </description> + + <attribute> + <name>columns</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <description> + (Integer) number of columns that the table contains. If + not specified, only two columns will be visible. + </description> + </attribute> + + <attribute> + <name>tableStyle</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <description> + The CSS style class to be applied to the entire rendered output + of the instant table. If not specified, no overall + style class is applied. + </description> + </attribute> + + <attribute> + <name>lineStyle</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <description> + The CSS style for the lines between rows. + </description> + </attribute> + + </tag> + + <tag> + + <name>row</name> + <tag-class>org.apache.webapp.admin.RowTag</tag-class> + <body-content>JSP</body-content> + <description> + Define a single "instant table row" option for the surrounding "table" + tag. It is not valid to use this tag *except* when nested inside an + "table" tag. + + NOTE: This tag can nest only "label" and "data" tags. + </description> + + <attribute> + <name>header</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <description> + (Boolean) variable set to "true" or "yes" if this row is + the header row. + </description> + </attribute> + + <attribute> + <name>labelStyle</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <description> + The style for the label table data element. + </description> + </attribute> + + <attribute> + <name>dataStyle</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <description> + The style for the value of the table data element. + </description> + </attribute> + + </tag> + + <tag> + + <name>label</name> + <tag-class>org.apache.webapp.admin.LabelTag</tag-class> + <body-content>JSP</body-content> + <description> + Render a "label" object, which is rendered as a label in the row of + an HTML "table" element. + + NOTE: To be usable, this tag must be nested inside a "row" tag. + </description> + </tag> + + <tag> + + <name>data</name> + <tag-class>org.apache.webapp.admin.DataTag</tag-class> + <body-content>JSP</body-content> + <description> + Render a "data" object, which is rendered as a label in the row of + an HTML "table" element. + + NOTE: To be usable, this tag must be nested inside a "row" tag. + </description> + </tag> + + <!-- ========== Instant Actions Tag ===================================== --> + + <tag> + <name>actions</name> <tag-class>org.apache.webapp.admin.ActionsTag</tag-class> <body-content>JSP</body-content> @@ -57,7 +177,6 @@ </attribute> </tag> - <tag> Index: WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties,v retrieving revision 1.9 diff -u -r1.9 ApplicationResources_en.properties --- WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties 17 Dec 2001 17:34:05 -0000 1.9 +++ WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties 3 Jan +2002 15:13:57 -0000 @@ -26,6 +26,7 @@ server.portnumber=Port Number server.debuglevel=Debug Level server.shutdown=Shutdown +server.properties=Properties error.portNumberText.required=<li>PortNumber cannot be empty</li> error.shutdownText.length=<li>Shutdown Text must be atleast 6 characters</li> error.portNumber.format=<li>PortNumber not a valid integer!</li> @@ -56,3 +57,16 @@ actions.valve.create=Create New Valve actions.valve.delete=Delete Valves actions.service.delete=Delete This Service +actions.thisconnector.delete=Delete This connector +connector.type=Type +connector.accept.count=Accept Count +connector.connection.timeout=Connection Timeout +connector.default.buffer=Default Buffer Size +connector.enable.dns=Enable DNS Lookups +connector.address.ip=IP Address +connector.redirect.portnumber=Redirect Port Number +connector.min=Minimum +connector.max=Maximum +connector.proxy.name=Proxy Name +connector.proxy.portnumber=Proxy Port Number +error.acceptCountText.required=<li>Accept count required</li> Index: WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_es.properties =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_es.properties,v retrieving revision 1.11 diff -u -r1.11 ApplicationResources_es.properties --- WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_es.properties 17 Dec 2001 17:34:05 -0000 1.11 +++ WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_es.properties 3 Jan +2002 15:13:58 -0000 @@ -26,6 +26,7 @@ server.portnumber=Numero de Puerto server.debuglevel=Nivel de Depuracion server.shutdown=Detener +server.properties=Caracteristicas error.portNumberText.required=<li>El numero del puerto no puede estar vacio.</li> error.shutdownText.length=<li>El texto de la para Detener debe ser de al menos 6 caracteres!</li> error.portNumber.format=<li>El numero de puerto es un entero no valido! </li> @@ -56,3 +57,16 @@ actions.valve.create=Cree Nueva La V\u00e1lvula actions.valve.delete=V\u00e1lvulas de la Cancelaci\u00f3n actions.service.delete=Suprima este servicio +actions.thisconnector.delete=Suprima este conector +connector.type=Pulsan +connector.accept.count=Valide La Cuenta +connector.connection.timeout=Descanso De la Conexi\u00f3n +connector.default.buffer=alla De Almacenador intermediario Del Valor por defecto +connector.enable.dns=Permita Las Operaciones de busqueda Del Dns +connector.address.ip=IP Direccionamiento +connector.redirect.portnumber=Vuelva a dirigir El Numero de acceso +connector.min=Minimo +connector.max=Maximo +connector.proxy.name=Nombre del poder +connector.proxy.portnumber=Numero de acceso del poder +error.acceptCountText.required=Valide la cuenta requerida
/* * $Header: Exp $ * $Revision: $ * $Date: 2001/12/19 01:58:10 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */ package org.apache.webapp.admin; import java.io.IOException; import java.net.URLEncoder; import java.util.ArrayList; import javax.servlet.http.HttpServletResponse; import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.tagext.BodyTagSupport; import javax.servlet.jsp.tagext.Tag; /** * <p>Nested tag that represents an individual "data" for a row. This tag * is valid <strong>only</strong> when nested within a RowTag tag. * * <p>In addition, the body content of this tag is used as the user-visible * data for the action, so that it may be conveniently localized.</p> * * <strong>FIXME</strong> - Internationalize the exception messages! * * @author Manveen Kaur * @version $Revision: $ */ public class DataTag extends BodyTagSupport { // ----------------------------------------------------- Instance Variables /** * The data that will be rendered for this table row. */ protected String data = null; // --------------------------------------------------------- Public Methods /** * Process the start of this tag. * * @exception JspException if a JSP exception has occurred */ public int doStartTag() throws JspException { // Initialize the holder for our data text this.data = null; // Do no further processing for now return (EVAL_BODY_TAG); } /** * Process the body text of this tag (if any). * * @exception JspException if a JSP exception has occurred */ public int doAfterBody() throws JspException { String data = bodyContent.getString(); if (data != null) { data = data.trim(); if (data.length() > 0) this.data = data; } return (SKIP_BODY); } /** * Record this action with our surrounding ActionsTag instance. * * @exception JspException if a processing error occurs */ public int doEndTag() throws JspException { // Find our parent ActionsTag instance Tag parent = getParent(); if ((parent == null) || !(parent instanceof RowTag)) throw new JspException("Must be nested in a rowTag isntance"); RowTag row = (RowTag) parent; // Register the information for the action represented by // this action HttpServletResponse response = (HttpServletResponse) pageContext.getResponse(); row.setData(data); return (EVAL_PAGE); } /** * Release all state information set by this tag. */ public void release() { this.data = null; } }
/* * $Header: Exp $ * $Revision: $ * $Date: $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */ package org.apache.webapp.admin; import java.io.IOException; import java.net.URLEncoder; import java.util.ArrayList; import javax.servlet.http.HttpServletResponse; import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.tagext.BodyTagSupport; import javax.servlet.jsp.tagext.Tag; /** * <p>Nested tag that represents an individual "instant table". This tag * is valid <strong>only</strong> when nested within an TableTag tag. * This tag has the following user-settable attributes:</p> * <ul> * <li><strong>header</strong> - Is this a header row?</li> * <li><strong>label</strong> - label to be displayed.</li> * <li><strong>data</strong> - data of the table data element.</li> * <li><strong>labelStyle</strong> - Style to be applied to the * label table data element.</li> * <li><strong>dataStyle</strong> - Style to be applied to the data table * data element.</li> * * </ul> * * @author Manveen Kaur * @version $Revision: $ $Date: $ */ public class RowTag extends BodyTagSupport { /** * Is this the header row? */ protected boolean header = false; public boolean getHeader() { return (this.header); } public void setHeader(boolean header) { this.header = header; } /** * The label that will be rendered for this row's table data element. */ protected String label = null; public void setLabel(String label) { this.label = label; } /** * The data of the table data element of this row. */ protected String data = null; public void setData(String data) { this.data = data; } /** * The style of the label. */ protected String labelStyle = null; public String getLabelStyle() { return (this.labelStyle); } public void setLabelStyle(String labelStyle) { this.labelStyle = labelStyle; } /** * The style of the data. */ protected String dataStyle = null; public String getdataStyle() { return (this.dataStyle); } public void setdataStyle(String dataStyle) { this.dataStyle = dataStyle; } // --------------------------------------------------------- Public Methods /** * Process the start of this tag. * * @exception JspException if a JSP exception has occurred */ public int doStartTag() throws JspException { // Do no further processing for now return (EVAL_BODY_TAG); } /** * Process the body text of this tag (if any). * * @exception JspException if a JSP exception has occurred */ public int doAfterBody() throws JspException { return (SKIP_BODY); } /** * Record this action with our surrounding ActionsTag instance. * * @exception JspException if a processing error occurs */ public int doEndTag() throws JspException { // Find our parent TableTag instance Tag parent = getParent(); if ((parent == null) || !(parent instanceof TableTag)) throw new JspException("Must be nested in a TableTag instance"); TableTag table = (TableTag) parent; // Register the information for the row represented by // this row HttpServletResponse response = (HttpServletResponse) pageContext.getResponse(); table.addRow(header, label, data, labelStyle, dataStyle); return (EVAL_PAGE); } /** * Release all state information set by this tag. */ public void release() { //super.release(); this.header= false; this.label = null; this.data = null; this.labelStyle = null; this.dataStyle = null; } }
/* * $Header: Exp $ * $Revision: $ * $Date: 2001/12/19 01:58:10 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */ package org.apache.webapp.admin; import java.io.IOException; import java.net.URLEncoder; import java.util.ArrayList; import javax.servlet.http.HttpServletResponse; import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.tagext.BodyTagSupport; import javax.servlet.jsp.tagext.Tag; /** * <p>Nested tag that represents an individual "labels" for a row. This tag * is valid <strong>only</strong> when nested within a RowTag tag. * * <p>In addition, the body content of this tag is used as the user-visible * label for the action, so that it may be conveniently localized.</p> * * <strong>FIXME</strong> - Internationalize the exception messages! * * @author Manveen Kaur * @version $Revision: $ */ public class LabelTag extends BodyTagSupport { // ----------------------------------------------------- Instance Variables /** * The label that will be rendered for this action. */ protected String label = null; // --------------------------------------------------------- Public Methods /** * Process the start of this tag. * * @exception JspException if a JSP exception has occurred */ public int doStartTag() throws JspException { // Initialize the holder for our label text this.label = null; // Do no further processing for now return (EVAL_BODY_TAG); } /** * Process the body text of this tag (if any). * * @exception JspException if a JSP exception has occurred */ public int doAfterBody() throws JspException { String label = bodyContent.getString(); if (label != null) { label = label.trim(); if (label.length() > 0) this.label = label; } return (SKIP_BODY); } /** * Record this action with our surrounding ActionsTag instance. * * @exception JspException if a processing error occurs */ public int doEndTag() throws JspException { // Find our parent ActionsTag instance Tag parent = getParent(); if ((parent == null) || !(parent instanceof RowTag)) throw new JspException("Must be nested in a rowTag isntance"); RowTag row = (RowTag) parent; // Register the information for the action represented by // this action HttpServletResponse response = (HttpServletResponse) pageContext.getResponse(); row.setLabel(label); return (EVAL_PAGE); } /** * Release all state information set by this tag. */ public void release() { this.label = null; } }
/* * $Header: Exp $ * $Revision: $ * $Date: $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */ package org.apache.webapp.admin; import java.io.IOException; import java.net.URLEncoder; import java.util.ArrayList; import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.tagext.BodyTagSupport; /** * <p>JSP custom tag that renders an "instant table" control. To the user, * it appears as an HTML <table> element * This tag has the following user-settable attributes:</p> * <ul> * <li><strong>columns</strong> - (Integer) number of columns in the table. * If not specified, one two columns will be created.</li> * <li><strong>table-class</strong> - The CSS style class to be applied to the * entire rendered output of the entire table, if any.</li> * <li><strong>header-row-class</strong> - The CSS style class to be applied to the * entire rendered output of the table header-row, if any.</li> * * </ul> * * <strong>FIXME</strong> - Internationalize the exception messages! * * @author Manveen Kaur * @version $Revision: $ $Date: $ */ public class TableTag extends BodyTagSupport { // ----------------------------------------------------- Manifest Constants /** * Attribute name used to indicate that we have generated the JavaScript * function already on the current page. The data stored for this * attribute is arbitrary - only its existence is relevant. */ // protected static final String FUNCTION_TAG = // "org.apache.webapp.admin.TableTag.FUNCTION_TAG"; // ----------------------------------------------------- Instance Variables /** * The set of labels for the rows displayed by this control. */ protected ArrayList labels = new ArrayList(); /** * The set of datas for the rows displayed by this control. */ protected ArrayList datas = new ArrayList(); /** * The set of labelStyles for the rows displayed by this control. */ protected ArrayList labelStyles = new ArrayList(); /** * The set of dataStyles for the rows displayed by this control. */ protected ArrayList dataStyles = new ArrayList(); /** * The set of "headers" flags for rows displayed by this control. */ protected ArrayList headers = new ArrayList(); // ------------------------------------------------------------- Properties /** * The number of elements that will be displayed to the user. */ protected int columns = 2; public int getColumns() { return (this.columns); } public void setColumns(int columns) { this.columns = columns; } /** * The CSS style class to be applied to the entire rendered output * of this "instant table" object. */ protected String tableStyle = null; public String getTableStyle() { return (this.tableStyle); } public void setTableStyle(String tableStyle) { this.tableStyle = tableStyle; } /** * The CSS Style for the lines between table rows. */ protected String lineStyle = null; public String getLineStyle() { return (this.lineStyle); } public void setLineStyle(String lineStyle) { this.lineStyle = lineStyle; } // --------------------------------------------------------- Public Methods /** * Render this instant actions control. * * @exception JspException if a processing error occurs */ public int doEndTag() throws JspException { JspWriter out = pageContext.getOut(); try { // Render the beginning of this element out.println(); out.print("<table "); if (columns > 2) { out.print(" columns=\""); out.print(columns); out.print("\""); } if (tableStyle != null) { out.print(" class=\""); out.print(tableStyle); out.print("\""); out.print(" border=\"1\" cellspacing=\"0\" "); out.print(" cellpadding=\"0\" width=\"100%\" "); } out.println(">"); // Render each defined row int n = labels.size(); for (int i = 0; i < n; i++) { String label = (String) labels.get(i); boolean header = ((Boolean) headers.get(i)).booleanValue(); String data = (String) datas.get(i); String labelStyle = (String) labelStyles.get(i); String dataStyle = (String) dataStyles.get(i); if (header) out.println("<tr class=\"header-row\" >"); else out.println("<tr>"); out.println(" <td width=\"27%\"> "); out.print(" <div align=\"left\""); if (labelStyle != null) out.print( " class=\"" + labelStyle +"\""); out.print(">"); out.print(label); out.println(" </div>"); out.println(" </td>"); out.println(" <td width=\"73%\"> "); out.print(" <div align=\"left\"" ); if (dataStyle != null) out.print(" class=\"" + dataStyle + "\""); out.print(">"); out.print(data); out.println(" </div>"); out.print(" </td>"); out.println("</tr>"); /* if (!header) { out.println("<tr height=\"1\">"); out.println(" <td class=\""+ lineStyle + "\" colspan=\"2\">"); out.println(" <img src=\"\" alt=\"\" width=\"1\" height=\"1\" border=\"0\">"); out.println(" </td>"); out.println("</tr>"); } */ } // Render the end of this element out.println("</table>"); out.println(); } catch (IOException e) { throw new JspException(e); } return (EVAL_PAGE); } /** * Release all state information set by this tag. */ public void release() { this.headers.clear(); this.labels.clear(); this.datas.clear(); this.labelStyles.clear(); this.dataStyles.clear(); this.columns = 2; this.tableStyle = null; this.lineStyle = null; } // -------------------------------------------------------- Package Methods /** * Add a new Action to the set that will be rendered by this control. * * @param label Localized label visible to the user * @param selected Initial selected state of this option * @param url URL to which control should be transferred if selected */ void addRow(boolean header, String label, String data, String labelStyle, String dataStyle) { headers.add(new Boolean(header)); labels.add(label); datas.add(data); labelStyles.add(labelStyle); dataStyles.add(dataStyle); } // ------------------------------------------------------ Protected Methods }
buttons.jsp
Description: application/unknown-content-type-jspfile
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>