Ejemplo n.º 1
0
 @Override
 public void done(SyncTask task) {
   if (task.task.equals(SyncTask.TASK_DOWN_DATA)) {
     Category c = null;
     c = book.root.search(task.local.id);
     if (c != null && c.getMessage() != null) {
       storage.save(c.getMessage());
       mainFrame.editor.reloadDocument(c.getMessage());
     }
   }
 }
Ejemplo n.º 2
0
 public void NewNote(BookAction event) {
   Category parent = selectedTreeNode();
   if (parent == null) {
     JOptionPane.showMessageDialog(
         mainFrame, "没有选择添加到哪一个目录.", "Error", JOptionPane.ERROR_MESSAGE);
   } else if (parent.isLeaf()) {
     JOptionPane.showMessageDialog(
         mainFrame, "不能在文件上面创建文件.", "Error", JOptionPane.ERROR_MESSAGE);
   } else {
     parent.addMessage("新建文件");
   }
 }
Ejemplo n.º 3
0
 public void Remove(BookAction event) {
   Category object = selectedTreeNode();
   if (object == null) {
     JOptionPane.showMessageDialog(mainFrame, "请选择需要删除的对象.", "Error", JOptionPane.ERROR_MESSAGE);
   } else {
     int i =
         JOptionPane.showConfirmDialog(
             mainFrame, "确定需要删除 '" + object.name + "'.", "确认", JOptionPane.OK_CANCEL_OPTION);
     if (i == 0) {
       object.remove();
     }
   }
 }
Ejemplo n.º 4
0
 public void Open(BookAction event) {
   final Category node = selectedTreeNode();
   if (node.isLeaf()) {
     actionThread.execute(
         new Runnable() {
           @Override
           public void run() {
             saveOpenedMessage();
             NoteMessage msg = node.getMessage(storage, true);
             mainFrame.editor.openDocument(msg);
             book.curNoteId = node.id;
           }
         });
     mainFrame.status("Opening " + node.name + "(" + node.id + ")");
   }
 }
Ejemplo n.º 5
0
 public void ReName(BookAction event) {
   Category object = selectedTreeNode();
   if (object == null) {
     JOptionPane.showMessageDialog(
         mainFrame, "请选择需要重命名的对象.", "Error", JOptionPane.ERROR_MESSAGE);
   } else {
     String s =
         (String)
             JOptionPane.showInputDialog(
                 mainFrame,
                 "输入新名字:\n",
                 "重命名",
                 JOptionPane.PLAIN_MESSAGE,
                 null,
                 null,
                 object.getName());
     if (s != null) {
       object.setName(s);
     }
   }
 }
Ejemplo n.º 6
0
 private void restoreLastStatus() {
   SwingUtilities.invokeLater(
       new Runnable() {
         public void run() {
           Vector<TreePath> expaned = new Vector<TreePath>();
           if (book.expaned != null) {
             expaned.addAll(book.expaned);
             book.expaned.clear();
           } else {
             book.expaned = new Vector<TreePath>();
           }
           for (TreePath path : expaned) {
             mainFrame.tree.expandPath(path);
           }
         }
       });
   if (book.curNoteId != null && !book.curNoteId.equals("")) {
     Category node = book.root.search(book.curNoteId);
     if (node != null) {
       NoteMessage msg = node.getMessage(storage, true);
       mainFrame.editor.openDocument(msg);
     }
   }
 }
Ejemplo n.º 7
0
 public void OrderMoveDown(BookAction event) {
   Category object = selectedTreeNode();
   object.moveOrder(1);
 }
Ejemplo n.º 8
0
 public void OrderByName(BookAction event) {
   Category object = selectedTreeNode();
   object.orderBy("name");
 }
Ejemplo n.º 9
0
 public void OrderByUpdate(BookAction event) {
   Category object = selectedTreeNode();
   object.orderBy("update_date");
 }
Ejemplo n.º 10
0
 public void OrderByPosition(BookAction event) {
   Category object = selectedTreeNode();
   object.orderBy("position");
 }