Skip to content

Commit 75fb75d

Browse files
authored
Merge branch 'dev/v2.0.1' into dependabot/npm_and_yarn/jlmap-vaadin-demo/vite-6.4.2
2 parents cac827e + 2a6c6c5 commit 75fb75d

35 files changed

Lines changed: 2544 additions & 60 deletions

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# --- Stage 1: Build the application ---
2+
FROM maven:3.9.6-eclipse-temurin-17 AS build
3+
4+
WORKDIR /app
5+
COPY pom.xml ./
6+
COPY jlmap-api ./jlmap-api
7+
COPY jlmap-vaadin ./jlmap-vaadin
8+
COPY jlmap-vaadin-demo ./jlmap-vaadin-demo
9+
10+
RUN mvn -f jlmap-vaadin-demo/pom.xml clean package -Pproduction
11+
12+
# --- Stage 2: Create the final image ---
13+
FROM eclipse-temurin:17-jre
14+
15+
WORKDIR /app
16+
COPY --from=build /app/jlmap-vaadin-demo/target/jlmap-vaadin-demo-*.jar app.jar
17+
EXPOSE 80
18+
ENTRYPOINT ["java", "-Dserver.port=80", "-jar", "app.jar"]

README.md

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
1-
# Java Leaflet (JLeaflet)
1+
# Java Leaflet (JLMAP): A Java Interactive Map For Vaadin and JavaFx
22

3-
A Java library for integrating Leaflet maps into Java applications with full Java Platform Module System (JPMS) support.
4-
Now supporting both **JavaFX** and **Vaadin** implementations with a unified API.
3+
A Java library for integrating [Leaflet](https://github.com/Leaflet/Leaflet) maps into Java applications with full Java Platform Module System (JPMS) support.
4+
Now supporting both [**JavaFX**](https://openjfx.io/) and [**Vaadin**](https://vaadin.com/) implementations with a unified API.
55

66
* Current version: **v2.0.0**
77

88
Project Source Code: https://github.com/makbn/java_leaflet
9+
910
Project Wiki: https://github.com/makbn/java_leaflet/wiki
1011

1112
![Java-Leaflet Test](https://github.com/makbn/java_leaflet/blob/master/.github/doc/app.png?raw=true)
1213

13-
> Leaflet is the leading open-source JavaScript library for mobile-friendly interactive maps. Weighing just about 38 KB
14-
> of JS, it has all the mapping features most developers ever need.
15-
> Leaflet is designed with simplicity, performance and usability in mind. It works efficiently across all major desktop
16-
> and mobile platforms, can be extended with lots of plugins, has a beautiful, easy to use and well-documented API and a
17-
> simple, readable source code that is a joy to contribute to.
18-
1914
## 🏗️ Project Structure
2015

2116
This project is now organized as a multi-module Maven project:
@@ -77,6 +72,7 @@ Add the JavaFX dependency to your `pom.xml`:
7772
<version>2.0.0</version>
7873
</dependency>
7974
```
75+
- https://central.sonatype.com/artifact/io.github.makbn/jlmap-fx
8076

8177
### Vaadin Implementation
8278

@@ -90,6 +86,7 @@ Add the Vaadin dependency to your `pom.xml`:
9086
<version>2.0.0</version>
9187
</dependency>
9288
```
89+
- https://central.sonatype.com/artifact/io.github.makbn/jlmap-vaadin
9390

9491
Also rememebr to allow the module in your properties file:
9592

@@ -353,14 +350,6 @@ jar --describe-module --file target/jlmap-vaadin-2.0.0.jar
353350
4. Ensure all tests pass
354351
5. Submit a pull request
355352

356-
## License
357-
358-
Since v2.0.0 This project is licensed under the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1 - see
359-
the [LICENSE](LICENSE) file for details.
360-
361-
## Author
362-
363-
**Matt Akbarian** (@makbn)
364353

365354
## Roadmap
366355

@@ -378,9 +367,12 @@ the [LICENSE](LICENSE) file for details.
378367
- [ ] implement object specific `JLOptions`
379368
- [ ] Performance optimizations
380369

381-
## Additional Resources
382370

383-
- **API Documentation**: See the `jlmap-api` module for core interfaces
384-
- **JavaFX Examples**: See the `jlmap-fx` module for JavaFX usage
385-
- **Vaadin Examples**: See the `jlmap-vaadin-demo` for Vaadin usage
386-
- **Leaflet Documentation**: [https://leafletjs.com/](https://leafletjs.com/)
371+
## License
372+
373+
Since v2.0.0 This project is licensed under the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1 - see
374+
the [LICENSE](LICENSE) file for details.
375+
376+
## Author
377+
378+
**Matt Akbarian** (@makbn)

jlmap-api/pom.xml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
<groupId>org.apache.maven.plugins</groupId>
5252
<artifactId>maven-surefire-plugin</artifactId>
5353
<version>3.1.2</version>
54+
<configuration>
55+
<useModulePath>false</useModulePath>
56+
</configuration>
5457
</plugin>
5558
<plugin>
5659
<groupId>org.jacoco</groupId>
@@ -108,7 +111,19 @@
108111
<dependency>
109112
<groupId>org.assertj</groupId>
110113
<artifactId>assertj-core</artifactId>
111-
<version>3.27.4</version>
114+
<version>3.27.7</version>
115+
<scope>test</scope>
116+
</dependency>
117+
<dependency>
118+
<groupId>org.mockito</groupId>
119+
<artifactId>mockito-core</artifactId>
120+
<version>5.7.0</version>
121+
<scope>test</scope>
122+
</dependency>
123+
<dependency>
124+
<groupId>org.mockito</groupId>
125+
<artifactId>mockito-junit-jupiter</artifactId>
126+
<version>5.7.0</version>
112127
<scope>test</scope>
113128
</dependency>
114129
</dependencies>

jlmap-api/src/main/java/io/github/makbn/jlmap/listener/event/DragEvent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@
3737
* @author Matt Akbarian (@makbn)
3838
*/
3939
public record DragEvent(JLAction action, JLLatLng center,
40-
JLBounds bounds, int zoomLevel) implements Event {
40+
JLBounds bounds, double zoomLevel) implements Event {
4141
}

jlmap-api/src/main/java/io/github/makbn/jlmap/listener/event/JLDragEventHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ public void handle(@NonNull JLMap<?> map, @NonNull JLObject<?> source, @NonNull
7878
return new MoveEvent(action,
7979
gson.fromJson(String.valueOf(param4), JLLatLng.class),
8080
gson.fromJson(String.valueOf(param5), JLBounds.class),
81-
Integer.parseInt(String.valueOf(param3)));
81+
Double.parseDouble(String.valueOf(param3)));
8282
}
8383

8484
private @NotNull DragEvent getDragEvent(JLAction action, Object param4, Object param5, Object param3) {
8585
return new DragEvent(action,
8686
gson.fromJson(String.valueOf(param4), JLLatLng.class),
8787
gson.fromJson(String.valueOf(param5), JLBounds.class),
88-
Integer.parseInt(String.valueOf(param3)));
88+
Double.parseDouble(String.valueOf(param3)));
8989
}
9090

9191
@Override

jlmap-api/src/main/java/io/github/makbn/jlmap/listener/event/JLStatusChangeEventHandler.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
* Handles status change events for the map, such as zoom and resize actions.
1717
* <p>
1818
* This event handler listens for map status changes and dispatches corresponding events:
19-
* @see ZoomEvent
20-
* @see ResizeEvent
2119
*
2220
* @author Matt Akbarian (@makbn)
21+
* @see ZoomEvent
22+
* @see ResizeEvent
2323
*/
2424
@Slf4j
2525
public class JLStatusChangeEventHandler implements JLEventHandler<Object> {
@@ -36,18 +36,18 @@ public class JLStatusChangeEventHandler implements JLEventHandler<Object> {
3636
public void handle(@NonNull JLMap<?> map, @NonNull Object source, @NonNull String functionName, OnJLActionListener<Object> listener, Object param1, Object param2, Object param3, Object param4, Object param5) {
3737
switch (functionName) {
3838
case FUNCTION_ZOOM -> listener
39-
.onAction(source, new ZoomEvent(JLAction.ZOOM, gson.fromJson(String.valueOf(param3), Integer.class), gson.fromJson(String.valueOf(param5), JLBounds.class)));
39+
.onAction(source, new ZoomEvent(JLAction.ZOOM, gson.fromJson(String.valueOf(param3), Double.class), gson.fromJson(String.valueOf(param5), JLBounds.class)));
4040
case FUNCTION_ZOOM_START -> listener
41-
.onAction(source, new ZoomEvent(JLAction.ZOOM_START, gson.fromJson(String.valueOf(param3), Integer.class), gson.fromJson(String.valueOf(param5), JLBounds.class)));
41+
.onAction(source, new ZoomEvent(JLAction.ZOOM_START, gson.fromJson(String.valueOf(param3), Double.class), gson.fromJson(String.valueOf(param5), JLBounds.class)));
4242
case FUNCTION_ZOOM_END -> listener
43-
.onAction(source, new ZoomEvent(JLAction.ZOOM_END, gson.fromJson(String.valueOf(param3), Integer.class), gson.fromJson(String.valueOf(param5), JLBounds.class)));
43+
.onAction(source, new ZoomEvent(JLAction.ZOOM_END, gson.fromJson(String.valueOf(param3), Double.class), gson.fromJson(String.valueOf(param5), JLBounds.class)));
4444
case FUNCTION_RESIZE -> listener
4545
.onAction(source, new ResizeEvent(JLAction.RESIZE,
4646
getDimension(param4, false, "Width"),
4747
getDimension(param4, false, "Height"),
4848
getDimension(param4, true, "Width"),
4949
getDimension(param4, true, "Height"),
50-
gson.fromJson(String.valueOf(param3), Integer.class)));
50+
gson.fromJson(String.valueOf(param3), Double.class)));
5151
default -> log.error("{} not implemented!", functionName);
5252
}
5353
}

jlmap-api/src/main/java/io/github/makbn/jlmap/listener/event/MoveEvent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
* @author Matt Akbarian (@makbn)
3232
*/
3333
public record MoveEvent(JLAction action, JLLatLng center,
34-
JLBounds bounds, int zoomLevel) implements Event {
34+
JLBounds bounds, double zoomLevel) implements Event {
3535
}

jlmap-api/src/main/java/io/github/makbn/jlmap/listener/event/ResizeEvent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
* @author Matt Akbarian (@makbn)
2424
* @see <a href="https://leafletjs.com/reference.html#resizeevent">Leaflet ResizeEvent Documentation</a>
2525
*/
26-
public record ResizeEvent(JLAction action, int newWidth, int newHeight, int oldWidth, int oldHeight, int zoom)
26+
public record ResizeEvent(JLAction action, int newWidth, int newHeight, int oldWidth, int oldHeight, double zoom)
2727
implements Event {
2828
}

jlmap-api/src/main/java/io/github/makbn/jlmap/listener/event/ZoomEvent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
*
2323
* @author Matt Akbarian (@makbn)
2424
* */
25-
public record ZoomEvent(JLAction action, int zoomLevel, JLBounds bounds) implements Event {
25+
public record ZoomEvent(JLAction action, double zoomLevel, JLBounds bounds) implements Event {
2626

2727
}

jlmap-api/src/main/java/io/github/makbn/jlmap/model/builder/JLCallbackBuilder.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ public JLCallbackBuilder(String elementType, String varName) {
2727
return switch (event) {
2828
case ADD, REMOVE -> """
2929
this.%3$s.on('%1$s', e => {
30-
e.sourceTarget.getElement().setAttribute('id', e.target.uuid);
30+
if (typeof e.sourceTarget.getElement === 'function'
31+
&& e.sourceTarget.getElement()
32+
&& typeof e.sourceTarget.getElement().setAttribute === 'function') {
33+
e.sourceTarget.getElement().setAttribute('id', e.target.uuid);
34+
}
3135
this.jlMapElement.$server.eventHandler('%1$s', '%2$s', e.target.uuid, this.map.getZoom(),
3236
JSON.stringify((typeof e.target.getLatLng === "function") ?
3337
e.target.getLatLng() :

0 commit comments

Comments
 (0)