1 5 package com.opensymphony.webwork.components.table.renderer; 6 7 import com.opensymphony.webwork.components.table.WebTable; 8 9 import java.text.SimpleDateFormat ; 10 11 12 16 public class DateCellRenderer extends AbstractCellRenderer { 17 19 SimpleDateFormat _formater = new SimpleDateFormat (); 20 21 26 String _formatString = null; 27 28 30 public DateCellRenderer() { 31 super(); 32 } 33 34 36 public String getCellValue(WebTable table, Object data, int row, int col) { 37 java.util.Date cellValue = null; 38 39 if (data == null) { 40 return ""; 41 } 42 43 if (data instanceof java.util.Date ) { 44 return _formater.format((java.util.Date ) data); 45 } 46 47 return data.toString(); 48 } 49 50 public void setFormatString(String format) { 51 _formatString = format; 52 _formater.applyPattern(_formatString); 53 } 54 } 55 | Popular Tags |