Changeset 14165 in josm for trunk/src/org
- Timestamp:
- 2018-08-19T04:34:42+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/util/MultipleNameVisitor.java
r11553 r14165 5 5 6 6 import java.util.Collection; 7 import java.util.Optional;8 7 9 8 import javax.swing.Icon; 10 9 import javax.swing.JLabel; 11 10 11 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 12 12 import org.openstreetmap.josm.data.osm.OsmPrimitive; 13 import org.openstreetmap.josm.data.preferences.IntegerProperty; 13 14 import org.openstreetmap.josm.tools.ImageProvider; 14 15 … … 23 24 * Maximum displayed length, in characters. 24 25 */ 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); 26 27 27 28 /** The class name of the combined primitives */ … … 43 44 multipleClassname = null; 44 45 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()) { 47 48 if (multipleName.length() > 0) { 48 49 multipleName.append(", "); … … 67 68 if (multipleName.length() > 0) { 68 69 sb.append(": "); 69 if (multipleName.length() <= MULTIPLE_NAME_MAX_LENGTH ) {70 if (multipleName.length() <= MULTIPLE_NAME_MAX_LENGTH.get()) { 70 71 sb.append(multipleName); 71 72 } else { 72 sb.append(multipleName.substring(0, MULTIPLE_NAME_MAX_LENGTH )).append("...");73 sb.append(multipleName.substring(0, MULTIPLE_NAME_MAX_LENGTH.get())).append("..."); 73 74 } 74 75 }
Note:
See TracChangeset
for help on using the changeset viewer.