From 2b9b98b8890121222bc29f32074a7a8b41584a57 Mon Sep 17 00:00:00 2001 From: jmr3366 Date: Fri, 18 Oct 2024 08:24:03 -0400 Subject: [PATCH 1/7] #4961 NPE on mouse off (needs testing, I can't validate) #4954 User Overlays break with new statsheets --- .../maptool/client/ui/sheet/stats/StatSheet.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/rptools/maptool/client/ui/sheet/stats/StatSheet.java b/src/main/java/net/rptools/maptool/client/ui/sheet/stats/StatSheet.java index 331e168acc..07901897f9 100644 --- a/src/main/java/net/rptools/maptool/client/ui/sheet/stats/StatSheet.java +++ b/src/main/java/net/rptools/maptool/client/ui/sheet/stats/StatSheet.java @@ -17,7 +17,6 @@ import java.io.IOException; import java.net.URL; import javafx.application.Platform; -import net.rptools.maptool.client.AppConstants; import net.rptools.maptool.client.MapTool; import net.rptools.maptool.model.Token; import net.rptools.maptool.model.sheet.stats.StatSheetContext; @@ -51,15 +50,15 @@ public void setContent(Token token, String content, URL entry, StatSheetLocation var overlay = MapTool.getFrame() .getOverlayPanel() - .getOverlay(AppConstants.INTERNAL_MAP_UNDER_POINTER_HTML_OVERLAY_NAME); + .getOverlay("MapTool Internal Map Under Pointer Overlay"); if (overlay != null) { overlay.updateContents(output, true); } else { MapTool.getFrame() .getOverlayPanel() .showOverlay( - AppConstants.INTERNAL_MAP_UNDER_POINTER_HTML_OVERLAY_NAME, - Integer.MIN_VALUE, + "MapTool Internal Map Under Pointer Overlay", + Integer.MAX_VALUE, output, null); } @@ -76,8 +75,10 @@ public void clearContent() { var overlay = MapTool.getFrame() .getOverlayPanel() - .getOverlay(AppConstants.INTERNAL_MAP_UNDER_POINTER_HTML_OVERLAY_NAME); - overlay.updateContents("", true); + .getOverlay("MapTool Internal Map Under Pointer Overlay"); + if (overlay != null) { + overlay.updateContents("", true); + } }); } } From 93a52975bfd0174b60213a1fb6a289ac72fb61f3 Mon Sep 17 00:00:00 2001 From: Jmr3366 <100969108+Jmr3366@users.noreply.github.com> Date: Fri, 18 Oct 2024 10:59:38 -0400 Subject: [PATCH 2/7] Update StatSheet.java Reverted usage of AppConstants. --- .../rptools/maptool/client/ui/sheet/stats/StatSheet.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/rptools/maptool/client/ui/sheet/stats/StatSheet.java b/src/main/java/net/rptools/maptool/client/ui/sheet/stats/StatSheet.java index 07901897f9..15277fce7d 100644 --- a/src/main/java/net/rptools/maptool/client/ui/sheet/stats/StatSheet.java +++ b/src/main/java/net/rptools/maptool/client/ui/sheet/stats/StatSheet.java @@ -17,6 +17,7 @@ import java.io.IOException; import java.net.URL; import javafx.application.Platform; +import net.rptools.maptool.client.AppConstants; import net.rptools.maptool.client.MapTool; import net.rptools.maptool.model.Token; import net.rptools.maptool.model.sheet.stats.StatSheetContext; @@ -50,14 +51,14 @@ public void setContent(Token token, String content, URL entry, StatSheetLocation var overlay = MapTool.getFrame() .getOverlayPanel() - .getOverlay("MapTool Internal Map Under Pointer Overlay"); + .getOverlay(AppConstants.INTERNAL_MAP_UNDER_POINTER_HTML_OVERLAY_NAME); if (overlay != null) { overlay.updateContents(output, true); } else { MapTool.getFrame() .getOverlayPanel() .showOverlay( - "MapTool Internal Map Under Pointer Overlay", + AppConstants.INTERNAL_MAP_UNDER_POINTER_HTML_OVERLAY_NAME, Integer.MAX_VALUE, output, null); @@ -75,7 +76,7 @@ public void clearContent() { var overlay = MapTool.getFrame() .getOverlayPanel() - .getOverlay("MapTool Internal Map Under Pointer Overlay"); + .getOverlay(AppConstants.INTERNAL_MAP_UNDER_POINTER_HTML_OVERLAY_NAME); if (overlay != null) { overlay.updateContents("", true); } From a6cd08148f3534a08d3dcb0f3694558fcff9ac6c Mon Sep 17 00:00:00 2001 From: jmr3366 Date: Sun, 20 Oct 2024 12:11:49 -0400 Subject: [PATCH 3/7] #4954 User Overlays break with new statsheets --- .../java/net/rptools/maptool/client/MapTool.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/rptools/maptool/client/MapTool.java b/src/main/java/net/rptools/maptool/client/MapTool.java index 441d8470c6..53d9093693 100644 --- a/src/main/java/net/rptools/maptool/client/MapTool.java +++ b/src/main/java/net/rptools/maptool/client/MapTool.java @@ -107,9 +107,7 @@ import net.rptools.maptool.server.ServerConfig; import net.rptools.maptool.server.ServerPolicy; import net.rptools.maptool.transfer.AssetTransferManager; -import net.rptools.maptool.util.MessageUtil; -import net.rptools.maptool.util.StringUtil; -import net.rptools.maptool.util.UserJvmOptions; +import net.rptools.maptool.util.*; import net.rptools.parser.ParserException; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; @@ -928,6 +926,16 @@ public static void setCampaign(Campaign campaign, GUID defaultRendererId) { MapTool.getFrame().getCampaignPanel().reset(); MapTool.getFrame().getGmPanel().reset(); UserDefinedMacroFunctions.getInstance().handleCampaignLoadMacroEvent(); + Platform.runLater( + () -> { + MapTool.getFrame() + .getOverlayPanel() + .showOverlay( + AppConstants.INTERNAL_MAP_UNDER_POINTER_HTML_OVERLAY_NAME, + Integer.MAX_VALUE, + "", + null); + }); } public static AssetTransferManager getAssetTransferManager() { From 7acb2738932f1814d039752124e18de338b3fbb6 Mon Sep 17 00:00:00 2001 From: jmr3366 Date: Mon, 21 Oct 2024 07:40:10 -0400 Subject: [PATCH 4/7] #4954 User Overlays break with new statsheets --- .../java/net/rptools/maptool/client/MapTool.java | 11 +---------- .../client/ui/htmlframe/HTMLOverlayPanel.java | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/main/java/net/rptools/maptool/client/MapTool.java b/src/main/java/net/rptools/maptool/client/MapTool.java index 53d9093693..baf42a2d1a 100644 --- a/src/main/java/net/rptools/maptool/client/MapTool.java +++ b/src/main/java/net/rptools/maptool/client/MapTool.java @@ -691,6 +691,7 @@ private static void initialize() { chatAutoSave = new ChatAutoSave(); chatAutoSave.setTimeout(AppPreferences.chatAutoSaveTimeInMinutes.get()); AppPreferences.chatAutoSaveTimeInMinutes.onChange(chatAutoSave::setTimeout); + MapTool.getFrame().getOverlayPanel().init(); // TODO: make this more formal when we switch to mina new ServerHeartBeatThread().start(); @@ -926,16 +927,6 @@ public static void setCampaign(Campaign campaign, GUID defaultRendererId) { MapTool.getFrame().getCampaignPanel().reset(); MapTool.getFrame().getGmPanel().reset(); UserDefinedMacroFunctions.getInstance().handleCampaignLoadMacroEvent(); - Platform.runLater( - () -> { - MapTool.getFrame() - .getOverlayPanel() - .showOverlay( - AppConstants.INTERNAL_MAP_UNDER_POINTER_HTML_OVERLAY_NAME, - Integer.MAX_VALUE, - "", - null); - }); } public static AssetTransferManager getAssetTransferManager() { diff --git a/src/main/java/net/rptools/maptool/client/ui/htmlframe/HTMLOverlayPanel.java b/src/main/java/net/rptools/maptool/client/ui/htmlframe/HTMLOverlayPanel.java index f431f7fbe7..2a1297d14b 100644 --- a/src/main/java/net/rptools/maptool/client/ui/htmlframe/HTMLOverlayPanel.java +++ b/src/main/java/net/rptools/maptool/client/ui/htmlframe/HTMLOverlayPanel.java @@ -31,7 +31,9 @@ import javafx.scene.layout.StackPane; import javafx.scene.web.WebView; import javax.swing.*; +import net.rptools.maptool.client.AppConstants; import net.rptools.maptool.client.MapTool; +import net.rptools.maptool.client.swing.MapToolEventQueue; import net.rptools.maptool.client.swing.SwingUtil; import net.rptools.maptool.client.tool.DefaultTool; import net.rptools.maptool.client.tool.Tool; @@ -117,6 +119,20 @@ public ConcurrentSkipListSet getOverlays() { return overlays.clone(); } + public HTMLOverlayManager init() { + MapToolEventQueue.invokeLater( + () -> { + MapTool.getFrame() + .getOverlayPanel() + .showOverlay( + AppConstants.INTERNAL_MAP_UNDER_POINTER_HTML_OVERLAY_NAME, + Integer.MAX_VALUE, + "", + null); + }); + return null; + } + /** * Returns the overlay associated with the name. * From 66ecd2709b8c39c1261e32d37d49a3d657ccffcc Mon Sep 17 00:00:00 2001 From: jmr3366 Date: Mon, 21 Oct 2024 08:07:47 -0400 Subject: [PATCH 5/7] #4954 User Overlays break with new statsheets --- src/main/java/net/rptools/maptool/client/MapTool.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/net/rptools/maptool/client/MapTool.java b/src/main/java/net/rptools/maptool/client/MapTool.java index baf42a2d1a..6be909a1db 100644 --- a/src/main/java/net/rptools/maptool/client/MapTool.java +++ b/src/main/java/net/rptools/maptool/client/MapTool.java @@ -926,6 +926,7 @@ public static void setCampaign(Campaign campaign, GUID defaultRendererId) { AssetManager.updateRepositoryList(); MapTool.getFrame().getCampaignPanel().reset(); MapTool.getFrame().getGmPanel().reset(); + MapTool.getFrame().getOverlayPanel().init(); UserDefinedMacroFunctions.getInstance().handleCampaignLoadMacroEvent(); } From 52c8e27e658ed7453bab766c02e29f1e0db9da4b Mon Sep 17 00:00:00 2001 From: jmr3366 Date: Fri, 1 Nov 2024 16:12:21 -0400 Subject: [PATCH 6/7] Hides internal overlays from `getInfo("client")` --- .../rptools/maptool/client/functions/getInfoFunction.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/rptools/maptool/client/functions/getInfoFunction.java b/src/main/java/net/rptools/maptool/client/functions/getInfoFunction.java index d6ee017d86..d36454ebda 100644 --- a/src/main/java/net/rptools/maptool/client/functions/getInfoFunction.java +++ b/src/main/java/net/rptools/maptool/client/functions/getInfoFunction.java @@ -26,6 +26,7 @@ import java.util.List; import java.util.concurrent.ConcurrentSkipListSet; import javax.swing.*; +import net.rptools.maptool.client.AppConstants; import net.rptools.maptool.client.AppPreferences; import net.rptools.maptool.client.MapTool; import net.rptools.maptool.client.MapToolExpressionParser; @@ -260,7 +261,9 @@ private JsonObject getClientInfo() { ConcurrentSkipListSet registeredOverlays = MapTool.getFrame().getOverlayPanel().getOverlays(); for (HTMLOverlayManager o : registeredOverlays) { - overlays.add(o.getName(), o.getProperties()); + if (!o.getName().startsWith(AppConstants.INTERNAL_FRAME_PREFIX)) { + overlays.add(o.getName(), o.getProperties()); + } } cinfo.add("overlays", overlays); From cb0c4d89a1e30eba5f435977fe05f9b47eaec668 Mon Sep 17 00:00:00 2001 From: jmr3366 Date: Tue, 12 Nov 2024 07:39:48 -0500 Subject: [PATCH 7/7] removed init sorting bool served no immediate purpose --- .../net/rptools/maptool/client/MapTool.java | 2 -- .../client/ui/htmlframe/HTMLOverlayPanel.java | 23 +------------------ 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/src/main/java/net/rptools/maptool/client/MapTool.java b/src/main/java/net/rptools/maptool/client/MapTool.java index 6be909a1db..33e96c68ba 100644 --- a/src/main/java/net/rptools/maptool/client/MapTool.java +++ b/src/main/java/net/rptools/maptool/client/MapTool.java @@ -691,7 +691,6 @@ private static void initialize() { chatAutoSave = new ChatAutoSave(); chatAutoSave.setTimeout(AppPreferences.chatAutoSaveTimeInMinutes.get()); AppPreferences.chatAutoSaveTimeInMinutes.onChange(chatAutoSave::setTimeout); - MapTool.getFrame().getOverlayPanel().init(); // TODO: make this more formal when we switch to mina new ServerHeartBeatThread().start(); @@ -926,7 +925,6 @@ public static void setCampaign(Campaign campaign, GUID defaultRendererId) { AssetManager.updateRepositoryList(); MapTool.getFrame().getCampaignPanel().reset(); MapTool.getFrame().getGmPanel().reset(); - MapTool.getFrame().getOverlayPanel().init(); UserDefinedMacroFunctions.getInstance().handleCampaignLoadMacroEvent(); } diff --git a/src/main/java/net/rptools/maptool/client/ui/htmlframe/HTMLOverlayPanel.java b/src/main/java/net/rptools/maptool/client/ui/htmlframe/HTMLOverlayPanel.java index 2a1297d14b..27ee49a384 100644 --- a/src/main/java/net/rptools/maptool/client/ui/htmlframe/HTMLOverlayPanel.java +++ b/src/main/java/net/rptools/maptool/client/ui/htmlframe/HTMLOverlayPanel.java @@ -31,9 +31,7 @@ import javafx.scene.layout.StackPane; import javafx.scene.web.WebView; import javax.swing.*; -import net.rptools.maptool.client.AppConstants; import net.rptools.maptool.client.MapTool; -import net.rptools.maptool.client.swing.MapToolEventQueue; import net.rptools.maptool.client.swing.SwingUtil; import net.rptools.maptool.client.tool.DefaultTool; import net.rptools.maptool.client.tool.Tool; @@ -119,20 +117,6 @@ public ConcurrentSkipListSet getOverlays() { return overlays.clone(); } - public HTMLOverlayManager init() { - MapToolEventQueue.invokeLater( - () -> { - MapTool.getFrame() - .getOverlayPanel() - .showOverlay( - AppConstants.INTERNAL_MAP_UNDER_POINTER_HTML_OVERLAY_NAME, - Integer.MAX_VALUE, - "", - null); - }); - return null; - } - /** * Returns the overlay associated with the name. * @@ -261,7 +245,6 @@ public void showOverlay(String name, int zOrder, String html, Object frameValue) setVisible(true); Platform.runLater( () -> { - boolean needsSorting = false; HTMLOverlayManager overlayManager = getOverlay(name); if (overlayManager != null) { if ("".equals(html)) { @@ -273,7 +256,6 @@ public void showOverlay(String name, int zOrder, String html, Object frameValue) overlays.remove(overlayManager); overlayManager.setZOrder(zOrder); overlays.add(overlayManager); - needsSorting = true; } } else { overlayManager = new HTMLOverlayManager(name, zOrder); @@ -282,12 +264,9 @@ public void showOverlay(String name, int zOrder, String html, Object frameValue) root.getChildren().add(overlayManager.getWebView()); if (!HTMLFrameFactory.isInternalOnly(overlayManager.getName())) { AppMenuBar.addToOverlayMenu(overlayManager); - needsSorting = true; } } - if (needsSorting) { - sortOverlays(); - } + sortOverlays(); overlayManager.updateContents(html, true); if (frameValue != null) { overlayManager.setValue(frameValue);