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: * Initial developer(s): Michel-Ange ANTON
022: * --------------------------------------------------------------------------
023: * $Id: GridColTag.java 4501 2004-03-26 16:16:12Z benoitf $
024: * --------------------------------------------------------------------------
025: */
026:
027: package org.objectweb.jonas.webapp.taglib;
028:
029: import javax.servlet.jsp.JspException;
030:
031: public class GridColTag extends GridTableBaseTag {
032:
033: // ----------------------------------------------------- Properties Variables
034:
035: private boolean nowrap = false;
036: private int colspan = -1;
037: private int rowspan = -1;
038:
039: public boolean isNowrap() {
040: return nowrap;
041: }
042:
043: public void setNowrap(boolean nowrap) {
044: this .nowrap = nowrap;
045: }
046:
047: public int getColspan() {
048: return colspan;
049: }
050:
051: public void setColspan(int colspan) {
052: this .colspan = colspan;
053: }
054:
055: public int getRowspan() {
056: return rowspan;
057: }
058:
059: public void setRowspan(int rowspan) {
060: this .rowspan = rowspan;
061: }
062:
063: // ----------------------------------------------------- Protected Methods
064:
065: /**
066: * Return the HTML element.
067: */
068: protected String getHtmlElement() {
069: return "td";
070: }
071:
072: /**
073: * Prepare the attributes of the HTML element
074: */
075: protected String prepareAttributes() throws JspException {
076: StringBuffer sb = new StringBuffer();
077: // Append nowrap
078: if (isNowrap()) {
079: sb.append(" nowrap");
080: }
081: // Append "colspan" parameter
082: sb.append(prepareAttribute("colspan", colspan));
083: // Append "rowspan" parameter
084: sb.append(prepareAttribute("rowspan", rowspan));
085: // Append Parent
086: sb.append(super .prepareAttributes());
087:
088: return sb.toString();
089: }
090:
091: protected String getDefaultBody() {
092: return " ";
093: }
094:
095: // ----------------------------------------------------- Public Methods
096:
097: /**
098: * Release resources after Tag processing has finished.
099: */
100: public void release() {
101: super .release();
102: nowrap = false;
103: }
104: }
|