Changeset 17269 in josm


Ignore:
Timestamp:
2020-10-26T18:20:09+01:00 (5 weeks ago)
Author:
Don-vip
Message:

fix #19993 - handle multiline note comments in notes dialog

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/NotesDialog.java

    r17188 r17269  
    77import java.awt.Component;
    88import java.awt.event.ActionEvent;
     9import java.awt.event.KeyEvent;
    910import java.awt.event.MouseAdapter;
    1011import java.awt.event.MouseEvent;
    11 import java.awt.event.KeyEvent;
    1212import java.text.DateFormat;
    1313import java.util.ArrayList;
     
    5151import org.openstreetmap.josm.tools.ImageProvider;
    5252import org.openstreetmap.josm.tools.OpenBrowser;
     53import org.openstreetmap.josm.tools.Shortcut;
    5354import org.openstreetmap.josm.tools.date.DateUtils;
    54 import org.openstreetmap.josm.tools.Shortcut;
    5555
    5656/**
     
    229229    }
    230230
    231     private static class NoteRenderer implements ListCellRenderer<Note> {
     231    static class NoteRenderer implements ListCellRenderer<Note> {
    232232
    233233        private final DefaultListCellRenderer defaultListCellRenderer = new DefaultListCellRenderer();
     
    242242                JLabel jlabel = (JLabel) comp;
    243243                if (fstComment != null) {
    244                     String text = note.getFirstComment().getText();
    245                     String userName = note.getFirstComment().getUser().getName();
     244                    String text = fstComment.getText();
     245                    String userName = fstComment.getUser().getName();
    246246                    if (userName == null || userName.isEmpty()) {
    247247                        userName = "<Anonymous>";
     
    249249                    String toolTipText = userName + " @ " + dateFormat.format(note.getCreatedAt());
    250250                    jlabel.setToolTipText(toolTipText);
    251                     jlabel.setText(note.getId() + ": " +text);
     251                    jlabel.setText(note.getId() + ": " +text.replace("\n\n", "\n").replace("\n", "; ").replace(":; ", ": "));
    252252                } else {
    253253                    jlabel.setToolTipText(null);
Note: See TracChangeset for help on using the changeset viewer.