KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > j2biz > blogunity > web > decorator > CommentsTableDecorator


1 /*
2  * $Id: CommentsTableDecorator.java,v 1.3 2004/12/26 00:26:18 michelson Exp $
3  *
4  * Copyright (c) 2004 j2biz Group, http://www.j2biz.com Koeln / Duesseldorf ,
5  * Germany
6  *
7  * @author Max Kalina
8  *
9  *
10  * This program is free software; you can redistribute it and/or modify it under
11  * the terms of the GNU General Public License as published by the Free Software
12  * Foundation; either version 2 of the License, or (at your option) any later
13  * version.
14  *
15  * This program is distributed in the hope that it will be useful, but WITHOUT
16  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License along with
21  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22  * Place, Suite 330, Boston, MA 02111-1307 USA
23  *
24  */

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     /**
35      * Logger for this class
36      */

37     private static final Log log = LogFactory.getLog(CommentsTableDecorator.class);
38     
39     public String JavaDoc getAuthor() {
40
41         Comment comment = (Comment) getCurrentRowObject();
42         return utils.renderUser(comment.getAuthor(), request);
43     }
44
45     public String JavaDoc getComment() {
46         Comment comment = (Comment) getCurrentRowObject();
47         return utils.renderComment(comment, request);
48     }
49
50     public String JavaDoc getCreateTime() {
51
52         Comment comment = (Comment) getCurrentRowObject();
53         return utils.formatDateTime(comment.getCreateTime());
54     }
55
56     public String JavaDoc getActions() {
57
58         Comment comment = (Comment) getCurrentRowObject();
59         StringBuffer JavaDoc out = new StringBuffer JavaDoc();
60         out.append("<nobr>");
61
62         // edit link
63
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("&nbsp;|&nbsp;");
71
72         // delete link
73
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