KickJava   Java API By Example, From Geeks To Geeks.

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


1 package com.lamatek.tags.google;
2
3 import javax.servlet.jsp.tagext.BodyTagSupport JavaDoc;
4 import javax.servlet.jsp.tagext.Tag JavaDoc;
5
6 import com.lamatek.tags.google.beans.EscapeChars;
7
8 /**
9  * GoogleMapLabelTag
10  *
11  * Represents a <googlemaps:label> tag. Developers should not extend this class
12  * or override it's methods.
13  */

14 public class GoogleMapLabelTag extends BodyTagSupport JavaDoc {
15
16     String JavaDoc point = null;
17     String JavaDoc css_class = null;
18     String JavaDoc style = null;
19     String JavaDoc content = null;
20     boolean html = true;
21     float opacity = 0.5f;
22     int x_offset = 0;
23     int y_offset = 0;
24     /**
25      * Overrides doStartTag() from BodyTagSupport.
26      */

27     public int doStartTag() {
28         return EVAL_BODY_BUFFERED;
29     }
30     /**
31      * Overrides doEndTag() from BodyTagSupport.
32      */

33     public int doEndTag() {
34         if (content == null) {
35             content = getBodyContent().getString().trim();
36             if (html)
37                 content = EscapeChars.escape(content);
38         }
39         Tag JavaDoc tag = this;
40         while (tag.getParent() != null) {
41             if (tag.getParent() instanceof GoogleMapTag) {
42                 ((GoogleMapTag) tag.getParent()).addLabel(this);
43                 return EVAL_PAGE;
44             }
45             tag = tag.getParent();
46         }
47         return EVAL_PAGE;
48     }
49     /**
50      * Returns the current css class attribute for this label.
51      *
52      */

53     public String JavaDoc getCss_class() {
54         return css_class;
55     }
56     /**
57      * Sets the css class attribute for this label's surrounding div.
58      */

59     public void setCss_class(String JavaDoc css_class) {
60         this.css_class = css_class;
61     }
62     /**
63      * Returns the point tag that determines where this label is placed.
64      */

65     public String JavaDoc getPoint() {
66         return point;
67     }
68     /**
69      * Sets the point tag that determines where this label is placed. Must be a
70      * valid point id.
71      */

72     public void setPoint(String JavaDoc point) {
73         this.point = point;
74     }
75     /**
76      * Returns the current css style attribute for this label's surrounding div.
77      */

78     public String JavaDoc getStyle() {
79         return style;
80     }
81     /**
82      * Sets the css style attribute for this label's surrounding div.
83      */

84     public void setStyle(String JavaDoc style) {
85         this.style = style;
86     }
87     /**
88      * Returns the text content for this label.
89      */

90     public String JavaDoc getContent() {
91         return content;
92     }
93     /**
94      * Returns the text content for this label.
95      */

96     public void setContent(String JavaDoc content) {
97         if (html)
98             this.content = EscapeChars.escape(content.trim());
99         else
100             this.content = content.trim();
101     }
102     /**
103      * Returns true if this label content is in html, false otherwise.
104      */

105     public boolean isHtml() {
106         return html;
107     }
108     /**
109      * Denotes whether or not content for this label is html.
110      */

111     public void setHtml(boolean html) {
112         this.html = html;
113     }
114     /**
115      * Returns the current opacity level (0-1) for this label.
116      */

117     public float getOpacity() {
118         return opacity;
119     }
120     /**
121      * Sets the opacity level (0-1) for this label.
122      */

123     public void setOpacity(float opacity) {
124         this.opacity = opacity;
125     }
126     /**
127      * Returns the left/right offset (in pixels) from the point to place this
128      * label. Negative is left, positive is right.
129      */

130     public int getX_offset() {
131         return x_offset;
132     }
133     /**
134      * Sets the left/right offset (in pixels) from the point to place this
135      * label. Negative is left, positive is right.
136      */

137     public void setX_offset(int x_offset) {
138         this.x_offset = x_offset;
139     }
140     /**
141      * Returns the up/down offset (in pixels) from the point to place this
142      * label. Negative is up, positive is down.
143      */

144     public int getY_offset() {
145         return y_offset;
146     }
147     /**
148      * Sets the up/down offset (in pixels) from the point to place this
149      * label. Negative is up, positive is down.
150      */

151     public void setY_offset(int y_offset) {
152         this.y_offset = y_offset;
153     }
154 }
155
Popular Tags