001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.commons.digester.rss;
019:
020: import java.io.PrintWriter;
021: import java.io.Serializable;
022:
023: /**
024: * <p>Implementation object representing an <strong>image</strong> in the
025: * <em>Rich Site Summary</em> DTD, version 0.91. This class may be subclassed
026: * to further specialize its behavior.</p>
027: */
028:
029: public class Image implements Serializable {
030:
031: // ------------------------------------------------------------- Properties
032:
033: /**
034: * The image description (1-100 characters).
035: */
036: protected String description = null;
037:
038: public String getDescription() {
039: return (this .description);
040: }
041:
042: public void setDescription(String description) {
043: this .description = description;
044: }
045:
046: /**
047: * The image height in pixels (1-400).
048: */
049: protected int height = 31;
050:
051: public int getHeight() {
052: return (this .height);
053: }
054:
055: public void setHeight(int height) {
056: this .height = height;
057: }
058:
059: /**
060: * The image link (1-500 characters).
061: */
062: protected String link = null;
063:
064: public String getLink() {
065: return (this .link);
066: }
067:
068: public void setLink(String link) {
069: this .link = link;
070: }
071:
072: /**
073: * The image alternate text (1-100 characters).
074: */
075: protected String title = null;
076:
077: public String getTitle() {
078: return (this .title);
079: }
080:
081: public void setTitle(String title) {
082: this .title = title;
083: }
084:
085: /**
086: * The image location URL (1-500 characters).
087: */
088: protected String url = null;
089:
090: public String getURL() {
091: return (this .url);
092: }
093:
094: public void setURL(String url) {
095: this .url = url;
096: }
097:
098: /**
099: * The image width in pixels (1-400).
100: */
101: protected int width = 31;
102:
103: public int getWidth() {
104: return (this .width);
105: }
106:
107: public void setWidth(int width) {
108: this .width = width;
109: }
110:
111: // -------------------------------------------------------- Package Methods
112:
113: /**
114: * Render this channel as XML conforming to the RSS 0.91 specification,
115: * to the specified writer.
116: *
117: * @param writer The writer to render output to
118: */
119: void render(PrintWriter writer) {
120:
121: writer.println(" <image>");
122:
123: writer.print(" <title>");
124: writer.print(title);
125: writer.println("</title>");
126:
127: writer.print(" <url>");
128: writer.print(url);
129: writer.println("</url>");
130:
131: if (link != null) {
132: writer.print(" <link>");
133: writer.print(link);
134: writer.println("</link>");
135: }
136:
137: writer.print(" <width>");
138: writer.print(width);
139: writer.println("</width>");
140:
141: writer.print(" <height>");
142: writer.print(height);
143: writer.println("</height>");
144:
145: if (description != null) {
146: writer.print(" <description>");
147: writer.print(description);
148: writer.println("</description>");
149: }
150:
151: writer.println(" </image>");
152:
153: }
154:
155: }
|