KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > roller > ui > rendering > util > WeblogEntryCommentForm


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. The ASF licenses this file to You
4  * under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License. For additional information regarding
15  * copyright in this work, please see the NOTICE file in the top level
16  * directory of this distribution.
17  */

18
19 package org.apache.roller.ui.rendering.util;
20
21 import org.apache.roller.pojos.CommentData;
22 import org.apache.roller.pojos.WeblogEntryData;
23 import org.apache.roller.pojos.wrapper.CommentDataWrapper;
24 import org.apache.roller.pojos.wrapper.WeblogEntryDataWrapper;
25
26
27 /**
28  * A simple class to represent the comment form displayed on a weblog entry
29  * permalink page. We use this class to manage the interaction with that form.
30  */

31 public class WeblogEntryCommentForm {
32     
33     private boolean error = false;
34     private String JavaDoc message = null;
35     
36     private String JavaDoc name = "";
37     private String JavaDoc email = "";
38     private String JavaDoc url = "";
39     private String JavaDoc content = "";
40     private boolean notify = false;
41     
42     private CommentData previewComment = null;
43     
44     
45     public WeblogEntryCommentForm() {}
46     
47     
48     public void setPreview(CommentData preview) {
49         this.previewComment = preview;
50         setData(preview);
51     }
52     
53     public void setData(CommentData comment) {
54         this.name = comment.getName();
55         this.email = comment.getEmail();
56         this.url = comment.getUrl();
57         this.content = comment.getContent();
58         this.notify = comment.getNotify().booleanValue();
59     }
60     
61     public void setError(String JavaDoc errorMessage) {
62         this.error = true;
63         this.message = errorMessage;
64     }
65     
66     public CommentDataWrapper getPreviewComment() {
67         return CommentDataWrapper.wrap(previewComment);
68     }
69     
70     public boolean isPreview() {
71         return (this.previewComment != null);
72     }
73     
74     public String JavaDoc getName() {
75         return name;
76     }
77
78     public void setName(String JavaDoc name) {
79         this.name = name;
80     }
81
82     public String JavaDoc getEmail() {
83         return email;
84     }
85
86     public void setEmail(String JavaDoc email) {
87         this.email = email;
88     }
89
90     public String JavaDoc getUrl() {
91         return url;
92     }
93
94     public void setUrl(String JavaDoc url) {
95         this.url = url;
96     }
97
98     public String JavaDoc getContent() {
99         return content;
100     }
101
102     public void setContent(String JavaDoc content) {
103         this.content = content;
104     }
105
106     public boolean isNotify() {
107         return notify;
108     }
109
110     public void setNotify(boolean notify) {
111         this.notify = notify;
112     }
113
114     public boolean isError() {
115         return error;
116     }
117
118     public void setError(boolean error) {
119         this.error = error;
120     }
121
122     public String JavaDoc getMessage() {
123         return message;
124     }
125
126     public void setMessage(String JavaDoc message) {
127         this.message = message;
128     }
129     
130 }
131
Popular Tags