[Bojangles-cvs] cvs: bojangles / MainWindow.java /xml XmlHandler.java
Status: Alpha
Brought to you by:
nehresma
From: kai5263499 <boj...@li...> - 2002-08-27 21:12:17
|
kai5263499 Tue Aug 27 14:12:17 2002 EDT Modified files: /bojangles MainWindow.java /bojangles/xml XmlHandler.java Log: Connected the open button to the loadXML() function and tried to get it semi-working... Index: bojangles/MainWindow.java diff -u bojangles/MainWindow.java:1.21 bojangles/MainWindow.java:1.22 --- bojangles/MainWindow.java:1.21 Mon Aug 26 11:27:19 2002 +++ bojangles/MainWindow.java Tue Aug 27 14:12:16 2002 @@ -359,11 +359,11 @@ } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { - saveXML(false); + saveXML(false); } private void openBtnActionPerformed(java.awt.event.ActionEvent evt) { - System.out.println("nope, i dont work yet... i'm just holding space"); + loadXML(); } private void testAppBtnActionPerformed(java.awt.event.ActionEvent evt) { @@ -414,7 +414,7 @@ // Kill de widget! //int row = widgetTree.getRowForLocation(evt.getX(), evt.getY()); String who = curSelectedItem.toString(); - System.out.println("I think: " + who); + System.out.println("I think: " + who + " has " + curSelectedItem.getLastPathComponent().toString() + " children..."); System.out.println("There is no spoon..."); appModified(true); } @@ -796,19 +796,14 @@ if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); sdir = file.getAbsoluteFile(); - prefDocument.selectSingleNode("/prefrences/prefSaveDir").setText(sdir.getPath()); - prefDocument.selectSingleNode("/prefrences/prefSaveFile").setText(sdir.getName()); - if (file.exists()) { - String suremsg = "Are you sure you want to overwrite?"; - int choice = JOptionPane.showConfirmDialog(this,"File \"" + file.getName() + "\" will be overwritten.",suremsg,JOptionPane.YES_NO_OPTION); - if(choice == JOptionPane.NO_OPTION) return; - System.out.println("Saved " + file.getName()); - curTitle = file.getName(); - appModified(false); + if (!file.exists()) { + String alertmsg = "File doesn't exist!"; + int choice = JOptionPane.showConfirmDialog(this,"File \"" + file.getName() + "\" does not exist!.",alertmsg,JOptionPane.OK_OPTION); + return; } // file to save as and wether or not to compress it, now thats hard coded because i havent added a checkbox to the above filechooser - xmlHandler.saveXML(file, true); + xmlHandler.loadXML(file); } else { System.out.println("Save canceled"); return; Index: bojangles/xml/XmlHandler.java diff -u bojangles/xml/XmlHandler.java:1.17 bojangles/xml/XmlHandler.java:1.18 --- bojangles/xml/XmlHandler.java:1.17 Sat Aug 24 17:35:08 2002 +++ bojangles/xml/XmlHandler.java Tue Aug 27 14:12:16 2002 @@ -30,7 +30,7 @@ public void loadXML(File file) { try { - doc = new SAXReader().read(file.getPath()); + doc = new SAXReader().read(file.getAbsolutePath() + file.getName()); } catch (DocumentException e) { e.printStackTrace(); } |