2323import com .flowingcode .vaadin .addons .googlemaps .maptypestyle .ElementType ;
2424import com .flowingcode .vaadin .addons .googlemaps .maptypestyle .FeatureType ;
2525import com .flowingcode .vaadin .addons .googlemaps .maptypestyle .MapStyle ;
26+ import com .flowingcode .vaadin .jsonmigration .JsonMigration ;
2627import com .vaadin .flow .component .ClickEvent ;
2728import com .vaadin .flow .component .ClientCallable ;
2829import com .vaadin .flow .component .Component ;
@@ -518,7 +519,7 @@ public Registration addClickListener(ComponentEventListener<GoogleMapClickEvent>
518519 DomListenerRegistration registration =
519520 getElement ()
520521 .addEventListener ("google-map-click" , ev -> {
521- JsonObject latLng = ev .getEventData ().get ("event.detail.latLng" );
522+ JsonObject latLng = JsonMigration .getEventData (ev ).get ("event.detail.latLng" );
522523 listener .onComponentEvent (new GoogleMapClickEvent (this , true , latLng ));
523524 }).addEventData ("event.detail.latLng" );
524525 return registration ::remove ;
@@ -530,7 +531,7 @@ public Registration addRightClickListener(ComponentEventListener<GoogleMapClickE
530531 DomListenerRegistration registration =
531532 getElement ()
532533 .addEventListener ("google-map-rightclick" , ev -> {
533- JsonObject latLng = ev .getEventData ().get ("event.detail.latLng" );
534+ JsonObject latLng = JsonMigration .getEventData (ev ).get ("event.detail.latLng" );
534535 listener .onComponentEvent (new GoogleMapClickEvent (this , true , latLng ));
535536 }).addEventData ("event.detail.latLng" );
536537 return registration ::remove ;
@@ -767,7 +768,7 @@ public Registration addGoogleMapBoundsChangedListener(
767768 DomListenerRegistration registration =
768769 getElement ().addEventListener ("google-map-bounds_changed" , ev -> {
769770 listener .onComponentEvent (new GoogleMapBoundsChangedEvent (this , true ,
770- new LatLonBounds (ev .getEventData ().get ("event.detail" ))));
771+ new LatLonBounds (JsonMigration .getEventData (ev ).get ("event.detail" ))));
771772 }).debounce (1000 , DebouncePhase .TRAILING ).addEventData ("event.detail" );
772773 return registration ::remove ;
773774 }
@@ -803,7 +804,7 @@ public void addCustomControls(CustomControl... customControls) {
803804 customControl .getControlButton ().getElement ().setAttribute ("slot" , "customControlSlot_" + i );
804805 getElement ().appendChild (customControl .getControlButton ().getElement ());
805806 }
806- getElement () .setPropertyJson ("customControls" , jsonArray );
807+ JsonMigration .setPropertyJson (getElement (), "customControls" , jsonArray );
807808 }
808809
809810 /**
@@ -822,7 +823,7 @@ public void setCustomControls(CustomControl... customControls) {
822823 getElement ().appendChild (customControl .getControlButton ().getElement ());
823824 this .customControls .add (customControl );
824825 }
825- getElement () .setPropertyJson ("customControls" , jsonArray );
826+ JsonMigration .setPropertyJson (getElement (), "customControls" , jsonArray );
826827 });
827828 }
828829
@@ -924,6 +925,6 @@ public void setMapStyle(MapStyle... mapStyles) {
924925 MapStyle mapStyle = mapStyles [i ];
925926 jsonArray .set (i , mapStyle .getJson ());
926927 }
927- getElement () .setPropertyJson ("styles" , jsonArray );
928+ JsonMigration .setPropertyJson (getElement (), "styles" , jsonArray );
928929 }
929930}
0 commit comments