KickJava   Java API By Example, From Geeks To Geeks.

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


1 package com.lamatek.tags.google;
2
3 import java.io.Serializable JavaDoc;
4
5 import javax.servlet.jsp.tagext.Tag JavaDoc;
6 import javax.servlet.jsp.tagext.TagSupport JavaDoc;
7
8
9 public class GoogleMapImageOverlayTag extends TagSupport JavaDoc implements Serializable JavaDoc {
10
11     String JavaDoc url = null;
12     String JavaDoc link = null;
13     int x = 0;
14     int y = 0;
15     float opacity = 0.50f;
16     String JavaDoc id = null;
17     /**
18      * Overrides doStartTag() from TagSupport. Developers should not override this
19      * method.
20      */

21     public int doStartTag() {
22         Tag JavaDoc tag = this;
23         while (tag.getParent() != null) {
24             if (tag.getParent() instanceof GoogleMapTag) {
25                 ((GoogleMapTag) tag.getParent()).addImageOverlay(this);
26                 return SKIP_BODY;
27             }
28             tag = tag.getParent();
29         }
30         return SKIP_BODY;
31     }
32     /**
33      * Returns the opacity level (0-1) of the image overlay. 0 is invisible,
34      * 1 is fully opaque. Default is 0.50.
35      *
36      * @return The opacity level as a float.
37      */

38     public float getOpacity() {
39         return opacity;
40     }
41     /**
42      * Sets the opacity level (0-1) of the image overlay. 0 is invisible,
43      * 1 is fully opaque. Default is 0.50.
44      *
45      * @param opacity The opacity level as a float.
46      */

47     public void setOpacity(float opacity) {
48         this.opacity = opacity;
49     }
50     /**
51      * Returns the x pixel location where the upper-left corner of the
52      * image is placed. The location is relative to the map's upper-left hand
53      * corner.
54      *
55      * @return An int that represents horizontal location in pixels.
56      */

57     public int getX() {
58         return x;
59     }
60     /**
61      * Returns the y pixel location where the upper-left corner of the
62      * image is placed. The location is relative to the map's upper-left hand
63      * corner.
64      *
65      * @return An int that represents vertical location in pixels.
66      */

67     public int getY() {
68         return y;
69     }
70     /**
71      * Sets the x pixel location where the upper-left corner of the
72      * image is placed. The location is relative to the map's upper-left hand
73      * corner.
74      *
75      * @param x int that represents horizontal location in pixels.
76      */

77     public void setX(int x) {
78         this.x = x;
79     }
80     /**
81      * Sets the y pixel location where the upper-left corner of the
82      * image is placed. The location is relative to the map's upper-left hand
83      * corner.
84      *
85      * @param y int that represents vertical location in pixels.
86      */

87     public void setY(int y) {
88         this.y = y;
89     }
90     /**
91      * Returns the url of the image to be displayed on the map.
92      *
93      * @return a relative or absolute url to an image file.
94      */

95     public String JavaDoc getUrl() {
96         return url;
97     }
98     /**
99      * Sets the url of the image to be displayed on the map.
100      * This can be a relative or absolute url.
101      *
102      * @param url A valid relative or absolute url to an image file.
103      */

104     public void setUrl(String JavaDoc url) {
105         this.url = url;
106     }
107     /**
108      * Returns the unique id of this image overlay.
109      *
110      * @return A unique id.
111      */

112     public String JavaDoc getId() {
113         return id;
114     }
115     /**
116      * Sets the id for this image overlay. It must be unique within the map.
117      *
118      * @param id The id for this image overlay.
119      */

120     public void setId(String JavaDoc id) {
121         this.id = id;
122     }
123     /**
124      * Returns the url that will be hyperlinked if the overlay is clicked on.
125      *
126      * @return A url that will be triggered if the image is clicked on.
127      */

128     public String JavaDoc getLink() {
129         return link;
130     }
131     /**
132      * Sets s hyperlink url that will be triggered if the overlay is clicked on.
133      *
134      * @param link The url that will be called if the image is clicked on.
135      */

136     public void setLink(String JavaDoc link) {
137         this.link = link;
138     }
139 }
140
Popular Tags