KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lamatek > tags > google > GoogleMapInfoWindowTag


1 package com.lamatek.tags.google;
2
3 import java.io.Serializable JavaDoc;
4
5 import javax.servlet.jsp.tagext.BodyTagSupport JavaDoc;
6 import javax.servlet.jsp.tagext.Tag JavaDoc;
7
8 import com.lamatek.tags.google.beans.EscapeChars;
9
10 /**
11  * GoogleMapInfoWindowTag
12  *
13  * This class represents a <googlemaps:infowindow> tag. Developers should not override this
14  * class.
15  *
16  * @author Tom Cole
17  * @version 0.40
18  */

19 public class GoogleMapInfoWindowTag extends BodyTagSupport JavaDoc implements Serializable JavaDoc, InfoWindow {
20     
21     boolean display = false;
22     String JavaDoc content;
23     boolean html = true;
24     String JavaDoc style = null;
25     String JavaDoc css_class = null;
26     /**
27      * Denotes that this tag is not tabbed.
28      *
29      * @return false
30      */

31     public boolean isTabbed() {
32         return false;
33     }
34     /**
35      * Overrides doStartTag from BodyTagSupport.
36      */

37     public int doStartTag() {
38         return EVAL_BODY_BUFFERED;
39     }
40     /**
41      * Overrides doEndTag from BodyTagSupport. Developers should not override this method.
42      */

43     public int doEndTag() {
44         if (content == null) {
45             content = getBodyContent().getString().trim();
46             if (html)
47                 content = EscapeChars.escape(content);
48         }
49         Tag JavaDoc tag = this;
50         while (tag.getParent() != null) {
51             if (tag.getParent() instanceof GoogleMapMarkerTag) {
52                 ((GoogleMapMarkerTag) tag.getParent()).setInfoWindow(this);
53                 return EVAL_PAGE;
54             }
55             tag = tag.getParent();
56         }
57         return EVAL_PAGE;
58     }
59     /**
60      * Sets whether or not this info window should be initially displayed. If set to
61      * true then the info window will be displayed. If set to false, the info window will
62      * only display after the user has clicked on the parent marker.
63      *
64      * @param display True to display, false to require a click to display.
65      */

66     public void setDisplay(boolean display) {
67         this.display = display;
68     }
69     /**
70      * Returns the body content of this info window. If html is set to true, this will return
71      * an escaped version.
72      *
73      * @return The body contents of the window as a String.
74      */

75     public String JavaDoc getContent() {
76         return content;
77     }
78     /**
79      * Sets the body content of this info window. If html is set to true, this content will
80      * be escaped. If this content contains html, you should call setHtml(true) <em>before</em>
81      * calling this method. If this is set,
82      * the content between the starting tag and ending tag will be ignored.
83      *
84      * @param content The displayed contents for this window.
85      */

86     public void setContent(String JavaDoc content) {
87         if (html)
88             this.content = EscapeChars.escape(content.trim());
89         else
90             this.content = content.trim();
91     }
92     /**
93      * Returns true if this window is set to initially display. Returns false otherwise.
94      *
95      * @return true or false.
96      */

97     public boolean isDisplay() {
98         return display;
99     }
100     /**
101      * Denotes whether or not the contents of this tag are html and therefore
102      * need to be escaped.
103      *
104      * @return True or false.
105      */

106     public boolean isHtml() {
107         return html;
108     }
109     /**
110      * Sets whether or not the contents of this tag are html and therefore need
111      * to be escaped.
112      *
113      * @param html True if content needs to be escaped, false if not.
114      */

115     public void setHtml(boolean html) {
116         this.html = html;
117     }
118     /**
119      * Gets the css style attribute for this window's content.
120      *
121      * @return The CSS style attribute(s)
122      */

123     public String JavaDoc getStyle() {
124         return style;
125     }
126     /**
127      * Sets the css style attribute for this window's content.
128      *
129      * @param style CSS style attribute(s)
130      */

131     public void setStyle(String JavaDoc style) {
132         this.style = style;
133     }
134     /**
135      * Gets the css class attribute for this window's content.
136      *
137      * @return The CSS class attribute(s)
138      */

139     public String JavaDoc getCss_class() {
140         return css_class;
141     }
142     /**
143      * Sets the css style attribute for this window's content.
144      *
145      * @param style CSS style attribute(s)
146      */

147     public void setCss_class(String JavaDoc css_class) {
148         this.css_class = css_class;
149     }
150 }
151
Popular Tags