KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > dlog4j > formbean > LogBaseForm


1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU Library General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15  */

16 package dlog4j.formbean;
17
18 import java.util.Date JavaDoc;
19 import java.util.List JavaDoc;
20
21 /**
22  * 日记信息的基类,有两个子类LogForm以及DraftForm
23  * @author Liudong
24  */

25 public class LogBaseForm extends ContentPreviewForm {
26     
27     public final static int LEVEL_1 = 1;
28     public final static int LEVEL_2 = 2;
29     public final static int LEVEL_3 = 3;
30     public final static int LEVEL_4 = 4;
31     public final static int LEVEL_5 = 5;
32     
33     int id;
34     UserForm owner;
35     String JavaDoc author;
36     String JavaDoc authorUrl;
37     String JavaDoc title;
38     Date JavaDoc logTime;
39     String JavaDoc refUrl;
40     String JavaDoc weather;
41     int useFace = 1;
42     int useUbb = 1;
43     int showFormerly = 0;
44     int moodLevel = LEVEL_3;
45     SiteForm site;
46     List JavaDoc attachments;
47
48     public List JavaDoc getAttachments() {
49         return attachments;
50     }
51     public void setAttachments(List JavaDoc attachments) {
52         this.attachments = attachments;
53     }
54     public String JavaDoc getAuthor() {
55         if("".equals(author))
56             return null;
57         return author;
58     }
59     public void setAuthor(String JavaDoc author) {
60         this.author = author;
61     }
62     public int getOwnerId(){
63         return (owner!=null)?owner.getId():-1;
64     }
65     public void setOwnerId(int userid){
66         if(owner==null)
67             owner = new UserForm();
68         owner.setId(userid);
69     }
70     /**
71      * @return
72      */

73     public String JavaDoc getOwnerName() {
74         return owner.getDisplayName();
75     }
76
77     public String JavaDoc getAuthorUrl() {
78         if("".equals(authorUrl))
79             return null;
80         return authorUrl;
81     }
82     public void setAuthorUrl(String JavaDoc authorUrl) {
83         this.authorUrl = authorUrl;
84     }
85     public int getId() {
86         return id;
87     }
88     public void setId(int id) {
89         this.id = id;
90     }
91     public Date JavaDoc getLogTime() {
92         return logTime;
93     }
94
95     public void setLogTime(Date JavaDoc logTime) {
96         this.logTime = logTime;
97     }
98     public int getMoodLevel() {
99         return moodLevel;
100     }
101     public void setMoodLevel(int moodLevel) {
102         this.moodLevel = moodLevel;
103     }
104     public UserForm getOwner() {
105         return owner;
106     }
107     public void setOwner(UserForm owner) {
108         this.owner = owner;
109     }
110     public String JavaDoc getRefUrl() {
111         if("".equals(refUrl))
112             return null;
113         return refUrl;
114     }
115     public void setRefUrl(String JavaDoc refUrl) {
116         this.refUrl = refUrl;
117     }
118     public int getShowFormerly() {
119         return showFormerly;
120     }
121     public void setShowFormerly(int showFormerly) {
122         this.showFormerly = showFormerly;
123     }
124     public SiteForm getSite() {
125         return site;
126     }
127     public void setSite(SiteForm site) {
128         this.site = site;
129     }
130     public String JavaDoc getTitleText(){
131         try{
132             return extractText(title);
133         }catch(Exception JavaDoc e){}
134         return null;
135     }
136     public String JavaDoc getTitle() {
137         if("".equals(title))
138             return null;
139         return title;
140     }
141     public void setTitle(String JavaDoc title) {
142         this.title = title;
143     }
144     public int getUseFace() {
145         return useFace;
146     }
147     public void setUseFace(int useFace) {
148         this.useFace = useFace;
149     }
150     public int getUseUbb() {
151         return useUbb;
152     }
153     public void setUseUbb(int useUbb) {
154         this.useUbb = useUbb;
155     }
156     public String JavaDoc getWeather() {
157         if("".equals(weather))
158             return null;
159         return weather;
160     }
161     public void setWeather(String JavaDoc weather) {
162         this.weather = weather;
163     }
164     
165     public static void main(String JavaDoc[] args){
166         try{
167             System.out.print("RESULT:");
168             System.out.println(extractText("<font color=\"red\" size=4>大字体测试</font>"));
169         }catch(Exception JavaDoc e){}
170     }
171 }
172
Popular Tags