Thread: [Jreepad-CVS] jreepad/src/jreepad JreepadNode.java, 1.18, 1.19 JreepadView.java, 1.31, 1.32 Jreepad
Brought to you by:
danstowell
From: PeWu <pe...@us...> - 2007-01-14 03:39:30
|
Update of /cvsroot/jreepad/jreepad/src/jreepad In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv20660/src/jreepad Modified Files: JreepadNode.java JreepadView.java JreepadViewer.java Log Message: Changed build to use jars with external libraries Index: JreepadView.java =================================================================== RCS file: /cvsroot/jreepad/jreepad/src/jreepad/JreepadView.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** JreepadView.java 25 Aug 2006 11:11:30 -0000 1.31 --- JreepadView.java 14 Jan 2007 00:21:59 -0000 1.32 *************** *** 25,30 **** import javax.swing.event.*; import javax.swing.undo.*; - import javax.swing.text.BadLocationException; import javax.swing.text.*; import java.awt.*; import java.awt.event.*; --- 25,37 ---- import javax.swing.event.*; import javax.swing.undo.*; import javax.swing.text.*; + + import org.philwilson.JTextile; + + import edu.stanford.ejalbert.BrowserLauncher; + import edu.stanford.ejalbert.exception.BrowserLaunchingExecutionException; + import edu.stanford.ejalbert.exception.BrowserLaunchingInitializingException; + import edu.stanford.ejalbert.exception.UnsupportedOperatingSystemException; + import java.awt.*; import java.awt.event.*; *************** *** 69,73 **** } ! private static short paraRightMargin = 0; static class JPParagraphView extends javax.swing.text.ParagraphView { --- 76,80 ---- } ! private static short paraRightMargin = 0; static class JPParagraphView extends javax.swing.text.ParagraphView { *************** *** 98,102 **** private JEditorPane editorPaneHtml; private JTable editorPaneCsv; ! // Undo features --- 105,109 ---- private JEditorPane editorPaneHtml; private JTable editorPaneCsv; ! // Undo features *************** *** 121,125 **** this(new JreepadNode("<Untitled node>", "", null)); } ! public JreepadView(JreepadNode root) { --- 128,132 ---- this(new JreepadNode("<Untitled node>", "", null)); } ! public JreepadView(JreepadNode root) { *************** *** 144,148 **** this.root = root; ! treeModel = new JreepadTreeModel(root); treeModel.addTreeModelListener(new JreepadTreeModelListener()); --- 151,155 ---- this.root = root; ! treeModel = new JreepadTreeModel(root); treeModel.addTreeModelListener(new JreepadTreeModelListener()); *************** *** 161,165 **** tree.setInvokesStopCellEditing(true); tree.setEditable(true); ! tree.setModel(treeModel); --- 168,172 ---- tree.setInvokesStopCellEditing(true); tree.setEditable(true); ! tree.setModel(treeModel); *************** *** 183,194 **** tree.getLastSelectedPathComponent(); if (node == null) return; ! // UNDO DEVELOPMENT: // System.out.println("TreeSelectionListener:valueChanged"); // undoMgr.discardAllEdits(); ! setCurrentNode(node); } ! }); // Fiddle with the cell editor - to ensure that when editing a new node, you shouldn't be able to leave a blank title --- 190,201 ---- tree.getLastSelectedPathComponent(); if (node == null) return; ! // UNDO DEVELOPMENT: // System.out.println("TreeSelectionListener:valueChanged"); // undoMgr.discardAllEdits(); ! setCurrentNode(node); } ! }); // Fiddle with the cell editor - to ensure that when editing a new node, you shouldn't be able to leave a blank title *************** *** 223,234 **** if(selPath != null) { ! if(currentDragDropNode != null && ! currentDragDropNode.getParentNode() != null && ! currentDragDropNode.getParentNode() != (JreepadNode)selPath.getLastPathComponent() && currentDragDropNode != (JreepadNode)selPath.getLastPathComponent()) { // Then we need to perform a drag-and-drop operation! moveNode(currentDragDropNode, (JreepadNode)selPath.getLastPathComponent()); ! // Ensure that the destination node is open tree.setSelectionPath(selPath.pathByAddingChild(currentDragDropNode)); --- 230,241 ---- if(selPath != null) { ! if(currentDragDropNode != null && ! currentDragDropNode.getParentNode() != null && ! currentDragDropNode.getParentNode() != (JreepadNode)selPath.getLastPathComponent() && currentDragDropNode != (JreepadNode)selPath.getLastPathComponent()) { // Then we need to perform a drag-and-drop operation! moveNode(currentDragDropNode, (JreepadNode)selPath.getLastPathComponent()); ! // Ensure that the destination node is open tree.setSelectionPath(selPath.pathByAddingChild(currentDragDropNode)); *************** *** 251,255 **** } }; ! tree.addMouseListener(ml); tree.addKeyListener(new KeyAdapter(){public void keyPressed(KeyEvent kee) { --- 258,262 ---- } }; ! tree.addMouseListener(ml); tree.addKeyListener(new KeyAdapter(){public void keyPressed(KeyEvent kee) { *************** *** 265,270 **** } // System.out.println("Tree detected a keypress: " + kee.getKeyText(kee.getKeyCode()) + " (key code "+ kee.getKeyCode()+")"); ! }}); ! treeView.setViewportView(tree); --- 272,277 ---- } // System.out.println("Tree detected a keypress: " + kee.getKeyText(kee.getKeyCode()) + " (key code "+ kee.getKeyCode()+")"); ! }}); ! treeView.setViewportView(tree); *************** *** 287,291 **** if(currentNode.getArticleMode() != JreepadNode.ARTICLEMODE_ORDINARY) return; // i.e. we are only relevant when in plain-text mode ! if(!editorPanePlainText.getText().equals(currentNode.getContent())) { --- 294,298 ---- if(currentNode.getArticleMode() != JreepadNode.ARTICLEMODE_ORDINARY) return; // i.e. we are only relevant when in plain-text mode ! if(!editorPanePlainText.getText().equals(currentNode.getContent())) { *************** *** 352,356 **** // System.out.println("articleView viewport size: " + articleView.getViewport().getSize()); // System.out.println(); ! switch(mode) { --- 359,363 ---- // System.out.println("articleView viewport size: " + articleView.getViewport().getSize()); // System.out.println(); ! switch(mode) { *************** *** 373,377 **** editorPaneHtml.setPreferredSize(articleView.getViewport().getExtentSize()); editorPaneHtml.setSize(articleView.getViewport().getExtentSize()); ! validate(); repaint(); // System.out.println("editorPane size: " + editorPane.getSize()); --- 380,384 ---- editorPaneHtml.setPreferredSize(articleView.getViewport().getExtentSize()); editorPaneHtml.setSize(articleView.getViewport().getExtentSize()); ! validate(); repaint(); // System.out.println("editorPane size: " + editorPane.getSize()); *************** *** 383,387 **** private void setViewBoth() ! { ensureCorrectArticleRenderMode(); splitPane.setLeftComponent(treeView); --- 390,394 ---- private void setViewBoth() ! { ensureCorrectArticleRenderMode(); splitPane.setLeftComponent(treeView); *************** *** 402,407 **** this.remove(treeView); ensureCorrectArticleRenderMode(); ! this.add(articleView); ! articleView.setSize(getSize()); } /* --- 409,414 ---- this.remove(treeView); ensureCorrectArticleRenderMode(); ! this.add(articleView); ! articleView.setSize(getSize()); } /* *************** *** 423,427 **** if(currentNode.getArticleMode() == JreepadNode.ARTICLEMODE_ORDINARY) currentNode.setContent(getEditorPaneText()); ! return; } --- 430,434 ---- if(currentNode.getArticleMode() == JreepadNode.ARTICLEMODE_ORDINARY) currentNode.setContent(getEditorPaneText()); ! return; } *************** *** 472,478 **** return; } ! //DEL storeForUndo(); ! JreepadNode oldParent = node.getParentNode(); --- 479,485 ---- return; } ! //DEL storeForUndo(); ! JreepadNode oldParent = node.getParentNode(); *************** *** 498,508 **** treeModel.reload(newParent); // treeModel.reload((TreeNode)tree.getPathForRow(0).getLastPathComponent()); ! // If the destination node didn't previously have any children, then we'll expand it // if(newParent.getChildCount()==1) ! ! // Reapply the expanded/collapsed states ! } --- 505,515 ---- treeModel.reload(newParent); // treeModel.reload((TreeNode)tree.getPathForRow(0).getLastPathComponent()); ! // If the destination node didn't previously have any children, then we'll expand it // if(newParent.getChildCount()==1) ! ! // Reapply the expanded/collapsed states ! } *************** *** 519,527 **** int pos = currentNode.getIndex(); if(pos<1) return; ! //DEL storeForUndo(); ! JreepadNode newParent = ((JreepadNode)currentNode.getParent().getChildAt(pos-1)); ! if(currentNode.indent()) { --- 526,534 ---- int pos = currentNode.getIndex(); if(pos<1) return; ! //DEL storeForUndo(); ! JreepadNode newParent = ((JreepadNode)currentNode.getParent().getChildAt(pos-1)); ! if(currentNode.indent()) { *************** *** 562,566 **** { TreePath nodePath = tree.getSelectionPath(); ! if(currentNode.equals(root)) { --- 569,573 ---- { TreePath nodePath = tree.getSelectionPath(); ! if(currentNode.equals(root)) { *************** *** 568,572 **** return; } ! //DEL storeForUndo(); currentNode.moveUp(); --- 575,579 ---- return; } ! //DEL storeForUndo(); currentNode.moveUp(); *************** *** 589,607 **** tree.setSelectionPath(nodePath); } ! private void notForRootNode() { // FIXME: If there are no child nodes, assume the user needs some advice about adding nodes if(root.isLeaf()) ! JOptionPane.showMessageDialog(this, ! JreepadViewer.lang.getString("MSG_ONLY_ON_CHILDNODES"), JreepadViewer.lang.getString("TITLE_ONLY_ON_CHILDNODES") , JOptionPane.INFORMATION_MESSAGE); ! else return; ! // JOptionPane.showMessageDialog(this, ! // "The root node is currently selected - you can only perform this operation on child nodes.", "Root node is selected" , // JOptionPane.INFORMATION_MESSAGE); } ! protected String getContentForNewNode() { --- 596,614 ---- tree.setSelectionPath(nodePath); } ! private void notForRootNode() { // FIXME: If there are no child nodes, assume the user needs some advice about adding nodes if(root.isLeaf()) ! JOptionPane.showMessageDialog(this, ! JreepadViewer.lang.getString("MSG_ONLY_ON_CHILDNODES"), JreepadViewer.lang.getString("TITLE_ONLY_ON_CHILDNODES") , JOptionPane.INFORMATION_MESSAGE); ! else return; ! // JOptionPane.showMessageDialog(this, ! // "The root node is currently selected - you can only perform this operation on child nodes.", "Root node is selected" , // JOptionPane.INFORMATION_MESSAGE); } ! protected String getContentForNewNode() { *************** *** 611,615 **** return ""; } ! private java.text.DateFormat dateFormat = java.text.DateFormat.getDateInstance(); private String getCurrentDate() --- 618,622 ---- return ""; } ! private java.text.DateFormat dateFormat = java.text.DateFormat.getDateInstance(); private String getCurrentDate() *************** *** 617,626 **** return dateFormat.format(new java.util.Date()); } ! public void insertDate() { if(currentNode.getArticleMode() != JreepadNode.ARTICLEMODE_ORDINARY) return; // May want to fix this later - allow other modes to have the date inserted... ! //DEL storeForUndo(); String theDate = getCurrentDate(); --- 624,633 ---- return dateFormat.format(new java.util.Date()); } ! public void insertDate() { if(currentNode.getArticleMode() != JreepadNode.ARTICLEMODE_ORDINARY) return; // May want to fix this later - allow other modes to have the date inserted... ! //DEL storeForUndo(); String theDate = getCurrentDate(); *************** *** 629,637 **** try { ! editorPanePlainText.setText(doc.getText(0, here) + theDate + ! doc.getText(here, doc.getLength() - here)); ! editorPaneHtml.setText(doc.getText(0, here) + theDate + ! doc.getText(here, doc.getLength() - here)); ! editorPanePlainText.setCaretPosition(here + theDate.length()); } catch(BadLocationException e) --- 636,644 ---- try { ! editorPanePlainText.setText(doc.getText(0, here) + theDate + ! doc.getText(here, doc.getLength() - here)); ! editorPaneHtml.setText(doc.getText(0, here) + theDate + ! doc.getText(here, doc.getLength() - here)); ! editorPanePlainText.setCaretPosition(here + theDate.length()); } catch(BadLocationException e) *************** *** 640,644 **** } } ! public JreepadNode addNodeAbove() { --- 647,651 ---- } } ! public JreepadNode addNodeAbove() { *************** *** 690,694 **** TreePath nodePath = tree.getSelectionPath(); treeModel.nodesWereInserted(currentNode, new int[]{currentNode.getIndex(ret)}); ! // tree.setSelectionPath(nodePath.pathByAddingChild(ret)); tree.scrollPathToVisible(nodePath.pathByAddingChild(ret)); --- 697,701 ---- TreePath nodePath = tree.getSelectionPath(); treeModel.nodesWereInserted(currentNode, new int[]{currentNode.getIndex(ret)}); ! // tree.setSelectionPath(nodePath.pathByAddingChild(ret)); tree.scrollPathToVisible(nodePath.pathByAddingChild(ret)); *************** *** 731,740 **** // System.out.println(currentNode.toFullString()); } ! public void returnFocusToTree() { tree.requestFocus(); } ! public void expandAllCurrentNode() { --- 738,747 ---- // System.out.println(currentNode.toFullString()); } ! public void returnFocusToTree() { tree.requestFocus(); } ! public void expandAllCurrentNode() { *************** *** 745,749 **** // It's at this point that we expand the current element tree.expandPath(tp); ! Enumeration getKids = thisNode.children(); JreepadNode thisKid; --- 752,756 ---- // It's at this point that we expand the current element tree.expandPath(tp); ! Enumeration getKids = thisNode.children(); JreepadNode thisKid; *************** *** 830,834 **** tree.expandPath(tree.getSelectionPath()); } ! public void addChild(JreepadNode newKid) { --- 837,841 ---- tree.expandPath(tree.getSelectionPath()); } ! public void addChild(JreepadNode newKid) { *************** *** 871,875 **** } } ! public static JreepadPrefs getPrefs() { --- 878,882 ---- } } ! public static JreepadPrefs getPrefs() { *************** *** 881,885 **** prefs.save(); } ! /* --- 888,892 ---- prefs.save(); } ! /* *************** *** 894,898 **** if(!canWeUndo()) return; ! // Swap the old root / selectionpath / expandedpaths for the current ones JreepadNode tempRoot = root; --- 901,905 ---- if(!canWeUndo()) return; ! // Swap the old root / selectionpath / expandedpaths for the current ones JreepadNode tempRoot = root; *************** *** 939,948 **** if(url==null || url.length()==0) url = currentNode.getTitle(); ! if((url == null) && (currentNode.getArticleMode()==JreepadNode.ARTICLEMODE_ORDINARY)) { try { ! String text = getEditorPaneText(); int startpos = editorPanePlainText.getCaretPosition(); --- 946,955 ---- if(url==null || url.length()==0) url = currentNode.getTitle(); ! if((url == null) && (currentNode.getArticleMode()==JreepadNode.ARTICLEMODE_ORDINARY)) { try { ! String text = getEditorPaneText(); int startpos = editorPanePlainText.getCaretPosition(); *************** *** 985,989 **** try { ! String text = getEditorPaneText(); int startpos = editorPanePlainText.getCaretPosition(); --- 992,996 ---- try { ! String text = getEditorPaneText(); int startpos = editorPanePlainText.getCaretPosition(); *************** *** 1068,1072 **** return; } ! // Strip quotes off if(url.length()>2 && url.startsWith("\"") && url.endsWith("\"")) --- 1075,1079 ---- return; } ! // Strip quotes off if(url.length()>2 && url.startsWith("\"") && url.endsWith("\"")) *************** *** 1077,1089 **** { if(!followTreepadInternalLink(url)) ! JOptionPane.showMessageDialog(this, ! JreepadViewer.lang.getString("MSG_NODE_NOT_FOUND"), JreepadViewer.lang.getString("TITLE_NODE_NOT_FOUND"), JOptionPane.ERROR_MESSAGE); return; } ! // It's probably a web-link, so let's do something to it and then try and launch it ! /* --- 1084,1096 ---- { if(!followTreepadInternalLink(url)) ! JOptionPane.showMessageDialog(this, ! JreepadViewer.lang.getString("MSG_NODE_NOT_FOUND"), JreepadViewer.lang.getString("TITLE_NODE_NOT_FOUND"), JOptionPane.ERROR_MESSAGE); return; } ! // It's probably a web-link, so let's do something to it and then try and launch it ! /* *************** *** 1115,1129 **** else surl.append(curl[i]); ! try ! { ! BrowserLauncher.openURL(surl.toString()); ! } ! catch(IOException err) ! { ! JOptionPane.showMessageDialog(this, "I/O error while opening URL:\n"+surl+"\n\nThe \"BrowserLauncher\" used to open a URL is an open-source Java library \nseparate from Jreepad itself - i.e. a separate Sourceforge project. \nIt may be a good idea to submit a bug report to\nhttp://sourceforge.net/projects/browserlauncher\n\nIf you do, please remember to supply information about the operating system\nyou are using - which type, and which version.", "Error" , JOptionPane.ERROR_MESSAGE); ! } // } } public boolean followTreepadInternalLink(String url) { --- 1122,1157 ---- else surl.append(curl[i]); ! try ! { ! new BrowserLauncher(null).openURLinBrowser(surl.toString()); ! } ! catch (BrowserLaunchingInitializingException e) ! { ! displayBrowserLauncherException(e, surl.toString()); ! } ! catch (BrowserLaunchingExecutionException e) ! { ! displayBrowserLauncherException(e, surl.toString()); ! } ! catch (UnsupportedOperatingSystemException e) ! { ! displayBrowserLauncherException(e, surl.toString()); ! } // } } + private void displayBrowserLauncherException(Exception e, String url) + { + JOptionPane.showMessageDialog(this, "Error while opening URL:\n" + url + "\n" + + e.getMessage() + "\n\n" + + "The \"BrowserLauncher\" used to open a URL is an open-source Java library \n" + + "separate from Jreepad itself - i.e. a separate Sourceforge project. \n" + + "It may be a good idea to submit a bug report to\n" + + "http://browserlaunch2.sourceforge.net/\n\n" + + "If you do, please remember to supply information about the operating system\n" + + "you are using - which type, and which version.", "Error", + JOptionPane.ERROR_MESSAGE); + } + public boolean followTreepadInternalLink(String url) { *************** *** 1185,1189 **** else newPath = new TreePath(newNode); ! // Now we need to select it... how do we do that? tree.setSelectionPath(newPath); --- 1213,1217 ---- else newPath = new TreePath(newNode); ! // Now we need to select it... how do we do that? tree.setSelectionPath(newPath); *************** *** 1231,1235 **** } return null; ! } // End of: Searching (for wikilike action) --- 1259,1263 ---- } return null; ! } // End of: Searching (for wikilike action) *************** *** 1243,1247 **** warnAboutUnsaved = yo; } ! // public void setTreeFont(Font f) // { --- 1271,1275 ---- warnAboutUnsaved = yo; } ! // public void setTreeFont(Font f) // { *************** *** 1273,1281 **** public void setArticleMode(int newMode) { ! // System.out.println("\n\n\nnode content : " + currentNode.getContent() // + "\neditorPanePlainText contains: " + editorPanePlainText.getText()); ! copyEditorPaneContentToNodeContent = false; // Disables store-for-undo ! currentNode.setContent(editorPanePlainText.getText()); /* --- 1301,1309 ---- public void setArticleMode(int newMode) { ! // System.out.println("\n\n\nnode content : " + currentNode.getContent() // + "\neditorPanePlainText contains: " + editorPanePlainText.getText()); ! copyEditorPaneContentToNodeContent = false; // Disables store-for-undo ! currentNode.setContent(editorPanePlainText.getText()); /* *************** *** 1298,1302 **** { case JreepadNode.ARTICLEMODE_ORDINARY: ! // DELETEME - PLAINTEXT SHOULD NOT BE AFFECTED BY OTHERS editorPanePlainText.setText(currentNode.getContent()); break; --- 1326,1330 ---- { case JreepadNode.ARTICLEMODE_ORDINARY: ! // DELETEME - PLAINTEXT SHOULD NOT BE AFFECTED BY OTHERS editorPanePlainText.setText(currentNode.getContent()); break; *************** *** 1332,1336 **** String[][] rowData = currentNode.interpretContentAsCsv(); String[] columnNames = null; ! // System.out.println("articleToJTable(): rows=" + rowData.length + ", cols="+rowData[0].length); initJTable(rowData, columnNames); --- 1360,1364 ---- String[][] rowData = currentNode.interpretContentAsCsv(); String[] columnNames = null; ! // System.out.println("articleToJTable(): rows=" + rowData.length + ", cols="+rowData[0].length); initJTable(rowData, columnNames); *************** *** 1342,1346 **** for(int i=0; i<columnNames.length; i++) columnNames[i] = " "; ! // System.out.println("articleToJTable(s): rows=" + rowData.length + ", cols="+rowData[0].length); initJTable(rowData, columnNames); --- 1370,1374 ---- for(int i=0; i<columnNames.length; i++) columnNames[i] = " "; ! // System.out.println("articleToJTable(s): rows=" + rowData.length + ", cols="+rowData[0].length); initJTable(rowData, columnNames); *************** *** 1350,1354 **** { editorPaneCsv = new JTable(new ArticleTableModel(rowData, columnNames)); ! // editorPaneCsv = new JTable(new ArticleTableModel(rowData, columnNames), // (getCurrentNode().tblColModel==null ? new ArticleTableColumnModel(): getCurrentNode().tblColModel)); // editorPaneCsv = new JTable(rowData, columnNames); --- 1378,1382 ---- { editorPaneCsv = new JTable(new ArticleTableModel(rowData, columnNames)); ! // editorPaneCsv = new JTable(new ArticleTableModel(rowData, columnNames), // (getCurrentNode().tblColModel==null ? new ArticleTableColumnModel(): getCurrentNode().tblColModel)); // editorPaneCsv = new JTable(rowData, columnNames); *************** *** 1454,1463 **** TreeCellEditor theEditor = (TreeCellEditor)tree.getCellEditor(); String newTitle = (String)(theEditor.getCellEditorValue()); ! // JreepadNode thatNode = (JreepadNode)(tree.getEditingPath().getLastPathComponent()); //System.out.println("ensureNodeTitleIsNotEmpty(): Event source = " + e.getSource()); //System.out.println("ensureNodeTitleIsNotEmpty(): thatNode = " + thatNode); // System.out.println("getCellEditorValue() = " + newTitle); ! if(newTitle.equals("")) { --- 1482,1491 ---- TreeCellEditor theEditor = (TreeCellEditor)tree.getCellEditor(); String newTitle = (String)(theEditor.getCellEditorValue()); ! // JreepadNode thatNode = (JreepadNode)(tree.getEditingPath().getLastPathComponent()); //System.out.println("ensureNodeTitleIsNotEmpty(): Event source = " + e.getSource()); //System.out.println("ensureNodeTitleIsNotEmpty(): thatNode = " + thatNode); // System.out.println("getCellEditorValue() = " + newTitle); ! if(newTitle.equals("")) { *************** *** 1540,1545 **** super(); } ! ! public boolean isCellEditable(int row, int col) { return false; --- 1568,1573 ---- super(); } ! ! public boolean isCellEditable(int row, int col) { return false; *************** *** 1568,1577 **** implements UndoableEditListener { public void undoableEditHappened(UndoableEditEvent e) { ! //System.out.println("Undoable event is " + (e.getEdit().isSignificant()?"":"NOT ") + "significant"); //System.out.println("Undoable event source: " + e.getEdit()); //Remember the edit and update the menus. ! if(copyEditorPaneContentToNodeContent){ //System.out.println("Storing undoable event for node " + getCurrentNode().getTitle()); --- 1596,1605 ---- implements UndoableEditListener { public void undoableEditHappened(UndoableEditEvent e) { ! //System.out.println("Undoable event is " + (e.getEdit().isSignificant()?"":"NOT ") + "significant"); //System.out.println("Undoable event source: " + e.getEdit()); //Remember the edit and update the menus. ! if(copyEditorPaneContentToNodeContent){ //System.out.println("Storing undoable event for node " + getCurrentNode().getTitle()); *************** *** 1585,1591 **** getCurrentNode().undoMgr.addEdit(e.getEdit()); } ! ! ! //undoAction.updateUndoState(); //redoAction.updateRedoState(); --- 1613,1619 ---- getCurrentNode().undoMgr.addEdit(e.getEdit()); } ! ! ! //undoAction.updateUndoState(); //redoAction.updateRedoState(); *************** *** 1607,1611 **** initColListener(); } ! private void initColListener(){ addColumnModelListener(new TableColumnModelListener() --- 1635,1639 ---- initColListener(); } ! private void initColListener(){ addColumnModelListener(new TableColumnModelListener() *************** *** 1618,1622 **** }); } ! private void storeColumnModel() { --- 1646,1650 ---- }); } ! private void storeColumnModel() { *************** *** 1624,1628 **** getCurrentNode().tblColModel = this; } ! } // End of: class ArticleTableColumnModel */ --- 1652,1656 ---- getCurrentNode().tblColModel = this; } ! } // End of: class ArticleTableColumnModel */ Index: JreepadViewer.java =================================================================== RCS file: /cvsroot/jreepad/jreepad/src/jreepad/JreepadViewer.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** JreepadViewer.java 25 Aug 2006 11:11:30 -0000 1.42 --- JreepadViewer.java 14 Jan 2007 00:23:19 -0000 1.43 *************** *** 31,34 **** --- 31,35 ---- import java.io.*; import java.util.*; + import java.net.MalformedURLException; import java.net.URL; import java.awt.datatransfer.*; *************** *** 38,41 **** --- 39,48 ---- // For reflection and Mac OSX specific things [...1712 lines suppressed...] */ --- 2691,2695 ---- textField.addCaretListener(cl); } ! } // End of class DSpinner */ *************** *** 2743,2747 **** } public void handleQuit(ApplicationEvent ae) { ! // // You MUST setHandled(false) if you want to delay or cancel the quit. // This is important for cross-platform development -- have a universal quit --- 2749,2753 ---- } public void handleQuit(ApplicationEvent ae) { ! // // You MUST setHandled(false) if you want to delay or cancel the quit. // This is important for cross-platform development -- have a universal quit Index: JreepadNode.java =================================================================== RCS file: /cvsroot/jreepad/jreepad/src/jreepad/JreepadNode.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** JreepadNode.java 12 Mar 2006 15:46:16 -0000 1.18 --- JreepadNode.java 14 Jan 2007 00:20:41 -0000 1.19 *************** *** 27,30 **** --- 27,32 ---- import javax.swing.undo.*; + import org.philwilson.JTextile; + public class JreepadNode implements Serializable, TreeNode, MutableTreeNode, Comparable { *************** *** 84,88 **** Stack nodeStack = new Stack(); nodeStack.push(this); ! String currentLine = bReader.readLine(); // Read the first line, check for treepadness --- 86,90 ---- Stack nodeStack = new Stack(); nodeStack.push(this); ! String currentLine = bReader.readLine(); // Read the first line, check for treepadness *************** *** 111,119 **** else if((currentLine.toLowerCase().startsWith("<treepad") && currentLine.endsWith(">")) ) { ! constructFromHjtInputStream(treeInputStream, autoDetectHtmlArticles, 1, bReader, lineNum, nodeStack, children); } else if((currentLine.toLowerCase().startsWith("<hj-treepad") && currentLine.endsWith(">")) ) ! constructFromHjtInputStream(treeInputStream, autoDetectHtmlArticles, 2, bReader, lineNum, nodeStack, children); else --- 113,121 ---- else if((currentLine.toLowerCase().startsWith("<treepad") && currentLine.endsWith(">")) ) { ! constructFromHjtInputStream(treeInputStream, autoDetectHtmlArticles, 1, bReader, lineNum, nodeStack, children); } else if((currentLine.toLowerCase().startsWith("<hj-treepad") && currentLine.endsWith(">")) ) ! constructFromHjtInputStream(treeInputStream, autoDetectHtmlArticles, 2, bReader, lineNum, nodeStack, children); else *************** *** 155,161 **** private String recursiveCreateFromXmlStream(BufferedReader bReader, String currentXmlContent, int depth) throws IOException { ! // System.out.println("XMLparse recursive: depth "+depth); ! // String currentXmlContent should BEGIN with the <node> tag. This is assumed, and if not true may cause problems! String currentLine; --- 157,163 ---- private String recursiveCreateFromXmlStream(BufferedReader bReader, String currentXmlContent, int depth) throws IOException { ! // System.out.println("XMLparse recursive: depth "+depth); ! // String currentXmlContent should BEGIN with the <node> tag. This is assumed, and if not true may cause problems! String currentLine; *************** *** 204,210 **** // We're reading CONTENT into the current node. currentXmlContent += currentLine; ! // System.out.println("\n\nThe content that I'm currently trying to process is:\n"+currentXmlContent); ! // Look out for <node which tells us we're starting a child startTagOffset = currentXmlContent.indexOf("<node"); --- 206,212 ---- // We're reading CONTENT into the current node. currentXmlContent += currentLine; ! // System.out.println("\n\nThe content that I'm currently trying to process is:\n"+currentXmlContent); ! // Look out for <node which tells us we're starting a child startTagOffset = currentXmlContent.indexOf("<node"); *************** *** 227,231 **** if(readingContent) this.content += xmlUnescapeChars(currentXmlContent.substring(0, startTagOffset)); ! // Having found a child node, we want to STOP adding anything to the current node's content (e.g. newlines...) readingContent = false; --- 229,233 ---- if(readingContent) this.content += xmlUnescapeChars(currentXmlContent.substring(0, startTagOffset)); ! // Having found a child node, we want to STOP adding anything to the current node's content (e.g. newlines...) readingContent = false; *************** *** 234,243 **** babyNode = new JreepadNode(this); //System.out.println("\n\nJust before passing to baby: content is:\n"+currentXmlContent); ! currentXmlContent = babyNode.recursiveCreateFromXmlStream(bReader, currentXmlContent.substring(startTagOffset), depth+1); //System.out.println("\n\nJust after passing to baby: content is:\n"+currentXmlContent); children.add(babyNode); } ! startTagOffset = currentXmlContent.indexOf("<node"); endTagOffset = currentXmlContent.indexOf("</node>"); --- 236,245 ---- babyNode = new JreepadNode(this); //System.out.println("\n\nJust before passing to baby: content is:\n"+currentXmlContent); ! currentXmlContent = babyNode.recursiveCreateFromXmlStream(bReader, currentXmlContent.substring(startTagOffset), depth+1); //System.out.println("\n\nJust after passing to baby: content is:\n"+currentXmlContent); children.add(babyNode); } ! startTagOffset = currentXmlContent.indexOf("<node"); endTagOffset = currentXmlContent.indexOf("</node>"); *************** *** 256,260 **** ! private void constructFromHjtInputStream(InputStreamReader treeInputStream, boolean autoDetectHtmlArticles, int hjtFileFormat, BufferedReader bReader, int lineNum, Stack nodeStack, Vector children --- 258,262 ---- ! private void constructFromHjtInputStream(InputStreamReader treeInputStream, boolean autoDetectHtmlArticles, int hjtFileFormat, BufferedReader bReader, int lineNum, Stack nodeStack, Vector children *************** *** 269,273 **** while( (hjtFileFormat == 2 || (dtLine = bReader.readLine())!=null) ! && (nodeLine = bReader.readLine())!=null && (titleLine = bReader.readLine())!=null && (depthLine = bReader.readLine())!=null) { --- 271,275 ---- while( (hjtFileFormat == 2 || (dtLine = bReader.readLine())!=null) ! && (nodeLine = bReader.readLine())!=null && (titleLine = bReader.readLine())!=null && (depthLine = bReader.readLine())!=null) { *************** *** 335,339 **** Stack nodeStack = new Stack(); nodeStack.push(this); ! int hjtFileFormat = -1; --- 337,341 ---- Stack nodeStack = new Stack(); nodeStack.push(this); ! int hjtFileFormat = -1; *************** *** 347,355 **** else throw new IOException("\"<Treepad>\" tag not found at beginning of file!\n(This can be caused by having the wrong character set specified.)"); ! dtLine = "dt=text"; while( (hjtFileFormat == 2 || (dtLine = bReader.readLine())!=null) ! && (nodeLine = bReader.readLine())!=null && (titleLine = bReader.readLine())!=null && (depthLine = bReader.readLine())!=null) { --- 349,357 ---- else throw new IOException("\"<Treepad>\" tag not found at beginning of file!\n(This can be caused by having the wrong character set specified.)"); ! dtLine = "dt=text"; while( (hjtFileFormat == 2 || (dtLine = bReader.readLine())!=null) ! && (nodeLine = bReader.readLine())!=null && (titleLine = bReader.readLine())!=null && (depthLine = bReader.readLine())!=null) { *************** *** 498,502 **** return ret.toString(); } ! public String articleToHtml(int exportMode, boolean urlsToLinks, String anchorName, int anchorType) { --- 500,504 ---- return ret.toString(); } ! public String articleToHtml(int exportMode, boolean urlsToLinks, String anchorName, int anchorType) { *************** *** 530,534 **** { case EXPORT_HTML_PREFORMATTED: ! return "<pre>" + (urlsToLinks ? urlsToHtmlLinksAndHtmlSpecialChars(getContent(), anchorType) : htmlSpecialChars(getContent()) ) + "</pre>"; --- 532,536 ---- { case EXPORT_HTML_PREFORMATTED: ! return "<pre>" + (urlsToLinks ? urlsToHtmlLinksAndHtmlSpecialChars(getContent(), anchorType) : htmlSpecialChars(getContent()) ) + "</pre>"; *************** *** 547,551 **** } } ! private static String htmlSpecialChars(String in) { --- 549,553 ---- } } ! private static String htmlSpecialChars(String in) { *************** *** 561,565 **** return ret.toString(); } ! // Search through the String, replacing URI-like substrings (containing ://) with HTML links private String urlsToHtmlLinksAndHtmlSpecialChars(String in, int anchorType) --- 563,567 ---- return ret.toString(); } ! // Search through the String, replacing URI-like substrings (containing ://) with HTML links private String urlsToHtmlLinksAndHtmlSpecialChars(String in, int anchorType) *************** *** 577,581 **** // if(c!=CharacterIterator.DONE && currentWord.length()==0) // continue; ! // Check if the current word is a URL - do weird stuff to it if so, else just output it if(currentWord.toString().indexOf("://")>0) --- 579,583 ---- // if(c!=CharacterIterator.DONE && currentWord.length()==0) // continue; ! // Check if the current word is a URL - do weird stuff to it if so, else just output it if(currentWord.toString().indexOf("://")>0) *************** *** 621,627 **** else if(c==CharacterIterator.DONE); else out.append(c); ! currentWord.setLength(0); ! if(c==CharacterIterator.DONE) break; --- 623,629 ---- else if(c==CharacterIterator.DONE); else out.append(c); ! currentWord.setLength(0); ! if(c==CharacterIterator.DONE) break; *************** *** 691,695 **** { StringBuffer ret = new StringBuffer("dt=Text\n<node>\n"); ! ret.append(getTitle() + "\n" + (currentDepth++) + "\n" + getContent() + "\n" // + (currentDepth==1?"ROOTNODEMANIA":"\n") // Not sure why I need to be slightly unusual with the root node... --- 693,697 ---- { StringBuffer ret = new StringBuffer("dt=Text\n<node>\n"); ! ret.append(getTitle() + "\n" + (currentDepth++) + "\n" + getContent() + "\n" // + (currentDepth==1?"ROOTNODEMANIA":"\n") // Not sure why I need to be slightly unusual with the root node... *************** *** 719,723 **** if(child<0 || child > children.size()) return null; ! JreepadNode ret = (JreepadNode)children.remove(child); return ret; --- 721,725 ---- if(child<0 || child > children.size()) return null; ! JreepadNode ret = (JreepadNode)children.remove(child); return ret; *************** *** 805,809 **** int index = getIndex(); if(index<1) return; ! removeFromParent(); getParentNode().insert(this, index-1); --- 807,811 ---- int index = getIndex(); if(index<1) return; ! removeFromParent(); getParentNode().insert(this, index-1); *************** *** 814,818 **** int index = getIndex(); if(index<0 || index >= getParentNode().getChildCount()-1) return; ! removeFromParent(); getParentNode().insert(this, index+1); --- 816,820 ---- int index = getIndex(); if(index<0 || index >= getParentNode().getChildCount()-1) return; ! removeFromParent(); getParentNode().insert(this, index+1); *************** *** 840,844 **** return theChild; } ! public int getIndex(TreeNode child) { --- 842,846 ---- return theChild; } ! public int getIndex(TreeNode child) { *************** *** 858,862 **** return getParent().getIndex(this); } ! public boolean isNodeInSubtree(JreepadNode n) { --- 860,864 ---- return getParent().getIndex(this); } ! public boolean isNodeInSubtree(JreepadNode n) { *************** *** 873,877 **** return false; } ! public void sortChildren() { --- 875,879 ---- return false; } ! public void sortChildren() { *************** *** 961,965 **** return getChildCount()==0; // Is this the correct behaviour? } ! public Enumeration children() { --- 963,967 ---- return getChildCount()==0; // Is this the correct behaviour? } ! public Enumeration children() { *************** *** 1051,1055 **** return ret; } ! public JreepadNode getChildByTitle(String title) { --- 1053,1057 ---- return ret; } ! public JreepadNode getChildByTitle(String title) { *************** *** 1073,1077 **** if(charWidth < 2) return; ! StringBuffer ret = new StringBuffer(); StringCharacterIterator iter = new StringCharacterIterator(content); --- 1075,1079 ---- if(charWidth < 2) return; ! StringBuffer ret = new StringBuffer(); StringCharacterIterator iter = new StringCharacterIterator(content); *************** *** 1087,1094 **** } ret.append(c); ! } content = ret.toString(); } ! public synchronized void stripAllTags() { --- 1089,1096 ---- } ret.append(c); ! } content = ret.toString(); } ! public synchronized void stripAllTags() { *************** *** 1109,1113 **** else if(on) ret.append(c); ! } content = ret.toString(); } --- 1111,1115 ---- else if(on) ret.append(c); ! } content = ret.toString(); } *************** *** 1180,1184 **** int parseMode = CSVPARSE_MODE_EXPECTINGDATA; StringBuffer curData = new StringBuffer(); ! // Go through once to determine the number of rows and columns StringCharacterIterator iter = new StringCharacterIterator(theContent); --- 1182,1186 ---- int parseMode = CSVPARSE_MODE_EXPECTINGDATA; StringBuffer curData = new StringBuffer(); ! // Go through once to determine the number of rows and columns StringCharacterIterator iter = new StringCharacterIterator(theContent); *************** *** 1320,1324 **** return stripControlChars(ret); } ! public String toXmlNoHeader(String encoding, int depth, boolean incChildren) { --- 1322,1326 ---- return stripControlChars(ret); } ! public String toXmlNoHeader(String encoding, int depth, boolean incChildren) { *************** *** 1449,1456 **** implements UndoableEditListener { public void undoableEditHappened(UndoableEditEvent e) { ! //System.out.println("Undoable event is " + (e.getEdit().isSignificant()?"":"NOT ") + "significant"); //System.out.println("Undoable event source: " + e.getEdit()); ! //Remember the edit and update the menus. undoMgr.addEdit(e.getEdit()); --- 1451,1458 ---- implements UndoableEditListener { public void undoableEditHappened(UndoableEditEvent e) { ! //System.out.println("Undoable event is " + (e.getEdit().isSignificant()?"":"NOT ") + "significant"); //System.out.println("Undoable event source: " + e.getEdit()); ! //Remember the edit and update the menus. undoMgr.addEdit(e.getEdit()); |