Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ types.d.ts
vite.generated.ts
vite.config.ts
/frontend/generated
/frontend/index.html
/frontend/index.html
/src/main/dev-bundle
/src/main/bundles
/src/main/frontend/generated
/src/main/frontend/index.html
8 changes: 7 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.flowingcode.vaadin.addons</groupId>
<artifactId>google-maps</artifactId>
<version>2.3.1-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
<name>Google Maps Addon</name>
<description>Integration of google-map for Vaadin platform</description>

Expand Down Expand Up @@ -132,6 +132,12 @@
</exclusions>
</dependency>

<dependency>
<groupId>com.flowingcode.vaadin</groupId>
<artifactId>json-migration-helper</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -518,7 +519,7 @@ public Registration addClickListener(ComponentEventListener<GoogleMapClickEvent>
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;
Expand All @@ -530,7 +531,7 @@ public Registration addRightClickListener(ComponentEventListener<GoogleMapClickE
DomListenerRegistration registration =
getElement()
.addEventListener("google-map-rightclick", 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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}

/**
Expand All @@ -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);
});
}

Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}

/**
Expand All @@ -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());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

/**
Expand All @@ -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);
}

}