diff --git a/.gitignore b/.gitignore index c681164..8af38de 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,8 @@ types.d.ts vite.generated.ts vite.config.ts /frontend/generated -/frontend/index.html \ No newline at end of file +/frontend/index.html +/src/main/dev-bundle +/src/main/bundles +/src/main/frontend/generated +/src/main/frontend/index.html \ No newline at end of file diff --git a/pom.xml b/pom.xml index c4f2ca7..f68d40a 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.flowingcode.vaadin.addons google-maps - 2.3.1-SNAPSHOT + 2.4.0-SNAPSHOT Google Maps Addon Integration of google-map for Vaadin platform @@ -132,6 +132,12 @@ + + com.flowingcode.vaadin + json-migration-helper + 0.0.1-SNAPSHOT + + org.slf4j slf4j-simple diff --git a/src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMap.java b/src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMap.java index 613f49f..eaa11a2 100644 --- a/src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMap.java +++ b/src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMap.java @@ -23,6 +23,7 @@ import com.flowingcode.vaadin.addons.googlemaps.maptypestyle.ElementType; import com.flowingcode.vaadin.addons.googlemaps.maptypestyle.FeatureType; import com.flowingcode.vaadin.addons.googlemaps.maptypestyle.MapStyle; +import com.flowingcode.vaadin.jsonmigration.JsonMigration; import com.vaadin.flow.component.ClickEvent; import com.vaadin.flow.component.ClientCallable; import com.vaadin.flow.component.Component; @@ -518,7 +519,7 @@ public Registration addClickListener(ComponentEventListener DomListenerRegistration registration = getElement() .addEventListener("google-map-click", ev -> { - JsonObject latLng = ev.getEventData().get("event.detail.latLng"); + JsonObject latLng = JsonMigration.getEventData(ev).get("event.detail.latLng"); listener.onComponentEvent(new GoogleMapClickEvent(this, true, latLng)); }).addEventData("event.detail.latLng"); return registration::remove; @@ -530,7 +531,7 @@ public Registration addRightClickListener(ComponentEventListener { - JsonObject latLng = ev.getEventData().get("event.detail.latLng"); + JsonObject latLng = JsonMigration.getEventData(ev).get("event.detail.latLng"); listener.onComponentEvent(new GoogleMapClickEvent(this, true, latLng)); }).addEventData("event.detail.latLng"); return registration::remove; @@ -767,7 +768,7 @@ public Registration addGoogleMapBoundsChangedListener( DomListenerRegistration registration = getElement().addEventListener("google-map-bounds_changed", ev -> { listener.onComponentEvent(new GoogleMapBoundsChangedEvent(this, true, - new LatLonBounds(ev.getEventData().get("event.detail")))); + new LatLonBounds(JsonMigration.getEventData(ev).get("event.detail")))); }).debounce(1000, DebouncePhase.TRAILING).addEventData("event.detail"); return registration::remove; } @@ -803,7 +804,7 @@ public void addCustomControls(CustomControl... customControls) { customControl.getControlButton().getElement().setAttribute("slot", "customControlSlot_" + i); getElement().appendChild(customControl.getControlButton().getElement()); } - getElement().setPropertyJson("customControls", jsonArray); + JsonMigration.setPropertyJson(getElement(), "customControls", jsonArray); } /** @@ -822,7 +823,7 @@ public void setCustomControls(CustomControl... customControls) { getElement().appendChild(customControl.getControlButton().getElement()); this.customControls.add(customControl); } - getElement().setPropertyJson("customControls", jsonArray); + JsonMigration.setPropertyJson(getElement(), "customControls", jsonArray); }); } @@ -924,6 +925,6 @@ public void setMapStyle(MapStyle... mapStyles) { MapStyle mapStyle = mapStyles[i]; jsonArray.set(i, mapStyle.getJson()); } - getElement().setPropertyJson("styles", jsonArray); + JsonMigration.setPropertyJson(getElement(), "styles", jsonArray); } } diff --git a/src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMapMarker.java b/src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMapMarker.java index 6f5d4bf..e3f6893 100644 --- a/src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMapMarker.java +++ b/src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMapMarker.java @@ -21,6 +21,7 @@ package com.flowingcode.vaadin.addons.googlemaps; +import com.flowingcode.vaadin.jsonmigration.JsonMigration; import com.vaadin.flow.component.ClickEvent; import com.vaadin.flow.component.Component; import com.vaadin.flow.component.ComponentEvent; @@ -193,7 +194,7 @@ public void setIconUrl(String iconUrl) { * @param icon the icon image of the marker */ public void setIcon(GoogleMapIcon icon) { - this.getElement().setPropertyJson("icon", icon.getJson()); + JsonMigration.setPropertyJson(getElement(), "icon", icon.getJson()); } /** @@ -203,7 +204,7 @@ public void setIcon(GoogleMapIcon icon) { * @param label the new marker's label */ public void setLabel(MarkerLabel label) { - this.getElement().setPropertyJson("label", label.getJson()); + JsonMigration.setPropertyJson(getElement(), "label", label.getJson()); } /** diff --git a/src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMapPoly.java b/src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMapPoly.java index 4219240..6b60d07 100644 --- a/src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMapPoly.java +++ b/src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMapPoly.java @@ -20,6 +20,7 @@ package com.flowingcode.vaadin.addons.googlemaps; +import com.flowingcode.vaadin.jsonmigration.JsonMigration; import com.vaadin.flow.component.ClickEvent; import com.vaadin.flow.component.Component; import com.vaadin.flow.component.ComponentEventListener; @@ -191,7 +192,7 @@ public void setIcons(Icon... icons) { for (int i = 0; i < icons.length; i++) { jsonArray.set(i, icons[i].getJson()); } - getElement().setPropertyJson("icons", jsonArray); + JsonMigration.setPropertyJson(getElement(), "icons", jsonArray); } /** @@ -204,7 +205,7 @@ public void setIcons(IconSequence... icons) { for (int i = 0; i < icons.length; i++) { jsonArray.set(i, icons[i].getJson()); } - getElement().setPropertyJson("icons", jsonArray); + JsonMigration.setPropertyJson(getElement(), "icons", jsonArray); } }