public void setDocument(Note note) {
   // Note note = CurrentProject.getNoteList().getActiveNote();
   // try {
   // this.editor.editor.setPage(CurrentStorage.get().getNoteURL(note));
   editor.document = (HTMLDocument) CurrentStorage.get().openNote(note);
   editor.initEditor();
   if (note != null) titleField.setText(note.getTitle());
   else titleField.setText("");
   initialTitle = titleField.getText();
   /*
    * } catch (Exception ex) { new ExceptionDialog(ex); }
    */
   /*
    * Document doc = CurrentStorage.get().openNote(note); try {
    * this.editor.editor.setText(doc.getText(0, doc.getLength())); } catch
    * (Exception ex){ ex.printStackTrace(); }
    */
   // .setDocument(CurrentStorage.get().openNote(note));
 }
 public void initCSS() {
   BufferedReader br =
       new BufferedReader(
           new InputStreamReader(
               net.sf.memoranda.ui.EditorPanel.class.getResourceAsStream(
                   "resources/css/default.css")));
   String css = "";
   try {
     String s = br.readLine();
     while (s != null) {
       css = css + s + "\n";
       s = br.readLine();
     }
   } catch (IOException ex) {
     ex.printStackTrace();
   }
   String NORMAL_FONT = Configuration.get("NORMAL_FONT").toString();
   String HEADER_FONT = Configuration.get("HEADER_FONT").toString();
   String MONO_FONT = Configuration.get("MONO_FONT").toString();
   String BASE_FONT_SIZE = Configuration.get("BASE_FONT_SIZE").toString();
   css =
       css.replaceAll(
           "%NORMAL_FONT%", NORMAL_FONT.length() > 0 ? "\"" + NORMAL_FONT + "\"" : "serif");
   css =
       css.replaceAll(
           "%HEADER_FONT%", HEADER_FONT.length() > 0 ? "\"" + HEADER_FONT + "\"" : "sans-serif");
   css =
       css.replaceAll(
           "%MONO_FONT%", MONO_FONT.length() > 0 ? "\"" + MONO_FONT + "\"" : "monospaced");
   css = css.replaceAll("%BASE_FONT_SIZE%", BASE_FONT_SIZE.length() > 0 ? BASE_FONT_SIZE : "16");
   editor.setStyleSheet(new StringReader(css));
   String usercss = (String) Configuration.get("USER_CSS");
   if (usercss.length() > 0)
     try {
       // DEBUG
       System.out.println("***[DEBUG] User css used: " + usercss);
       editor.setStyleSheet(new InputStreamReader(new java.io.FileInputStream(usercss)));
     } catch (Exception ex) {
       System.out.println("***[DEBUG] Failed to open: " + usercss);
       ex.printStackTrace();
     }
 }
 public boolean isDocumentChanged() {
   return editor.isDocumentChanged() || !titleField.getText().equals(initialTitle);
 }