Package org.openstreetmap.josm.data.osm
Class NoteData
- java.lang.Object
-
- org.openstreetmap.josm.data.osm.NoteData
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
NoteData.NoteDataUpdateListener
A listener that can be informed on note data changes.
-
Field Summary
Fields Modifier and Type Field Description private java.util.Comparator<Note>
comparator
private java.util.Set<DataSource>
dataSourceSet
private ListenerList<NoteData.NoteDataUpdateListener>
listeners
private long
newNoteId
private Storage<Note>
noteList
private Note
selectedNote
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCommentToNote(Note note, java.lang.String text)
Add a new comment to an existing noteboolean
addDataSource(DataSource source)
Adds a new data source.void
addNoteDataUpdateListener(NoteData.NoteDataUpdateListener listener)
Adds a listener that listens to node data changesvoid
addNotes(java.util.Collection<Note> newNotes)
Add notes to the data set.void
closeNote(Note note, java.lang.String text)
Close note with commentvoid
createNote(LatLon location, java.lang.String text)
Create a new noteprivate void
dataUpdated()
java.util.Comparator<Note>
getCurrentSortMethod()
Returns the current comparator being used to sort the note list.private static User
getCurrentUser()
java.util.Collection<DataSource>
getDataSources()
Returns the collection of data sources.java.util.Collection<Note>
getNotes()
Returns the notes stored in this layerNote
getSelectedNote()
Returns the currently selected notejava.util.Collection<Note>
getSortedNotes()
Returns the notes stored in this layer sorted according tocomparator
boolean
isModified()
Return whether or not there are any changes in the note data set.void
mergeFrom(NoteData from)
Merge notes from an existing note data.void
removeNoteDataUpdateListener(NoteData.NoteDataUpdateListener listener)
Removes a listener that listens to node data changesvoid
reOpenNote(Note note, java.lang.String text)
Reopen a closed note.void
setSelectedNote(Note note)
Set a selected note.void
setSortMethod(java.util.Comparator<Note> comparator)
Set the comparator to be used to sort the note list.void
updateNotes(java.util.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, wait
-
Methods inherited from interface org.openstreetmap.josm.data.Data
getDataSourceArea, getDataSourceBounds
-
-
-
-
Field Detail
-
newNoteId
private long newNoteId
-
selectedNote
private Note selectedNote
-
comparator
private java.util.Comparator<Note> comparator
-
listeners
private final ListenerList<NoteData.NoteDataUpdateListener> listeners
-
dataSourceSet
private final java.util.Set<DataSource> dataSourceSet
-
-
Method Detail
-
getNotes
public java.util.Collection<Note> getNotes()
Returns the notes stored in this layer- Returns:
- collection of notes
-
getSortedNotes
public java.util.Collection<Note> getSortedNotes()
Returns the notes stored in this layer sorted according tocomparator
- Returns:
- sorted collection of notes
-
getSelectedNote
public Note 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(java.util.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, java.lang.String text)
Create a new note- Parameters:
location
- Location of notetext
- Required comment with which to open the note
-
addCommentToNote
public void addCommentToNote(Note note, java.lang.String text)
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
public void closeNote(Note note, java.lang.String text)
Close note with comment- Parameters:
note
- Note to close. Must already exist in the layertext
- Comment to attach to close action, if desired
-
reOpenNote
public void reOpenNote(Note note, java.lang.String text)
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
private void dataUpdated()
-
getCurrentUser
private static User getCurrentUser()
-
updateNotes
public void updateNotes(java.util.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
public java.util.Comparator<Note> 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(java.util.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
public void addNoteDataUpdateListener(NoteData.NoteDataUpdateListener listener)
Adds a listener that listens to node data changes- Parameters:
listener
- The listener
-
removeNoteDataUpdateListener
public void removeNoteDataUpdateListener(NoteData.NoteDataUpdateListener listener)
Removes a listener that listens to node data changes- Parameters:
listener
- The listener
-
getDataSources
public java.util.Collection<DataSource> getDataSources()
Description copied from interface:Data
Returns the collection of data sources.- Specified by:
getDataSources
in interfaceData
- 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
-
-