From 1eb06d76b1cf69e24642307a0224b5f5908f0918 Mon Sep 17 00:00:00 2001 From: Javier Godoy <11554739+javier-godoy@users.noreply.github.com> Date: Wed, 6 Nov 2024 11:06:20 -0300 Subject: [PATCH] style: apply code formatting --- .../vaadin/addons/googlemaps/GoogleMap.java | 345 +++++++++--------- .../addons/googlemaps/GoogleMapPoly.java | 74 ++-- 2 files changed, 206 insertions(+), 213 deletions(-) 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 b7ab950..b44492a 100644 --- a/src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMap.java +++ b/src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMap.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -43,7 +43,6 @@ import elemental.json.JsonObject; import elemental.json.JsonValue; import java.util.ArrayList; -import java.util.ArrayList; import java.util.List; import java.util.concurrent.CompletableFuture; import org.apache.commons.lang3.StringUtils; @@ -56,9 +55,9 @@ @JsModule("./googlemaps/geolocation.js") public class GoogleMap extends Component implements HasSize { - private Integer trackLocationId = null; + private Integer trackLocationId = null; - private List customControls = new ArrayList(); + private List customControls = new ArrayList<>(); /** Base map types supported by Google Maps. */ public enum MapType { @@ -80,23 +79,23 @@ public enum MapType { * languages. Use null or empty string to disable. */ public GoogleMap(String apiKey, String clientId, String language) { - this.getElement().setAttribute("api-key", apiKey); + getElement().setAttribute("api-key", apiKey); if (!StringUtils.isEmpty(clientId)) { - this.getElement().setAttribute("client-id", clientId); + getElement().setAttribute("client-id", clientId); } if (!StringUtils.isEmpty(language)) { - this.getElement().setAttribute("language", language); + getElement().setAttribute("language", language); } } @Synchronize("google-map-idle") public Double getLatitude() { - return this.getElement().getProperty("latitude", 0d); + return getElement().getProperty("latitude", 0d); } @Synchronize("google-map-idle") public Double getLongitude() { - return this.getElement().getProperty("longitude", 0d); + return getElement().getProperty("longitude", 0d); } /** @@ -105,8 +104,8 @@ public Double getLongitude() { * @param center The new coordinates of the center. */ public void setCenter(LatLon center) { - this.getElement().setProperty("latitude", center.getLat()); - this.getElement().setProperty("longitude", center.getLon()); + getElement().setProperty("latitude", center.getLat()); + getElement().setProperty("longitude", center.getLon()); } /** @@ -127,7 +126,7 @@ public LatLon getCenter() { * @param zoom New amount of the zoom. */ public void setZoom(int zoom) { - this.getElement().setProperty("zoom", zoom); + getElement().setProperty("zoom", zoom); } /** @@ -137,7 +136,7 @@ public void setZoom(int zoom) { */ @Synchronize("google-map-idle") public int getZoom() { - return this.getElement().getProperty("zoom", 0); + return getElement().getProperty("zoom", 0); } /** @@ -147,7 +146,7 @@ public int getZoom() { * @param position Coordinates of the marker on the map. * @param draggable Set true to enable dragging of the marker. * @param iconUrl The url of the icon of the marker. - * + * * @return GoogleMapMarker object created with the given settings. */ public GoogleMapMarker addMarker( @@ -156,7 +155,7 @@ public GoogleMapMarker addMarker( addMarker(gmm); return gmm; } - + /** * Adds a new marker to the map. * @@ -164,7 +163,7 @@ public GoogleMapMarker addMarker( * @param position Coordinates of the marker on the map. * @param draggable Set true to enable dragging of the marker. * @param icon the icon image of the marker. - * + * * @return GoogleMapMarker object created with the given settings. */ public GoogleMapMarker addMarker( @@ -176,45 +175,45 @@ public GoogleMapMarker addMarker( /** * Creates a polygon with the given points and adds the new polygon to the map. - * + * * @param points the points of the polygon - * + * * @return the new created polygon */ public GoogleMapPolygon addPolygon(List points) { GoogleMapPolygon polygon = new GoogleMapPolygon(points); - addPolygon(polygon); + addPolygon(polygon); return polygon; } /** * Adds a new polygon to the map. - * + * * @param polygon the polygon to be added to the map */ public void addPolygon(GoogleMapPolygon polygon) { - this.getElement().appendChild(polygon.getElement()); - if (this.getElement().getParent() != null) { - this.getElement().executeJs("this._updateObjects()"); + getElement().appendChild(polygon.getElement()); + if (getElement().getParent() != null) { + getElement().executeJs("this._updateObjects()"); } } /** * Removes a polygon from the map. - * + * * @param polygon the polygon to be removed from the map */ @SuppressWarnings("squid:S3242") public void removePolygon(GoogleMapPolygon polygon) { - this.getElement().removeChild(polygon.getElement()); - this.getElement().executeJs("this._updateObjects()"); + getElement().removeChild(polygon.getElement()); + getElement().executeJs("this._updateObjects()"); } - + /** * Creates a polyline with the given points and adds the new polyline to the map. - * + * * @param points the points of the polyline - * + * * @return the new created polyline */ public GoogleMapPolyline addPolyline(List points) { @@ -225,25 +224,25 @@ public GoogleMapPolyline addPolyline(List points) { /** * Adds a new polyline to the map. - * + * * @param polyline the polyline to be added to the map */ public void addPolyline(GoogleMapPolyline polyline) { - this.getElement().appendChild(polyline.getElement()); - if (this.getElement().getParent() != null) { - this.getElement().executeJs("this._updateObjects()"); + getElement().appendChild(polyline.getElement()); + if (getElement().getParent() != null) { + getElement().executeJs("this._updateObjects()"); } } /** * Removes a polyline from the map. - * + * * @param polyline the polyline to be removed from the map */ @SuppressWarnings("squid:S3242") public void removePolyline(GoogleMapPolyline polyline) { - this.getElement().removeChild(polyline.getElement()); - this.getElement().executeJs("this._updateObjects()"); + getElement().removeChild(polyline.getElement()); + getElement().executeJs("this._updateObjects()"); } /** @@ -252,17 +251,17 @@ public void removePolyline(GoogleMapPolyline polyline) { * @param marker The marker to add. */ public void addMarker(GoogleMapMarker marker) { - this.getElement().appendChild(marker.getElement()); - if (this.getElement().getParent() != null) { - this.getElement().executeJs("this._updateMarkers()"); + getElement().appendChild(marker.getElement()); + if (getElement().getParent() != null) { + getElement().executeJs("this._updateMarkers()"); } } @SuppressWarnings("squid:S3242") public void removeMarker(GoogleMapMarker marker) { - this.getElement().removeChild(marker.getElement()); + getElement().removeChild(marker.getElement()); // markers need to be updated on removal - this.getElement().executeJs("this._updateMarkers()"); + getElement().executeJs("this._updateMarkers()"); } /** @@ -271,7 +270,7 @@ public void removeMarker(GoogleMapMarker marker) { * @param type The new MapType to use. */ public void setMapType(MapType type) { - this.getElement().setProperty("mapType", type.name().toLowerCase()); + getElement().setProperty("mapType", type.name().toLowerCase()); } /** @@ -280,7 +279,7 @@ public void setMapType(MapType type) { * @return The current MapType. */ public MapType getMapType() { - return MapType.valueOf(this.getElement().getProperty("mapType").toUpperCase()); + return MapType.valueOf(getElement().getProperty("mapType").toUpperCase()); } /** @@ -289,7 +288,7 @@ public MapType getMapType() { * @return true, if the map draggable. */ public boolean isDraggable() { - return this.getElement().getProperty("draggable", true); + return getElement().getProperty("draggable", true); } /** @@ -298,7 +297,7 @@ public boolean isDraggable() { * @param draggable Set to true to enable dragging. */ public void setDraggable(boolean draggable) { - this.getElement().setProperty("draggable", draggable); + getElement().setProperty("draggable", draggable); } /** @@ -307,7 +306,7 @@ public void setDraggable(boolean draggable) { * @param maxZoom The maximum amount for zoom. */ public void setMaxZoom(int maxZoom) { - this.getElement().setProperty("maxZoom", maxZoom); + getElement().setProperty("maxZoom", maxZoom); } /** @@ -316,7 +315,7 @@ public void setMaxZoom(int maxZoom) { * @return maximum amount of zoom */ public int getMaxZoom() { - return this.getElement().getProperty("maxZoom", 1); + return getElement().getProperty("maxZoom", 1); } /** @@ -325,7 +324,7 @@ public int getMaxZoom() { * @param minZoom The minimum amount for zoom. */ public void setMinZoom(int minZoom) { - this.getElement().setProperty("minZoom", minZoom); + getElement().setProperty("minZoom", minZoom); } /** @@ -334,71 +333,71 @@ public void setMinZoom(int minZoom) { * @return minimum amount of zoom */ public int getMinZoom() { - return this.getElement().getProperty("minZoom", 1); + return getElement().getProperty("minZoom", 1); } /** * Allows to disable/enable rotate control. - * + * * @param disable Set true to disable rotate control */ public void disableRotateControl(boolean disable) { - this.getElement().setProperty("disableRotateControl", disable); + getElement().setProperty("disableRotateControl", disable); } /** * Allows to disable/enable street view control. - * + * * @param disable Set true to disable street view control */ public void disableStreetViewControl(boolean disable) { - this.getElement().setProperty("disableStreetViewControl", disable); + getElement().setProperty("disableStreetViewControl", disable); } /** * Allows to disable/enable map type control. - * + * * @param disable Set true to disable map type control */ public void disableMapTypeControl(boolean disable) { - this.getElement().setProperty("disableMapTypeControl", disable); + getElement().setProperty("disableMapTypeControl", disable); } /** * Allows to disable/enable zoom control. - * + * * @param disable Set true to disable zoom control */ public void disableZoomControl(boolean disable) { - this.getElement().setProperty("disableZoomControl", disable); + getElement().setProperty("disableZoomControl", disable); } /** * Allows to disable/enable full screen control. - * + * * @param disable Set true to disable full screen control */ public void disableFullScreenControl(boolean disable) { - this.getElement().setProperty("disableFullScreenControl", disable); + getElement().setProperty("disableFullScreenControl", disable); } /** * Allows to disable/enable scale control. - * + * * @param disable Set true to disable scale control */ public void disableScaleControl(boolean disable) { - this.getElement().setProperty("disableScaleControl", disable); + getElement().setProperty("disableScaleControl", disable); } /** * Sets the mapId. See * https://developers.google.com/maps/documentation/javascript/cloud-based-map-styling - * + * * @param mapId If set, the custom style associated with that map id is applied. */ public void setMapId(String mapId) { - this.getElement().setProperty("mapId", mapId); + getElement().setProperty("mapId", mapId); } /** @@ -407,100 +406,100 @@ public void setMapId(String mapId) { * @return The current map id. */ public String getMapId() { - return this.getElement().getProperty("mapId"); + return getElement().getProperty("mapId"); } - + /** * Sets the size of the control buttons appearing in the map. Must be specified when creating the * map. See * https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions.controlSize - * + * * @param controlSize If set, control's size will be updated with this value. */ public void setControlSize(int controlSize) { - this.getElement().setProperty("controlSize", controlSize); + getElement().setProperty("controlSize", controlSize); } /** * Returns the current control size value. - * + * * @return The current size of the control buttons. */ public int getControlSize() { - return this.getElement().getProperty("controlSize", 0); + return getElement().getProperty("controlSize", 0); } /** * Sets a KML or GeoRSS feed url to be displayed as a KML Layer in the map. - * + * * @param kml the url to be displayed. */ public void setKml(String kml){ - this.getElement().setProperty("kml", kml); + getElement().setProperty("kml", kml); } /** * Returns the current KML or GeoRSS feed url associated with a KML Layer in the map. - * + * * @return the current url. */ public String getKml() { - return this.getElement().getProperty("kml"); + return getElement().getProperty("kml"); } - + /** - * Enables markers clustering. + * Enables markers clustering. */ public void enableMarkersClustering() { - this.getElement().setProperty("enableMarkersClustering", true); + getElement().setProperty("enableMarkersClustering", true); } - + /** * Sets tilt value on a vector map. - * + * * @param tilt the value to set */ public void setTilt(double tilt) { - this.getElement().setProperty("tilt", tilt); + getElement().setProperty("tilt", tilt); } - + /** * Returns current tilt value. - * + * * @return tilt value */ public double getTilt() { - return this.getElement().getProperty("tilt", 45d); + return getElement().getProperty("tilt", 45d); } - + /** * Sets heading (rotation) value on a vector map. - * + * * @param heading the value to set */ public void setHeading(double heading) { - this.getElement().setProperty("heading", heading); + getElement().setProperty("heading", heading); } - + /** * Returns the current heading value. - * + * * @return haeading value */ public double getHeading() { - return this.getElement().getProperty("heading", 0d); + return getElement().getProperty("heading", 0d); } - + public static class GoogleMapClickEvent extends ClickEvent { private final double lat; private final double lon; public double getLatitude() { - return this.lat; + return lat; } public double getLongitude() { - return this.lon; + return lon; } public GoogleMapClickEvent( @@ -508,38 +507,32 @@ public GoogleMapClickEvent( boolean fromClient, @EventData(value = "event.detail.latLng") JsonValue latLng) { super(source); - this.lat = ((JsonObject) latLng).getNumber("lat"); - this.lon = ((JsonObject) latLng).getNumber("lng"); + lat = ((JsonObject) latLng).getNumber("lat"); + lon = ((JsonObject) latLng).getNumber("lng"); } } public Registration addClickListener(ComponentEventListener listener) { - this.getElement().setProperty("clickable", true); - this.getElement().setProperty("clickEvents", true); + getElement().setProperty("clickable", true); + getElement().setProperty("clickEvents", true); DomListenerRegistration registration = - this.getElement() - .addEventListener( - "google-map-click", - ev -> { - JsonObject latLng = ev.getEventData().get("event.detail.latLng"); - listener.onComponentEvent(new GoogleMapClickEvent(this, true, latLng)); - }) - .addEventData("event.detail.latLng"); + getElement() + .addEventListener("google-map-click", ev -> { + JsonObject latLng = ev.getEventData().get("event.detail.latLng"); + listener.onComponentEvent(new GoogleMapClickEvent(this, true, latLng)); + }).addEventData("event.detail.latLng"); return registration::remove; } public Registration addRightClickListener(ComponentEventListener listener) { - this.getElement().setProperty("clickable", true); - this.getElement().setProperty("clickEvents", true); + getElement().setProperty("clickable", true); + getElement().setProperty("clickEvents", true); DomListenerRegistration registration = - this.getElement() - .addEventListener( - "google-map-rightclick", - ev -> { - JsonObject latLng = ev.getEventData().get("event.detail.latLng"); - listener.onComponentEvent(new GoogleMapClickEvent(this, true, latLng)); - }) - .addEventData("event.detail.latLng"); + getElement() + .addEventListener("google-map-rightclick", ev -> { + JsonObject latLng = ev.getEventData().get("event.detail.latLng"); + listener.onComponentEvent(new GoogleMapClickEvent(this, true, latLng)); + }).addEventData("event.detail.latLng"); return registration::remove; } @@ -555,7 +548,7 @@ public void goToCurrentLocation() { @ClientCallable private void handleGeolocation(double latitude, double longitude) { - this.setCenter(new LatLon(latitude, longitude)); + setCenter(new LatLon(latitude, longitude)); ComponentUtil.fireEvent(this, new CurrentLocationEvent(this, false)); } @@ -620,19 +613,19 @@ public Registration addGeolocationErrorEventListener( /** * Activates tracking current location on map. - * + * *

Uses geolocation#watchPosition * method to track current position.

- * + * *

Geolocation requires that the user gives consent to location sharing when prompted by the * browser.

- * - * @throws IllegalStateException if a tracking location session is already active. + * + * @throws IllegalStateException if a tracking location session is already active. * The current session must be stopped before starting a new one. */ public void trackLocation() { - if (this.getTrackLocationId() == null) { + if (getTrackLocationId() == null) { getElement().executeJs("return geolocation.trackLocation($0)", this).then(Integer.class, trackLocationId -> { this.trackLocationId = trackLocationId; @@ -643,16 +636,16 @@ public void trackLocation() { "A tracking location session is already active. Please stop the current session before starting a new one."); } } - + /** * Returns track location id if a location tracking was activated. - * + * * @return the location tracking id */ public Integer getTrackLocationId() { return trackLocationId; } - + /** Event that is fired when activating location tracking. */ public class LocationTrackingActivatedEvent extends ComponentEvent { @@ -660,7 +653,7 @@ public LocationTrackingActivatedEvent(GoogleMap source, boolean fromClient) { super(source, fromClient); } } - + /** * Adds a LocationTrackingActivatedEvent listener. The listener is called when setting activating * tracking location. @@ -672,7 +665,7 @@ public Registration addLocationTrackingActivatedEventListener( ComponentEventListener listener) { return addListener(LocationTrackingActivatedEvent.class, listener); } - + /** * Stops the current location tracking session. */ @@ -680,43 +673,43 @@ public void stopTrackLocation() { if(trackLocationId != null) { getElement().executeJs("geolocation.clearTracking($0)", trackLocationId); trackLocationId = null; - } + } } /** * Returns a {@link CompletableFuture} containing the map current {@link LatLonBounds bounds}. - * + * * @return current {@link LatLonBounds bounds} */ - public CompletableFuture getBounds() { - return this.getElement().executeJs("return this.map.getBounds()") + public CompletableFuture getBounds() { + return getElement().executeJs("return this.map.getBounds()") .toCompletableFuture(JsonObject.class).thenApply(result -> { return new LatLonBounds(result); }); } - + /** * Sets the custom renderer definition to be applied to the markers clustering. The custom * renderer needs to be define as a global JavaScript object conforming the Renderer interface * from * https://github.com/googlemaps/js-markerclusterer/blob/5ac92567dd0c52a1e1b897d791463a064656830c/src/renderer.ts#L65C2-L65C78 - * + * * @param customRenderer the custom renderer definition */ public void setClusteringRenderer(String customRenderer) { - this.getElement().setProperty("customRenderer", customRenderer); + getElement().setProperty("customRenderer", customRenderer); } /** * Adds a GoogleMapIdleEvent listener. The listener is called when the map is in idle state (after * pan or zoom) - * + * * @param listener * @return */ public Registration addMapIdleListener(ComponentEventListener listener) { DomListenerRegistration registration = - this.getElement().addEventListener("google-map-idle", ev -> { + getElement().addEventListener("google-map-idle", ev -> { listener.onComponentEvent(new GoogleMapIdleEvent(this, true)); }); return registration::remove; @@ -731,7 +724,7 @@ public GoogleMapIdleEvent(GoogleMap source, boolean fromClient) { /** * Adds a GoogleMapBoundsChangedEvent listener. The listener is called when the map is moved or * zoomed - * + * * @param listener * @return */ @@ -739,7 +732,7 @@ public Registration addGoogleMapBoundsChangedListener( ComponentEventListener listener) { DomListenerRegistration registration = - this.getElement().addEventListener("google-map-bounds_changed", ev -> { + getElement().addEventListener("google-map-bounds_changed", ev -> { listener.onComponentEvent(new GoogleMapBoundsChangedEvent(this, true, new LatLonBounds(ev.getEventData().get("event.detail")))); }).debounce(1000, DebouncePhase.TRAILING).addEventData("event.detail"); @@ -753,19 +746,19 @@ public static class GoogleMapBoundsChangedEvent extends ComponentEvent { + getElement().executeJs("this._removeCustomControls()").then((e) -> { JsonArray jsonArray = Json.createArray(); for (int i = 0; i < customControls.length; i++) { CustomControl customControl = customControls[i]; jsonArray.set(i, customControl.getJson(i)); customControl.getControlButton().getElement().setAttribute("slot", "customControlSlot_" + i); - this.getElement().appendChild(customControl.getControlButton().getElement()); + getElement().appendChild(customControl.getControlButton().getElement()); this.customControls.add(customControl); } - this.getElement().setPropertyJson("customControls", jsonArray); - }); + getElement().setPropertyJson("customControls", jsonArray); + }); } - + /** * Adds a custom control to be displayed in the map. - * + * * @param customControl the custom control to add to the map */ public void addCustomControl(CustomControl customControl) { - this.customControls.add(customControl); - this.setCustomControls(this.customControls.stream().toArray(CustomControl[]::new)); + customControls.add(customControl); + setCustomControls(customControls.stream().toArray(CustomControl[]::new)); } - + /** * Removes a custom control added to the map. - * + * * @param customControl the custom control to be removed */ public void removeCustomControl(CustomControl customControl) { - this.customControls.remove(customControl); - this.setCustomControls(this.customControls.stream().toArray(CustomControl[]::new)); + customControls.remove(customControl); + setCustomControls(customControls.stream().toArray(CustomControl[]::new)); } - + /** * Removes all custom controls added to the map. */ public void removeCustomControls() { - this.customControls.clear(); - this.getElement().executeJs("this._removeCustomControls()"); + customControls.clear(); + getElement().executeJs("this._removeCustomControls()"); } - + /** * Adds a FullScreenEvent listener. The listener is called to notify whether the map is in full * screen mode. - * + * * @param listener a FullScreenEvent listener * @return Registration object to allow removing the listener */ public Registration addFullScreenListener(ComponentEventListener listener) { DomListenerRegistration registration = - this.getElement().addEventListener("fullscreenchange", ev -> { - this.getElement() + getElement().addEventListener("fullscreenchange", ev -> { + getElement() .executeJs( - "var isFullScreen = document.fullScreen ||\r\n" + "var isFullScreen = document.fullScreen ||\r\n" + " document.mozFullScreen ||\r\n" - + " document.webkitIsFullScreen;\r\n" + + " document.webkitIsFullScreen;\r\n" + " return isFullScreen != null ? isFullScreen : false;") .then(Boolean.class, isFullScreen -> listener .onComponentEvent(new FullScreenEvent(this, true, isFullScreen))); @@ -854,12 +847,12 @@ public Registration addFullScreenListener(ComponentEventListener { - + private boolean isFullScreen; - + /** * Creates a new FullScreenEvent. - * + * * @param source the source component * @param fromClient whether the event originated from the client side * @param isFullScreen the full screen state @@ -871,25 +864,25 @@ public FullScreenEvent(GoogleMap source, boolean fromClient, boolean isFullScree /** * Checks if the map is in full screen mode. - * + * * @return true if the map is in full screen mode, false otherwise */ public boolean isFullScreen() { return isFullScreen; - } + } } - + /** * Exits the full screen mode on the map. */ public void closeFullScreen() { - this.getElement() + getElement() .executeJs("document.exitFullscreen();"); } - + /** * Sets style formatting to the {@link FeatureType features} and {@link ElementType elements} of the map. - * + * * @param mapStyles formatting to be applied to the map features and elements */ public void setMapStyle(MapStyle... mapStyles) { @@ -898,6 +891,6 @@ public void setMapStyle(MapStyle... mapStyles) { MapStyle mapStyle = mapStyles[i]; jsonArray.set(i, mapStyle.getJson()); } - this.getElement().setPropertyJson("styles", jsonArray); - } + getElement().setPropertyJson("styles", jsonArray); + } } 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 7007f83..3db229f 100644 --- a/src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMapPoly.java +++ b/src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMapPoly.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -60,94 +60,94 @@ public GoogleMapPoly(List points) { } public void setFillOpacity(double opacity) { - this.getElement().setProperty("fillOpacity", opacity); + getElement().setProperty("fillOpacity", opacity); } public double getFillOpacity() { - return this.getElement().getProperty("fillOpacity", 1d); + return getElement().getProperty("fillOpacity", 1d); } public void setStrokeOpacity(double opacity) { - this.getElement().setProperty("strokeOpacity", opacity); + getElement().setProperty("strokeOpacity", opacity); } public double getStrokeOpacity() { - return this.getElement().getProperty("strokeOpacity", 1d); + return getElement().getProperty("strokeOpacity", 1d); } public void setStrokePosition(StrokePosition position) { - this.getElement().setProperty("strokePosition", position.name().toLowerCase()); + getElement().setProperty("strokePosition", position.name().toLowerCase()); } public StrokePosition getStrokePosition() { - return StrokePosition.valueOf(this.getElement().getProperty("strokePosition").toUpperCase()); + return StrokePosition.valueOf(getElement().getProperty("strokePosition").toUpperCase()); } public void setStrokeWeight(double weight) { - this.getElement().setProperty("strokeWeight", weight); + getElement().setProperty("strokeWeight", weight); } public double getStrokeWeight() { - return this.getElement().getProperty("strokeWeight", 1d); + return getElement().getProperty("strokeWeight", 1d); } public void setZIndex(double zindex) { - this.getElement().setProperty("zIndex", zindex); + getElement().setProperty("zIndex", zindex); } public double getZIndex() { - return this.getElement().getProperty("zIndex", 1d); + return getElement().getProperty("zIndex", 1d); } public void setFillColor(String string) { - this.getElement().setProperty("fillColor", string); + getElement().setProperty("fillColor", string); } public String getFillColor() { - return this.getElement().getProperty("fillColor"); + return getElement().getProperty("fillColor"); } public void setStrokeColor(String string) { - this.getElement().setProperty("strokeColor", string); + getElement().setProperty("strokeColor", string); } public String getStrokeColor() { - return this.getElement().getProperty("strokeColor"); + return getElement().getProperty("strokeColor"); } public void setClosed(boolean b) { - this.getElement().setProperty("closed", b); + getElement().setProperty("closed", b); } public boolean isClosed() { - return this.getElement().getProperty("closed", false); + return getElement().getProperty("closed", false); } public void setGeodesic(boolean b) { - this.getElement().setProperty("geodesic", b); + getElement().setProperty("geodesic", b); } public boolean isGeodesic() { - return this.getElement().getProperty("geodesic", false); + return getElement().getProperty("geodesic", false); } public void setPoints(Iterable points) { - points.forEach(point -> this.getElement().appendChild(point.getElement())); + points.forEach(point -> getElement().appendChild(point.getElement())); } public GoogleMapPoint addPoint(LatLon position) { GoogleMapPoint point = new GoogleMapPoint(position.getLat(), position.getLon()); - this.getElement().appendChild(point.getElement()); + getElement().appendChild(point.getElement()); return point; } public void addPoint(GoogleMapPoint point) { - this.getElement().appendChild(point.getElement()); + getElement().appendChild(point.getElement()); } @SuppressWarnings("squid:S3242") public void removePoint(GoogleMapPoint point) { - this.getElement().removeChild(point.getElement()); + getElement().removeChild(point.getElement()); } @DomEvent("google-map-poly-click") @@ -161,23 +161,23 @@ public GoogleMapPolyClickEvent( boolean fromClient, @EventData(value = "event.detail.latLng") JsonValue latLng) { super(source); - this.lat = ((JsonObject) latLng).getNumber("lat"); - this.lon = ((JsonObject) latLng).getNumber("lng"); + lat = ((JsonObject) latLng).getNumber("lat"); + lon = ((JsonObject) latLng).getNumber("lng"); } public double getLatitude() { - return this.lat; + return lat; } public double getLongitude() { - return this.lon; + return lon; } } public Registration addClickListener( ComponentEventListener listener) { - this.getElement().setProperty("clickable", true); - this.getElement().setProperty("clickEvents", true); + getElement().setProperty("clickable", true); + getElement().setProperty("clickEvents", true); return addListener(GoogleMapPolyClickEvent.class, listener); } @@ -189,21 +189,21 @@ public void setIcons(Icon... icons) { JsonArray jsonArray = Json.createArray(); for (int i = 0; i < icons.length; i++) { jsonArray.set(i, icons[i].getJson()); - } - this.getElement().setPropertyJson("icons", jsonArray); + } + getElement().setPropertyJson("icons", jsonArray); } - + /** * Set icons to the polygon/polyline. - * + * * @param icons the icons to set */ public void setIcons(IconSequence... icons) { JsonArray jsonArray = Json.createArray(); for (int i = 0; i < icons.length; i++) { jsonArray.set(i, icons[i].getJson()); - } - this.getElement().setPropertyJson("icons", jsonArray); + } + getElement().setPropertyJson("icons", jsonArray); } - + }