GridRowTag.java

00001 /*
00002  * JOnAS: Java(TM) Open Application Server
00003  * Copyright (C) 1999 Bull S.A.
00004  * Contact: jonas-team@objectweb.org
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00019  * USA
00020  *
00021  * Initial developer(s): Michel-Ange ANTON
00022  * --------------------------------------------------------------------------
00023  * $Id: GridRowTag.java,v 1.3 2003/06/20 17:15:42 antonma Exp $
00024  * --------------------------------------------------------------------------
00025  */
00026 
00027 package org.objectweb.jonas.webapp.taglib;
00028 
00029 import javax.servlet.jsp.tagext.Tag;
00030 
00031 public class GridRowTag extends GridTableBaseTag {
00032 
00033 // ----------------------------------------------------- Properties
00034 
00035     private boolean changeStyle = false;
00036 
00037     public boolean isChangeStyle() {
00038         return changeStyle;
00039     }
00040 
00041     public void setChangeStyle(boolean changeStyle) {
00042         this.changeStyle = changeStyle;
00043     }
00044 
00045 // ----------------------------------------------------- Public Methods
00046 
00050     public void release() {
00051         super.release();
00052         changeStyle = false;
00053     }
00054 
00055 // ----------------------------------------------------- Protected Methods
00056 
00060     protected String getHtmlElement() {
00061         return "tr";
00062     }
00063 
00070     protected String prepareStyles() {
00071         StringBuffer styles = new StringBuffer();
00072         if (getStyle() != null) {
00073             styles.append(" style=\"");
00074             styles.append(getStyle());
00075             styles.append("\"");
00076         }
00077 
00078         // Get the row class from the GridTag parent
00079         String sClass = getStyleClass();
00080         if (sClass == null) {
00081             sClass = getRowClass();
00082         }
00083         // Render class
00084         if (sClass != null) {
00085             styles.append(" class=\"");
00086             styles.append(sClass);
00087             styles.append("\"");
00088         }
00089 
00090         if (getStyleId() != null) {
00091             styles.append(" id=\"");
00092             styles.append(getStyleId());
00093             styles.append("\"");
00094         }
00095         if (getTitle() != null) {
00096             styles.append(" title=\"");
00097             styles.append(getTitle());
00098             styles.append("\"");
00099         }
00100         return styles.toString();
00101     }
00102 
00106     protected String getRowClass() {
00107         // Determine if embedded in an GridTag
00108         Tag tag = findAncestorWithClass(this, GridTag.class);
00109         if (tag == null) {
00110             return null;
00111         }
00112         // Determine the current row number
00113         GridTag oTag = (GridTag) tag;
00114         return oTag.getRowStyle(changeStyle);
00115     }
00116 
00117 }

Generated on Tue Feb 15 15:05:34 2005 for JOnAS by  doxygen 1.3.9.1