Changeset 14855 in josm


Ignore:
Timestamp:
2019-03-09T14:02:04+01:00 (4 months ago)
Author:
GerdP
Message:

see #17401: Improve performance: Use cached icon in MultipleNameVisitor
Drastically reduces the time to open a tree with thousands of errors

File:
1 edited

Legend:

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

    r14165 r14855  
    2525     */
    2626    public static final IntegerProperty MULTIPLE_NAME_MAX_LENGTH = new IntegerProperty("multiple.name.max.length", 140);
     27    private static final String MULTI_CLASS_NAME = "object";
     28    private static final Icon MULTI_CLASS_ICON = ImageProvider.get("data", MULTI_CLASS_NAME);
    2729
    2830    /** The class name of the combined primitives */
     
    5759                multiplePluralClassname = classNamePlural;
    5860            } else if (!multipleClassname.equals(className)) {
    59                 multipleClassname = "object";
     61                multipleClassname = MULTI_CLASS_NAME;
    6062                multiplePluralClassname = trn("object", "objects", 2);
    6163            }
     
    6567            displayName = name;
    6668        } else {
     69            if (MULTI_CLASS_NAME.equals(multipleClassname)) {
     70                icon = MULTI_CLASS_ICON;
     71            }
    6772            StringBuilder sb = new StringBuilder().append(size).append(' ').append(trn(multipleClassname, multiplePluralClassname, size));
    6873            if (multipleName.length() > 0) {
     
    96101     */
    97102    public Icon getIcon() {
    98         if (size <= 1)
    99             return icon;
    100         else
    101             return ImageProvider.get("data", multipleClassname);
     103        return icon;
    102104    }
    103105
Note: See TracChangeset for help on using the changeset viewer.