Ignore:
Timestamp:
2015-04-18T22:37:12+02:00 (9 years ago)
Author:
simon04
Message:

see #10980 - Note download: update already downloaded non-modified notes; use Storage for internal storage

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
2 edited

Legend:

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

    r8212 r8224  
    1313import java.util.ArrayList;
    1414import java.util.Arrays;
     15import java.util.Collection;
    1516import java.util.List;
    1617
     
    186187            noteData = ((NoteLayer)newLayer).getNoteData();
    187188            model.setData(noteData.getNotes());
    188             setNoteList(noteData.getNotes());
     189            setNotes(noteData.getSortedNotes());
    189190        }
    190191    }
     
    193194    public void layerRemoved(Layer oldLayer) {
    194195        if (oldLayer instanceof NoteLayer) {
    195             if (Main.isDebugEnabled()) {
    196                 Main.debug("note layer removed. Clearing everything");
    197             }
    198196            noteData = null;
    199197            model.clearData();
     
    209207     * @param noteList List of notes to display
    210208     */
    211     public void setNoteList(List<Note> noteList) {
     209    public void setNotes(Collection<Note> noteList) {
    212210        model.setData(noteList);
    213211        updateButtonStates();
     
    265263
    266264        public NoteTableModel() {
    267             data = new ArrayList<Note>();
     265            data = new ArrayList<>();
    268266        }
    269267
     
    281279        }
    282280
    283         public void setData(List<Note> noteList) {
     281        public void setData(Collection<Note> noteList) {
    284282            data.clear();
    285283            data.addAll(noteList);
     
    315313            dialog.showNoteDialog(tr("Add comment to note:"), NotesDialog.ICON_COMMENT);
    316314            if (dialog.getValue() != 1) {
    317                 Main.debug("User aborted note reopening");
    318315                return;
    319316            }
     
    337334            dialog.showNoteDialog(tr("Close note with message:"), NotesDialog.ICON_CLOSED);
    338335            if (dialog.getValue() != 1) {
    339                 Main.debug("User aborted note closing");
    340336                return;
    341337            }
     
    377373            dialog.showNoteDialog(tr("Reopen note with message:"), NotesDialog.ICON_OPEN);
    378374            if (dialog.getValue() != 1) {
    379                 Main.debug("User aborted note reopening");
    380375                return;
    381376            }
  • trunk/src/org/openstreetmap/josm/gui/layer/NoteLayer.java

    r8214 r8224  
    1313import java.text.DateFormat;
    1414import java.util.ArrayList;
     15import java.util.Collection;
     16import java.util.Collections;
    1517import java.util.List;
    1618
     
    5658     * @param name The name of the layer. Typically "Notes"
    5759     */
    58     public NoteLayer(List<Note> notes, String name) {
     60    public NoteLayer(Collection<Note> notes, String name) {
    5961        super(name);
    6062        noteData = new NoteData(notes);
     
    6365    /** Convenience constructor that creates a layer with an empty note list */
    6466    public NoteLayer() {
    65         super(tr("Notes"));
    66         noteData = new NoteData();
     67        this(Collections.<Note>emptySet(), tr("Notes"));
    6768    }
    6869
     
    9798    @Override
    9899    public boolean requiresSaveToFile() {
    99         Main.debug("associated notes file: " + getAssociatedFile());
    100100        return getAssociatedFile() != null && isModified();
    101101    }
Note: See TracChangeset for help on using the changeset viewer.