private NoteProvider getNoteProvider(boolean changed) { NoteProvider provider = session.get(NoteProvider.class); if (provider == null) { provider = new NoteProvider(); session.set(provider); } else if (changed) { setChanged(); } return provider; }
public void storeNote(String id, String title, String content) { NoteHeader note = getNoteProvider(false).getNote(id); if (note != null) { setChanged(); note.setTitle(title); session.set(id, content); listeners.noteChanced(id); } }
private void setChanged() { session.set(session.get((NoteProvider.class))); }
public String getNoteContent(String id) { return id == null ? null : session.get(id, String.class); }
public void addNote(String title, String content) { String id = getNoteProvider(true).addNote(title, content); session.set(id, content); listeners.noteAdded(id); }