Changeset 7312 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2014-07-15T16:48:46+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMSLayerPanel.java
r7015 r7312 25 25 import org.openstreetmap.josm.data.imagery.ImageryInfo; 26 26 import org.openstreetmap.josm.gui.bbox.SlippyMapBBoxChooser; 27 import org.openstreetmap.josm.gui.util.GuiHelper; 27 28 import org.openstreetmap.josm.gui.widgets.JosmTextArea; 28 29 import org.openstreetmap.josm.io.imagery.WMSImagery; … … 86 87 tr("WMS Error"), JOptionPane.ERROR_MESSAGE); 87 88 } catch (WMSImagery.WMSGetCapabilitiesException ex) { 88 JOptionPane.showMessageDialog(getParent(), tr("Could not parse WMS layer list."), 89 tr("WMS Error"), JOptionPane.ERROR_MESSAGE); 90 Main.error("Could not parse WMS layer list. Incoming data:\n"+ex.getIncomingData()); 89 String incomingData = ex.getIncomingData().trim(); 90 String title = tr("WMS Error"); 91 String message = tr("Could not parse WMS layer list."); 92 Main.error("Could not parse WMS layer list. Incoming data:\n"+incomingData); 93 if (incomingData != null 94 && (incomingData.startsWith("<html>") || incomingData.startsWith("<HTML>")) 95 && (incomingData.endsWith("</html>") || incomingData.endsWith("</HTML>"))) { 96 GuiHelper.notifyUserHtmlError(AddWMSLayerPanel.this, title, message, incomingData); 97 } else { 98 JOptionPane.showMessageDialog(getParent(), message, title, JOptionPane.ERROR_MESSAGE); 99 } 91 100 } 92 101 } -
trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java
r7204 r7312 11 11 import java.awt.Font; 12 12 import java.awt.GraphicsEnvironment; 13 import java.awt.GridBagLayout; 13 14 import java.awt.Image; 14 15 import java.awt.Stroke; … … 29 30 import javax.swing.Icon; 30 31 import javax.swing.ImageIcon; 32 import javax.swing.JLabel; 31 33 import javax.swing.JOptionPane; 34 import javax.swing.JPanel; 32 35 import javax.swing.JScrollPane; 33 36 import javax.swing.SwingUtilities; … … 36 39 import org.openstreetmap.josm.Main; 37 40 import org.openstreetmap.josm.gui.ExtendedDialog; 41 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 42 import org.openstreetmap.josm.tools.GBC; 38 43 import org.openstreetmap.josm.tools.ImageProvider; 39 44 … … 132 137 133 138 /** 139 * Warns user about a dangerous action requiring confirmation. 140 * @param title Title of dialog 141 * @param content Content of dialog 142 * @param baseActionIcon Unused? FIXME why is this parameter unused? 143 * @param continueToolTip Tooltip to display for "continue" button 134 144 * @return true if the user wants to cancel, false if they want to continue 135 145 */ … … 150 160 dlg.setCancelButton(1); 151 161 return dlg.showDialog().getValue() != 2; 162 } 163 164 /** 165 * Notifies user about an error received from an external source as an HTML page. 166 * @param parent Parent component 167 * @param title Title of dialog 168 * @param message Message displayed at the top of the dialog 169 * @param html HTML content to display (real error message) 170 * @since 7312 171 */ 172 public static final void notifyUserHtmlError(Component parent, String title, String message, String html) { 173 JPanel p = new JPanel(new GridBagLayout()); 174 p.add(new JLabel(message), GBC.eol()); 175 p.add(new JLabel(tr("Received error page:")), GBC.eol()); 176 JScrollPane sp = embedInVerticalScrollPane(new HtmlPanel(html)); 177 sp.setPreferredSize(new Dimension(640, 240)); 178 p.add(sp, GBC.eol().fill(GBC.BOTH)); 179 180 ExtendedDialog ed = new ExtendedDialog(parent, title, new String[] {tr("OK")}); 181 ed.setButtonIcons(new String[] {"ok.png"}); 182 ed.setContent(p); 183 ed.showDialog(); 152 184 } 153 185
Note:
See TracChangeset
for help on using the changeset viewer.