Changeset 9356 in josm


Ignore:
Timestamp:
2016-01-09T18:27:03+01:00 (4 years ago)
Author:
simon04
Message:

see #7943 - OAuth: Display instructions for for non-standard OSM APIs

Warning: Since you are using not the default OSM API, make sure to set
an OAuth consumer key and secret in the Advanced OAuth parameters.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/oauth/OAuthAuthorizationWizard.java

    r9352 r9356  
    3636import javax.swing.event.HyperlinkEvent;
    3737import javax.swing.event.HyperlinkListener;
     38import javax.swing.text.html.HTMLEditorKit;
    3839
    3940import org.openstreetmap.josm.Main;
     
    4849import org.openstreetmap.josm.gui.util.GuiHelper;
    4950import org.openstreetmap.josm.gui.widgets.HtmlPanel;
     51import org.openstreetmap.josm.io.OsmApi;
    5052import org.openstreetmap.josm.tools.CheckParameterUtil;
    5153import org.openstreetmap.josm.tools.ImageProvider;
     
    152154        cbAuthorisationProcedure.addItemListener(new AuthorisationProcedureChangeListener());
    153155        lbl.setLabelFor(cbAuthorisationProcedure);
     156
     157        if (!OsmApi.DEFAULT_API_URL.equals(apiUrl)) {
     158            gc.gridy = 3;
     159            gc.gridwidth = 2;
     160            gc.gridx = 0;
     161            final HtmlPanel pnlWarning = new HtmlPanel();
     162            final HTMLEditorKit kit = (HTMLEditorKit) pnlWarning.getEditorPane().getEditorKit();
     163            kit.getStyleSheet().addRule(".warning-body {"
     164                    + "background-color:rgb(253,255,221);padding: 10pt; "
     165                    + "border-color:rgb(128,128,128);border-style: solid;border-width: 1px;}");
     166            kit.getStyleSheet().addRule("ol {margin-left: 1cm}");
     167            pnlWarning.setText("<html><body>"
     168                    + "<p class=\"warning-body\">"
     169                    + tr("<strong>Warning:</strong> Since you are using not the default OSM API, " +
     170                    "make sure to set an OAuth consumer key and secret in the <i>Advanced OAuth parameters</i>.")
     171                    + "</p>"
     172                    + "</body></html>");
     173            pnl.add(pnlWarning, gc);
     174        }
     175
    154176        return pnl;
    155177    }
Note: See TracChangeset for help on using the changeset viewer.