Changeset 6524 in josm
- Timestamp:
- 2013-12-24T21:12:40+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
r6380 r6524 8 8 import java.net.URL; 9 9 import java.net.URLEncoder; 10 import java.util.ArrayList; 10 11 import java.util.Collection; 11 12 import java.util.concurrent.Future; … … 29 30 import org.openstreetmap.josm.io.OsmTransferCanceledException; 30 31 import org.openstreetmap.josm.io.OsmTransferException; 32 import org.openstreetmap.josm.tools.Utils; 31 33 import org.xml.sax.SAXException; 32 34 … … 322 324 if (urlString.matches(PATTERN_OSM_API_URL)) { 323 325 // TODO: proper i18n after stabilization 324 String message = "<ul><li>"+tr("OSM Server URL:") + " " + url.getHost() + "</li><li>" + 325 tr("Command")+": "+url.getPath()+"</li>"; 326 Collection<String> items = new ArrayList<String>(); 327 items.add(tr("OSM Server URL:") + " " + url.getHost()); 328 items.add(tr("Command")+": "+url.getPath()); 326 329 if (url.getQuery() != null) { 327 message += "<li>" + tr("Request details: {0}", url.getQuery().replaceAll(",\\s*", ", ")) + "</li>"; 328 } 329 message += "</ul>"; 330 return message; 330 items.add(tr("Request details: {0}", url.getQuery().replaceAll(",\\s*", ", "))); 331 } 332 return Utils.joinAsHtmlUnorderedList(items); 331 333 } 332 334 // TODO: other APIs -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java
r6336 r6524 34 34 import org.openstreetmap.josm.tools.ExceptionUtil; 35 35 import org.openstreetmap.josm.tools.ImageProvider; 36 import org.openstreetmap.josm.tools.Utils; 36 37 37 38 /** … … 257 258 } 258 259 if (!errors.isEmpty()) { 259 final StringBuilder sb = new StringBuilder();260 final Collection<String> items = new ArrayList<String>(); 260 261 for (Object error : errors) { 261 262 if (error instanceof String) { 262 sb.append("<li>").append(error).append("</li>").append("<br>");263 items.add((String) error); 263 264 } else if (error instanceof Exception) { 264 sb.append("<li>").append(ExceptionUtil.explainException((Exception) error)).append("</li>") 265 .append("<br>"); 265 items.add(ExceptionUtil.explainException((Exception) error)); 266 266 } 267 267 } 268 sb.insert(0, "<ul>");269 sb.append("</ul>");270 268 271 269 GuiHelper.runInEDT(new Runnable() { … … 273 271 public void run() { 274 272 JOptionPane.showMessageDialog(Main.parent, "<html>" 275 + tr("The following errors occurred during mass download: {0}", sb.toString()) + "</html>", 273 + tr("The following errors occurred during mass download: {0}", 274 Utils.joinAsHtmlUnorderedList(items)) + "</html>", 276 275 tr("Errors during download"), JOptionPane.ERROR_MESSAGE); 277 276 } -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/PostDownloadHandler.java
r6084 r6524 5 5 6 6 import java.util.ArrayList; 7 import java.util.Collection; 7 8 import java.util.LinkedHashSet; 8 9 import java.util.List; … … 15 16 import org.openstreetmap.josm.gui.ExceptionDialogUtil; 16 17 import org.openstreetmap.josm.tools.ExceptionUtil; 18 import org.openstreetmap.josm.tools.Utils; 17 19 18 20 public class PostDownloadHandler implements Runnable { … … 104 106 // 105 107 if (!errors.isEmpty()) { 106 final StringBuffer sb = new StringBuffer();108 final Collection<String> items = new ArrayList<String>(); 107 109 for (Object error:errors) { 108 110 if (error instanceof String) { 109 sb.append("<li>").append(error).append("</li>").append("<br>");111 items.add((String) error); 110 112 } else if (error instanceof Exception) { 111 sb.append("<li>").append(ExceptionUtil.explainException((Exception)error)).append("</li>").append("<br>");113 items.add(ExceptionUtil.explainException((Exception)error)); 112 114 } 113 115 } 114 sb.insert(0, "<html><ul>");115 sb.append("</ul></html>");116 116 117 117 SwingUtilities.invokeLater(new Runnable() { … … 120 120 JOptionPane.showMessageDialog( 121 121 Main.parent, 122 sb.toString(),122 "<html>"+Utils.joinAsHtmlUnorderedList(items)+"</html>", 123 123 tr("Errors during download"), 124 124 JOptionPane.ERROR_MESSAGE); -
trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
r6429 r6524 189 189 label.setToolTipText("<html>" 190 190 + description 191 + (examples.length > 0 ? ("<ul><li>" + Utils.join("</li><li>", Arrays.asList(examples)) + "</li></ul>") : "")191 + (examples.length > 0 ? Utils.joinAsHtmlUnorderedList(Arrays.asList(examples)) : "") 192 192 + "</html>"); 193 193 } -
trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
r6380 r6524 17 17 import java.util.List; 18 18 import java.util.Map; 19 import java.util.Map.Entry; 19 20 import java.util.Set; 20 import java.util.Map.Entry;21 21 22 22 import javax.swing.Icon; … … 272 272 * <li>it is untagged (see {@link Node#isTagged()}</li> 273 273 * <li>it is not referred to by other non-deleted primitives outside of <code>primitivesToDelete</code></li> 274 * < ul>274 * </ul> 275 275 * @param layer the layer in whose context primitives are deleted 276 276 * @param primitivesToDelete the primitives to delete -
trunk/src/org/openstreetmap/josm/corrector/ReverseWayNoTagCorrector.java
r6362 r6524 15 15 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; 16 16 import org.openstreetmap.josm.gui.DefaultNameFormatter; 17 import org.openstreetmap.josm.tools.Utils; 17 18 18 19 /** 19 20 * A ReverseWayNoTagCorrector warns about ways that should not be reversed 20 * because their semantic meaning cannot be preserved in that case. 21 * because their semantic meaning cannot be preserved in that case. 21 22 * E.g. natural=coastline, natural=cliff, barrier=retaining_wall cannot be changed. 22 23 * @see ReverseWayTagCorrector for handling of tags that can be modified (oneway=yes, etc.) … … 30 31 31 32 /** 32 * Tags that imply a semantic meaning from the way direction and cannot be changed. 33 * Tags that imply a semantic meaning from the way direction and cannot be changed. 33 34 */ 34 35 public static final TagCollection directionalTags = new TagCollection(Arrays.asList(new Tag[]{ … … 46 47 47 48 /** 48 * Replies the tags that imply a semantic meaning from <code>way</code> direction and cannot be changed. 49 * Replies the tags that imply a semantic meaning from <code>way</code> direction and cannot be changed. 49 50 * @param way The way to look for 50 51 * @return tags that imply a semantic meaning from <code>way</code> direction and cannot be changed … … 68 69 return tags.iterator().next().toString(); 69 70 } else if (tags.size() > 1) { 70 StringBuilder s = new StringBuilder("<ul>"); 71 for (Tag t : tags) { 72 s.append("<li>").append(t).append("</li>"); 73 } 74 s.append("</ul>"); 75 return s.toString(); 71 return Utils.joinAsHtmlUnorderedList(tags); 76 72 } else { 77 73 return ""; -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r6523 r6524 480 480 } 481 481 482 private static String getHtmlList(Collection<String> set) {483 StringBuilder sb = new StringBuilder("<ul>");484 for (String s : set) {485 sb.append("<li>"+s+"</li>");486 }487 return sb.append("</ul>").toString();488 }489 490 482 private void handleProxyErrors() { 491 483 if (proxySelector.hasErrors()) { … … 497 489 ed.setIcon(JOptionPane.WARNING_MESSAGE); 498 490 ed.setContent(tr("JOSM tried to access the following resources:")+ 499 "<br>"+ getHtmlList(proxySelector.getErrorResources())+491 "<br>"+Utils.joinAsHtmlUnorderedList(proxySelector.getErrorResources())+ 500 492 tr("but <b>failed</b> to do so, because of the following proxy errors:")+ 501 "<br>"+ getHtmlList(proxySelector.getErrorMessages())+493 "<br>"+Utils.joinAsHtmlUnorderedList(proxySelector.getErrorMessages())+ 502 494 tr("Would you like to change your proxy settings now ?") 503 495 ); -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMergeModel.java
r6317 r6524 36 36 import org.openstreetmap.josm.gui.widgets.OsmPrimitivesTableModel; 37 37 import org.openstreetmap.josm.tools.CheckParameterUtil; 38 import org.openstreetmap.josm.tools.Utils; 38 39 39 40 /** … … 358 359 sb.append("<html>"); 359 360 sb.append(tr("The following objects could not be copied to the target object<br>because they are deleted in the target dataset:")); 360 sb.append("<ul>"); 361 for (String item: items) { 362 sb.append("<li>").append(item).append("</li>"); 363 } 364 sb.append("</ul>"); 361 sb.append(Utils.joinAsHtmlUnorderedList(items)); 365 362 sb.append("</html>"); 366 363 HelpAwareOptionPane.showOptionDialog( -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolverTable.java
r6084 r6524 47 47 * pressing TAB or ENTER. The action alters the standard navigation path from cell to cell: <ul> 48 48 * <li>it jumps over cells in the first column</li> <li>it automatically add a new empty row 49 * when the user leaves the last cell in the table</li> <ul>49 * when the user leaves the last cell in the table</li></ul> 50 50 * 51 51 * -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolverTable.java
r6084 r6524 49 49 * pressing TAB or ENTER. The action alters the standard navigation path from cell to cell: <ul> 50 50 * <li>it jumps over cells in the first column</li> <li>it automatically add a new empty row 51 * when the user leaves the last cell in the table</li> <ul>51 * when the user leaves the last cell in the table</li></ul> 52 52 * 53 53 * -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTable.java
r6316 r6524 156 156 * pressing TAB or ENTER. The action alters the standard navigation path from cell to cell: <ul> 157 157 * <li>it jumps over cells in the first column</li> <li>it automatically add a new empty row 158 * when the user leaves the last cell in the table</li> <ul>158 * when the user leaves the last cell in the table</li></ul> 159 159 * 160 160 * -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java
r6362 r6524 56 56 * <li>a dedicated version in this {@link History} called the {@link PointInTimeType#REFERENCE_POINT_IN_TIME}</li> 57 57 * <li>another version in this {@link History} called the {@link PointInTimeType#CURRENT_POINT_IN_TIME}</li> 58 * < ul>58 * </ul> 59 59 * {@link HistoryBrowser} always compares the {@link PointInTimeType#REFERENCE_POINT_IN_TIME} with the 60 60 * {@link PointInTimeType#CURRENT_POINT_IN_TIME}. -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
r6456 r6524 63 63 import org.openstreetmap.josm.tools.ExifReader; 64 64 import org.openstreetmap.josm.tools.ImageProvider; 65 import org.openstreetmap.josm.tools.Utils; 65 66 66 67 import com.drew.imaging.jpeg.JpegMetadataReader; … … 221 222 sb.append(errorMessages.iterator().next()); 222 223 } else { 223 sb.append("<ul>"); 224 for (String msg: errorMessages) { 225 sb.append("<li>").append(msg).append("</li>"); 226 } 227 sb.append("/ul>"); 224 sb.append(Utils.joinAsHtmlUnorderedList(errorMessages)); 228 225 } 229 226 sb.append("</html>"); -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginListPanel.java
r6142 r6524 30 30 import org.openstreetmap.josm.plugins.PluginInformation; 31 31 import org.openstreetmap.josm.tools.OpenBrowser; 32 import org.openstreetmap.josm.tools.Utils; 32 33 33 34 public class PluginListPanel extends VerticallyScrollablePanel{ … … 170 171 otherPlugins.size() 171 172 )); 172 sb.append("<ul>"); 173 for (String p: otherPlugins) { 174 sb.append("<li>").append(p).append("</li>"); 175 } 176 sb.append("</ul>").append("</html>"); 173 sb.append(Utils.joinAsHtmlUnorderedList(otherPlugins)); 174 sb.append("</html>"); 177 175 JOptionPane.showMessageDialog( 178 176 parent, -
trunk/src/org/openstreetmap/josm/gui/tagging/TagTable.java
r6321 r6524 2 2 package org.openstreetmap.josm.gui.tagging; 3 3 4 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 … … 45 46 import org.openstreetmap.josm.data.osm.Tag; 46 47 import org.openstreetmap.josm.gui.dialogs.relation.RunnableAction; 47 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;48 48 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList; 49 49 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager; … … 103 103 * <li>it automatically add a new empty row when the user leaves the 104 104 * last cell in the table</li> 105 * < ul>105 * </ul> 106 106 * 107 107 */ -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r6362 r6524 64 64 import org.openstreetmap.josm.tools.I18n; 65 65 import org.openstreetmap.josm.tools.ImageProvider; 66 import org.openstreetmap.josm.tools.Utils; 66 67 67 68 /** … … 411 412 missingRequiredPlugin.size() 412 413 )); 413 sb.append("<ul>"); 414 for (String p: missingRequiredPlugin) { 415 sb.append("<li>").append(p).append("</li>"); 416 } 417 sb.append("</ul>").append("</html>"); 414 sb.append(Utils.joinAsHtmlUnorderedList(missingRequiredPlugin)); 415 sb.append("</html>"); 418 416 JOptionPane.showMessageDialog( 419 417 parent, … … 710 708 "JOSM could not find information about the following plugins:", 711 709 plugins.size())); 712 sb.append("<ul>"); 713 for (String plugin: plugins) { 714 sb.append("<li>").append(plugin).append("</li>"); 715 } 716 sb.append("</ul>"); 710 sb.append(Utils.joinAsHtmlUnorderedList(plugins)); 717 711 sb.append(trn("The plugin is not going to be loaded.", 718 712 "The plugins are not going to be loaded.", -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r6421 r6524 201 201 } 202 202 203 public static String joinAsHtmlUnorderedList(Collection<?> values) { 203 /** 204 * Converts the given iterable collection as an unordered HTML list. 205 * @param values The iterable collection 206 * @return An unordered HTML list 207 */ 208 public static String joinAsHtmlUnorderedList(Iterable<?> values) { 204 209 StringBuilder sb = new StringBuilder(1024); 205 210 sb.append("<ul>");
Note:
See TracChangeset
for help on using the changeset viewer.