Thread: [Jreepad-CVS] jreepad/src/jreepad TreeView.java, 1.4, 1.5 JreepadViewer.java, 1.54, 1.55 JreepadVie
Brought to you by:
danstowell
From: PeWu <pe...@us...> - 2007-03-21 10:40:41
|
Update of /cvsroot/jreepad/jreepad/src/jreepad In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2551/src/jreepad Modified Files: TreeView.java JreepadViewer.java JreepadView.java Log Message: cleanup: Removed unneeded code Index: JreepadView.java =================================================================== RCS file: /cvsroot/jreepad/jreepad/src/jreepad/JreepadView.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** JreepadView.java 21 Mar 2007 09:40:52 -0000 1.46 --- JreepadView.java 21 Mar 2007 10:40:35 -0000 1.47 *************** *** 427,431 **** JreepadNode parent = currentNode.getParentNode(); JreepadNode ret = parent.addChild(index); - ret.getArticle().setContent(JreepadArticle.getNewContent()); treeModel.nodesWereInserted(parent, new int[]{index}); TreePath newPath = (parentPath.pathByAddingChild(ret)); --- 427,430 ---- *************** *** 450,454 **** JreepadNode parent = currentNode.getParentNode(); JreepadNode ret = parent.addChild(index+1); - ret.getArticle().setContent(JreepadArticle.getNewContent()); treeModel.nodesWereInserted(parent, new int[]{index+1}); tree.startEditingAtPath(parentPath.pathByAddingChild(ret)); --- 449,452 ---- *************** *** 460,464 **** //DEL storeForUndo(); JreepadNode ret = currentNode.addChild(); - ret.getArticle().setContent(JreepadArticle.getNewContent()); TreePath nodePath = tree.getSelectionPath(); treeModel.nodesWereInserted(currentNode, new int[]{currentNode.getIndex(ret)}); --- 458,461 ---- *************** *** 893,897 **** currentNode.getArticle().wrapContentToCharWidth(charWidth); currentArticleView.reloadArticle(); - treeModel.setContentSaved(false); } --- 890,893 ---- *************** *** 901,905 **** currentNode.getArticle().stripAllTags(); currentArticleView.reloadArticle(); - treeModel.setContentSaved(false); } --- 897,900 ---- Index: TreeView.java =================================================================== RCS file: /cvsroot/jreepad/jreepad/src/jreepad/TreeView.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TreeView.java 15 Mar 2007 12:46:05 -0000 1.4 --- TreeView.java 21 Mar 2007 10:40:35 -0000 1.5 *************** *** 27,34 **** import javax.swing.JTree; - import javax.swing.event.CellEditorListener; - import javax.swing.event.ChangeEvent; import javax.swing.tree.DefaultTreeCellRenderer; - import javax.swing.tree.TreeCellEditor; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; --- 27,31 ---- *************** *** 43,47 **** public class TreeView extends JTree { - private static final String UNTITLED_NODE_TEXT = "<Untitled node>"; private JreepadTreeModel treeModel; --- 40,43 ---- *************** *** 62,103 **** setCellRenderer(renderer); - - // Fiddle with the cell editor - to ensure that when editing a new node, you shouldn't be - // able to leave a blank title - getCellEditor().addCellEditorListener(new CellEditorListener() - { - public void editingCanceled(ChangeEvent e) - { - ensureNodeTitleIsNotEmpty(); - } - - public void editingStopped(ChangeEvent e) - { - ensureNodeTitleIsNotEmpty(); - } - }); - // Add mouse listener - this will be used to implement drag-and-drop, context menu (?), etc addMouseListener(new TreeViewMouseListener()); } - public void cancelEditing() - { - super.cancelEditing(); // if we can override this perhaps we can prevent blank nodes...? - JreepadNode lastEditedNode = (JreepadNode)(getSelectionPath().getLastPathComponent()); - if (lastEditedNode.getTitle().equals("")) - lastEditedNode.setTitle(UNTITLED_NODE_TEXT); - } - - private void ensureNodeTitleIsNotEmpty() - { - TreeCellEditor theEditor = getCellEditor(); - String newTitle = (String) (theEditor.getCellEditorValue()); - - if (newTitle.equals("")) - theEditor.getTreeCellEditorComponent(this, UNTITLED_NODE_TEXT, - true, true, false, 1); - } - public void moveNode(JreepadNode node, JreepadNode newParent) { --- 58,65 ---- Index: JreepadViewer.java =================================================================== RCS file: /cvsroot/jreepad/jreepad/src/jreepad/JreepadViewer.java,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** JreepadViewer.java 21 Mar 2007 09:40:52 -0000 1.54 --- JreepadViewer.java 21 Mar 2007 10:40:35 -0000 1.55 *************** *** 535,547 **** JMenuItem addAboveMenuItem = new JMenuItem(lang.getString("MENUITEM_ADDABOVE")); //"Add sibling above"); ! addAboveMenuItem.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) { theJreepad.addNodeAbove(); /* theJreepad.returnFocusToTree(); */ document.setContentSaved(false); updateWindowTitle();}}); editMenu.add(addAboveMenuItem); JMenuItem addBelowMenuItem = new JMenuItem(lang.getString("MENUITEM_ADDBELOW")); //"Add sibling below"); ! addBelowMenuItem.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) { theJreepad.addNodeBelow(); /* theJreepad.returnFocusToTree(); */ document.setContentSaved(false); updateWindowTitle();}}); editMenu.add(addBelowMenuItem); JMenuItem addChildMenuItem = new JMenuItem(lang.getString("MENUITEM_ADDCHILD")); //"Add child"); ! addChildMenuItem.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) { theJreepad.addNode(); /* theJreepad.returnFocusToTree(); */ document.setContentSaved(false);updateWindowTitle(); }}); editMenu.add(addChildMenuItem); --- 535,547 ---- JMenuItem addAboveMenuItem = new JMenuItem(lang.getString("MENUITEM_ADDABOVE")); //"Add sibling above"); ! addAboveMenuItem.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) { theJreepad.addNodeAbove(); updateWindowTitle();}}); editMenu.add(addAboveMenuItem); JMenuItem addBelowMenuItem = new JMenuItem(lang.getString("MENUITEM_ADDBELOW")); //"Add sibling below"); ! addBelowMenuItem.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) { theJreepad.addNodeBelow(); updateWindowTitle();}}); editMenu.add(addBelowMenuItem); JMenuItem addChildMenuItem = new JMenuItem(lang.getString("MENUITEM_ADDCHILD")); //"Add child"); ! addChildMenuItem.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) { theJreepad.addNode(); updateWindowTitle(); }}); editMenu.add(addChildMenuItem); *************** *** 567,575 **** JMenuItem upMenuItem = new JMenuItem(lang.getString("MENUITEM_MOVEUP")); //"Move node up"); ! upMenuItem.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) { theJreepad.moveCurrentNodeUp(); theJreepad.returnFocusToTree(); document.setContentSaved(false);updateWindowTitle(); }}); editMenu.add(upMenuItem); JMenuItem downMenuItem = new JMenuItem(lang.getString("MENUITEM_MOVEDOWN")); //"Move node down"); ! downMenuItem.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) { theJreepad.moveCurrentNodeDown(); theJreepad.returnFocusToTree(); document.setContentSaved(false);updateWindowTitle(); }}); editMenu.add(downMenuItem); --- 567,575 ---- JMenuItem upMenuItem = new JMenuItem(lang.getString("MENUITEM_MOVEUP")); //"Move node up"); ! upMenuItem.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) { theJreepad.moveCurrentNodeUp(); theJreepad.returnFocusToTree(); updateWindowTitle(); }}); editMenu.add(upMenuItem); JMenuItem downMenuItem = new JMenuItem(lang.getString("MENUITEM_MOVEDOWN")); //"Move node down"); ! downMenuItem.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) { theJreepad.moveCurrentNodeDown(); theJreepad.returnFocusToTree(); updateWindowTitle(); }}); editMenu.add(downMenuItem); *************** *** 577,585 **** JMenuItem indentMenuItem = new JMenuItem(lang.getString("MENUITEM_MOVEIN")); //"Indent node (demote)"); ! indentMenuItem.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) { theJreepad.indentCurrentNode(); theJreepad.returnFocusToTree(); document.setContentSaved(false);updateWindowTitle(); }}); editMenu.add(indentMenuItem); JMenuItem outdentMenuItem = new JMenuItem(lang.getString("MENUITEM_MOVEOUT")); //"Outdent node (promote)"); ! outdentMenuItem.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) { theJreepad.outdentCurrentNode(); theJreepad.returnFocusToTree(); document.setContentSaved(false);updateWindowTitle(); }}); editMenu.add(outdentMenuItem); --- 577,585 ---- JMenuItem indentMenuItem = new JMenuItem(lang.getString("MENUITEM_MOVEIN")); //"Indent node (demote)"); ! indentMenuItem.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) { theJreepad.indentCurrentNode(); theJreepad.returnFocusToTree(); updateWindowTitle(); }}); editMenu.add(indentMenuItem); JMenuItem outdentMenuItem = new JMenuItem(lang.getString("MENUITEM_MOVEOUT")); //"Outdent node (promote)"); ! outdentMenuItem.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) { theJreepad.outdentCurrentNode(); theJreepad.returnFocusToTree(); updateWindowTitle(); }}); editMenu.add(outdentMenuItem); *************** *** 686,694 **** JMenuItem sortMenuItem = new JMenuItem(lang.getString("MENUITEM_SORTONELEVEL")); //"Sort children (one level)"); ! sortMenuItem.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) { theJreepad.sortChildren(); document.setContentSaved(false);updateWindowTitle(); }}); actionsMenu.add(sortMenuItem); JMenuItem sortRecursiveMenuItem = new JMenuItem(lang.getString("MENUITEM_SORTALLLEVELS")); //"Sort children (all levels)"); ! sortRecursiveMenuItem.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) { theJreepad.sortChildrenRecursive(); document.setContentSaved(false);updateWindowTitle(); }}); actionsMenu.add(sortRecursiveMenuItem); --- 686,694 ---- JMenuItem sortMenuItem = new JMenuItem(lang.getString("MENUITEM_SORTONELEVEL")); //"Sort children (one level)"); ! sortMenuItem.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) { theJreepad.sortChildren(); updateWindowTitle(); }}); actionsMenu.add(sortMenuItem); JMenuItem sortRecursiveMenuItem = new JMenuItem(lang.getString("MENUITEM_SORTALLLEVELS")); //"Sort children (all levels)"); ! sortRecursiveMenuItem.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) { theJreepad.sortChildrenRecursive(); updateWindowTitle(); }}); actionsMenu.add(sortRecursiveMenuItem); *************** *** 931,943 **** // Add the actions to the toolbar buttons upButton.addActionListener(new ActionListener(){ ! public void actionPerformed(ActionEvent e){ theJreepad.moveCurrentNodeUp(); repaint(); theJreepad.returnFocusToTree(); document.setContentSaved(false);updateWindowTitle();} }); downButton.addActionListener(new ActionListener(){ ! public void actionPerformed(ActionEvent e){ theJreepad.moveCurrentNodeDown(); repaint(); theJreepad.returnFocusToTree(); document.setContentSaved(false);updateWindowTitle();} }); indentButton.addActionListener(new ActionListener(){ ! public void actionPerformed(ActionEvent e){ theJreepad.indentCurrentNode(); repaint(); theJreepad.returnFocusToTree(); document.setContentSaved(false);updateWindowTitle();} }); outdentButton.addActionListener(new ActionListener(){ ! public void actionPerformed(ActionEvent e){ theJreepad.outdentCurrentNode(); repaint(); theJreepad.returnFocusToTree(); document.setContentSaved(false);updateWindowTitle(); } }); --- 931,943 ---- // Add the actions to the toolbar buttons upButton.addActionListener(new ActionListener(){ ! public void actionPerformed(ActionEvent e){ theJreepad.moveCurrentNodeUp(); repaint(); theJreepad.returnFocusToTree(); updateWindowTitle();} }); downButton.addActionListener(new ActionListener(){ ! public void actionPerformed(ActionEvent e){ theJreepad.moveCurrentNodeDown(); repaint(); theJreepad.returnFocusToTree(); updateWindowTitle();} }); indentButton.addActionListener(new ActionListener(){ ! public void actionPerformed(ActionEvent e){ theJreepad.indentCurrentNode(); repaint(); theJreepad.returnFocusToTree(); updateWindowTitle();} }); outdentButton.addActionListener(new ActionListener(){ ! public void actionPerformed(ActionEvent e){ theJreepad.outdentCurrentNode(); repaint(); theJreepad.returnFocusToTree(); updateWindowTitle(); } }); *************** *** 945,953 **** addAboveButton.addActionListener(new ActionListener(){ ! public void actionPerformed(ActionEvent e){ theJreepad.addNodeAbove(); repaint(); /* theJreepad.returnFocusToTree(); */ document.setContentSaved(false);updateWindowTitle();} }); addBelowButton.addActionListener(new ActionListener(){ ! public void actionPerformed(ActionEvent e){ theJreepad.addNodeBelow(); repaint(); /* theJreepad.returnFocusToTree(); */ document.setContentSaved(false);updateWindowTitle();} }); addButton.addActionListener(new ActionListener(){ ! public void actionPerformed(ActionEvent e){ theJreepad.addNode(); repaint(); /* theJreepad.returnFocusToTree(); */ document.setContentSaved(false);updateWindowTitle();} }); removeButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ deleteNodeAction(); } }); --- 945,953 ---- addAboveButton.addActionListener(new ActionListener(){ ! public void actionPerformed(ActionEvent e){ theJreepad.addNodeAbove(); repaint(); updateWindowTitle();} }); addBelowButton.addActionListener(new ActionListener(){ ! public void actionPerformed(ActionEvent e){ theJreepad.addNodeBelow(); repaint(); updateWindowTitle();} }); addButton.addActionListener(new ActionListener(){ ! public void actionPerformed(ActionEvent e){ theJreepad.addNode(); repaint(); updateWindowTitle();} }); removeButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ deleteNodeAction(); } }); *************** *** 1038,1066 **** public void actionPerformed(ActionEvent e){ theJreepad.moveCurrentNodeUp(); repaint(); theJreepad.returnFocusToTree(); ! document.setContentSaved(false);updateWindowTitle();} }); downIconButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ theJreepad.moveCurrentNodeDown(); repaint(); theJreepad.returnFocusToTree(); ! document.setContentSaved(false);updateWindowTitle();} }); indentIconButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ theJreepad.indentCurrentNode(); repaint(); theJreepad.returnFocusToTree(); ! document.setContentSaved(false);updateWindowTitle();} }); outdentIconButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ theJreepad.outdentCurrentNode(); repaint(); theJreepad.returnFocusToTree(); ! document.setContentSaved(false);updateWindowTitle(); } }); addAboveIconButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ theJreepad.addNodeAbove(); repaint(); /* theJreepad.returnFocusToTree(); */ ! document.setContentSaved(false);updateWindowTitle();} }); addBelowIconButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ theJreepad.addNodeBelow(); repaint(); /* theJreepad.returnFocusToTree(); */ ! document.setContentSaved(false);updateWindowTitle();} }); addIconButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ theJreepad.addNode(); repaint(); /* theJreepad.returnFocusToTree(); */ ! document.setContentSaved(false);updateWindowTitle();} }); removeIconButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ deleteNodeAction(); } }); --- 1038,1066 ---- public void actionPerformed(ActionEvent e){ theJreepad.moveCurrentNodeUp(); repaint(); theJreepad.returnFocusToTree(); ! updateWindowTitle();} }); downIconButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ theJreepad.moveCurrentNodeDown(); repaint(); theJreepad.returnFocusToTree(); ! updateWindowTitle();} }); indentIconButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ theJreepad.indentCurrentNode(); repaint(); theJreepad.returnFocusToTree(); ! updateWindowTitle();} }); outdentIconButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ theJreepad.outdentCurrentNode(); repaint(); theJreepad.returnFocusToTree(); ! updateWindowTitle(); } }); addAboveIconButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ theJreepad.addNodeAbove(); repaint(); /* theJreepad.returnFocusToTree(); */ ! updateWindowTitle();} }); addBelowIconButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ theJreepad.addNodeBelow(); repaint(); /* theJreepad.returnFocusToTree(); */ ! updateWindowTitle();} }); addIconButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ theJreepad.addNode(); repaint(); /* theJreepad.returnFocusToTree(); */ ! updateWindowTitle();} }); removeIconButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ deleteNodeAction(); } }); *************** *** 1547,1551 **** return; } - document.setContentSaved(false); updateWindowTitle(); } --- 1547,1550 ---- *************** *** 1905,1909 **** theJreepad.removeNode(); theJreepad.returnFocusToTree(); - document.setContentSaved(false); updateWindowTitle(); } --- 1904,1907 ---- |