Package io.jmix.mapsui.component
Class ContextMenuInvocationContext
java.lang.Object
io.jmix.mapsui.component.ContextMenuInvocationContext
Class that holds details of the
GeoMap
's context menu invocation,
which can be used to customize context menu before it is shown on the client-side.
Context menu can be configured in two levels:
- GeoMap - a general context menu that applies to any place on the map.
- Vector layer or Canvas Layer - a context menu that applies to geometries on the layer. Each layer can process context menu in its own way. Menu items added on the previous level are also included.
In order to customize context menu, define a contextMenuDelegate
function for the
GeoMap
, VectorLayer
or CanvasLayer
.
This can be done with handler mechanism in a screen controller, for example:
@Install(to = "map", subject = "contextMenuDelegate") private ContextMenu mapContextMenuDelegate(final ContextMenuInvocationContext context) { ContextMenu contextMenu = context.getContextMenu(); contextMenu.addItem("Center map here", selectedItem -> map.setCenter( context.getPoint().getX(), context.getPoint().getY())); return contextMenu; }
-
Method Summary
Modifier and TypeMethodDescriptionstatic ContextMenuInvocationContext
create
(ContextMenu contextMenu) int
int
<T extends Layer>
TgetLayer()
org.locationtech.jts.geom.Point
getPoint()
void
setCanvasGeometry
(CanvasLayer.Geometry canvasGeometry) void
setClientX
(int clientX) void
setClientY
(int clientY) void
void
void
setPoint
(org.locationtech.jts.geom.Point point)
-
Method Details
-
getContextMenu
-
getPoint
public org.locationtech.jts.geom.Point getPoint() -
setPoint
public void setPoint(org.locationtech.jts.geom.Point point) -
getEntity
-
setEntity
-
getLayer
-
setLayer
-
getCanvasGeometry
-
setCanvasGeometry
-
getClientX
public int getClientX() -
setClientX
public void setClientX(int clientX) -
getClientY
public int getClientY() -
setClientY
public void setClientY(int clientY)