wicket.contrib.gmap
Class GMap2

java.lang.Object
  extended by org.apache.wicket.Component
      extended by org.apache.wicket.MarkupContainer
          extended by org.apache.wicket.markup.html.WebMarkupContainer
              extended by org.apache.wicket.markup.html.panel.Panel
                  extended by wicket.contrib.gmap.GMap2
All Implemented Interfaces:
Serializable, Iterable<Component>, IEventSink, IEventSource, IClusterable, IConverterLocator, IHeaderContributor, IRequestableComponent, IHierarchical<Component>, GOverlayContainer

public class GMap2
extends Panel
implements GOverlayContainer

Wicket component to embed Google Maps into your pages.

The Google Maps API requires an API key to use it. You will need to generate one for each deployment context you have. See the Google Maps API sign up page for more information.

See Also:
Serialized Form

Nested Class Summary
 class GMap2.OverlayListener
           
 class GMap2.PanDirectionBehavior
           
 class GMap2.SetCenterBehavior
           
 class GMap2.SetMapTypeBehavior
           
 class GMap2.SetZoomBehavior
           
 class GMap2.ZoomInBehavior
           
 class GMap2.ZoomOutBehavior
           
 
Field Summary
 
Fields inherited from class org.apache.wicket.markup.html.panel.Panel
PANEL
 
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER
 
Constructor Summary
GMap2(String id, GMapHeaderContributor headerContrib)
          Construct.
GMap2(String id, GMapHeaderContributor headerContrib, List<GOverlay> overlays)
          Deprecated. The usage is discouraged. Use this(String, String) instead and add the overlays later on.
GMap2(String id, String gMapKey)
          Construct.
GMap2(String id, String gMapKey, List<GOverlay> overlays)
          Deprecated. The usage is discouraged. Use this(String, String) instead and add the overlays later on.
 
Method Summary
 GMap2 addControl(GControl control)
          Add a control.
 GMap2 addOverlay(GOverlay overlay)
          Add an overlay.
 void enableGoogleBar(boolean enabled)
           
 void fitMarkers(List<GLatLng> markersToShow)
           
 void fitMarkers(List<GLatLng> markersToShow, boolean showMarkersForPoints)
           
 void fitMarkers(List<GLatLng> markersToShow, boolean showMarkersForPoints, double zoomAdjustment)
           Makes the map zoom out and centre around all the GLatLng points in markersToShow.
 GLatLngBounds getBounds()
           
 GLatLng getCenter()
           
 Set<GControl> getControls()
           
 GInfoWindow getInfoWindow()
           
 String getJSinvoke(String invocation)
          Convenience method for generating a JavaScript call on this GMap2 with the given invocation.
 GMapType getMapType()
           
 List<GOverlay> getOverlays()
           
 int getZoom()
           
 boolean isDoubleClickZoomEnabled()
           
 boolean isDraggingEnabled()
           
 boolean isScrollWheelZoomEnabled()
           
protected  void onBeforeRender()
           
 void panTo(GLatLng center)
          Changes the center point of the map to the given point.
 GMap2 removeAllOverlays()
          Clear all overlays.
 GMap2 removeControl(GControl control)
          Remove a control.
 GMap2 removeOverlay(GOverlay overlay)
          Remove an overlay.
 void renderHead(IHeaderResponse response)
           
 void setCenter(GLatLng center)
          Set the center.
 void setDoubleClickZoomEnabled(boolean enabled)
           
 void setDraggingEnabled(boolean enabled)
           
 void setMapType(GMapType mapType)
           
 void setOverlays(List<GOverlay> overlays)
           
 void setScrollWheelZoomEnabled(boolean enabled)
           
 void setZoom(int level)
           
 void update(AjaxRequestTarget target)
          Update state from a request to an AJAX target.
 
Methods inherited from class org.apache.wicket.markup.html.panel.Panel
newMarkupSourcingStrategy
 
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebPage, getWebRequest
 
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, hasAssociatedMarkup, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onComponentTagBody, onMarkupAttached, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren
 
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, canCallListenerInterface, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, configure, continueToOriginalDestination, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessage, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, internalPrepareForRender, internalRenderComponent, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, locateMarkupStream, markRendering, modelChanged, modelChanging, onAfterRender, onComponentTag, onConfigure, onDetach, onEvent, onInitialize, onModelChanged, onModelChanging, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GMap2

public GMap2(String id,
             String gMapKey)
Construct.

Parameters:
id -
gMapKey - Google gmap API KEY

GMap2

@Deprecated
public GMap2(String id,
                        String gMapKey,
                        List<GOverlay> overlays)
Deprecated. The usage is discouraged. Use this(String, String) instead and add the overlays later on.

Construct.

Parameters:
id -
gMapKey - Google gmap API KEY
overlays -

GMap2

public GMap2(String id,
             GMapHeaderContributor headerContrib)
Construct.

Parameters:
id -
headerContrib -

GMap2

@Deprecated
public GMap2(String id,
                        GMapHeaderContributor headerContrib,
                        List<GOverlay> overlays)
Deprecated. The usage is discouraged. Use this(String, String) instead and add the overlays later on.

Construct.

Parameters:
id -
headerContrib -
overlays -
Method Detail

renderHead

public void renderHead(IHeaderResponse response)
Specified by:
renderHead in interface IHeaderContributor
Overrides:
renderHead in class Component
See Also:
Component.renderHead(org.apache.wicket.markup.html.IHeaderResponse)

onBeforeRender

protected void onBeforeRender()
Overrides:
onBeforeRender in class Component
See Also:
Component.onBeforeRender()

addControl

public GMap2 addControl(GControl control)
Add a control.

Parameters:
control - control to add
Returns:
This

removeControl

public GMap2 removeControl(GControl control)
Remove a control.

Parameters:
control - control to remove
Returns:
This

addOverlay

public GMap2 addOverlay(GOverlay overlay)
Add an overlay.

Specified by:
addOverlay in interface GOverlayContainer
Parameters:
overlay - overlay to add
Returns:
This

removeOverlay

public GMap2 removeOverlay(GOverlay overlay)
Remove an overlay.

Specified by:
removeOverlay in interface GOverlayContainer
Parameters:
overlay - overlay to remove
Returns:
This

removeAllOverlays

public GMap2 removeAllOverlays()
Clear all overlays.

Specified by:
removeAllOverlays in interface GOverlayContainer
Returns:
This

getOverlays

public List<GOverlay> getOverlays()
Specified by:
getOverlays in interface GOverlayContainer

getControls

public Set<GControl> getControls()

getCenter

public GLatLng getCenter()

getBounds

public GLatLngBounds getBounds()

enableGoogleBar

public void enableGoogleBar(boolean enabled)

setDraggingEnabled

public void setDraggingEnabled(boolean enabled)

isDraggingEnabled

public boolean isDraggingEnabled()

setDoubleClickZoomEnabled

public void setDoubleClickZoomEnabled(boolean enabled)

isDoubleClickZoomEnabled

public boolean isDoubleClickZoomEnabled()

setScrollWheelZoomEnabled

public void setScrollWheelZoomEnabled(boolean enabled)

isScrollWheelZoomEnabled

public boolean isScrollWheelZoomEnabled()

getMapType

public GMapType getMapType()

setMapType

public void setMapType(GMapType mapType)

getZoom

public int getZoom()

setZoom

public void setZoom(int level)

setCenter

public void setCenter(GLatLng center)
Set the center.

Parameters:
center - center to set

panTo

public void panTo(GLatLng center)
Changes the center point of the map to the given point. If the point is already visible in the current map view, change the center in a smooth animation.

Parameters:
center - the new center of the map

getInfoWindow

public GInfoWindow getInfoWindow()

getJSinvoke

public String getJSinvoke(String invocation)
Convenience method for generating a JavaScript call on this GMap2 with the given invocation.

Parameters:
invocation - The JavaScript call to invoke on this GMap2.
Returns:
The generated JavaScript.

fitMarkers

public void fitMarkers(List<GLatLng> markersToShow)
See Also:
fitMarkers(List, boolean, double)

fitMarkers

public void fitMarkers(List<GLatLng> markersToShow,
                       boolean showMarkersForPoints)
See Also:
fitMarkers(List, boolean, double)

fitMarkers

public void fitMarkers(List<GLatLng> markersToShow,
                       boolean showMarkersForPoints,
                       double zoomAdjustment)

Makes the map zoom out and centre around all the GLatLng points in markersToShow.

Big ups to Doug Leeper for the code.

Parameters:
markersToShow - the points to centre around.
showMarkersForPoints - if true, will also add basic markers to the map for each point focused on. Just a simple convenience method - you will probably want to turn this off so that you can show more information with each marker when clicked etc.
See Also:
Doug's Nabble post

update

public void update(AjaxRequestTarget target)
Update state from a request to an AJAX target.


setOverlays

public void setOverlays(List<GOverlay> overlays)


Copyright © 2012. All Rights Reserved.