Changeset 14165 in josm for trunk/src/org


Ignore:
Timestamp:
2018-08-19T04:34:42+02:00 (6 years ago)
Author:
Don-vip
Message:

fix #16652 - validator dialog: display multiple OSM primitives like in other dialogs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/util/MultipleNameVisitor.java

    r11553 r14165  
    55
    66import java.util.Collection;
    7 import java.util.Optional;
    87
    98import javax.swing.Icon;
    109import javax.swing.JLabel;
    1110
     11import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
    1212import org.openstreetmap.josm.data.osm.OsmPrimitive;
     13import org.openstreetmap.josm.data.preferences.IntegerProperty;
    1314import org.openstreetmap.josm.tools.ImageProvider;
    1415
     
    2324     * Maximum displayed length, in characters.
    2425     */
    25     public static final int MULTIPLE_NAME_MAX_LENGTH = 80;
     26    public static final IntegerProperty MULTIPLE_NAME_MAX_LENGTH = new IntegerProperty("multiple.name.max.length", 140);
    2627
    2728    /** The class name of the combined primitives */
     
    4344        multipleClassname = null;
    4445        for (OsmPrimitive osm : data) {
    45             String name = Optional.ofNullable(osm.get("name")).orElseGet(() -> osm.get("ref"));
    46             if (name != null && !name.isEmpty() && multipleName.length() <= MULTIPLE_NAME_MAX_LENGTH) {
     46            String name = osm.getDisplayName(DefaultNameFormatter.getInstance());
     47            if (name != null && !name.isEmpty() && multipleName.length() <= MULTIPLE_NAME_MAX_LENGTH.get()) {
    4748                if (multipleName.length() > 0) {
    4849                    multipleName.append(", ");
     
    6768            if (multipleName.length() > 0) {
    6869                sb.append(": ");
    69                 if (multipleName.length() <= MULTIPLE_NAME_MAX_LENGTH) {
     70                if (multipleName.length() <= MULTIPLE_NAME_MAX_LENGTH.get()) {
    7071                    sb.append(multipleName);
    7172                } else {
    72                     sb.append(multipleName.substring(0, MULTIPLE_NAME_MAX_LENGTH)).append("...");
     73                    sb.append(multipleName.substring(0, MULTIPLE_NAME_MAX_LENGTH.get())).append("...");
    7374                }
    7475            }
Note: See TracChangeset for help on using the changeset viewer.