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 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; }
private void setChanged() { session.set(session.get((NoteProvider.class))); }
public void addNote(String title, String content) { String id = getNoteProvider(true).addNote(title, content); session.set(id, content); listeners.noteAdded(id); }