KickJava   Java API By Example, From Geeks To Geeks.

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


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 <googlemaps:message> tag. Developers should
14  * not extend this class or override it's methods.
15  *
16  * @author Tom Cole
17  * @version 0.40
18  */

19 public class GoogleMapMessageTag extends BodyTagSupport JavaDoc implements Serializable JavaDoc {
20
21     String JavaDoc content = "";
22     String JavaDoc style = null;
23     /**
24      * Overrides doStartTag() in BodyTagSupport.
25      */

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

33     public int doEndTag() {
34         content = EscapeChars.escape(getBodyContent().getString().trim());
35         Tag JavaDoc tag = this;
36         while (tag.getParent() != null) {
37             if (tag.getParent() instanceof GoogleMapTag) {
38                 ((GoogleMapTag) tag.getParent()).setMessage(this);
39                 return EVAL_PAGE;
40             }
41             tag = tag.getParent();
42         }
43         return EVAL_PAGE;
44     }
45     /**
46      * Returns the message body text. If html is set to true, this will be escaped.
47      *
48      * @return Message body text.
49      */

50     public String JavaDoc getMessage() {
51         return content;
52     }
53     /**
54      * Sets the message body text. If html is set to true, this will be escaped.
55      *
56      * @param message Message body text.
57      */

58     public void setMessage(String JavaDoc message) {
59         this.content = message.trim();
60     }
61     /**
62      * Sets the css_style to use for the message.
63      *
64      * @param style The css_style to apply to the message.
65      */

66     public void setStyle(String JavaDoc style) {
67         this.style = style;
68     }
69     /**
70      * Returns the css_style for this message.
71      *
72      * @return A css style string.
73      */

74     public String JavaDoc getStyle() {
75         return style;
76     }
77 }
78
Popular Tags