Ignore:
Timestamp:
2011-04-15T12:26:55+02:00 (13 years ago)
Author:
stoecker
Message:

improve validator user interface

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/upload/ValidateUploadHook.java

    r3745 r4023  
    2121import org.openstreetmap.josm.data.validation.TestError;
    2222import org.openstreetmap.josm.data.validation.util.AgregatePrimitivesVisitor;
     23import org.openstreetmap.josm.gui.ExtendedDialog;
    2324import org.openstreetmap.josm.gui.dialogs.validator.ValidatorTreePanel;
    2425import org.openstreetmap.josm.gui.preferences.ValidatorPreference;
     26import org.openstreetmap.josm.gui.widgets.HtmlPanel;
    2527import org.openstreetmap.josm.tools.GBC;
    2628
     
    108110        ValidatorTreePanel errorPanel = new ValidatorTreePanel(errors);
    109111        errorPanel.expandAll();
    110         p.add(new JScrollPane(errorPanel), GBC.eol());
     112        HtmlPanel pnlMessage = new HtmlPanel();
     113        pnlMessage.setText("<html><body>"
     114                + tr("The following are results of automatic validation. Try fixing"
     115                + " these, but be careful( don't destray valid data)."
     116                + " When in doubt ignore them.<br>When you"
     117                + " cancel this dialog, you can find the entries in the validator"
     118                + " side panel to inspect them.")
     119                + "<table align=\"center\">"
     120                + "<tr><td align=\"left\"><b>"+tr("Errors")
     121                + "&nbsp;</b></td><td align=\"left\">"
     122                + tr("Usually this should be fixed.")+"</td></tr>"
     123                + "<tr><td align=\"left\"><b>"+tr("Warnings")
     124                + "&nbsp;</b></td><td align=\"left\">"
     125                + tr("Fix these when possible.")+"</td></tr>"
     126                + "<tr><td align=\"left\"><b>"+tr("Other")
     127                + "&nbsp;</b></td><td align=\"left\">"
     128                + tr("Informational warnings, expect many false entries.")+"</td></tr>"
     129                + "</table>"
     130        );
     131        p.add(pnlMessage, GBC.eol());
     132        p.add(new JScrollPane(errorPanel), GBC.eol().fill(GBC.BOTH));
    111133
    112         int res = JOptionPane.showConfirmDialog(Main.parent, p,
    113             tr("Data with errors. Upload anyway?"),
    114             JOptionPane.YES_NO_OPTION,
    115             JOptionPane.QUESTION_MESSAGE);
    116         if (res == JOptionPane.NO_OPTION) {
     134        ExtendedDialog ed = new ExtendedDialog(Main.parent,
     135                tr("Supicious data found. Upload anyway?"),
     136                new String[] {tr("Continue upload"), tr("Cancel")});
     137        ed.setButtonIcons(new String[] {"ok.png", "cancel.png"});
     138        ed.setContent(p);
     139        ed.showDialog();
     140
     141        if(ed.getValue() != 1) {
    117142            OsmValidator.initializeErrorLayer();
    118143            Main.map.validatorDialog.unfurlDialog();
    119144            Main.map.validatorDialog.tree.setErrors(errors);
    120145            Main.main.getCurrentDataSet().fireSelectionChanged();
     146            return false;
    121147        }
    122         return res == JOptionPane.YES_OPTION;
     148        return true;
    123149    }
    124150}
Note: See TracChangeset for help on using the changeset viewer.