com.maryanovsky.map.client.widgets.overview
Class OverviewMapWidget

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Composite
              extended by com.maryanovsky.map.client.MapWidget
                  extended by com.maryanovsky.map.client.widgets.overview.OverviewMapWidget
All Implemented Interfaces:
HasAttachHandlers, HasHandlers, EventListener, HasVisibility, IsRenderable, IsWidget

public class OverviewMapWidget
extends MapWidget

A MapWidget which displays an overview map for a certain other MapWidget. The style name of this widget is map-OverviewMapWidget. The rectangle that displays the bounds of the main map consists of 3 elements placed into each other - outer, middle and inner one. Their style names are map-OverviewMapWidgetRectOuter, map-OverviewMapWidgetRectMiddle and map-OverviewMapWidgetRectInner respectively. In order to properly use this widget's default look, you need to import the "widgets/overview/overview.css" file into the page's CSS.

Author:
Maryanovsky Alexander

Nested Class Summary
static class OverviewMapWidget.StandardSynchronization
          The most commonly used implementation of OverviewMapWidget.Synchronization.
static interface OverviewMapWidget.Synchronization
          The interface to implement when you want to decide on a custom relationship between the location of a main map widget and its overview.
 
Nested classes/interfaces inherited from class com.maryanovsky.map.client.MapWidget
MapWidget.MapAnimation
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.maryanovsky.map.client.MapWidget
MAGNIFICATION_PROPERTY_NAME, MAP_PROPERTY_NAME, SIZE_PROPERTY_NAME, TEMPORARY_OFFSET_PROPERTY_NAME
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
OverviewMapWidget(MapWidget mainMapWidget, OverviewMapWidget.Synchronization synchronization)
          Creates a new OverviewMapWidget for the specified main map widget and OverviewMapWidget.Synchronization between them.
 
Method Summary
protected  Widget createBoundsWidget()
          Creates the widget to display the display bounds of the main map widget on the overview widget.
protected  Widget getBoundsWidget()
          Returns the widget displaying the bounds of the main map on this overview map; null if none.
 MapWidget getMainMapWidget()
          Returns the main map widget whose overview this widget displays.
protected  LatLng getPinnedBoundsWidgetLocation()
          Returns the location of the bounds widget when it is pinned; null otherwise.
protected  boolean isBoundsWidgetDragged()
          Returns whether the bounds widget is currently being dragged.
protected  void replaceBoundsWidget()
          Replaces the current boundsWidget, if any, with a new one, as created by createBoundsWidget().
protected  void setBoundsWidgetDragged(boolean isBoundsWidgetDragged)
          Tells the overview map widget whether its bounds widget it being dragged.
protected  void setPinnedBoundsWidgetLocation(LatLng location)
          Pins the bounds widget to the specified location, or unpins it if the argument is null.
protected  void updateBoundsWidget()
          Updates the current boundsWidget to accurately reflect the bounds of the main map widget display.
 
Methods inherited from class com.maryanovsky.map.client.MapWidget
addOverlay, addOverlays, addPropertyChangeListener, addReadyListener, applyMagnification, applyMagnification, applyTemporaryOffset, endCurrentAnimation, getBounds, getCenter, getMagnification, getMap, getMapLocationModel, getMapSize, getMouseEventsSource, getOverlayPanel, getOverlays, getPanAnimationLength, getTemporaryOffset, getTileCoverSize, getTouchEventsSource, getUserEventWidget, getWidgetPanel, getZoomAnimationLength, isAnimatedZoomSupported, isGrabCursor, isLoadTilesDuringTemporaryChanges, localToMap, mapToLocal, moveTo, onLoad, onUnload, panBy, panTo, removeOverlay, removeOverlays, removePropertyChangeListener, removeReadyListener, resized, setGrabCursor, setLoadTilesDuringTemporaryChanges, setMagnification, setMap, setPanAnimationLength, setTemporaryOffset, setTileCoverSize, setZoomAnimationLength, shouldAnimateTo, show, startAnimation, zoomBy, zoomByFixPoint, zoomByTargetLocation, zoomByTargetPoint, zoomTo, zoomToFixPoint, zoomToTargetLocation, zoomToTargetPoint
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OverviewMapWidget

public OverviewMapWidget(MapWidget mainMapWidget,
                         OverviewMapWidget.Synchronization synchronization)
Creates a new OverviewMapWidget for the specified main map widget and OverviewMapWidget.Synchronization between them.

Parameters:
mainMapWidget - The main map widget with which we are linked.
synchronization - The synchronization between the main and overview map widgets.
Method Detail

getMainMapWidget

public final MapWidget getMainMapWidget()
Returns the main map widget whose overview this widget displays.


setPinnedBoundsWidgetLocation

protected final void setPinnedBoundsWidgetLocation(LatLng location)
Pins the bounds widget to the specified location, or unpins it if the argument is null. This allows forcing it to a location other than the one displayed by the main widget, when such a thing is necessary (usually temporarily, during certain animations).


getPinnedBoundsWidgetLocation

protected final LatLng getPinnedBoundsWidgetLocation()
Returns the location of the bounds widget when it is pinned; null otherwise. It is up to updateBoundsWidget() to check whether the bounds widget is pinned and set its location appropriately.


setBoundsWidgetDragged

protected final void setBoundsWidgetDragged(boolean isBoundsWidgetDragged)
Tells the overview map widget whether its bounds widget it being dragged. During a drag, its location should not be touched by updateBoundsWidget().


isBoundsWidgetDragged

protected boolean isBoundsWidgetDragged()
Returns whether the bounds widget is currently being dragged. During a drag, its location should not be touched by updateBoundsWidget().


getBoundsWidget

protected final Widget getBoundsWidget()
Returns the widget displaying the bounds of the main map on this overview map; null if none.


replaceBoundsWidget

protected void replaceBoundsWidget()
Replaces the current boundsWidget, if any, with a new one, as created by createBoundsWidget().


createBoundsWidget

protected Widget createBoundsWidget()
Creates the widget to display the display bounds of the main map widget on the overview widget. Returns null for none. This method may be invoked (by replaceBoundsWidget() more than once, such as when the projection of one of the map(s) changes.


updateBoundsWidget

protected void updateBoundsWidget()
Updates the current boundsWidget to accurately reflect the bounds of the main map widget display. See also getPinnedBoundsWidgetLocation() and isBoundsWidgetDragged() for special circumstances when the bounds widget may not necessarily reflect the bounds of the main map widget.