01: //$Id: RSSImage.java,v 1.5 2004/03/25 10:09:10 taganaka Exp $
02: package org.gnu.stealthp.rsslib;
03:
04: /**
05: * RSS image's definitions class.
06: *
07: * <blockquote>
08: * <em>This module, both source code and documentation, is in the
09: * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
10: * </blockquote>
11: *
12: * @since RSSLIB4J 0.1
13: * @author Francesco aka 'Stealthp' stealthp[@]stealthp.org
14: * @version 0.2
15: */
16:
17: public class RSSImage extends RSSObject {
18:
19: private String url;
20: private String w;
21: private String h;
22:
23: /**
24: * Set url of the image
25: * @param u The image's url
26: */
27: public void setUrl(String u) {
28: this .url = u;
29: }
30:
31: /**
32: * Get the url of the image
33: * @return the image's url
34: */
35: public String getUrl() {
36: return this .url;
37: }
38:
39: /**
40: * Set the image's width
41: * @param width width
42: */
43: public void setWidth(String width) {
44: w = width;
45: }
46:
47: /**
48: * Set the image's height
49: * @param height height
50: */
51: public void setHeight(String height) {
52: h = height;
53: }
54:
55: /**
56: * Get the image's width
57: * @return width (could be null)
58: */
59: public String getWidth() {
60: return w;
61: }
62:
63: /**
64: * Get the image's height
65: * @return height (could be null)
66: */
67: public String getHeight() {
68: return h;
69: }
70:
71: /**
72: * Return a html img tag with link associated
73: * @return html
74: */
75: public String toHTML() {
76: String html = "<a href=\"" + link + "\">";
77: html += "<img src=\"" + url + "\" border=\"0\" ";
78: html += (w != null) ? "width=\"" + w + " \"" : " ";
79: html += (h != null) ? "height=\"" + h + " \"" : " ";
80: html += (title != null) ? "alt=\"" + title + "\"" : "";
81: html += "/>";
82: html += "</a>";
83: return html;
84: }
85:
86: /**
87: * Useful for debug
88: * @return information
89: */
90: public String toString() {
91: String info = "TITLE: " + title + "\n" + "LINK: " + link + "\n"
92: + "URL: " + url;
93: return info;
94: }
95:
96: }
|