KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > digester > rss > Image


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not 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.
15  */

16
17
18 package org.apache.commons.digester.rss;
19
20 import java.io.PrintWriter JavaDoc;
21 import java.io.Serializable JavaDoc;
22
23
24 /**
25  * <p>Implementation object representing an <strong>image</strong> in the
26  * <em>Rich Site Summary</em> DTD, version 0.91. This class may be subclassed
27  * to further specialize its behavior.</p>
28  */

29
30 public class Image implements Serializable JavaDoc {
31
32
33     // ------------------------------------------------------------- Properties
34

35
36     /**
37      * The image description (1-100 characters).
38      */

39     protected String JavaDoc description = null;
40
41     public String JavaDoc getDescription() {
42         return (this.description);
43     }
44
45     public void setDescription(String JavaDoc description) {
46         this.description = description;
47     }
48
49
50     /**
51      * The image height in pixels (1-400).
52      */

53     protected int height = 31;
54
55     public int getHeight() {
56         return (this.height);
57     }
58
59     public void setHeight(int height) {
60         this.height = height;
61     }
62
63
64     /**
65      * The image link (1-500 characters).
66      */

67     protected String JavaDoc link = null;
68
69     public String JavaDoc getLink() {
70         return (this.link);
71     }
72
73     public void setLink(String JavaDoc link) {
74         this.link = link;
75     }
76
77
78     /**
79      * The image alternate text (1-100 characters).
80      */

81     protected String JavaDoc title = null;
82
83     public String JavaDoc getTitle() {
84         return (this.title);
85     }
86
87     public void setTitle(String JavaDoc title) {
88         this.title = title;
89     }
90
91
92     /**
93      * The image location URL (1-500 characters).
94      */

95     protected String JavaDoc url = null;
96
97     public String JavaDoc getURL() {
98         return (this.url);
99     }
100
101     public void setURL(String JavaDoc url) {
102         this.url = url;
103     }
104
105
106     /**
107      * The image width in pixels (1-400).
108      */

109     protected int width = 31;
110
111     public int getWidth() {
112         return (this.width);
113     }
114
115     public void setWidth(int width) {
116         this.width = width;
117     }
118
119
120     // -------------------------------------------------------- Package Methods
121

122
123     /**
124      * Render this channel as XML conforming to the RSS 0.91 specification,
125      * to the specified writer.
126      *
127      * @param writer The writer to render output to
128      */

129     void render(PrintWriter JavaDoc writer) {
130
131         writer.println(" <image>");
132
133         writer.print(" <title>");
134         writer.print(title);
135         writer.println("</title>");
136
137         writer.print(" <url>");
138         writer.print(url);
139         writer.println("</url>");
140
141         if (link != null) {
142             writer.print(" <link>");
143             writer.print(link);
144             writer.println("</link>");
145         }
146
147         writer.print(" <width>");
148         writer.print(width);
149         writer.println("</width>");
150
151         writer.print(" <height>");
152         writer.print(height);
153         writer.println("</height>");
154
155         if (description != null) {
156             writer.print(" <description>");
157             writer.print(description);
158             writer.println("</description>");
159         }
160
161         writer.println(" </image>");
162
163     }
164
165
166 }
167
Popular Tags