From d3df75da87dc6f3f5e98d5ec2bf2f1f42d48fbbb Mon Sep 17 00:00:00 2001 From: Bruno Salmon Date: Sun, 31 Mar 2024 19:57:56 +0100 Subject: [PATCH] Fixed J2CL compilation issue with apps using javafx-media --- .../javafxgraphics/NodePeerFactoryRegistry.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/webfx-kit/webfx-kit-javafxgraphics-peers/src/main/java/dev/webfx/kit/mapper/peers/javafxgraphics/NodePeerFactoryRegistry.java b/webfx-kit/webfx-kit-javafxgraphics-peers/src/main/java/dev/webfx/kit/mapper/peers/javafxgraphics/NodePeerFactoryRegistry.java index 804b777ac..851e468a6 100644 --- a/webfx-kit/webfx-kit-javafxgraphics-peers/src/main/java/dev/webfx/kit/mapper/peers/javafxgraphics/NodePeerFactoryRegistry.java +++ b/webfx-kit/webfx-kit-javafxgraphics-peers/src/main/java/dev/webfx/kit/mapper/peers/javafxgraphics/NodePeerFactoryRegistry.java @@ -1,7 +1,6 @@ package dev.webfx.kit.mapper.peers.javafxgraphics; import dev.webfx.platform.console.Console; -import dev.webfx.platform.util.function.Factory; import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.layout.Region; @@ -9,18 +8,19 @@ import java.util.HashMap; import java.util.Map; import java.util.function.Function; +import java.util.function.Supplier; /** * @author Bruno Salmon */ public final class NodePeerFactoryRegistry { - private final static Map, Factory> nodePeerFactories = new HashMap<>(); + private final static Map, Supplier> nodePeerFactories = new HashMap<>(); private final static Map, Function> customTagNodePeerFactories = new HashMap<>(); private static Function> defaultRegionFactory; private static Function> defaultGroupFactory; - public static > void registerNodePeerFactory(Class nodeClass, Factory factory) { + public static > void registerNodePeerFactory(Class nodeClass, Supplier factory) { nodePeerFactories.put(nodeClass, factory); } @@ -54,9 +54,9 @@ public static > V createNodePeer(N node) { if (customTagFactory != null) return (V) customTagFactory.apply(customTag); } - Factory factory = nodePeerFactories.get(nodeClass); + Supplier factory = nodePeerFactories.get(nodeClass); if (factory != null) - return (V) factory.create(); + return (V) factory.get(); // If not found, it can be because it's a derived class // For regions and groups, we delegate this search to their default factory if (node instanceof Region && defaultRegionFactory != null) @@ -73,7 +73,7 @@ public static > V createNodePeer(N node) { } factory = nodePeerFactories.get(nodeClass); if (factory != null) - return (V) factory.create(); + return (V) factory.get(); } // If still not found, we return null after logging the problem Console.log("WARNING: No NodePeer factory registered for " + node.getClass());