com.maryanovsky.map.client
Class WidgetOverlay

java.lang.Object
  extended by com.maryanovsky.map.client.WidgetOverlay
All Implemented Interfaces:
Overlay

public class WidgetOverlay
extends Object
implements Overlay

An overlay which positions a single widget at a specified location on the map.

Author:
Maryanovsky Alexander

Field Summary
static String ANCHOR_PROPERTY_NAME
          The name of the anchor property.
static String OFFSET_PROPERTY_NAME
          The name of the offset property.
 
Constructor Summary
WidgetOverlay(Widget widget, LatLng anchor, PointView offset)
          Creates a new WidgetOverlay which places the specified widget at the specified offset from the specified anchor point.
WidgetOverlay(Widget widget, LatLng anchor, PointView offset, SizeView widgetSize)
          Creates a new WidgetOverlay which places the specified widget at the specified offset from the specified anchor point.
 
Method Summary
 void added(MapWidget mapWidget)
          Adds the widget to the map's overlay panel.
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Registers the specified property change listener to be notified when the specified property of this overlay changes.
 Alignment getAlignment()
          Returns the alignment of the widget relative to the location specified by the anchor and offset.
 LatLng getAnchor()
          Returns the anchor point at which the widget is added.
 PointView getOffset()
          Returns the current offset of the widget from the anchor point.
 Widget getWidget()
          Returns the widget this overlay adds to the map.
 void makeAnchorDraggableByMouse(HasAllMouseHandlers dragHandle, boolean updateContinuously)
          Makes the overlay draggable (via the specified drag handle) using the mouse in such a way that dragging it adjusts its anchor, but not the offset.
 void makeAnchorDraggableByTouch(HasAllTouchHandlers dragHandle, boolean updateContinuously)
          Makes the overlay draggable (via the specified drag handle) by touch in such a way that dragging it adjusts its anchor, but not the offset.
 void makeNonDraggable()
          Makes the overlay non-draggable.
 void makeOffsetDraggableByMouse(HasAllMouseHandlers dragHandle, boolean updateContinuously)
          Makes the overlay draggable (via the specified drag handle) using the mouse in such a way that dragging it adjusts the offset, but not the anchor.
 void makeOffsetDraggableByTouch(HasAllTouchHandlers dragHandle, boolean updateContinuously)
          Makes the overlay draggable (via the specified drag handle) by touch in such a way that dragging it adjusts the offset, but not the anchor.
 void removed(MapWidget mapWidget)
          Removes the widget from the map's overlay panel.
 void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Unregisters the specified property change listener from being notified when the specified property of this overlay changes.
 void setAlignment(Alignment alignment)
          Sets the alignment of the widget relative to the location specified by the anchor and offset.
 void setAnchor(LatLng anchor)
          Sets the anchor point at which the widget is added.
 void setOffset(PointView offset)
          Sets the offset of the widget from the anchor point.
 void updated(MapWidget mapWidget, boolean isTemporary)
          Invoked when the map view changes.
 void updatePosition()
          Updates the widget's position.
 void updateWidgetSize(SizeView widgetSize)
          This method should be called when the widget's size changes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANCHOR_PROPERTY_NAME

public static final String ANCHOR_PROPERTY_NAME
The name of the anchor property.

See Also:
Constant Field Values

OFFSET_PROPERTY_NAME

public static final String OFFSET_PROPERTY_NAME
The name of the offset property.

See Also:
Constant Field Values
Constructor Detail

WidgetOverlay

public WidgetOverlay(Widget widget,
                     LatLng anchor,
                     PointView offset,
                     SizeView widgetSize)
Creates a new WidgetOverlay which places the specified widget at the specified offset from the specified anchor point. You may also pass the size of the widget, which can significantly reduce up the time it takes to add the overlay. If you pass null for the widgetSize parameter, it will be determined automatically, which, if there are many WidgetOverlays, may take a long time. Additionally, if


WidgetOverlay

public WidgetOverlay(Widget widget,
                     LatLng anchor,
                     PointView offset)
Creates a new WidgetOverlay which places the specified widget at the specified offset from the specified anchor point.

Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
Registers the specified property change listener to be notified when the specified property of this overlay changes.


removePropertyChangeListener

public void removePropertyChangeListener(String propertyName,
                                         PropertyChangeListener listener)
Unregisters the specified property change listener from being notified when the specified property of this overlay changes.


getWidget

public Widget getWidget()
Returns the widget this overlay adds to the map.


getAnchor

public LatLng getAnchor()
Returns the anchor point at which the widget is added.


setAnchor

public void setAnchor(LatLng anchor)
Sets the anchor point at which the widget is added.


setOffset

public void setOffset(PointView offset)
Sets the offset of the widget from the anchor point.


getOffset

public PointView getOffset()
Returns the current offset of the widget from the anchor point.


getAlignment

public Alignment getAlignment()
Returns the alignment of the widget relative to the location specified by the anchor and offset.


setAlignment

public void setAlignment(Alignment alignment)
Sets the alignment of the widget relative to the location specified by the anchor and offset.


updateWidgetSize

public void updateWidgetSize(SizeView widgetSize)
This method should be called when the widget's size changes. If you want the widget's size to be (re)calculated automatically, pass a null value.


added

public void added(MapWidget mapWidget)
Adds the widget to the map's overlay panel.

Specified by:
added in interface Overlay

updated

public void updated(MapWidget mapWidget,
                    boolean isTemporary)
Invoked when the map view changes. isTemporary specifies whether the change is temporary (such as during a drag of the map or a pan animation) or permanent.

Specified by:
updated in interface Overlay

updatePosition

public void updatePosition()
Updates the widget's position. Does nothing if it hasn't been added to a map widget yet.


removed

public void removed(MapWidget mapWidget)
Removes the widget from the map's overlay panel.

Specified by:
removed in interface Overlay

makeOffsetDraggableByMouse

public void makeOffsetDraggableByMouse(HasAllMouseHandlers dragHandle,
                                       boolean updateContinuously)
Makes the overlay draggable (via the specified drag handle) using the mouse in such a way that dragging it adjusts the offset, but not the anchor. updateContinuously specifies whether the offset will be updated as the overlay is dragged or only at the end of the drag gesture.


makeAnchorDraggableByMouse

public void makeAnchorDraggableByMouse(HasAllMouseHandlers dragHandle,
                                       boolean updateContinuously)
Makes the overlay draggable (via the specified drag handle) using the mouse in such a way that dragging it adjusts its anchor, but not the offset. updateContinuously specifies whether the anchor will be updated as the overlay is dragged or only at the end of the drag gesture.


makeOffsetDraggableByTouch

public void makeOffsetDraggableByTouch(HasAllTouchHandlers dragHandle,
                                       boolean updateContinuously)
Makes the overlay draggable (via the specified drag handle) by touch in such a way that dragging it adjusts the offset, but not the anchor. updateContinuously specifies whether the offset will be updated as the overlay is dragged or only at the end of the drag gesture.


makeAnchorDraggableByTouch

public void makeAnchorDraggableByTouch(HasAllTouchHandlers dragHandle,
                                       boolean updateContinuously)
Makes the overlay draggable (via the specified drag handle) by touch in such a way that dragging it adjusts its anchor, but not the offset. updateContinuously specifies whether the anchor will be updated as the overlay is dragged or only at the end of the drag gesture.


makeNonDraggable

public void makeNonDraggable()
Makes the overlay non-draggable.