Class WLeafletMap.AbstractMapItem
- Direct Known Subclasses:
WLeafletMap.AbstractOverlayItem,WLeafletMap.Marker
- Enclosing class:
- WLeafletMap
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 -
Method Summary
Modifier and TypeMethodDescriptionclicked()Signalemitted when the user clicks on the map item.protected abstract voidcreateItemJS(StringBuilder ss, StringBuilder postJS, long id) Writes the JS code to create this item to the stream.Signalemitted when the user double-clicks on the map item.protected WLeafletMapgetMap()Returns the map this item belongs to.Get the current position.Signalemitted when the user holds the mouse click on the map item.Signalemitted when the user's mouse leaves the map item.Signalemitted when the user's mouse enters the map item.Signalemitted when the user releases the mouse click on the map item.voidMove the map item.protected booleanReturn 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(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 Details
-
AbstractMapItem
Constructor.Since this is an abstract class, it should not be used directly.
-
-
Method Details
-
move
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
Get the current position.- See Also:
-
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
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
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
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
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
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
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
Returns the map this item belongs to. -
update
Writes the JS to update this item to the stream.This is called when the map is rendered if
needsUpdate()returns true. -
setMap
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:
-