From f53c2976cb9c96246190248da07b043ed9f6a3b5 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Thu, 2 Mar 2023 07:59:35 -0700 Subject: [PATCH] Allow feedback from select boxes on upload Signed-off-by: Taylor Smock --- .../maproulette/gui/task/current/CurrentTaskPanel.java | 2 +- .../plugins/maproulette/io/upload/EarlyUploadHook.java | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/openstreetmap/josm/plugins/maproulette/gui/task/current/CurrentTaskPanel.java b/src/main/java/org/openstreetmap/josm/plugins/maproulette/gui/task/current/CurrentTaskPanel.java index 7cc2cff..88180b7 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/maproulette/gui/task/current/CurrentTaskPanel.java +++ b/src/main/java/org/openstreetmap/josm/plugins/maproulette/gui/task/current/CurrentTaskPanel.java @@ -264,7 +264,7 @@ private static void updateSelections(HTMLDocument doc, Task task) { * @param doc The document to parse * @return The selected options */ - static Map getSelections(HTMLDocument doc) { + public static Map getSelections(HTMLDocument doc) { final var selectionMap = new TreeMap(); final var selectIterator = doc.getIterator(HTML.Tag.SELECT); while (selectIterator.isValid()) { diff --git a/src/main/java/org/openstreetmap/josm/plugins/maproulette/io/upload/EarlyUploadHook.java b/src/main/java/org/openstreetmap/josm/plugins/maproulette/io/upload/EarlyUploadHook.java index 0307622..c7d92e9 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/maproulette/io/upload/EarlyUploadHook.java +++ b/src/main/java/org/openstreetmap/josm/plugins/maproulette/io/upload/EarlyUploadHook.java @@ -2,6 +2,7 @@ package org.openstreetmap.josm.plugins.maproulette.io.upload; import static org.openstreetmap.josm.plugins.maproulette.config.MapRouletteConfig.getBaseUrl; +import static org.openstreetmap.josm.plugins.maproulette.gui.task.current.CurrentTaskPanel.getSelections; import static org.openstreetmap.josm.tools.I18n.tr; import java.awt.GridBagLayout; @@ -20,6 +21,7 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSeparator; +import javax.swing.text.html.HTMLDocument; import org.openstreetmap.josm.actions.upload.UploadHook; import org.openstreetmap.josm.data.APIDataSet; @@ -89,12 +91,15 @@ public boolean checkUpload(APIDataSet apiDataSet) { ConditionalOptionPaneUtil.startBulkOperation(PREF_CHECK_IF_FINISHED); for (var task : possibleTasks) { if (ids.containsAll(TaskPrimitives.getPrimitiveIds(task))) { + final var descriptivePanel = createDescriptivePanel(task, apiDataSet); final var didFix = ConditionalOptionPaneUtil.showConfirmationDialog(PREF_CHECK_IF_FINISHED, - MainApplication.getMainFrame(), createDescriptivePanel(task, apiDataSet), + MainApplication.getMainFrame(), descriptivePanel, tr("Did you finish the following MapRoulette Task?"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_OPTION); if (didFix) { - ModifiedObjects.addModifiedTask(new ModifiedTask(task, TaskStatus.FIXED, null, null, null, null)); + final var doc = (HTMLDocument) ((JosmEditorPane) descriptivePanel.getComponent(1)).getDocument(); + ModifiedObjects.addModifiedTask( + new ModifiedTask(task, TaskStatus.FIXED, null, null, null, getSelections(doc))); } } }