Changeset 10638 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2016-07-25T21:19:38+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java
r10634 r10638 19 19 import java.util.Map; 20 20 import java.util.Set; 21 import java.util.stream.Collectors; 21 22 22 23 import org.openstreetmap.josm.Main; … … 42 43 import org.openstreetmap.josm.tools.I18n; 43 44 import org.openstreetmap.josm.tools.Utils; 44 import org.openstreetmap.josm.tools.Utils.Function;45 45 46 46 /** … … 631 631 */ 632 632 public String formatAsHtmlUnorderedList(Collection<? extends OsmPrimitive> primitives, int maxElements) { 633 final Collection<String> displayNames = Utils.transform(primitives, 634 (Function<OsmPrimitive, String>) x -> x.getDisplayName(this)); 633 Collection<String> displayNames = primitives.stream().map(x -> x.getDisplayName(this)).collect(Collectors.toList()); 635 634 return Utils.joinAsHtmlUnorderedList(Utils.limit(displayNames, maxElements, "...")); 636 635 } -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/CombinePrimitiveResolverDialog.java
r10611 r10638 22 22 import java.util.List; 23 23 import java.util.Set; 24 import java.util.stream.Collectors; 24 25 25 26 import javax.swing.AbstractAction; … … 48 49 import org.openstreetmap.josm.tools.CheckParameterUtil; 49 50 import org.openstreetmap.josm.tools.ImageProvider; 51 import org.openstreetmap.josm.tools.StreamUtils; 50 52 import org.openstreetmap.josm.tools.UserCancelException; 51 import org.openstreetmap.josm.tools.Utils;52 import org.openstreetmap.josm.tools.Utils.Function;53 53 import org.openstreetmap.josm.tools.WindowGeometry; 54 54 … … 569 569 final Collection<? extends OsmPrimitive> primitives, 570 570 final TagCollection normalizedTags) throws UserCancelException { 571 String conflicts = Utils.joinAsHtmlUnorderedList(Utils.transform(normalizedTags.getKeysWithMultipleValues(), 572 (Function<String, String>) key -> tr("{0} ({1})", key, Utils.join(tr(", "), Utils.transform(normalizedTags.getValues(key), 573 (Function<String, String>) x -> x == null || x.isEmpty() ? tr("<i>missing</i>") : x))))); 571 String conflicts = normalizedTags.getKeysWithMultipleValues().stream().map( 572 key -> getKeyDescription(key, normalizedTags)).collect(StreamUtils.toHtmlList()); 574 573 String msg = /* for correct i18n of plural forms - see #9110 */ trn("You are about to combine {0} objects, " 575 574 + "but the following tags are used conflictingly:<br/>{1}" … … 594 593 } 595 594 } 595 596 private static String getKeyDescription(String key, TagCollection normalizedTags) { 597 String values = normalizedTags.getValues(key) 598 .stream() 599 .map(x -> ((x == null || x.isEmpty()) ? tr("<i>missing</i>") : x)) 600 .collect(Collectors.joining(tr(", "))); 601 return tr("{0} ({1})", key, values); 602 } 596 603 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/OsmIdSelectionDialog.java
r10611 r10638 13 13 import java.util.Collection; 14 14 import java.util.Collections; 15 import java.util.EnumSet;16 15 import java.util.LinkedList; 17 16 import java.util.List; 18 17 import java.util.Set; 18 import java.util.stream.Collectors; 19 19 20 20 import javax.swing.BorderFactory; … … 39 39 import org.openstreetmap.josm.gui.widgets.OsmPrimitiveTypesComboBox; 40 40 import org.openstreetmap.josm.tools.Utils; 41 import org.openstreetmap.josm.tools.Utils.Function;42 41 43 42 /** … … 204 203 final List<SimplePrimitiveId> ids = SimplePrimitiveId.fuzzyParse(buf); 205 204 if (!ids.isEmpty()) { 206 final String parsedText = Utils.join(", ", Utils.transform(ids,207 (Function<SimplePrimitiveId, String>) x -> x.getType().getAPIName().charAt(0) + String.valueOf(x.getUniqueId())));205 final String parsedText = ids.stream().map(x -> x.getType().getAPIName().charAt(0) + String.valueOf(x.getUniqueId())) 206 .collect(Collectors.joining(", ")); 208 207 tfId.tryToPasteFrom(parsedText); 209 final Set<OsmPrimitiveType> types = EnumSet.copyOf(Utils.transform(ids, 210 (Function<SimplePrimitiveId, OsmPrimitiveType>) x -> x.getType())); 208 final Set<OsmPrimitiveType> types = ids.stream().map(x -> x.getType()).collect(Collectors.toSet()); 211 209 if (types.size() == 1) { 212 210 // select corresponding type -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanel.java
r10611 r10638 17 17 import java.util.List; 18 18 import java.util.Set; 19 import java.util.stream.Collectors; 19 20 20 21 import javax.swing.AbstractAction; … … 53 54 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 54 55 import org.openstreetmap.josm.tools.ImageProvider; 55 import org.openstreetmap.josm.tools.Utils;56 import org.openstreetmap.josm.tools.Utils.Function;57 56 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; 58 57 … … 301 300 @Override 302 301 public void actionPerformed(ActionEvent arg0) { 303 final List<PrimitiveId> primitiveIds = new ArrayList<>(Utils.transform(304 model.getSelectedPrimitives(), (Function<HistoryOsmPrimitive, PrimitiveId>) x -> x.getPrimitiveId()));302 final List<PrimitiveId> primitiveIds = model.getSelectedPrimitives().stream().map(x -> x.getPrimitiveId()) 303 .collect(Collectors.toList()); 305 304 Main.worker.submit(new DownloadPrimitivesWithReferrersTask(false, primitiveIds, true, true, null, null)); 306 305 }
Note:
See TracChangeset
for help on using the changeset viewer.