bojangles-cvs Mailing List for bojangles (Page 2)
Status: Alpha
Brought to you by:
nehresma
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(43) |
Sep
(11) |
Oct
(3) |
Nov
|
Dec
|
---|
From: nehresma <boj...@li...> - 2002-08-25 00:26:33
|
nehresma Sat Aug 24 17:26:31 2002 EDT Modified files: /bojangles/xml XmlHandler.java /bojangles MainWindow.java Log: couple compile bugs fixed Index: bojangles/xml/XmlHandler.java diff -u bojangles/xml/XmlHandler.java:1.15 bojangles/xml/XmlHandler.java:1.16 --- bojangles/xml/XmlHandler.java:1.15 Sat Aug 24 11:06:10 2002 +++ bojangles/xml/XmlHandler.java Sat Aug 24 17:26:31 2002 @@ -29,7 +29,7 @@ } public void loadXML(File file) { - doc = SAXReader().read(); + //doc = new SAXReader().read(); // OK, the XML is right, now we just need to update the GUI } Index: bojangles/MainWindow.java diff -u bojangles/MainWindow.java:1.18 bojangles/MainWindow.java:1.19 --- bojangles/MainWindow.java:1.18 Sat Aug 24 11:16:23 2002 +++ bojangles/MainWindow.java Sat Aug 24 17:26:31 2002 @@ -757,8 +757,8 @@ if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); sdir = file.getAbsoluteFile(); - prefDocument.selectSingleNode("/prefrences/prefSaveDir").addText(sdir.getPath()); - prefDocument.selectSingleNode("/prefrences/prefSaveFile").addText(sdir.getName()); + 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?"; |
From: kai5263499 <boj...@li...> - 2002-08-24 18:16:26
|
kai5263499 Sat Aug 24 11:16:25 2002 EDT Modified files: /bojangles CorrelationTable.java MainWindow.form MainWindow.java RemoveButtonEditor.java RemoveButtonRenderer.java buildBJ Log: Addition to the previous. |
From: kai5263499 <boj...@li...> - 2002-08-24 18:06:11
|
kai5263499 Sat Aug 24 11:06:11 2002 EDT Modified files: /bojangles/xml XmlHandler.java Log: Stuff I didn't commit Friday. It includes GZIP support and updated prefrences (although its still somewhat broken...). Index: bojangles/xml/XmlHandler.java diff -u bojangles/xml/XmlHandler.java:1.14 bojangles/xml/XmlHandler.java:1.15 --- bojangles/xml/XmlHandler.java:1.14 Thu Aug 22 14:07:10 2002 +++ bojangles/xml/XmlHandler.java Sat Aug 24 11:06:10 2002 @@ -28,7 +28,9 @@ doc = DocumentHelper.createDocument(); } - public void loadXML(File file) { + public void loadXML(File file) { + doc = SAXReader().read(); + // OK, the XML is right, now we just need to update the GUI } public void addProperty(String path, String name, String text) { |
From: kai5263499 <boj...@li...> - 2002-08-22 21:08:27
|
kai5263499 Thu Aug 22 14:08:27 2002 EDT Modified files: /bojangles MainWindow.java Log: Cleaned up some things (added a doExit function that should handle all exits) and tried to start making a prefs.xml file if one didnt exist... |
From: kai5263499 <boj...@li...> - 2002-08-22 21:07:11
|
kai5263499 Thu Aug 22 14:07:10 2002 EDT Modified files: /bojangles/xml XmlHandler.java Log: Finished gzip saveing option, now i just need to let the user decide when and when not to use it. It also automagically adds a .gz to the end of a gzipped doc. Now to work on opening a document... Index: bojangles/xml/XmlHandler.java diff -u bojangles/xml/XmlHandler.java:1.13 bojangles/xml/XmlHandler.java:1.14 --- bojangles/xml/XmlHandler.java:1.13 Thu Aug 22 06:43:27 2002 +++ bojangles/xml/XmlHandler.java Thu Aug 22 14:07:10 2002 @@ -176,22 +176,24 @@ public void saveXML(File of, boolean wantCompressed) { try { OutputFormat format = OutputFormat.createPrettyPrint(); - OutputStream outfileOrig = new FileOutputStream(of); - - if(wantCompressed) { - File nf = new File(of.getAbsolutePath() + of.getName() + ".gz"); + if(true) { + File nof = new File(of.getAbsolutePath() + ".gz"); + System.out.println(of.getAbsolutePath() + ".gz"); FileOutputStream newStream = new FileOutputStream(of); OutputStream outfile = new GZIPOutputStream(newStream); XMLWriter saver = new XMLWriter(outfile, format); saver.write(this.doc); - System.out.println("Compressed to: " + of.getAbsolutePath() + of.getName() + ".gz"); + // Must flush buffers + outfile.close(); } + else { - XMLWriter saverOrig = new XMLWriter(outfileOrig, format); - saverOrig.write(this.doc); + FileOutputStream outfile = new FileOutputStream(of); + XMLWriter saver = new XMLWriter(outfile, format); + saver.write(this.doc); + outfile.close(); } - - } + } catch (Exception e) { e.printStackTrace(); } |
From: kai5263499 <boj...@li...> - 2002-08-22 13:44:22
|
kai5263499 Thu Aug 22 06:44:22 2002 EDT Added files: /bojangles testAppPrefsDlg.java Log: I dont know if i added this already... Its a prefs GUI Index: bojangles/testAppPrefsDlg.java +++ bojangles/testAppPrefsDlg.java package bojangles; import javax.swing.*; /** * <p>Title: testAppPrefsDlg</p> * <p>Description: Dialog box to provide a GUI interface to change testing options</p> * <p>Copyright: Copyright (c) 2002 under the GPL</p> * @author Wes */ public class testAppPrefsDlg extends javax.swing.JDialog { public String hostStr; public String portStr; public String pathStr; public String browserStr; /** Creates new form testAppPrefsDlg */ public testAppPrefsDlg(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ private void initComponents() {//GEN-BEGIN:initComponents jLabel1 = new javax.swing.JLabel(); jSeparator1 = new javax.swing.JSeparator(); jLabel2 = new javax.swing.JLabel(); jLabel21 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); browser = new javax.swing.JTextField(); host = new javax.swing.JTextField(); port = new javax.swing.JTextField(); path = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); statusBar = new javax.swing.JLabel(); getContentPane().setLayout(null); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); jLabel1.setFont(new java.awt.Font("Dialog", 1, 18)); jLabel1.setText("App Testing Prefrences"); getContentPane().add(jLabel1); jLabel1.setBounds(0, 0, 400, 30); getContentPane().add(jSeparator1); jSeparator1.setBounds(0, 40, 390, 2); jLabel2.setText("<html>What port does Centrallix use?</html>"); getContentPane().add(jLabel2); jLabel2.setBounds(20, 130, 150, 30); jLabel21.setText("<html>Where is your browser's binary file located?"); getContentPane().add(jLabel21); jLabel21.setBounds(20, 70, 150, 30); jLabel3.setText("<html>What host is Centrallix running on?</html>"); getContentPane().add(jLabel3); jLabel3.setBounds(20, 100, 150, 30); jLabel4.setText("<html>What path are the bojangle apps held in?</html"); getContentPane().add(jLabel4); jLabel4.setBounds(20, 160, 150, 30); jButton1.setText("Allrightythen"); getContentPane().add(jButton1); jButton1.setBounds(30, 200, 150, 26); jButton2.setText("Nah, needs garlic"); getContentPane().add(jButton2); jButton2.setBounds(210, 200, 160, 26); browser.setText("/usr/bin/mozilla"); browser.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { browserActionPerformed(evt); } }); getContentPane().add(browser); browser.setBounds(180, 70, 200, 20); host.setText("localhost"); getContentPane().add(host); host.setBounds(180, 100, 200, 20); port.setText("8800"); getContentPane().add(port); port.setBounds(180, 130, 200, 20); path.setText("/kardia"); getContentPane().add(path); path.setBounds(180, 160, 200, 20); jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel5.setText("<html>http://localhost:8800/kardia</html>"); getContentPane().add(jLabel5); jLabel5.setBounds(50, 50, 280, 16); getContentPane().add(statusBar); statusBar.setBounds(0, 230, 400, 20); pack(); }//GEN-END:initComponents private void browserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browserActionPerformed // Add your handling code here: }//GEN-LAST:event_browserActionPerformed /** Closes the dialog */ private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog setVisible(false); // Set class variables this.portStr = port.getText(); this.hostStr = host.getText(); this.pathStr = path.getText(); this.browserStr = browser.getText(); // Commit suicide dispose(); }//GEN-LAST:event_closeDialog // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton2; private javax.swing.JSeparator jSeparator1; private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel21; private javax.swing.JTextField host; private javax.swing.JTextField browser; private javax.swing.JTextField path; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel statusBar; private javax.swing.JTextField port; // End of variables declaration//GEN-END:variables public static void main(String args[]) { new testAppPrefsDlg(new javax.swing.JFrame(), true).show(); } } |
From: kai5263499 <boj...@li...> - 2002-08-22 13:43:32
|
kai5263499 Thu Aug 22 06:43:28 2002 EDT Modified files: /bojangles/widgets Page.java PictureButton.java TextButton.java Widget.java /bojangles/xml XmlHandler.java Log: Forgot to add this lastnight (would have saved Nathan all that work)... This includes unified header comments and initial support for GZIP. Index: bojangles/widgets/Page.java diff -u bojangles/widgets/Page.java:1.2 bojangles/widgets/Page.java:1.3 --- bojangles/widgets/Page.java:1.2 Sat Aug 3 15:26:08 2002 +++ bojangles/widgets/Page.java Thu Aug 22 06:43:26 2002 @@ -1,18 +1,16 @@ package bojangles.widgets; -/** - * <p>Title: </p> - * <p>Description: </p> - * <p>Copyright: Copyright (c) 2002</p> - * <p>Company: </p> - * @author unascribed - * @version 1.0 - */ - import bojangles.*; import bojangles.xml.*; import java.awt.*; import java.awt.event.*; + +/** + * <p>Title: Page</p> + * <p>Description: Page Widget (extention to Widget)</p> + * <p>Copyright: Copyright (c) 2002 under the GPL</p> + * @author Nathan + */ public class Page extends Widget { public Page(String path, XmlHandler xml, ElementFocusListener fl) { Index: bojangles/widgets/PictureButton.java diff -u bojangles/widgets/PictureButton.java:1.1 bojangles/widgets/PictureButton.java:1.2 --- bojangles/widgets/PictureButton.java:1.1 Tue Aug 20 15:37:15 2002 +++ bojangles/widgets/PictureButton.java Thu Aug 22 06:43:26 2002 @@ -1,10 +1,4 @@ -/* - * TextButton.java - * - * Created on July 6, 2002, 2:52 PM - */ - -package widgets; +package bojangles.widgets; import bojangles.*; import bojangles.xml.*; @@ -16,9 +10,12 @@ import java.util.*; /** - * - * @author nathan + * <p>Title: TextButton</p> + * <p>Description: Button that uses a user-supplied image file for the background</p> + * <p>Copyright: Copyright (c) 2002 under the GPL</p> + * @author Wes (Based on the textbutton) */ + public class PictureButton extends bojangles.widgets.Widget implements PropertiesTableListener { JButton button = new JButton(); @@ -26,8 +23,8 @@ public PictureButton(String path, XmlHandler xmlHandler, ElementFocusListener fl, String label) { super(path, xmlHandler, fl); setLayout(new BorderLayout()); - this.label = new JLabel(label, SwingConstants.CENTER); - add(this.label); + //this.label = new JLabel(label, SwingConstants.CENTER); + //add(this.label); button.setIcon(new ImageIcon("images/x.gif")); setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.white, Color.black)); } @@ -44,7 +41,7 @@ setBounds(x.intValue(), y.intValue(), width.intValue(), height.intValue()); } else if (propertyName.equals("text")) { Hashtable h = xmlHandler.getProperties(path); - label.setText((String)h.get("text")); + // label.setText((String)h.get("text")); } } Index: bojangles/widgets/TextButton.java diff -u bojangles/widgets/TextButton.java:1.1.1.1 bojangles/widgets/TextButton.java:1.2 --- bojangles/widgets/TextButton.java:1.1.1.1 Sat Aug 3 08:42:37 2002 +++ bojangles/widgets/TextButton.java Thu Aug 22 06:43:26 2002 @@ -1,9 +1,3 @@ -/* - * TextButton.java - * - * Created on July 6, 2002, 2:52 PM - */ - package bojangles.widgets; import bojangles.*; @@ -16,9 +10,12 @@ import java.util.*; /** - * - * @author nathan + * <p>Title: TextButton</p> + * <p>Description: TextButton Widget (extention to Widget)</p> + * <p>Copyright: Copyright (c) 2002 under the GPL</p> + * @author Nathan */ + public class TextButton extends bojangles.widgets.Widget implements PropertiesTableListener { JLabel label = null; Index: bojangles/widgets/Widget.java diff -u bojangles/widgets/Widget.java:1.3 bojangles/widgets/Widget.java:1.4 --- bojangles/widgets/Widget.java:1.3 Tue Aug 20 15:37:15 2002 +++ bojangles/widgets/Widget.java Thu Aug 22 06:43:26 2002 @@ -9,12 +9,10 @@ import java.util.*; /** - * <p>Title: </p> - * <p>Description: </p> - * <p>Copyright: Copyright (c) 2002</p> - * <p>Company: </p> - * @author unascribed - * @version 1.0 + * <p>Title: Widget</p> + * <p>Description: Widget class</p> + * <p>Copyright: Copyright (c) 2002 under the GPL</p> + * @author Nathan */ public class Widget extends JPanel implements KeyListener, MouseListener, FocusListener, MouseMotionListener, ComponentListener { Index: bojangles/xml/XmlHandler.java diff -u bojangles/xml/XmlHandler.java:1.12 bojangles/xml/XmlHandler.java:1.13 --- bojangles/xml/XmlHandler.java:1.12 Wed Aug 21 19:38:54 2002 +++ bojangles/xml/XmlHandler.java Thu Aug 22 06:43:27 2002 @@ -2,11 +2,19 @@ import java.lang.*; import java.io.*; +import java.util.zip.*; import java.util.*; import java.awt.event.*; import org.dom4j.*; import org.dom4j.io.*; +/** + * <p>Title: XmlHandler</p> + * <p>Description: Widget XML handeling subroutienes</p> + * <p>Copyright: Copyright (c) 2002 under the GPL</p> + * @author Nathan + */ + public class XmlHandler extends Object { Document doc = null; Vector listeners = new Vector(); @@ -165,13 +173,26 @@ return l.size(); } - public void saveXML(File of) { + public void saveXML(File of, boolean wantCompressed) { try { - FileOutputStream outfile = new FileOutputStream(of); OutputFormat format = OutputFormat.createPrettyPrint(); - XMLWriter saver = new XMLWriter(outfile, format); - saver.write(this.doc); - } catch (Exception e) { + OutputStream outfileOrig = new FileOutputStream(of); + + if(wantCompressed) { + File nf = new File(of.getAbsolutePath() + of.getName() + ".gz"); + FileOutputStream newStream = new FileOutputStream(of); + OutputStream outfile = new GZIPOutputStream(newStream); + XMLWriter saver = new XMLWriter(outfile, format); + saver.write(this.doc); + System.out.println("Compressed to: " + of.getAbsolutePath() + of.getName() + ".gz"); + } + else { + XMLWriter saverOrig = new XMLWriter(outfileOrig, format); + saverOrig.write(this.doc); + } + + } + catch (Exception e) { e.printStackTrace(); } } |
From: nehresma <boj...@li...> - 2002-08-22 03:24:34
|
nehresma Wed Aug 21 20:24:33 2002 EDT Modified files: /bojangles MainWindow.java Log: removed some debug code Index: bojangles/MainWindow.java diff -u bojangles/MainWindow.java:1.15 bojangles/MainWindow.java:1.16 --- bojangles/MainWindow.java:1.15 Wed Aug 21 19:51:30 2002 +++ bojangles/MainWindow.java Wed Aug 21 20:24:32 2002 @@ -324,7 +324,6 @@ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { xmlHandler.printXML(); - System.out.println(propertiesTable.getColumnModel().getColumn(0).getCellRenderer()); } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { @@ -333,16 +332,16 @@ private void testAppBtnActionPerformed(java.awt.event.ActionEvent evt) { if(this.appModified){ - saveXML(); + saveXML(); } // Redundant? Redundant? if(!this.appModified) { - if(this.prefsSet) { - return; - } - else { - //testAppPrefsDlg testappprefsdlg = new testAppPrefsDlg(); - } + if(this.prefsSet) { + return; + } + else { + //testAppPrefsDlg testappprefsdlg = new testAppPrefsDlg(); + } } else return; } |
From: nehresma <boj...@li...> - 2002-08-22 02:51:31
|
nehresma Wed Aug 21 19:51:30 2002 EDT Modified files: /bojangles MainWindow.java Log: check to make sure the preferences file exists before attempting to read from it. Index: bojangles/MainWindow.java diff -u bojangles/MainWindow.java:1.14 bojangles/MainWindow.java:1.15 --- bojangles/MainWindow.java:1.14 Tue Aug 20 15:32:24 2002 +++ bojangles/MainWindow.java Wed Aug 21 19:51:30 2002 @@ -16,16 +16,6 @@ import org.dom4j.io.*; -/* - * MainWindow.java - * - * Created on June 24, 2002, 8:46 PM - */ - -/** - * - * @author Nathan Ehresman - */ public class MainWindow extends javax.swing.JFrame implements ElementFocusListener, TableModelListener { /** * The correlation table linking JTreeNode, Widget, and XML path. @@ -630,36 +620,36 @@ } private void loadPrefrences() { - try { - File prefFile = new File("prefs.xml"); - if (null == prefFile) { - System.out.println("No saved prefrences..."); - // Lets make a document anyway to write collected prefrences to... - // Document prefDocument = new SAXDocument(); - prefDocument = DocumentHelper.createDocument(); - } - else { - System.out.println("Loading prefrences from prefs.xml"); - prefDocument = new SAXReader().read("prefs.xml"); - sdir = new File(prefDocument.selectSingleNode("/prefrences/prefSaveDir").getText()); - lastfile = prefDocument.selectSingleNode("/prefrences/lastFileSaved").getText(); - prefBrowser = prefDocument.selectSingleNode("/prefrences/browser").getText(); - prefHost = prefDocument.selectSingleNode("/prefrences/testHost").getText(); - prefPort = prefDocument.selectSingleNode("/prefrences/testPort").getText(); - prefPath = prefDocument.selectSingleNode("/prefrences/testPath").getText(); - System.out.println("URL: http://" + prefHost + ":" + prefPort + "/" + prefPath + "/" + lastfile); - System.out.println("Load ok!"); - } - } - catch (Exception e) { - e.printStackTrace(); + try { + File prefFile = new File("prefs.xml"); + if (null == prefFile) + return; + else if (!prefFile.exists()) { + System.out.println("No saved prefrences..."); + // Lets make a document anyway to write collected prefrences to... + // Document prefDocument = new SAXDocument(); + prefDocument = DocumentHelper.createDocument(); + } else { + System.out.println("Loading prefrences from prefs.xml"); + prefDocument = new SAXReader().read("prefs.xml"); + sdir = new File(prefDocument.selectSingleNode("/prefrences/prefSaveDir").getText()); + lastfile = prefDocument.selectSingleNode("/prefrences/lastFileSaved").getText(); + prefBrowser = prefDocument.selectSingleNode("/prefrences/browser").getText(); + prefHost = prefDocument.selectSingleNode("/prefrences/testHost").getText(); + prefPort = prefDocument.selectSingleNode("/prefrences/testPort").getText(); + prefPath = prefDocument.selectSingleNode("/prefrences/testPath").getText(); + System.out.println("URL: http://" + prefHost + ":" + prefPort + "/" + prefPath + "/" + lastfile); + System.out.println("Load ok!"); + } + } catch (Exception e) { + e.printStackTrace(); } } private void appModified(boolean moded) { - appModified = moded; - if(moded) this.setTitle(curTitle + "*"); - else this.setTitle(curTitle); + appModified = moded; + if(moded) this.setTitle(curTitle + "*"); + else this.setTitle(curTitle); } private void saveXML() { |
From: nehresma <boj...@li...> - 2002-08-22 02:44:41
|
nehresma Wed Aug 21 19:44:40 2002 EDT Modified files: /bojangles/widgets HighlightBorder.java Log: commented the top right and bottom left grabbers back out. if/when we get the mouse move bug stuff worked out for those then we can uncomment them, but for now i think they are best left out as to not cause confusion. Index: bojangles/widgets/HighlightBorder.java diff -u bojangles/widgets/HighlightBorder.java:1.2 bojangles/widgets/HighlightBorder.java:1.3 --- bojangles/widgets/HighlightBorder.java:1.2 Tue Aug 20 15:37:15 2002 +++ bojangles/widgets/HighlightBorder.java Wed Aug 21 19:44:40 2002 @@ -30,9 +30,9 @@ // bottom right g.fillRect(w-borderDepth,h-borderDepth,borderDepth, borderDepth); // bottom left - g.fillRect(0,h-borderDepth,borderDepth, borderDepth); + //g.fillRect(0,h-borderDepth,borderDepth, borderDepth); // top right - g.fillRect(w-borderDepth,0,borderDepth, borderDepth); + //g.fillRect(w-borderDepth,0,borderDepth, borderDepth); } public Insets getBorderInsets(Component c) { |
From: nehresma <boj...@li...> - 2002-08-22 02:40:33
|
nehresma Wed Aug 21 19:40:32 2002 EDT Modified files: /bojangles/xml XmlListener.java Log: removed worthless comments from netbeans at the top Index: bojangles/xml/XmlListener.java diff -u bojangles/xml/XmlListener.java:1.2 bojangles/xml/XmlListener.java:1.3 --- bojangles/xml/XmlListener.java:1.2 Tue Aug 20 15:37:15 2002 +++ bojangles/xml/XmlListener.java Wed Aug 21 19:40:32 2002 @@ -1,14 +1,5 @@ package bojangles.xml; -/** - * <p>Title: </p> - * <p>Description: </p> - * <p>Copyright: Copyright (c) 2002</p> - * <p>Company: </p> - * @author nhre - * @version 1.0 - */ - public interface XmlListener { public void elementAdded(XmlEvent evt); public void elementModified(XmlEvent evt); |
From: nehresma <boj...@li...> - 2002-08-22 02:38:56
|
nehresma Wed Aug 21 19:38:55 2002 EDT Modified files: /bojangles/xml XmlHandler.java Log: removed the import of the swing classes. gui stuff should not go in the XmlHandler class. Index: bojangles/xml/XmlHandler.java diff -u bojangles/xml/XmlHandler.java:1.11 bojangles/xml/XmlHandler.java:1.12 --- bojangles/xml/XmlHandler.java:1.11 Mon Aug 19 13:54:11 2002 +++ bojangles/xml/XmlHandler.java Wed Aug 21 19:38:54 2002 @@ -1,6 +1,5 @@ package bojangles.xml; -import javax.swing.*; import java.lang.*; import java.io.*; import java.util.*; |
From: kai5263499 <boj...@li...> - 2002-08-20 22:43:59
|
kai5263499 Tue Aug 20 15:43:58 2002 EDT Added files: /bojangles/widget_definitions EXAMPLE.xml Log: Afore mentioned EXAMPLE.xml file for refrence... Index: bojangles/widget_definitions/EXAMPLE.xml +++ bojangles/widget_definitions/EXAMPLE.xml <widget> <name>page</name> <displayname>Page</displayname> <outer_type>widget/page</outer_type> <class>container</class> <visible>true</visible> <initial_settings> <x>5</x> <y>5</y> <width>500</width> <height>400</height> <bgcolor>#e0e0e0</bgcolor> </initial_settings> <resizable>false</resizable> <moveable>false</moveable> <max_per_document>1</max_per_document> <properties> <title> <represent_as>text</represent_as> <default>bojangles generated application</default> </title> <bgcolor> <represent_as>color</represent_as> <default>#e0e0e0</default> </bgcolor> <textcolor> <represent_as>color</represent_as> <default>#000000</default> </textcolor> </properties> </widget> |
From: kai5263499 <boj...@li...> - 2002-08-20 22:37:16
|
kai5263499 Tue Aug 20 15:37:16 2002 EDT Added files: /bojangles/widgets PictureButton.java Modified files: /bojangles/widget_definitions form.xml /bojangles/widgets HighlightBorder.java Widget.java /bojangles/xml XmlListener.java Log: Getting bold with a general commit to put in misc changes made... I'm including a copy of prefs.xml for refrence. I might remove it later as bojangles will later dynamically make a prefs.xml file if it dosent exist already. The other files contain minor changes. Oh, and I started on a picturebutton. Index: bojangles/widget_definitions/form.xml diff -u bojangles/widget_definitions/form.xml:1.2 bojangles/widget_definitions/form.xml:1.3 --- bojangles/widget_definitions/form.xml:1.2 Wed Aug 14 08:22:39 2002 +++ bojangles/widget_definitions/form.xml Tue Aug 20 15:37:15 2002 @@ -13,7 +13,6 @@ </initial_settings> <resizable>true</resizable> <moveable>true</moveable> - <max_per_document></max_per_document> <properties> <title> <represent_as>text</represent_as> Index: bojangles/widgets/HighlightBorder.java diff -u bojangles/widgets/HighlightBorder.java:1.1.1.1 bojangles/widgets/HighlightBorder.java:1.2 --- bojangles/widgets/HighlightBorder.java:1.1.1.1 Sat Aug 3 08:42:37 2002 +++ bojangles/widgets/HighlightBorder.java Tue Aug 20 15:37:15 2002 @@ -30,9 +30,9 @@ // bottom right g.fillRect(w-borderDepth,h-borderDepth,borderDepth, borderDepth); // bottom left - //g.fillRect(0,h-borderDepth,borderDepth, borderDepth); + g.fillRect(0,h-borderDepth,borderDepth, borderDepth); // top right - //g.fillRect(w-borderDepth,0,borderDepth, borderDepth); + g.fillRect(w-borderDepth,0,borderDepth, borderDepth); } public Insets getBorderInsets(Component c) { Index: bojangles/widgets/Widget.java diff -u bojangles/widgets/Widget.java:1.2 bojangles/widgets/Widget.java:1.3 --- bojangles/widgets/Widget.java:1.2 Sat Aug 3 15:26:08 2002 +++ bojangles/widgets/Widget.java Tue Aug 20 15:37:15 2002 @@ -17,7 +17,7 @@ * @version 1.0 */ -public class Widget extends JPanel implements MouseListener, FocusListener, MouseMotionListener, ComponentListener { +public class Widget extends JPanel implements KeyListener, MouseListener, FocusListener, MouseMotionListener, ComponentListener { protected final int NONE = 0; protected final int TOPRIGHT = 1; protected final int TOPLEFT = 2; @@ -49,10 +49,15 @@ public void setPath(String path) { this.path = path; } + public String getPath() { return path; } + public void setBounds(int x, int y, int width, int height) { + if(height == 0 && width == 0) { + return; + } super.setBounds(x,y,width,height); this.width=width; this.height=height; @@ -81,6 +86,7 @@ } notifyElementFocusListeners(); } + public void focusLost(FocusEvent e) { if (resizable) { borderDepth=0; @@ -90,6 +96,7 @@ setBorder(previousBorder); } } + public void mousePressed(MouseEvent e) { if (!isFocusOwner()) requestFocus(); @@ -109,7 +116,17 @@ lastPoint = p; } } - public void mouseClicked(MouseEvent e) { } + + public void mouseClicked(MouseEvent e) { + //if(e.getClass() == e.BUTTON2_MASK) { + // + //} + } + + public void keyTyped(KeyEvent e) { + + } + public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mouseReleased(MouseEvent e) { @@ -203,4 +220,11 @@ public boolean getMoveable() { return moveable; } + + public void keyPressed(KeyEvent e) { } + + public void keyReleased(KeyEvent e) { + System.out.println(e.getKeyText(e.getKeyCode())); + } + } Index: bojangles/xml/XmlListener.java diff -u bojangles/xml/XmlListener.java:1.1.1.1 bojangles/xml/XmlListener.java:1.2 --- bojangles/xml/XmlListener.java:1.1.1.1 Sat Aug 3 08:42:37 2002 +++ bojangles/xml/XmlListener.java Tue Aug 20 15:37:15 2002 @@ -5,7 +5,7 @@ * <p>Description: </p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: </p> - * @author unascribed + * @author nhre * @version 1.0 */ Index: bojangles/widgets/PictureButton.java +++ bojangles/widgets/PictureButton.java /* * TextButton.java * * Created on July 6, 2002, 2:52 PM */ package widgets; import bojangles.*; import bojangles.xml.*; import java.awt.*; import java.awt.event.*; import java.lang.*; import javax.swing.*; import javax.swing.border.*; import java.util.*; /** * * @author nathan */ public class PictureButton extends bojangles.widgets.Widget implements PropertiesTableListener { JButton button = new JButton(); /** Creates a new instance of PictureButton */ public PictureButton(String path, XmlHandler xmlHandler, ElementFocusListener fl, String label) { super(path, xmlHandler, fl); setLayout(new BorderLayout()); this.label = new JLabel(label, SwingConstants.CENTER); add(this.label); button.setIcon(new ImageIcon("images/x.gif")); setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.white, Color.black)); } public void tableModified(String currentElementPath, String propertyName) { if (!currentElementPath.equals(path)) return; if (propertyName.equals("x") || propertyName.equals("y") || propertyName.equals("width") || propertyName.equals("height")) { Hashtable h = xmlHandler.getProperties(path); Integer x = new Integer((String)h.get("x")); Integer y = new Integer((String)h.get("y")); Integer width = new Integer((String)h.get("width")); Integer height = new Integer((String)h.get("height")); setBounds(x.intValue(), y.intValue(), width.intValue(), height.intValue()); } else if (propertyName.equals("text")) { Hashtable h = xmlHandler.getProperties(path); label.setText((String)h.get("text")); } } public void componentHidden(java.awt.event.ComponentEvent componentEvent) { } public void componentMoved(java.awt.event.ComponentEvent componentEvent) { } public void componentResized(java.awt.event.ComponentEvent componentEvent) { } public void componentShown(java.awt.event.ComponentEvent componentEvent) { } public void focusGained(java.awt.event.FocusEvent focusEvent) { } public void focusLost(java.awt.event.FocusEvent focusEvent) { } public void keyPressed(java.awt.event.KeyEvent keyEvent) { } public void keyReleased(java.awt.event.KeyEvent keyEvent) { } public void keyTyped(java.awt.event.KeyEvent keyEvent) { } public void mouseClicked(java.awt.event.MouseEvent mouseEvent) { } public void mouseDragged(java.awt.event.MouseEvent mouseEvent) { } public void mouseEntered(java.awt.event.MouseEvent mouseEvent) { } public void mouseExited(java.awt.event.MouseEvent mouseEvent) { } public void mouseMoved(java.awt.event.MouseEvent mouseEvent) { } public void mousePressed(java.awt.event.MouseEvent mouseEvent) { } public void mouseReleased(java.awt.event.MouseEvent mouseEvent) { } } |
From: kai5263499 <boj...@li...> - 2002-08-20 22:32:26
|
kai5263499 Tue Aug 20 15:32:24 2002 EDT Modified files: /bojangles MainWindow.java Log: Prefrences addition... Index: bojangles/MainWindow.java diff -u bojangles/MainWindow.java:1.13 bojangles/MainWindow.java:1.14 --- bojangles/MainWindow.java:1.13 Tue Aug 20 09:38:30 2002 +++ bojangles/MainWindow.java Tue Aug 20 15:32:24 2002 @@ -61,9 +61,12 @@ private File sdir = null; private boolean appModified = false; private String curTitle= "New Window"; + private String lastfile, prefHost, prefPort, prefPath, prefBrowser; + private Document prefDocument = null; /** Creates new form MainWindow */ public MainWindow() { + loadPrefrences(); loadWidgetDefinitions(); initComponents(); initPopupMenus(); @@ -275,8 +278,8 @@ } }); - fileMenu.add(exitMenuItem); fileMenu.add(saveMenuItem); + fileMenu.add(exitMenuItem); helpMenu.add(genhelpMenuItem); jMenuBar1.add(fileMenu); jMenuBar1.add(helpMenu); @@ -476,7 +479,7 @@ } Container parent = null; - // if we are the first thing in the tree, then set the parent equal to the displayPanel + // if we are the first thing in the tree, t hen set the parent equal to the displayPanel if (null == popupOnTreeNode) parent = displayPanel; else { @@ -603,7 +606,6 @@ } private void loadWidgetDefinitions() { - File[] files = new File("widget_definitions").listFiles(); if (null == files) { System.out.println("Unable to find the widget definitions."); @@ -612,7 +614,8 @@ for (int i=0;i<files.length;i++) { String name = files[i].getName(); - if (name.endsWith(".xml")) { + // Loop through the widget definition XML files. But exclude the example widget file. + if (name.endsWith(".xml") && !name.equalsIgnoreCase("EXAMPLE.xml")) { try { System.out.println("Loading widget definition from " + name); Document document = new SAXReader().read("widget_definitions/" + name); @@ -627,17 +630,29 @@ } private void loadPrefrences() { - File files = new File("prefs.xml"); - if (null == files) { - System.out.println("No saved prefrences..."); - } try { + File prefFile = new File("prefs.xml"); + if (null == prefFile) { + System.out.println("No saved prefrences..."); + // Lets make a document anyway to write collected prefrences to... + // Document prefDocument = new SAXDocument(); + prefDocument = DocumentHelper.createDocument(); + } + else { System.out.println("Loading prefrences from prefs.xml"); - Document document = new SAXReader().read("prefs.xml"); - } - catch (DocumentException e) { + prefDocument = new SAXReader().read("prefs.xml"); + sdir = new File(prefDocument.selectSingleNode("/prefrences/prefSaveDir").getText()); + lastfile = prefDocument.selectSingleNode("/prefrences/lastFileSaved").getText(); + prefBrowser = prefDocument.selectSingleNode("/prefrences/browser").getText(); + prefHost = prefDocument.selectSingleNode("/prefrences/testHost").getText(); + prefPort = prefDocument.selectSingleNode("/prefrences/testPort").getText(); + prefPath = prefDocument.selectSingleNode("/prefrences/testPath").getText(); + System.out.println("URL: http://" + prefHost + ":" + prefPort + "/" + prefPath + "/" + lastfile); + System.out.println("Load ok!"); + } + } + catch (Exception e) { e.printStackTrace(); - System.exit(1); } } @@ -649,19 +664,14 @@ private void saveXML() { JFileChooser fc = new JFileChooser(); - if(sdir != null) fc.setCurrentDirectory(sdir); // Try to read in prefrences from the prefs.xml doc... - /* - else { - if(System.getProperty("os.name").equalsIgnoreCase("Linux")) { - fc.setCurrentDirectory(); - } - }*/ + if(sdir != null) fc.setCurrentDirectory(sdir); int returnVal = fc.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); sdir = file.getAbsoluteFile(); + //prefDocument 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); |
From: kai5263499 <boj...@li...> - 2002-08-20 16:38:35
|
kai5263499 Tue Aug 20 09:38:33 2002 EDT Modified files: /bojangles MainWindow.java Log: Lunch update... Added window naming stuff. Index: bojangles/MainWindow.java diff -u bojangles/MainWindow.java:1.12 bojangles/MainWindow.java:1.13 --- bojangles/MainWindow.java:1.12 Tue Aug 20 05:32:41 2002 +++ bojangles/MainWindow.java Tue Aug 20 09:38:30 2002 @@ -39,7 +39,7 @@ private JComboBox propertiesComboBox; private JMenu treeAddMenu, fileMenu, helpMenu, containerMenu, componentMenu; private JMenuBar jMenuBar1; - private JMenuItem exitMenuItem, treeDelMenuItem, genhelpMenuItem; + private JMenuItem exitMenuItem, saveMenuItem, treeDelMenuItem, genhelpMenuItem; private JPopupMenu treePopup; private JScrollPane jScrollPane1; private JSplitPane jSplitPane1, jSplitPane2; @@ -60,6 +60,7 @@ private boolean prefsSet = false; private File sdir = null; private boolean appModified = false; + private String curTitle= "New Window"; /** Creates new form MainWindow */ public MainWindow() { @@ -126,6 +127,7 @@ fileMenu = new javax.swing.JMenu(); helpMenu = new javax.swing.JMenu(); exitMenuItem = new javax.swing.JMenuItem(); + saveMenuItem = new javax.swing.JMenuItem(); genhelpMenuItem = new javax.swing.JMenuItem(); treePopup.addPopupMenuListener(new javax.swing.event.PopupMenuListener() { @@ -258,7 +260,13 @@ exitMenuItemActionPerformed(evt); } }); - + saveMenuItem.setText("Save"); + saveMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + saveMenuItemActionPerformed(evt); + } + }); + helpMenu.setText("Help"); genhelpMenuItem.setText("General Help"); genhelpMenuItem.addActionListener(new java.awt.event.ActionListener() { @@ -268,6 +276,7 @@ }); fileMenu.add(exitMenuItem); + fileMenu.add(saveMenuItem); helpMenu.add(genhelpMenuItem); jMenuBar1.add(fileMenu); jMenuBar1.add(helpMenu); @@ -334,7 +343,7 @@ saveXML(); } // Redundant? Redundant? - if(this.appModified == false) { + if(!this.appModified) { if(this.prefsSet) { return; } @@ -346,9 +355,15 @@ } private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) { + if(this.appModified) { + } System.exit(0); } + private void saveMenuItemActionPerformed(java.awt.event.ActionEvent evt) { + saveXML(); + } + private void genhelpMenuItemActionPerformed(java.awt.event.ActionEvent evt) { // TODO here... } @@ -357,7 +372,7 @@ // Kill de widget! System.out.println(evt.toString()); System.out.println("There is no spoon..."); - this.appModified = true; + appModified(true); } public void elementFocusChanged(String path) { @@ -386,7 +401,7 @@ public void tableChanged(TableModelEvent e) { if (null == currentElement) return; if (null == e) return; - this.appModified = true; + appModified(true); int row = e.getFirstRow(); String propertyName = (String)propertiesTableModel.getValueAt(row, 1); @@ -494,8 +509,8 @@ String parentPath = (String)h.get("path"); treeNode = new DefaultMutableTreeNode(name); treeModel.insertNodeInto(treeNode, parentTreeNode, parentTreeNode.getChildCount()); - path = xmlHandler.addElement(parentPath, name, null); + appModified(true); } // add the widget's defined properties to the application's XML document @@ -599,7 +614,7 @@ String name = files[i].getName(); if (name.endsWith(".xml")) { try { - System.out.println("loading widget definition from " + name); + System.out.println("Loading widget definition from " + name); Document document = new SAXReader().read("widget_definitions/" + name); String outerType = document.selectSingleNode("/widget/outer_type").getText(); widgetDefinitions.put(outerType, document); @@ -626,9 +641,15 @@ } } + private void appModified(boolean moded) { + appModified = moded; + if(moded) this.setTitle(curTitle + "*"); + else this.setTitle(curTitle); + } + private void saveXML() { JFileChooser fc = new JFileChooser(); - if(this.sdir != null) fc.setCurrentDirectory(this.sdir); + if(sdir != null) fc.setCurrentDirectory(sdir); // Try to read in prefrences from the prefs.xml doc... /* else { @@ -640,13 +661,14 @@ int returnVal = fc.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); - this.sdir = file.getAbsoluteFile(); + sdir = file.getAbsoluteFile(); if (file.exists()) { - String suremsg = "Are you sure you want to overwrite " + file + " ?"; - int choice = JOptionPane.showConfirmDialog(this,"File will be overwritten.",suremsg,JOptionPane.YES_NO_OPTION); + 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; - this.appModified = false; - System.out.println("Saved " + file); + System.out.println("Saved " + file.getName()); + curTitle = file.getName(); + appModified(false); } xmlHandler.saveXML(file); } else { @@ -657,6 +679,7 @@ public static void main(String[] args) { MainWindow win = new MainWindow(); + win.setTitle("New App"); win.show(); } } |
From: kai5263499 <boj...@li...> - 2002-08-20 12:32:44
|
kai5263499 Tue Aug 20 05:32:42 2002 EDT Modified files: /bojangles MainWindow.java Log: Stuff I forgot yesterday... (I thought i comitted it when I comitted XmlHandler)Oh well... |
From: kai5263499 <boj...@li...> - 2002-08-19 20:54:13
|
kai5263499 Mon Aug 19 13:54:11 2002 EDT Modified files: /bojangles/xml XmlHandler.java Log: Made printXML prettier and made a function out of saveXML (so it can be used in other things. Also laied the groundwork for opening premade XML files and started a prefrences system. Oh, and made saveXML remember the last dir you saved in (but only keeps it while you have the app open, hence the prefrences file...) -Wes Index: bojangles/xml/XmlHandler.java diff -u bojangles/xml/XmlHandler.java:1.10 bojangles/xml/XmlHandler.java:1.11 --- bojangles/xml/XmlHandler.java:1.10 Wed Aug 14 20:13:03 2002 +++ bojangles/xml/XmlHandler.java Mon Aug 19 13:54:11 2002 @@ -21,6 +21,9 @@ doc = DocumentHelper.createDocument(); } + public void loadXML(File file) { + } + public void addProperty(String path, String name, String text) { if (null == path || path.equals("/")) { // need to actually throw and exception here and catch it up above @@ -166,7 +169,8 @@ public void saveXML(File of) { try { FileOutputStream outfile = new FileOutputStream(of); - XMLWriter saver = new XMLWriter(outfile); + OutputFormat format = OutputFormat.createPrettyPrint(); + XMLWriter saver = new XMLWriter(outfile, format); saver.write(this.doc); } catch (Exception e) { e.printStackTrace(); @@ -175,7 +179,8 @@ public void printXML() { try { - XMLWriter writer = new XMLWriter(System.out); + OutputFormat format = OutputFormat.createPrettyPrint(); + XMLWriter writer = new XMLWriter(System.out, format); writer.write(doc); } catch (Exception e) { e.printStackTrace(); |
From: nehresma <boj...@li...> - 2002-08-15 03:33:58
|
nehresma Wed Aug 14 20:33:54 2002 EDT Modified files: /bojangles/widget_definitions htmlwindow.xml Log: spelling fix Index: bojangles/widget_definitions/htmlwindow.xml diff -u bojangles/widget_definitions/htmlwindow.xml:1.2 bojangles/widget_definitions/htmlwindow.xml:1.3 --- bojangles/widget_definitions/htmlwindow.xml:1.2 Wed Aug 14 18:14:48 2002 +++ bojangles/widget_definitions/htmlwindow.xml Wed Aug 14 20:33:54 2002 @@ -1,6 +1,6 @@ <widget> <name>htmlwindow</name> - <displayname>HMTLWindow</displayname> + <displayname>HTMLWindow</displayname> <outer_type>widget/htmlwindow</outer_type> <class>container</class> <visible>true</visible> |
From: nehresma <boj...@li...> - 2002-08-15 03:13:05
|
nehresma Wed Aug 14 20:13:03 2002 EDT Modified files: /bojangles/xml XmlHandler.java Log: removed legacy regex requirement (thanks dman for finding this) Index: bojangles/xml/XmlHandler.java diff -u bojangles/xml/XmlHandler.java:1.9 bojangles/xml/XmlHandler.java:1.10 --- bojangles/xml/XmlHandler.java:1.9 Wed Aug 14 18:49:50 2002 +++ bojangles/xml/XmlHandler.java Wed Aug 14 20:13:03 2002 @@ -4,7 +4,6 @@ import java.lang.*; import java.io.*; import java.util.*; -import java.util.regex.*; import java.awt.event.*; import org.dom4j.*; import org.dom4j.io.*; |
From: nehresma <boj...@li...> - 2002-08-15 01:49:51
|
nehresma Wed Aug 14 18:49:50 2002 EDT Modified files: /bojangles/xml XmlHandler.java Log: * fix a bunch of formatting problems that i made a long time ago and never bothered to fix * removed some debugging code that is no longer needed |
From: nehresma <boj...@li...> - 2002-08-15 01:40:54
|
nehresma Wed Aug 14 18:40:53 2002 EDT Modified files: /bojangles MainWindow.java /bojangles/xml XmlHandler.java Log: * updated the save dialog box to be lightweight and moved some GUI code into MainWindow. Index: bojangles/MainWindow.java diff -u bojangles/MainWindow.java:1.10 bojangles/MainWindow.java:1.11 --- bojangles/MainWindow.java:1.10 Wed Aug 14 07:52:36 2002 +++ bojangles/MainWindow.java Wed Aug 14 18:40:52 2002 @@ -309,16 +309,20 @@ System.out.println(propertiesTable.getColumnModel().getColumn(0).getCellRenderer()); } - private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { - try { - FileDialog fb = new FileDialog(this, "Save as", FileDialog.SAVE); - fb.setVisible(true); - String file = new String(fb.getDirectory() + fb.getFile()); - xmlHandler.saveXML(file); - } - catch (Exception e) { - e.printStackTrace(); - } + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { + JFileChooser fc = new JFileChooser(); + int returnVal = fc.showSaveDialog(this); + if (returnVal == JFileChooser.APPROVE_OPTION) { + File file = fc.getSelectedFile(); + if (file.exists()) { + String suremsg = "Are you sure you want to overwrite " + file + " ?"; + int choice = JOptionPane.showConfirmDialog(this,"File will be overwritten.",suremsg,JOptionPane.YES_NO_OPTION); + if(choice == JOptionPane.NO_OPTION) return; + } + xmlHandler.saveXML(file); + } else { + System.out.println("Save canceled"); + } } private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) { Index: bojangles/xml/XmlHandler.java diff -u bojangles/xml/XmlHandler.java:1.7 bojangles/xml/XmlHandler.java:1.8 --- bojangles/xml/XmlHandler.java:1.7 Wed Aug 14 14:09:02 2002 +++ bojangles/xml/XmlHandler.java Wed Aug 14 18:40:53 2002 @@ -175,31 +175,20 @@ return l.size(); } - public void saveXML(String of) { + public void saveXML(File of) { try { - // Lets do some error checking, keep the user from hurting themselves. - File ckfile = new File(of); - if(ckfile.exists()) { - String suremsg = "Are you sure you want to overwrite " + of + " ?"; - int choice = JOptionPane.showConfirmDialog(null,"File will be overwritten.",suremsg,JOptionPane.YES_NO_OPTION); - if(choice == JOptionPane.NO_OPTION) { - JOptionPane.showMessageDialog(null,"Save aborted","Save status",JOptionPane.PLAIN_MESSAGE); - return; - } - } FileOutputStream outfile = new FileOutputStream(of); XMLWriter saver = new XMLWriter(outfile); saver.write(this.doc); - //String savemsg = "Saved " + of,"Save status"; - //JOptionPane.showMessageDialog(this, savemsg, JOptionPane.PLAIN_MESSAGE); - } catch (Exception e) { e.printStackTrace(); } + } catch (Exception e) { + e.printStackTrace(); + } } public void printXML() { try { XMLWriter writer = new XMLWriter(System.out); writer.write(doc); - System.out.println("\n"); } catch (Exception e) { e.printStackTrace(); } } |
From: nehresma <boj...@li...> - 2002-08-15 01:14:49
|
nehresma Wed Aug 14 18:14:48 2002 EDT Modified files: /bojangles/widget_definitions htmlwindow.xml Log: since htmlwindows shouldn't really be limited to N instances per app file, i removed the empty max_per_document element. this also fixes a NumberFormatException when trying to convert an empty string to an integer. Index: bojangles/widget_definitions/htmlwindow.xml diff -u bojangles/widget_definitions/htmlwindow.xml:1.1 bojangles/widget_definitions/htmlwindow.xml:1.2 --- bojangles/widget_definitions/htmlwindow.xml:1.1 Wed Aug 14 08:22:39 2002 +++ bojangles/widget_definitions/htmlwindow.xml Wed Aug 14 18:14:48 2002 @@ -13,7 +13,6 @@ </initial_settings> <resizable>true</resizable> <moveable>true</moveable> - <max_per_document></max_per_document> <properties> <title> <represent_as>text</represent_as> |
From: kai5263499 <boj...@li...> - 2002-08-14 21:09:03
|
kai5263499 Wed Aug 14 14:09:02 2002 EDT Modified files: /bojangles/xml XmlHandler.java Log: Added overwrite prevention-checking... Index: bojangles/xml/XmlHandler.java diff -u bojangles/xml/XmlHandler.java:1.6 bojangles/xml/XmlHandler.java:1.7 --- bojangles/xml/XmlHandler.java:1.6 Wed Aug 14 07:51:16 2002 +++ bojangles/xml/XmlHandler.java Wed Aug 14 14:09:02 2002 @@ -9,6 +9,7 @@ * @version 1.0 */ +import javax.swing.*; import java.lang.*; import java.io.*; import java.util.*; @@ -176,11 +177,21 @@ public void saveXML(String of) { try { - //File sfile = new File(of); + // Lets do some error checking, keep the user from hurting themselves. + File ckfile = new File(of); + if(ckfile.exists()) { + String suremsg = "Are you sure you want to overwrite " + of + " ?"; + int choice = JOptionPane.showConfirmDialog(null,"File will be overwritten.",suremsg,JOptionPane.YES_NO_OPTION); + if(choice == JOptionPane.NO_OPTION) { + JOptionPane.showMessageDialog(null,"Save aborted","Save status",JOptionPane.PLAIN_MESSAGE); + return; + } + } FileOutputStream outfile = new FileOutputStream(of); XMLWriter saver = new XMLWriter(outfile); saver.write(this.doc); - System.out.println("Slected file: \n" + of); + //String savemsg = "Saved " + of,"Save status"; + //JOptionPane.showMessageDialog(this, savemsg, JOptionPane.PLAIN_MESSAGE); } catch (Exception e) { e.printStackTrace(); } } |
From: kai5263499 <boj...@li...> - 2002-08-14 15:22:41
|
kai5263499 Wed Aug 14 08:22:40 2002 EDT Added files: /bojangles/widget_definitions htmlwindow.xml Modified files: /bojangles/widget_definitions form.xml Log: Added HTMLWindow widget to accomodate draggable windows in centrallix. Index: bojangles/widget_definitions/form.xml diff -u bojangles/widget_definitions/form.xml:1.1 bojangles/widget_definitions/form.xml:1.2 --- bojangles/widget_definitions/form.xml:1.1 Wed Aug 14 07:11:41 2002 +++ bojangles/widget_definitions/form.xml Wed Aug 14 08:22:39 2002 @@ -5,8 +5,8 @@ <class>container</class> <visible>true</visible> <initial_settings> - <x>5</x> - <y>5</y> + <x>20</x> + <y>20</y> <width>100</width> <height>100</height> <bgcolor>#77CBEE</bgcolor> @@ -17,7 +17,7 @@ <properties> <title> <represent_as>text</represent_as> - <default>bojangles generated application</default> + <default>generic form</default> </title> <bgcolor> <represent_as>color</represent_as> Index: bojangles/widget_definitions/htmlwindow.xml +++ bojangles/widget_definitions/htmlwindow.xml <widget> <name>htmlwindow</name> <displayname>HMTLWindow</displayname> <outer_type>widget/htmlwindow</outer_type> <class>container</class> <visible>true</visible> <initial_settings> <x>20</x> <y>20</y> <width>100</width> <height>100</height> <bgcolor>#77CBEE</bgcolor> </initial_settings> <resizable>true</resizable> <moveable>true</moveable> <max_per_document></max_per_document> <properties> <title> <represent_as>text</represent_as> <default>generic htmlwindow</default> </title> <bgcolor> <represent_as>color</represent_as> <default>#77CBEE</default> </bgcolor> <textcolor> <represent_as>color</represent_as> <default>#000000</default> </textcolor> <width>100</width> <height>100</height> </properties> </widget> |