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.Comment; 32 33 public class CommentsTableDecorator extends AbstractTableDecorator { 34 37 private static final Log log = LogFactory.getLog(CommentsTableDecorator.class); 38 39 public String getAuthor() { 40 41 Comment comment = (Comment) getCurrentRowObject(); 42 return utils.renderUser(comment.getAuthor(), request); 43 } 44 45 public String getComment() { 46 Comment comment = (Comment) getCurrentRowObject(); 47 return utils.renderComment(comment, request); 48 } 49 50 public String getCreateTime() { 51 52 Comment comment = (Comment) getCurrentRowObject(); 53 return utils.formatDateTime(comment.getCreateTime()); 54 } 55 56 public String getActions() { 57 58 Comment comment = (Comment) getCurrentRowObject(); 59 StringBuffer out = new StringBuffer (); 60 out.append("<nobr>"); 61 62 out.append("<a HREF=\""); 64 out.append(ctx); 65 out.append("/my/editCommentForm?id="); 66 out.append(comment.getId()); 67 out.append("\">"); 68 out.append(getMessageForKey("EDIT")); 69 out.append("</a>"); 70 out.append(" | "); 71 72 out.append("<a HREF=\""); 74 out.append(ctx); 75 out.append("/my/deleteCommentConfirm?id="); 76 out.append(comment.getId()); 77 out.append("\">"); 78 out.append(getMessageForKey("DELETE")); 79 out.append("</a>"); 80 81 out.append("</nobr>"); 82 83 return out.toString(); 84 } 85 86 } | Popular Tags |