1 5 package com.opensymphony.webwork.components.table.renderer; 6 7 import com.opensymphony.webwork.components.table.WebTable; 8 9 10 14 public class BooleanCellRenderer extends AbstractCellRenderer { 15 17 20 protected String _falseValue = "false"; 21 22 25 protected String _trueValue = "true"; 26 27 29 public BooleanCellRenderer() { 30 super(); 31 } 32 33 35 public String getCellValue(WebTable table, Object data, int row, int col) { 36 if (data == null) { 37 return ""; 38 } 39 40 if (data instanceof Boolean ) { 41 return ((Boolean ) data).booleanValue() ? _trueValue : _falseValue; 42 } 43 44 return data.toString(); } 46 47 public void setFalseValue(String falseValue) { 48 _falseValue = falseValue; 49 } 50 51 public void setTrueValue(String trueValue) { 52 _trueValue = trueValue; 53 } 54 } 55 | Popular Tags |