Class NoteData

java.lang.Object
org.openstreetmap.josm.data.osm.NoteData
All Implemented Interfaces:
Data

public class NoteData extends Object implements Data
Class to hold and perform operations on a set of notes
  • Field Details

  • Constructor Details

    • NoteData

      public NoteData()
      Construct a new note container without notes
      Since:
      14101
    • NoteData

      public NoteData(Collection<Note> notes)
      Construct a new note container with a given list of notes
      Parameters:
      notes - The list of notes to populate the container with
  • Method Details

    • getNotes

      Returns the notes stored in this layer
      Returns:
      collection of notes
    • getSortedNotes

      Returns the notes stored in this layer sorted according to comparator
      Returns:
      sorted collection of notes
    • getSelectedNote

      Returns the currently selected note
      Returns:
      currently selected note
    • setSelectedNote

      public void setSelectedNote(Note note)
      Set a selected note. Causes the dialog to select the note and the note layer to draw the selected note's comments.
      Parameters:
      note - Selected note. Null indicates no selection
    • isModified

      public boolean isModified()
      Return whether or not there are any changes in the note data set. These changes may need to be either uploaded or saved.
      Returns:
      true if local modifications have been made to the note data set. False otherwise.
    • mergeFrom

      public void mergeFrom(NoteData from)
      Merge notes from an existing note data.
      Parameters:
      from - existing note data
      Since:
      13437
    • addNotes

      public void addNotes(Collection<Note> newNotes)
      Add notes to the data set. It only adds a note if the ID is not already present
      Parameters:
      newNotes - A list of notes to add
    • createNote

      public void createNote(LatLon location, String text)
      Create a new note
      Parameters:
      location - Location of note
      text - Required comment with which to open the note
    • addCommentToNote

      public void addCommentToNote(Note note, String text)
      Add a new comment to an existing note
      Parameters:
      note - Note to add comment to. Must already exist in the layer
      text - Comment to add
    • closeNote

      public void closeNote(Note note, String text)
      Close note with comment
      Parameters:
      note - Note to close. Must already exist in the layer
      text - Comment to attach to close action, if desired
    • reOpenNote

      public void reOpenNote(Note note, String text)
      Reopen a closed note.
      Parameters:
      note - Note to reopen. Must already exist in the layer
      text - Comment to attach to the reopen action, if desired
    • dataUpdated

      private void dataUpdated()
    • getCurrentUser

      private static User getCurrentUser()
    • updateNotes

      public void updateNotes(Map<Note,Note> updatedNotes)
      Updates notes with new state. Primarily to be used when updating the note layer after uploading note changes to the server.
      Parameters:
      updatedNotes - Map containing the original note as the key and the updated note as the value
    • getCurrentSortMethod

      Returns the current comparator being used to sort the note list.
      Returns:
      The current comparator being used to sort the note list
    • setSortMethod

      public void setSortMethod(Comparator<Note> comparator)
      Set the comparator to be used to sort the note list. Several are available as public static members of this class.
      Parameters:
      comparator - - The Note comparator to sort by
    • addNoteDataUpdateListener

      Adds a listener that listens to node data changes
      Parameters:
      listener - The listener
    • removeNoteDataUpdateListener

      Removes a listener that listens to node data changes
      Parameters:
      listener - The listener
    • getDataSources

      Description copied from interface: Data
      Returns the collection of data sources.
      Specified by:
      getDataSources in interface Data
      Returns:
      the collection of data sources.
    • addDataSource

      public boolean addDataSource(DataSource source)
      Adds a new data source.
      Parameters:
      source - data source to add
      Returns:
      true if the collection changed as a result of the call
      Since:
      18868