Ticket #11275: josm_patch_multiselect_rev_2.diff

File josm_patch_multiselect_rev_2.diff, 3.2 KB (added by brycenesbitt, 9 years ago)

Enhanced patch, shows value if there is just unset and one value.

  • src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesCellRenderer.java

     
    33
    44import static org.openstreetmap.josm.tools.I18n.marktr;
    55import static org.openstreetmap.josm.tools.I18n.tr;
     6import static org.openstreetmap.josm.tools.I18n.trn;
    67
    78import java.awt.Color;
    89import java.awt.Component;
    910import java.awt.Font;
     11import java.util.Iterator;
    1012import java.util.Map;
     13import java.util.Set;
    1114
    1215import javax.swing.JLabel;
    1316import javax.swing.JTable;
     
    5053                str = (String) value;
    5154            } else if (value instanceof Map<?, ?>) {
    5255                Map<?, ?> v = (Map<?, ?>) value;
    53                 if (v.size() != 1) {
    54                     str=tr("<different>");
     56                if (v.size() != 1) {    // Multiple values: give user a short summary of the values
     57                    Integer blank_count;
     58                    Integer other_count;
     59                    if (v.get("") == null) {
     60                        blank_count = 0;
     61                        other_count = v.size();
     62                    } else {
     63                        blank_count = (Integer)v.get("");
     64                        other_count = v.size()-1;
     65                    }
     66                    String temp1 = trn("<{0} unset, ", "<{0} unset, ", blank_count, blank_count);
     67                    String temp2 = "";
     68                    if (other_count == 1) {
     69                        for (Map.Entry<?, ?> entry : v.entrySet()) { // Find the non-blank value in the map
     70                            if ( entry.getKey() != "") {
     71                                temp2 = entry.getValue().toString() + " '" + entry.getKey() + "'>";
     72                            }
     73                        }
     74                    } else {
     75                        temp2=tr ("{0} other values>",  other_count);
     76                    }
     77                    str=temp1 + temp2;
    5578                    c.setFont(c.getFont().deriveFont(Font.ITALIC));
    56                 } else {
     79
     80                } else {                // One value: display the value
    5781                    final Map.Entry<?, ?> entry = v.entrySet().iterator().next();
    5882                    str = (String) entry.getKey();
    5983                }
  • src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

     
    703703        }
    704704
    705705        if(tagData.getRowCount() != 0 || membershipData.getRowCount() != 0) {
    706             setTitle(tr("Tags: {0} / Memberships: {1}",
    707                     tagData.getRowCount(), membershipData.getRowCount()));
     706            setTitle(tr("Objects: {2} / Tags: {0} / Memberships: {1}",
     707                    tagData.getRowCount(), membershipData.getRowCount(), newSel.size() ));
    708708        } else {
    709709            setTitle(tr("Tags / Memberships"));
    710710        }