Package org.openstreetmap.josm.data.osm
Class NoteData
java.lang.Object
org.openstreetmap.josm.data.osm.NoteData
- All Implemented Interfaces:
Data
Class to hold and perform operations on a set of notes
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA listener that can be informed on note data changes. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Comparator<Note>private final Set<DataSource>private final ListenerList<NoteData.NoteDataUpdateListener>private longprivate Note -
Constructor Summary
ConstructorsConstructorDescriptionNoteData()Construct a new note container without notesNoteData(Collection<Note> notes) Construct a new note container with a given list of notes -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCommentToNote(Note note, String text) Add a new comment to an existing notebooleanaddDataSource(DataSource source) Adds a new data source.voidAdds a listener that listens to node data changesvoidaddNotes(Collection<Note> newNotes) Add notes to the data set.voidClose note with commentvoidcreateNote(LatLon location, String text) Create a new noteprivate voidReturns the current comparator being used to sort the note list.private static UserReturns the collection of data sources.getNotes()Returns the notes stored in this layerReturns the currently selected noteReturns the notes stored in this layer sorted according tocomparatorbooleanReturn whether or not there are any changes in the note data set.voidMerge notes from an existing note data.voidRemoves a listener that listens to node data changesvoidreOpenNote(Note note, String text) Reopen a closed note.voidsetSelectedNote(Note note) Set a selected note.voidsetSortMethod(Comparator<Note> comparator) Set the comparator to be used to sort the note list.voidupdateNotes(Map<Note, Note> updatedNotes) Updates notes with new state.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openstreetmap.josm.data.Data
getDataSourceArea, getDataSourceBounds
-
Field Details
-
newNoteId
-
noteList
-
selectedNote
-
comparator
-
listeners
-
dataSourceSet
-
-
Constructor Details
-
NoteData
public NoteData()Construct a new note container without notes- Since:
- 14101
-
NoteData
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 tocomparator- Returns:
- sorted collection of notes
-
getSelectedNote
Returns the currently selected note- Returns:
- currently selected note
-
setSelectedNote
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
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
Merge notes from an existing note data.- Parameters:
from- existing note data- Since:
- 13437
-
addNotes
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
Create a new note- Parameters:
location- Location of notetext- Required comment with which to open the note
-
addCommentToNote
Add a new comment to an existing note- Parameters:
note- Note to add comment to. Must already exist in the layertext- Comment to add
-
closeNote
Close note with comment- Parameters:
note- Note to close. Must already exist in the layertext- Comment to attach to close action, if desired
-
reOpenNote
Reopen a closed note.- Parameters:
note- Note to reopen. Must already exist in the layertext- Comment to attach to the reopen action, if desired
-
dataUpdated
-
getCurrentUser
-
updateNotes
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
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:DataReturns the collection of data sources.- Specified by:
getDataSourcesin interfaceData- Returns:
- the collection of data sources.
-
addDataSource
Adds a new data source.- Parameters:
source- data source to add- Returns:
trueif the collection changed as a result of the call- Since:
- 18868
-