KickJava   Java API By Example, From Geeks To Geeks.

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


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  * GoogleMapBodyTag
12  *
13  * This tag corresponds to the body contents of the GoogleMapTag. This is
14  * for advanced javascript programmers who can use it to add custom map controls.
15  * This class should not be overriden by developers.
16  *
17  * @author Tom Cole
18  * @version 0.40
19  */

20 public class GoogleMapBodyTag extends BodyTagSupport JavaDoc implements Serializable JavaDoc {
21
22     String JavaDoc content = "";
23     boolean html = false;
24     /**
25      * Overrides doStartTag() in BodyTagSupport.
26      */

27     public int doStartTag() {
28         return EVAL_BODY_BUFFERED;
29     }
30     /**
31      * Overrides doEndTag() in BodyTagSupport. Developers should not
32      * override this method.
33      */

34     public int doEndTag() {
35         content = getBodyContent().getString().trim();
36         if (html)
37             content = EscapeChars.escape(content);
38         Tag JavaDoc tag = this;
39         while (tag.getParent() != null) {
40             if (tag.getParent() instanceof GoogleMapTag) {
41                 ((GoogleMapTag) tag.getParent()).setBody(content);
42                 return EVAL_PAGE;
43             }
44             tag = tag.getParent();
45         }
46         return EVAL_PAGE;
47     }
48     /**
49      * Denotes whether or not the body contains html. If true, then the content
50      * will be escaped, otherwise it is left as is.
51      *
52      * @return True if content contains html, false otherwise.
53      */

54     public boolean isHtml() {
55         return html;
56     }
57     /**
58      * Sets whether or not the body contains html. If true, then the content
59      * will be escaped, otherwise it is left as is.
60      *
61      * @param html True or false.
62      */

63     public void setHtml(boolean html) {
64         this.html = html;
65     }
66 }
67
Popular Tags