1 25 26 package com.j2biz.blogunity.web.decorator; 27 28 import org.apache.commons.logging.Log; 29 import org.apache.commons.logging.LogFactory; 30 31 import com.j2biz.blogunity.pojo.Entry; 32 33 public class EntriesTableDecorator extends AbstractTableDecorator { 34 37 private static final Log log = LogFactory.getLog(EntriesTableDecorator.class); 38 39 public String getAuthor() { 40 41 Entry entry = (Entry) getCurrentRowObject(); 42 return utils.renderUser(entry.getAuthor(), request); 43 } 44 45 public String getEntry() { 46 47 Entry entry = (Entry) getCurrentRowObject(); 48 return utils.renderEntry(entry, request); 49 } 50 51 public String getCreateTime() { 52 53 Entry entry = (Entry) getCurrentRowObject(); 54 return utils.formatDateTime(entry.getCreateTime()); 55 } 56 57 public String getType() { 58 59 Entry entry = (Entry) getCurrentRowObject(); 60 if (entry.getType() == Entry.DRAFT) return "DRAFT"; 61 else if (entry.getType() == Entry.PRIVATE) return "PRIVATE"; 62 else 63 return "PUBLIC"; 64 } 65 66 public String getActions() { 67 68 Entry entry = (Entry) getCurrentRowObject(); 69 StringBuffer out = new StringBuffer (); 70 out.append("<nobr>"); 71 72 out.append("<a HREF=\""); 74 out.append(ctx); 75 out.append("/my/editEntryForm?id="); 76 out.append(entry.getId()); 77 out.append("\">"); 78 out.append(getMessageForKey("EDIT")); 79 out.append("</a>"); 80 out.append(" | "); 81 82 out.append("<a HREF=\""); 84 out.append(ctx); 85 out.append("/my/deleteBlogEntryConfirm?id="); 86 out.append(entry.getId()); 87 out.append("\">"); 88 out.append(getMessageForKey("DELETE")); 89 out.append("</a>"); 90 out.append(" | "); 91 92 out.append("<a HREF=\""); 94 out.append(ctx); 95 out.append("/my/listEntryComments?id="); 96 out.append(entry.getId()); 97 out.append("\">"); 98 out.append(getMessageForKey("COMMENTS")); 99 out.append("</a>"); 100 out.append(" | "); 101 102 out.append("<a HREF=\""); 104 out.append(ctx); 105 out.append("/my/listTrackbacks?id="); 106 out.append(entry.getId()); 107 out.append("\">"); 108 out.append(getMessageForKey("TRACKBACKS")); 109 out.append("</a>"); 110 111 out.append("</nobr>"); 112 113 return out.toString(); 114 } 115 116 } | Popular Tags |