1 12 package org.displaytag.sample.decorators; 13 14 import java.text.DecimalFormat ; 15 16 import org.apache.commons.lang.time.FastDateFormat; 17 import org.displaytag.decorator.TableDecorator; 18 import org.displaytag.sample.ListObject; 19 20 21 28 public class Wrapper extends TableDecorator 29 { 30 31 34 private FastDateFormat dateFormat; 35 36 39 private DecimalFormat moneyFormat; 40 41 44 public Wrapper() 45 { 46 super(); 47 48 50 this.dateFormat = FastDateFormat.getInstance("MM/dd/yy"); this.moneyFormat = new DecimalFormat ("$ #,###,###.00"); } 53 54 58 public String getNullValue() 59 { 60 return null; 61 } 62 63 67 public String getDate() 68 { 69 return this.dateFormat.format(((ListObject) this.getCurrentRowObject()).getDate()); 70 } 71 72 76 public String getMoney() 77 { 78 return this.moneyFormat.format(((ListObject) this.getCurrentRowObject()).getMoney()); 79 } 80 81 85 public String getLink1() 86 { 87 ListObject object = (ListObject) getCurrentRowObject(); 88 int index = getListIndex(); 89 90 return "<a HREF=\"details.jsp?index=" + index 92 + "\">" + object.getId() 94 + "</a>"; } 96 97 102 public String getLink2() 103 { 104 ListObject object = (ListObject) getCurrentRowObject(); 105 int id = object.getId(); 106 107 return "<a HREF=\"details.jsp?id=" + id 109 + "&action=view\">View</a> | " + "<a HREF=\"details.jsp?id=" + id 112 + "&action=edit\">Edit</a> | " + "<a HREF=\"details.jsp?id=" + id 115 + "&action=delete\">Delete</a>"; } 117 } 118 | Popular Tags |