public class NoteData extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.Comparator<Note> |
comparator |
static java.util.Comparator<Note> |
DATE_COMPARATOR
Sorts notes strictly by creation date
|
static java.util.Comparator<Note> |
DEFAULT_COMPARATOR
Sorts notes in the following order:
1) Open notes
2) Closed notes
3) New notes
Within each subgroup it sorts by ID
|
static java.util.Comparator<Note> |
LAST_ACTION_COMPARATOR
Sorts notes by the last modified date
|
private long |
newNoteId |
private Storage<Note> |
noteList |
private Note |
selectedNote |
static java.util.Comparator<Note> |
USER_COMPARATOR
Sorts notes by user, then creation date
|
Constructor and Description |
---|
NoteData(java.util.Collection<Note> notes)
Construct a new note container with a given list of notes
|
Modifier and Type | Method and Description |
---|---|
void |
addCommentToNote(Note note,
java.lang.String text)
Add a new comment to an existing note
|
void |
addNotes(java.util.Collection<Note> newNotes)
Add notes to the data set.
|
void |
closeNote(Note note,
java.lang.String text)
Close note with comment
|
void |
createNote(LatLon location,
java.lang.String text)
Create a new note
|
private void |
dataUpdated() |
java.util.Comparator<Note> |
getCurrentSortMethod() |
private static User |
getCurrentUser() |
java.util.Collection<Note> |
getNotes()
Returns the notes stored in this layer
|
Note |
getSelectedNote()
Returns the currently selected note
|
java.util.Collection<Note> |
getSortedNotes()
Returns the notes stored in this layer sorted according to
comparator |
boolean |
isModified()
Return whether or not there are any changes in the note data set.
|
void |
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.
|
private long newNoteId
private Note selectedNote
private java.util.Comparator<Note> comparator
public static final java.util.Comparator<Note> DEFAULT_COMPARATOR
public static final java.util.Comparator<Note> DATE_COMPARATOR
public static final java.util.Comparator<Note> USER_COMPARATOR
public static final java.util.Comparator<Note> LAST_ACTION_COMPARATOR
public java.util.Collection<Note> getNotes()
public java.util.Collection<Note> getSortedNotes()
comparator
public Note getSelectedNote()
public void setSelectedNote(Note note)
note
- Selected note. Null indicates no selectionpublic boolean isModified()
public void addNotes(java.util.Collection<Note> newNotes)
newNotes
- A list of notes to addpublic void createNote(LatLon location, java.lang.String text)
location
- Location of notetext
- Required comment with which to open the notepublic void addCommentToNote(Note note, java.lang.String text)
note
- Note to add comment to. Must already exist in the layertext
- Comment to addpublic void closeNote(Note note, java.lang.String text)
note
- Note to close. Must already exist in the layertext
- Comment to attach to close action, if desiredpublic void reOpenNote(Note note, java.lang.String text)
note
- Note to reopen. Must already exist in the layertext
- Comment to attach to the reopen action, if desiredprivate void dataUpdated()
private static User getCurrentUser()
public void updateNotes(java.util.Map<Note,Note> updatedNotes)
updatedNotes
- Map containing the original note as the key and the updated note as the valuepublic java.util.Comparator<Note> getCurrentSortMethod()
public void setSortMethod(java.util.Comparator<Note> comparator)
comparator
- - The Note comparator to sort by