Skip to content

Commit

Permalink
Allow feedback from select boxes on upload
Browse files Browse the repository at this point in the history
Signed-off-by: Taylor Smock <[email protected]>
  • Loading branch information
tsmock committed Mar 2, 2023
1 parent 1f818b8 commit f53c297
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ private static void updateSelections(HTMLDocument doc, Task task) {
* @param doc The document to parse
* @return The selected options
*/
static Map<String, Option> getSelections(HTMLDocument doc) {
public static Map<String, Option> getSelections(HTMLDocument doc) {
final var selectionMap = new TreeMap<String, Option>();
final var selectIterator = doc.getIterator(HTML.Tag.SELECT);
while (selectIterator.isValid()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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)));
}
}
}
Expand Down

0 comments on commit f53c297

Please sign in to comment.