KickJava   Java API By Example, From Geeks To Geeks.

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


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 /**
7  * GoogleMapClusterTag
8  *
9  * This tag represents a <googlemaps:cluster> tag and allows developers to groups
10  * icons together into clusters, that expand as the user zooms in on them. Developers should
11  * not extend this class or override it's methods.
12  */

13 public class GoogleMapClusterTag extends BodyTagSupport JavaDoc {
14     
15     GoogleMapIconTag icon = null;
16     int maxVisibleMarkers = 100;
17     int gridSize = 5;
18     int markersPerCluster = 5;
19     String JavaDoc pathToScript = null;
20     /**
21      * Overrides doStartTag() from TagSupport. Developers should not override this method.
22      */

23     public int doStartTag() {
24         Tag JavaDoc tag = this;
25         while (tag.getParent() != null) {
26             if (tag.getParent() instanceof GoogleMapTag) {
27                 ((GoogleMapTag) tag.getParent()).setClusterer(this);
28                 return EVAL_BODY_INCLUDE;
29             }
30             tag = tag.getParent();
31         }
32         return EVAL_BODY_INCLUDE;
33     }
34     public int getGridSize() {
35         return gridSize;
36     }
37     public void setGridSize(int gridSize) {
38         this.gridSize = gridSize;
39     }
40     /**
41      * Gets the GoogleMapIconTag that will render the icons for clustered markers.
42      *
43      * @return A GoogleMapIconTag or null if not defined.
44      */

45     public GoogleMapIconTag getIcon() {
46         return icon;
47     }
48     /**
49      * Sets the GoogleMapIconTag that will render the icons for clustered markers.
50      *
51      * @param icon A GoogleMapIconTag.
52      */

53     public void setIcon(GoogleMapIconTag icon) {
54         this.icon = icon;
55     }
56     /**
57      * Returns the minimum number of markers that can be joined to create a cluster.
58      *
59      * @return Minimum markers per cluster.
60      */

61     public int getMarkersPerCluster() {
62         return markersPerCluster;
63     }
64     /**
65      * Sets the minimum number of markers that can be joined to create a cluster.
66      *
67      * @param markersPerCluster Minimum markers per cluster.
68      */

69     public void setMarkersPerCluster(int markersPerCluster) {
70         this.markersPerCluster = markersPerCluster;
71     }
72     /**
73      * Returns the maximum number of visible markers (both clustered and non-clustered) that
74      * should appear on the map.
75      *
76      * @return The maximum number of displayed markers.
77      */

78     public int getMaxVisibleMarkers() {
79         return maxVisibleMarkers;
80     }
81     /**
82      * Sets the maximum number of visible markers (both clustered and non-clustered) that
83      * should appear on the map.
84      *
85      * @param maxVisibleMarkers The maximum number of displayed markers.
86      */

87     public void setMaxVisibleMarkers(int maxVisibleMarkers) {
88         this.maxVisibleMarkers = maxVisibleMarkers;
89     }
90     /**
91      * Returns the path (URL) to the Clusterer.js file.
92      *
93      * @return URL to javascript file.
94      */

95     public String JavaDoc getPathToScript() {
96         return pathToScript;
97     }
98     /**
99      * Sets the URL path to the Clusterer.js file. This must be a complete
100      * relative or absolute URL, including filename.
101      *
102      * @param pathToScript A valid URL that points to the Clusterer.js file.
103      */

104     public void setPathToScript(String JavaDoc pathToScript) {
105         this.pathToScript = pathToScript;
106     }
107 }
108
Popular Tags