Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.1.0 #308

Merged
merged 45 commits into from
Dec 6, 2023
Merged

4.1.0 #308

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
ee46937
Merge pull request #286 from xdev-software/master
AB-xdev Oct 13, 2023
87f837a
Bump vaadin.version from 24.1.12 to 24.2.0
dependabot[bot] Oct 17, 2023
6b67652
Bump org.springframework.boot.version from 3.1.4 to 3.1.5
dependabot[bot] Oct 20, 2023
6cb43b9
Fix syntax for edit
AB-xdev Oct 25, 2023
7f6fd29
Update update-from-template.yml
AB-xdev Oct 25, 2023
4a9626f
Merge pull request #9 from xdev-software/update-from-template
AB-xdev Oct 25, 2023
b2b2122
Merge pull request #86 from xdev-software/dependabot/maven/vaadin.ver…
AB-xdev Oct 25, 2023
7d0fc6b
Merge pull request #87 from xdev-software/dependabot/maven/org.spring…
AB-xdev Oct 25, 2023
d51d168
Merge pull request #88 from xdev-software/update-from-template
AB-xdev Oct 25, 2023
6c3628b
Compile with Java 21
AB-xdev Oct 26, 2023
36b201e
Recommend Java 21 for development
AB-xdev Oct 26, 2023
81ae43b
Merge pull request #89 from xdev-software/update-from-template
AB-xdev Oct 26, 2023
8dee66b
Bump vaadin.version from 24.2.0 to 24.2.1
dependabot[bot] Oct 27, 2023
b074b3b
Bump org.apache.commons:commons-text from 1.10.0 to 1.11.0
dependabot[bot] Oct 30, 2023
9b23bbb
Merge remote-tracking branch 'origin/update-from-template' into develop
AB-xdev Nov 6, 2023
4028697
Merge pull request #90 from xdev-software/dependabot/maven/vaadin.ver…
AB-xdev Nov 6, 2023
08519b8
Added spring boot info to installation guide
AB-xdev Nov 6, 2023
17259f8
Merge pull request #291 from xdev-software/dependabot/maven/org.apach…
AB-xdev Nov 6, 2023
d3ec5fa
Bump vaadin.version from 24.2.1 to 24.2.2
dependabot[bot] Nov 7, 2023
77bcbb3
Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.6.0 to 3.6.2
dependabot[bot] Nov 7, 2023
863ce33
Merge pull request #10 from xdev-software/dependabot/maven/org.apache…
AB-xdev Nov 7, 2023
8cbecb8
Merge pull request #91 from xdev-software/dependabot/maven/vaadin.ver…
AB-xdev Nov 7, 2023
5cd919d
Merge remote-tracking branch 'origin/update-from-template'
AB-xdev Nov 7, 2023
0cf81c0
Place bracket correctly
AB-xdev Nov 7, 2023
aeccd61
Merge pull request #11 from xdev-software/update-from-template
AB-xdev Nov 7, 2023
eccee27
Merge pull request #94 from xdev-software/update-from-template
AB-xdev Nov 7, 2023
a4afa9a
Merge remote-tracking branch 'origin/update-from-template' into develop
AB-xdev Nov 7, 2023
5667315
Bump vaadin.version from 24.2.2 to 24.2.4
dependabot[bot] Nov 22, 2023
30d8aac
Merge pull request #96 from xdev-software/dependabot/maven/vaadin.ver…
AB-xdev Nov 23, 2023
e458faa
Bump actions/setup-java from 3 to 4
dependabot[bot] Nov 30, 2023
4efe636
Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.6.2 to 3.6.3
dependabot[bot] Dec 4, 2023
a1f982e
Merge pull request #12 from xdev-software/dependabot/github_actions/a…
AB-xdev Dec 4, 2023
122fc93
Merge pull request #13 from xdev-software/dependabot/maven/org.apache…
AB-xdev Dec 4, 2023
523e4be
Fix incorrect method call
AB-xdev Dec 6, 2023
9270308
Provide workaround for instant map interactions before map is ready
AB-xdev Dec 6, 2023
6aaa915
Bump minor
AB-xdev Dec 6, 2023
3298401
Merge remote-tracking branch 'origin/update-from-template'
AB-xdev Dec 6, 2023
42758e8
Bump org.springframework.boot.version from 3.1.5 to 3.2.0
dependabot[bot] Dec 6, 2023
6bc8bdc
Bump vaadin.version from 24.2.4 to 24.2.5
dependabot[bot] Dec 6, 2023
736cd79
Merge pull request #97 from xdev-software/dependabot/maven/org.spring…
AB-xdev Dec 6, 2023
28b1893
Merge pull request #98 from xdev-software/dependabot/maven/vaadin.ver…
AB-xdev Dec 6, 2023
c25a336
Merge remote-tracking branch 'origin/update-from-template' into develop
AB-xdev Dec 6, 2023
6cf648e
Bump com.fasterxml.jackson.core:jackson-databind from 2.15.3 to 2.16.0
dependabot[bot] Dec 6, 2023
8e9e19d
Merge pull request #298 from xdev-software/dependabot/maven/com.faste…
AB-xdev Dec 6, 2023
549dfe3
Cleanup
AB-xdev Dec 6, 2023
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
4 changes: 2 additions & 2 deletions .github/workflows/checkBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ jobs:

strategy:
matrix:
java: [17]
java: [17, 21]
distribution: [temurin]

steps:
- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
Expand Down Expand Up @@ -105,6 +105,9 @@ jobs:
<artifactId>${{ env.PRIMARY_MAVEN_MODULE }}</artifactId>
<version>${{ steps.version.outputs.release }}</version>
</dependency>

### Additional notes
* [Spring-Boot] You may have to include ``software/xdev`` inside [``vaadin.whitelisted-packages``](https://vaadin.com/docs/latest/integrations/spring/configuration#configure-the-scanning-of-packages)
```

publish_central: # Publish the code to central
Expand All @@ -120,7 +123,7 @@ jobs:
git pull

- name: Set up JDK Apache Maven Central
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with: # running setup-java again overwrites the settings.xml
java-version: '17'
distribution: 'temurin'
Expand Down Expand Up @@ -152,7 +155,7 @@ jobs:
git pull

- name: Setup - Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up JDK OSSRH
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with: # running setup-java again overwrites the settings.xml
distribution: 'temurin'
java-version: '17'
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/update-from-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,8 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh_pr_up() {
gh pr create "$@" || gh pr edit "$@"
gh pr create -H "${{ env.UPDATE_BRANCH }}" "$@" || (git checkout "${{ env.UPDATE_BRANCH }}" && gh pr edit "$@")
}
gh_pr_up -B "${{ steps.main.outputs.current_branch }}" \
-H "${{ env.UPDATE_BRANCH }}" \
--title "Update from template" \
--body "An automated PR to sync changes from the template into this repo"
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.1.0
* Provide a workaround that fixes a problem where certain methods didn't work instantly after the map was created #305
* Moved some container specific methods to ``MapContainer``

## 4.0.1
* Added shortcut method ``invokeSelfReturn`` #282
* Updated dependencies
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ We also encourage you to read the [contribution instructions by GitHub](https://
### Software Requirements
You should have the following things installed:
* Git
* Java 17 - should be as unmodified as possible (Recommended: [Eclipse Adoptium](https://adoptium.net/temurin/releases/))
* Java 21 - should be as unmodified as possible (Recommended: [Eclipse Adoptium](https://adoptium.net/temurin/releases/))
* Maven

### Recommended setup
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.xdev-software</groupId>
<artifactId>vaadin-maps-leaflet-flow-root</artifactId>
<version>4.0.2-SNAPSHOT</version>
<version>4.1.0-SNAPSHOT</version>
<packaging>pom</packaging>

<organization>
Expand Down
6 changes: 3 additions & 3 deletions vaadin-maps-leaflet-flow-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.xdev-software</groupId>
<artifactId>vaadin-maps-leaflet-flow-demo</artifactId>
<version>4.0.2-SNAPSHOT</version>
<version>4.1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<inceptionYear>2019</inceptionYear>
Expand All @@ -26,9 +26,9 @@
<mainClass>software.xdev.vaadin.Application</mainClass>

<!-- Dependency-Versions -->
<vaadin.version>24.1.12</vaadin.version>
<vaadin.version>24.2.5</vaadin.version>

<org.springframework.boot.version>3.1.4</org.springframework.boot.version>
<org.springframework.boot.version>3.2.0</org.springframework.boot.version>
</properties>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import software.xdev.vaadin.maps.leaflet.flow.demo.ComplexDemo;
import software.xdev.vaadin.maps.leaflet.flow.demo.FreeingUpResourceBenchmarkDemo;
import software.xdev.vaadin.maps.leaflet.flow.demo.InitialResizeDemo;
import software.xdev.vaadin.maps.leaflet.flow.demo.MinimalisticDemo;


Expand Down Expand Up @@ -55,6 +56,12 @@ protected void onAttach(final AttachEvent attachEvent)
"Minimalistic",
"Showcasing the simplest form of using the API"
),
new Example(
InitialResizeDemo.NAV,
"Initial resize",
"Some map methods - when called instantly after the map is created - will not work correctly."
+ " This example shows how to workaround this restriction."
),
new Example(
ComplexDemo.NAV,
"Complex",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package software.xdev.vaadin.maps.leaflet.flow.demo;

import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.Route;

import software.xdev.vaadin.maps.leaflet.MapContainer;
import software.xdev.vaadin.maps.leaflet.basictypes.LLatLng;
import software.xdev.vaadin.maps.leaflet.basictypes.LLatLngBounds;
import software.xdev.vaadin.maps.leaflet.layer.raster.LTileLayer;
import software.xdev.vaadin.maps.leaflet.layer.vector.LPolylineOptions;
import software.xdev.vaadin.maps.leaflet.layer.vector.LRectangle;
import software.xdev.vaadin.maps.leaflet.map.LMap;
import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry;
import software.xdev.vaadin.maps.leaflet.registry.LDefaultComponentManagementRegistry;


@Route(InitialResizeDemo.NAV)
public class InitialResizeDemo extends VerticalLayout
{
public static final String NAV = "/initial-resize";

public InitialResizeDemo()
{
this.setSizeFull();

final LComponentManagementRegistry reg = new LDefaultComponentManagementRegistry(this);

// We want to show this area initially
final LLatLngBounds bounds = new LLatLngBounds(
reg,
new LLatLng(reg, 49, 12),
new LLatLng(reg, 50, 11)
);

final MapContainer mapContainer = new MapContainer(reg, map -> {
// This needs to be done after the map was initially resized
// otherwise the view is calculated incorrectly
map.fitBounds(bounds);
});
mapContainer.setSizeFull();
this.add(mapContainer);

final LMap map = mapContainer.getlMap();
map.addLayer(LTileLayer.createDefaultForOpenStreetMapTileServer(reg));

// Still required as the map refuses to work otherwise
map.setView(new LLatLng(reg, 0, 0), 1);

// Create rectangle for reference
new LRectangle(reg, bounds, new LPolylineOptions())
.addTo(map);
}
}
10 changes: 5 additions & 5 deletions vaadin-maps-leaflet-flow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.xdev-software</groupId>
<artifactId>vaadin-maps-leaflet-flow</artifactId>
<version>4.0.2-SNAPSHOT</version>
<version>4.1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>LeafletMap for Vaadin</name>
Expand Down Expand Up @@ -49,7 +49,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<!-- Dependency-Versions -->
<vaadin.version>24.1.12</vaadin.version>
<vaadin.version>24.2.5</vaadin.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -108,13 +108,13 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.15.3</version>
<version>2.16.0</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.10.0</version>
<version>1.11.0</version>
</dependency>
</dependencies>

Expand Down Expand Up @@ -178,7 +178,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.0</version>
<version>3.6.3</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
*/
package software.xdev.vaadin.maps.leaflet;

import java.util.function.Consumer;

import com.vaadin.flow.component.ClientCallable;
import com.vaadin.flow.component.Composite;
import com.vaadin.flow.component.HasComponents;
import com.vaadin.flow.component.HasSize;
Expand All @@ -26,6 +29,7 @@
import com.vaadin.flow.component.dependency.NpmPackage;
import com.vaadin.flow.component.html.Div;

import software.xdev.vaadin.maps.leaflet.basictypes.LLatLngBounds;
import software.xdev.vaadin.maps.leaflet.map.LMap;
import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry;

Expand All @@ -41,11 +45,62 @@ public class MapContainer extends Composite<Div> implements HasSize, HasStyle, H
{
private final LMap lMap;

private Consumer<LMap> afterInitialResize;

public MapContainer(final LComponentManagementRegistry reg)
{
this(reg, null);
}

/**
* @param afterInitialResize This is called after the map was initially resized/is ready.
* <p/>
* This is ONLY required when calling certain methods like e.g.
* {@link LMap#fitBounds(LLatLngBounds)} instantly after the map is created.
* <p/>
* For performance reasons it's highly recommended to only use this when required.
*/
public MapContainer(
final LComponentManagementRegistry reg,
final Consumer<LMap> afterInitialResize)
{
this.afterInitialResize = afterInitialResize;
this.getContent().setSizeFull();
this.fixZIndex();

this.lMap = new LMap(reg, this.getContent());
this.fixInitialSizeAfterCreation();
}

protected String ensureId()
{
// Id is auto assigned by LMap so this will never throw
return this.getContent().getId().orElseThrow();
}

protected void fixZIndex()
{
LMap.fixZIndex(this.getContent());
}

protected void fixInitialSizeAfterCreation()
{
this.lMap.fixInvalidSizeAfterCreation(this.afterInitialResize != null
? "document.getElementById('" + this.ensureId() + "').$server.onInitialResize();"
: null);
}

@ClientCallable
public void onInitialResize()
{
if(this.afterInitialResize == null)
{
return;
}

this.afterInitialResize.accept(this.getlMap());
// Free up
this.afterInitialResize = null;
}

public LMap getlMap()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ default S once(final String type, final String function, final String context)
*/
default S once(final String type, final String function)
{
return this.on(type, function, null);
return this.once(type, function, null);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ public LMap(
final LMapOptions options)
{
super(compReg, "L.map($0" + compReg.writeOptionsOptionalParameter(options) + ")", id);
// https://stackoverflow.com/q/53879753
this.fixInvalidSizeAfterCreation();
}

public LMap(
Expand All @@ -65,23 +63,6 @@ public LMap(
final LComponentManagementRegistry compReg,
final Div bindDiv,
final LMapOptions options)
{
this(compReg, bindDiv, options, true);
}

public LMap(
final LComponentManagementRegistry compReg,
final Div bindDiv,
final boolean fixDivZIndex)
{
this(compReg, bindDiv, null, fixDivZIndex);
}

public LMap(
final LComponentManagementRegistry compReg,
final Div bindDiv,
final LMapOptions options,
final boolean fixDivZIndex)
{
this(
compReg,
Expand All @@ -91,10 +72,6 @@ public LMap(
return dynamicId;
}),
options);
if(fixDivZIndex)
{
fixZIndex(bindDiv);
}
}

/**
Expand All @@ -105,10 +82,15 @@ public static void fixZIndex(final Div div)
div.getStyle().set("z-index", "1");
}

protected void fixInvalidSizeAfterCreation()
public void fixInvalidSizeAfterCreation(final String callback)
{
// https://stackoverflow.com/q/53879753
// This should no longer be required starting in Leaflet v2 https://github.com/Leaflet/Leaflet/pull/8612
this.componentRegistry().execJs("let tempMap = " + this.clientComponentJsAccessor() + "; "
+ "setTimeout(function () { tempMap.invalidateSize(false); }, 100)");
+ "setTimeout(function () { "
+ " tempMap.invalidateSize(false); "
+ (callback != null ? callback : "")
+ " }, 100)");
}

// endregion
Expand Down