@Override public void initialize(URL url, ResourceBundle rb) { // do the stuff for the communicator try { if (SingletonSmack.getInstance().getSessionIds().size() < 1) { SingletonSmack.getInstance() .addSession( new SessionInformation( "Test Session", "http://example.com", "Dies ist eine Test Session.")); } final Integer sessionId = SingletonSmack.getInstance().getSessionIds().get(0); SingletonSmack.getInstance().setUsingSession(sessionId); } catch (NotesCommunicatorException e) { SingletonViewManager.getInstance().showError(e); } // init the notesPersistenceManager notesPersistenceManager = new NotesPersistenceManager(new MyNotesPersistenceManagerListener()); // refresh the view try { refresh(); } catch (InstantiationException e) { SingletonViewManager.getInstance().showError(e); } }
@Override public void onUnlocked(int indexOfUnlockedNote) { try { refresh(); } catch (InstantiationException e) { SingletonViewManager.getInstance().showError(e); } }
@FXML private void handleButtonAdd() { // get the text for the note String text = SingletonViewManager.getInstance() .askInput("New Note", "Add a new Note", "Please enter the content of the new note."); // create the note, lock it final int index = notesPersistenceManager.addNote(NoteType.TEXT); notesPersistenceManager.lockNote(index); // get the note for editing TextNoteInformation textNote = null; // try { textNote = (TextNoteInformation) notesPersistenceManager.getAllNotes().get(index); // } catch (InstantiationException e) { // SingletonViewManager.getInstance().showError(e); // } // edit the note textNote.setText(text); // publish the note notesPersistenceManager.refreshNote(index, textNote); // unlock the note notesPersistenceManager.unlockNote(index); // refresh the view try { refresh(); } catch (InstantiationException e) { SingletonViewManager.getInstance().showError(e); } }