Class WLeafletMap.AbstractMapItem
- java.lang.Object
-
- eu.webtoolkit.jwt.WObject
-
- eu.webtoolkit.jwt.WLeafletMap.AbstractMapItem
-
- Direct Known Subclasses:
WLeafletMap.AbstractOverlayItem,WLeafletMap.Marker
- Enclosing class:
- WLeafletMap
public abstract static class WLeafletMap.AbstractMapItem extends WObject
An abstract map item.This is the base class for all items that can be added to a
WLeafletMap. As this is an abstract class, it should not be added directly to a map as is. Instead, you should use one of the subclasses.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractMapItem(WLeafletMap.Coordinate pos)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Signalclicked()Signalemitted when the user clicks on the map item.protected abstract voidcreateItemJS(java.lang.StringBuilder ss, java.lang.StringBuilder postJS, long id)Writes the JS code to create this item to the stream.SignaldoubleClicked()Signalemitted when the user double-clicks on the map item.protected WLeafletMapgetMap()Returns the map this item belongs to.WLeafletMap.CoordinategetPosition()Get the current position.SignalmouseWentDown()Signalemitted when the user holds the mouse click on the map item.SignalmouseWentOut()Signalemitted when the user's mouse leaves the map item.SignalmouseWentOver()Signalemitted when the user's mouse enters the map item.SignalmouseWentUp()Signalemitted when the user releases the mouse click on the map item.voidmove(WLeafletMap.Coordinate pos)Move the map item.protected booleanneedsUpdate()Return whether this item needs to be updated.protected voidsetMap(WLeafletMap map)Set the map this item belongs to.protected voidunrender()Unrender the item.protected voidupdate(java.lang.StringBuilder js)Writes the JS to update this item to the stream.-
Methods inherited from class eu.webtoolkit.jwt.WObject
getId, getObjectName, remove, setFormData, setObjectName, tr
-
-
-
-
Constructor Detail
-
AbstractMapItem
protected AbstractMapItem(WLeafletMap.Coordinate pos)
Constructor.Since this is an abstract class, it should not be used directly.
-
-
Method Detail
-
move
public void move(WLeafletMap.Coordinate pos)
Move the map item.If this map item belongs to a map, this will trigger an update of the
WLeafletMapto move the map item. If it doesn't belong to a map, the position is merely updated.
-
getPosition
public WLeafletMap.Coordinate getPosition()
Get the current position.- See Also:
move(WLeafletMap.Coordinate pos)
-
clicked
public Signal clicked()
Signalemitted when the user clicks on the map item.Note: For
WLeafletMap.AbstractOverlayItem, this signal is only triggered if their interactive option is set to true (by default, it is set to false).
-
doubleClicked
public Signal doubleClicked()
Signalemitted when the user double-clicks on the map item.Note: Double-clicking on a marker may trigger the doubleClickZoom from leaflet as well, which does zoom on the map, centered on where the click occurred.
Note: For
WLeafletMap.AbstractOverlayItem, this signal is only triggered if their interactive option is set to true (by default, it is set to false).
-
mouseWentDown
public Signal mouseWentDown()
Signalemitted when the user holds the mouse click on the map item.Note: For
WLeafletMap.AbstractOverlayItem, this signal is only triggered if their interactive option is set to true (by default, it is set to false).
-
mouseWentUp
public Signal mouseWentUp()
Signalemitted when the user releases the mouse click on the map item.Note: For
WLeafletMap.AbstractOverlayItem, this signal is only triggered if their interactive option is set to true (by default, it is set to false).
-
mouseWentOver
public Signal mouseWentOver()
Signalemitted when the user's mouse enters the map item.Note: For
WLeafletMap.AbstractOverlayItem, this signal is only triggered if their interactive option is set to true (by default, it is set to false).
-
mouseWentOut
public Signal mouseWentOut()
Signalemitted when the user's mouse leaves the map item.Note: For
WLeafletMap.AbstractOverlayItem, this signal is only triggered if their interactive option is set to true (by default, it is set to false).
-
createItemJS
protected abstract void createItemJS(java.lang.StringBuilder ss, java.lang.StringBuilder postJS, long id)Writes the JS code to create this item to the stream.This method should write in
ssthe JS code that creates the item. ThepostJSstream can be used to write JS code that should be executed after the item has been created.
-
unrender
protected void unrender()
Unrender the item.This is called when the map needs to be recreated. You can override this function in case you need to do some cleanup before the map is recreated.
By default, this does nothing.
-
needsUpdate
protected boolean needsUpdate()
Return whether this item needs to be updated.This is called when the map is rendered. If this returns true,
update()will be used to update the item.
-
getMap
protected WLeafletMap getMap()
Returns the map this item belongs to.
-
update
protected void update(java.lang.StringBuilder js)
Writes the JS to update this item to the stream.This is called when the map is rendered if
needsUpdate()returns true.
-
setMap
protected void setMap(WLeafletMap map)
Set the map this item belongs to.This is called to set the map the item belongs to. You can override this function if you need to do something when the item is added to a map.
You should not call this function directly.
- See Also:
getMap()
-
-