00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 package org.objectweb.jonas.webapp.taglib;
00027
00028 import javax.servlet.jsp.JspException;
00029
00033 public class GridTag extends GridTableBaseTag {
00034
00035
00036
00037 private int m_iRow = 0;
00038 private boolean m_bEvenRow = false;
00039
00040
00041
00042 private String oddStyleClass = null;
00043 private String evenStyleClass = null;
00044 private String globalRowStyleClass = null;
00045 private int periodRow = 1;
00046 private int border = 0;
00047 private int cellSpacing = 0;
00048 private int cellPadding = 0;
00049
00053 public String getOddStyleClass() {
00054 return oddStyleClass;
00055 }
00056
00062 public void setOddStyleClass(String styleClass) {
00063 this.oddStyleClass = styleClass;
00064 }
00065
00073 public String getEvenStyleClass() {
00074 return evenStyleClass;
00075 }
00076
00082 public void setEvenStyleClass(String styleClass) {
00083 this.evenStyleClass = styleClass;
00084 }
00085
00086 public int getPeriodRow() {
00087 return periodRow;
00088 }
00089
00090 public void setPeriodRow(int periodRow) {
00091 this.periodRow = periodRow;
00092 }
00093 public void setPeriodRow(String p_PeriodRow) {
00094 this.periodRow = Integer.parseInt(p_PeriodRow);
00095 }
00096
00097 public int getBorder() {
00098 return border;
00099 }
00100
00101 public void setBorder(int border) {
00102 this.border = border;
00103 }
00104
00105 public int getCellSpacing() {
00106 return cellSpacing;
00107 }
00108
00109 public void setCellSpacing(int cellSpacing) {
00110 this.cellSpacing = cellSpacing;
00111 }
00112
00113 public int getCellPadding() {
00114 return cellPadding;
00115 }
00116
00117 public void setCellPadding(int cellPadding) {
00118 this.cellPadding = cellPadding;
00119 }
00120
00121 public String getGlobalRowStyleClass() {
00122 return globalRowStyleClass;
00123 }
00124
00125 public void setGlobalRowStyleClass(String globalRowStyleClass) {
00126 this.globalRowStyleClass = globalRowStyleClass;
00127 }
00128
00129
00130
00136 public int doStartTag()
00137 throws JspException {
00138 m_bEvenRow = false;
00139 m_iRow = 0;
00140 return super.doStartTag();
00141 }
00142
00146 public void release() {
00147 super.release();
00148 m_iRow = 0;
00149 m_bEvenRow = false;
00150
00151 oddStyleClass = null;
00152 evenStyleClass = null;
00153 globalRowStyleClass = null;
00154 periodRow = 1;
00155
00156 border = 0;
00157 cellSpacing = 0;
00158 cellPadding = 0;
00159
00160
00161
00162 }
00163
00164
00165
00169 protected String prepareAttributes() throws JspException {
00170 StringBuffer sb = new StringBuffer();
00171
00172
00173 sb.append(prepareAttribute("border", border));
00174
00175 sb.append(prepareAttribute("cellspacing", cellSpacing));
00176
00177 sb.append(prepareAttribute("cellpadding", cellPadding));
00178
00179
00180 sb.append(super.prepareAttributes());
00181
00182 return sb.toString();
00183
00184 }
00185
00186 protected String getRowStyle(boolean p_bChange) {
00187 if (globalRowStyleClass == null) {
00188 if (periodRow > 0) {
00189 if (m_iRow >= periodRow) {
00190 m_bEvenRow = !m_bEvenRow;
00191 m_iRow = 0;
00192 }
00193 m_iRow++;
00194 }
00195 if (p_bChange == true) {
00196 m_bEvenRow = !m_bEvenRow;
00197 m_iRow = 1;
00198 }
00199 if (m_bEvenRow == true) {
00200 return evenStyleClass;
00201 }
00202 return oddStyleClass;
00203 }
00204 return globalRowStyleClass;
00205 }
00206 }