Return-Path: Delivered-To: apmail-xmlbeans-commits-archive@www.apache.org Received: (qmail 12359 invoked from network); 17 Jun 2005 23:49:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 17 Jun 2005 23:49:30 -0000 Received: (qmail 45219 invoked by uid 500); 17 Jun 2005 23:49:29 -0000 Delivered-To: apmail-xmlbeans-commits-archive@xmlbeans.apache.org Received: (qmail 45183 invoked by uid 500); 17 Jun 2005 23:49:29 -0000 Mailing-List: contact commits-help@xmlbeans.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@xmlbeans.apache.org List-Id: Delivered-To: mailing list commits@xmlbeans.apache.org Received: (qmail 45169 invoked by uid 99); 17 Jun 2005 23:49:29 -0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 17 Jun 2005 16:49:26 -0700 Received: (qmail 11519 invoked by uid 65534); 17 Jun 2005 23:48:12 -0000 Message-ID: <20050617234812.11517.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: svn commit: r191227 [5/5] - in /xmlbeans/trunk/samples: Any/ Any/schemas/ Any/src/ Any/src/org/ Any/src/org/apache/ Any/src/org/apache/xmlbeans/ Any/src/org/apache/xmlbeans/samples/ Any/src/org/apache/xmlbeans/samples/any/ Any/src/org/apache/xmlbeans/samples/any/impl/ Any/src/org/apache/xmlbeans/samples/anytype/ Any/xml/ MixedContent/src/org/apache/xmlbeans/samples/cursor/ Validation/ Validation/schemas/ Validation/src/ Validation/src/org/ Validation/src/org/apache/ Validation/src/org/apache/xmlbeans/ Validation/src/org/apache/xmlbeans/samples/ Validation/src/org/apache/xmlbeans/samples/validation/ Validation/src/org/apache/xmlbeans/samples/validation/todolist/ Validation/src/org/apache/xmlbeans/samples/validation/todolist/impl/ Validation/xml/ XQueryXPath/ XQueryXPath/bin/ XQueryXPath/bin/org/ XQueryXPath/bin/org/apache/ XQueryXPath/bin/org/apache/xmlbeans/ XQueryXPath/bin/org/apache/xmlbeans/samples/ XQueryXPath/bin/org/apache/xmlbeans/samples/xquery/ XQueryXPath/bin/org/apache/xmlbeans/samples/xquery/employees/ XQueryXPath/bin/org/apache/xmlbeans/samples/xquery/employees/impl/ XQueryXPath/lib/ XQueryXPath/schemas/ XQueryXPath/src/ XQueryXPath/src/org/ XQueryXPath/src/org/apache/ XQueryXPath/src/org/apache/xmlbeans/ XQueryXPath/src/org/apache/xmlbeans/samples/ XQueryXPath/src/org/apache/xmlbeans/samples/xquery/ XQueryXPath/src/org/apache/xmlbeans/samples/xquery/employees/ XQueryXPath/src/org/apache/xmlbeans/samples/xquery/employees/impl/ XQueryXPath/xml/ XmlTree/ XmlTree/src/ XmlTree/src/org/ XmlTree/src/org/apache/ XmlTree/src/org/apache/xmlbeans/ XmlTree/src/org/apache/xmlbeans/samples/ XmlTree/src/org/apache/xmlbeans/samples/xmltree/ XmlTree/xml/ Date: Fri, 17 Jun 2005 23:48:04 -0000 To: commits@xmlbeans.apache.org From: cezar@apache.org X-Mailer: svnmailer-1.0.0-dev X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Added: xmlbeans/trunk/samples/XmlTree/src/org/apache/xmlbeans/samples/xmltr= ee/XmlModel.java URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/XmlTree/src/org/a= pache/xmlbeans/samples/xmltree/XmlModel.java?rev=3D191227&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- xmlbeans/trunk/samples/XmlTree/src/org/apache/xmlbeans/samples/xmltree/= XmlModel.java (added) +++ xmlbeans/trunk/samples/XmlTree/src/org/apache/xmlbeans/samples/xmltree/= XmlModel.java Fri Jun 17 16:48:00 2005 @@ -0,0 +1,154 @@ +/* Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli= ed. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.xmlbeans.samples.xmltree; + +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreePath; +import javax.swing.event.TreeModelListener; +import java.util.Vector; + +/** + * Defines a data model for the XmlTree. Through the data model, the tree = can + * retrieve information about the underlying hierarchical data, including = the + * root of the hierarchy, children of specified nodes, and so on. This dat= a + * model interacts with the underlying XML data through {@link XmlEntry} + * instances (known as "user objects" in the context of JTree data models)= . The + * XmlEntry class knows how to retrieve XML-specific hierarchical informat= ion as + * it is represented by the XmlObject XMLBeans type. In other words, from = the + * tree's perspective, XmlEntry wraps XmlObject. + */ +final class XmlModel implements TreeModel +{ + private final XmlEntry m_rootEntry; + + private final Vector m_treeModelListeners =3D new Vector(); + + /** + * Creates a new instance of the model using entry as a root + * node. + *=20 + * @param entry The root node. + */ + public XmlModel(XmlEntry entry) + { + m_rootEntry =3D entry; + } + + /** + * Gets the child of node at index. + *=20 + * @param node The parent whose child to get. + * @param index The index of the child to get. + * @return The child as an XmlEntry instance. + */ + public Object getChild(Object node, int index) + { + XmlEntry entry =3D (XmlEntry) node; + return entry.getChild(index); + } + + /** + * Gets the number of children that node has. + *=20 + * @param node The tree node whose children should be counted. + * @return The number of children. + */ + public int getChildCount(Object node) + { + XmlEntry entry =3D (XmlEntry) node; + return entry.getChildCount(); + } + + /** + * Gets the index of childNode as a child of parentNode. + *=20 + * @param parentNode The parent tree node whose children should be che= cked. + * @param childNode The tree node whose child index should be returned= . + * @return The index of childNode; -1 if either + * parentNode or childNode is null. + */ + public int getIndexOfChild(Object parentNode, Object childNode) + { + int childIndex =3D 0; + XmlEntry parent =3D (XmlEntry) parentNode; + XmlEntry[] children =3D parent.getChildren(); + for (int i =3D 0; i < children.length; i++) + { + if (children[i].equals(childNode)) + { + childIndex =3D i; + } + } + return childIndex; + } + + /** + * Gets the root of this model. + *=20 + * @return An XmlEntry instance representing the XML's root element. + */ + public Object getRoot() + { + return m_rootEntry; + } + + /** + * Determines whether node has any children, returning + * true if it doesn't. + *=20 + * @param node The node to test. + * @return true if node has no children; + * otherwise, false. + */ + public boolean isLeaf(Object node) + { + XmlEntry entry =3D (XmlEntry) node; + return entry.getChildCount() =3D=3D 0; + } + + /** + * Called when the user has altered the value for the item identified = by + * treePath to newValue. + *=20 + * @param treePath The item whose path has changed. + * @param newValue The new value. + */ + public void valueForPathChanged(TreePath treePath, Object newValue) + { + System.out.println("Path changing: " + treePath.toString() + "; " + + newValue.toString()); + } + + /** + * Adds a listener. + *=20 + * @param treeModelListener The listener to add. + */ + public void addTreeModelListener(TreeModelListener treeModelListener) + { + m_treeModelListeners.addElement(treeModelListener); + } + + /** + * Removes a listener added by addTreeModelListener. + *=20 + * @param treeModelListener The listener to remove. + */ + public void removeTreeModelListener(TreeModelListener treeModelListene= r) + { + m_treeModelListeners.removeElement(treeModelListener); + } +} \ No newline at end of file Added: xmlbeans/trunk/samples/XmlTree/src/org/apache/xmlbeans/samples/xmltr= ee/XmlTree.java URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/XmlTree/src/org/a= pache/xmlbeans/samples/xmltree/XmlTree.java?rev=3D191227&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- xmlbeans/trunk/samples/XmlTree/src/org/apache/xmlbeans/samples/xmltree/= XmlTree.java (added) +++ xmlbeans/trunk/samples/XmlTree/src/org/apache/xmlbeans/samples/xmltree/= XmlTree.java Fri Jun 17 16:48:00 2005 @@ -0,0 +1,154 @@ +/* Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli= ed. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.xmlbeans.samples.xmltree; + +import org.apache.xmlbeans.XmlException; +import org.apache.xmlbeans.XmlObject; + +import javax.swing.ImageIcon; +import javax.swing.JTree; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.TreeSelectionModel; +import java.io.File; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; + +/** + * A tree view on XML, with nodes representing both elements and attribute= s=2E See + * {@link XmlEntry}and {@link XmlModel}for information on how information + * about the underlying XML is retrieved for use in the tree. Those classe= s use + * XMLBeans to provide a wrapper by which the tree exposes the underlying = XML. + */ +final class XmlTree extends JTree +{ + /** + * Receives XML instance, executing methods that=20 + * edit the received instance or create a new one. + *=20 + * @param args An array in which the first item is a + * path to the XML instance file. + */ + public static void main(String[] args) + { + System.out.println("Creating XmlTree.\n"); + File xmlFile =3D new File(args[0]); + XmlTreeFrame thisSample =3D new XmlTreeFrame(xmlFile); + } + =20 + /** + * Constructs the tree using xmlFile as an original source of + * nodes. + *=20 + * @param xmlFile The XML file the new tree should represent. + */ + public XmlTree(File xmlFile) + { + setXmlFile(xmlFile); + } + + /** + * Sets the XML file that should be used to build the tree; the tree w= ill be + * refreshed to represent xmlFile. + *=20 + * @param xmlFile The XML file the new tree should represent. + */ + public void setXmlFile(File xmlFile) + { + initComponents(xmlFile); + } + + /** + * Parses xmlFile into XMLBeans types (XmlObject instances), + * returning the instance representing the root. + *=20 + * @param xmlFile The XML file to parse. + * @return An XmlObject representing the root of the parsed XML. + */ + private static XmlObject parseXml(File xmlFile) + { + XmlObject xml =3D XmlObject.Factory.newInstance(); + try + { + xml =3D XmlObject.Factory.parse(xmlFile); + } catch (XmlException xmle) + { + System.err.println(xmle.toString()); + } catch (IOException ioe) + { + System.err.println(ioe.toString()); + } + return xml; + } + + /** + * Sets up the components that make up this tree. + *=20 + * @param xmlFile The XML file the new tree should represent. + */ + private void initComponents(File xmlFile) + { + // Parse the XML create an XmlModel from its root. + XmlEntry rootEntry =3D new XmlEntry(parseXml(xmlFile)); + XmlModel treemodel =3D new XmlModel(rootEntry); + + // Set UI properties. + setModel(treemodel); + setRootVisible(true); + setShowsRootHandles(true); + setAutoscrolls(true); + setEditable(false); + getSelectionModel().setSelectionMode( + TreeSelectionModel.SINGLE_TREE_SELECTION); + DefaultTreeCellRenderer renderer =3D new DefaultTreeCellRenderer()= ; + // Uncomment these lines to provide your own GIF files for + // tree icons. + // renderer.setLeafIcon(createImageIcon("images/leaf.gif"))= ; + // renderer.setOpenIcon(createImageIcon("images/minus.gif")= ); + // renderer.setClosedIcon(createImageIcon("images/plus.gif"= )); + setCellRenderer(renderer); + setRootVisible(false); + setAutoscrolls(false); + } + + /** + * Creates an icon from a path that points at a GIF file. This method = is + * called to create tree node icons. + *=20 + * @param path The path to a GIF file. + * @return An icon instance. + */ + private static ImageIcon createImageIcon(String path) + { + File imgFile =3D new File(path); + URL imgUrl =3D null; + try + { + imgUrl =3D imgFile.toURL(); + } catch (MalformedURLException e) + { + e.printStackTrace(); + } + if (imgUrl !=3D null) + { + return new ImageIcon(imgUrl); + } else + { + System.err.println("Couldn't find file: " + path); + return null; + } + } +} \ No newline at end of file Added: xmlbeans/trunk/samples/XmlTree/src/org/apache/xmlbeans/samples/xmltr= ee/XmlTreeFrame.java URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/XmlTree/src/org/a= pache/xmlbeans/samples/xmltree/XmlTreeFrame.java?rev=3D191227&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- xmlbeans/trunk/samples/XmlTree/src/org/apache/xmlbeans/samples/xmltree/= XmlTreeFrame.java (added) +++ xmlbeans/trunk/samples/XmlTree/src/org/apache/xmlbeans/samples/xmltree/= XmlTreeFrame.java Fri Jun 17 16:48:00 2005 @@ -0,0 +1,252 @@ +/* Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli= ed. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.xmlbeans.samples.xmltree; + +import org.apache.xmlbeans.XmlObject; +import org.apache.xmlbeans.XmlCursor; +import org.apache.xmlbeans.XmlOptions; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.io.File; + +/** + * Provides a frame within which to display an instance of the {@link XmlT= ree}, + * along with a pane within which to display the XML corresponding to a no= de + * selected in the tree. The tree's data is managed by the {@link XmlModel= }and + * {@link XmlEntry}classes, along with XmlTree. The XmlTreeFrame class is + * merely a container to show the tree in use. + */ +final class XmlTreeFrame extends JFrame +{ + // Variables for UI components. + private XmlTree treeXmlTree; + + private JButton btnRefresh; + + private JPanel pnlContent; + + private JPanel pnlSelectionPanel; + + private JPanel pnlTree; + + private JScrollPane scrContent; + + private JScrollPane scrTree; + + private JSplitPane splTreeContent; + + private JTextField txtFileName; + + private JTextPane txtpnlContent; + + /** + * Constructs the frame with an XML file to use for the tree. + *=20 + * @param xmlFile The file containing XML that the tree should represe= nt. + */ + public XmlTreeFrame(File xmlFile) + { + initComponents(xmlFile); + } + + /** + * Initializes UI components, setting properties and adding event list= eners. + *=20 + * @param xmlFile The XML file to be represented by the tree. + */ + private void initComponents(File xmlFile) + { + // Set properties for this frame. + getContentPane().setLayout(new GridBagLayout()); + setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + setTitle("XML Tree View"); + setName("frmXmlTreeView"); + + // Create the top panel that will contain text box and refresh but= ton. + pnlSelectionPanel =3D new JPanel(); + pnlSelectionPanel.setLayout(new GridBagLayout()); + + // Create the text box to display the XML file path. + txtFileName =3D new JTextField(); + GridBagConstraints gridBagConstraints; + gridBagConstraints =3D new GridBagConstraints(); + gridBagConstraints.gridx =3D 0; + gridBagConstraints.gridy =3D 0; + gridBagConstraints.anchor =3D GridBagConstraints.WEST; + gridBagConstraints.insets =3D new Insets(4, 4, 0, 4); + gridBagConstraints.weightx =3D 1; + gridBagConstraints.fill =3D GridBagConstraints.HORIZONTAL; + txtFileName.setText(xmlFile.getAbsolutePath()); + pnlSelectionPanel.add(txtFileName, gridBagConstraints); + + // Create the refresh button. + btnRefresh =3D new JButton(); + btnRefresh.setText("Refresh"); + gridBagConstraints =3D new GridBagConstraints(); + gridBagConstraints.gridwidth =3D 1; + gridBagConstraints.gridx =3D 1; + gridBagConstraints.gridy =3D 0; + gridBagConstraints.anchor =3D GridBagConstraints.EAST; + pnlSelectionPanel.add(btnRefresh, gridBagConstraints); + + // Add the selection panel to this frame. + gridBagConstraints =3D new GridBagConstraints(); + gridBagConstraints.gridx =3D 0; + gridBagConstraints.gridy =3D 0; + gridBagConstraints.fill =3D GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor =3D GridBagConstraints.NORTHWEST; + gridBagConstraints.weightx =3D 1; + gridBagConstraints.weighty =3D 0; + getContentPane().add(pnlSelectionPanel, gridBagConstraints); + + // Create the split plane that separates the tree and the content = panes. + splTreeContent =3D new JSplitPane(); + + // Create the components for the left side of the split pane: + // the panel, scrolling panel, and the XML tree it will contain. + pnlTree =3D new JPanel(); + scrTree =3D new JScrollPane(); + treeXmlTree =3D new XmlTree(xmlFile); + scrTree.setViewportView(treeXmlTree); + pnlTree.setLayout(new GridBagLayout()); + gridBagConstraints =3D new GridBagConstraints(); + gridBagConstraints.fill =3D GridBagConstraints.BOTH; + gridBagConstraints.anchor =3D GridBagConstraints.NORTH; + gridBagConstraints.weightx =3D 1.0; + gridBagConstraints.weighty =3D 1.0; + pnlTree.add(scrTree, gridBagConstraints); + + // Put the tree panel in the left side of the split pane. + splTreeContent.setLeftComponent(pnlTree); + + // Create the components for the left side of the split pane: + // the panel, scrolling panel, and the XML tree it will contain. + pnlContent =3D new JPanel(); + scrContent =3D new JScrollPane(); + txtpnlContent =3D new JTextPane(); + scrContent.setViewportView(txtpnlContent); + pnlContent.setLayout(new GridBagLayout()); + gridBagConstraints =3D new GridBagConstraints(); + gridBagConstraints.fill =3D GridBagConstraints.BOTH; + gridBagConstraints.anchor =3D GridBagConstraints.NORTHWEST; + gridBagConstraints.weightx =3D 1; + gridBagConstraints.weighty =3D 1; + pnlContent.add(scrContent, gridBagConstraints); + + // Put the content panel in the right side of the split pane. + splTreeContent.setRightComponent(pnlContent); + + // Set the rest of the split pane's properties, + splTreeContent.setDividerLocation(170); + gridBagConstraints =3D new GridBagConstraints(); + gridBagConstraints.gridx =3D 0; + gridBagConstraints.gridy =3D 1; + gridBagConstraints.weightx =3D 1; + gridBagConstraints.weighty =3D 1; + gridBagConstraints.fill =3D GridBagConstraints.BOTH; + gridBagConstraints.gridheight =3D GridBagConstraints.REMAINDER; + gridBagConstraints.anchor =3D GridBagConstraints.NORTH; + getContentPane().add(splTreeContent, gridBagConstraints); + + // Add a listener to get mouse clicks on the tree nodes. + treeXmlTree.addMouseListener(new MouseListener() + { + public void mouseClicked(MouseEvent event) + { + if (event.getClickCount() =3D=3D 1) + { + XmlEntry selection =3D (XmlEntry) treeXmlTree + .getLastSelectedPathComponent(); + // selection might be null if the user clicked one of = the + // expandy/collapsy things without selecting a node. + if (selection =3D=3D null) + { + return; + } + // Get the pretty-printed XML text and put it in the + // window on the right. + XmlObject node =3D selection.getXml(); + XmlCursor nodeCursor =3D node.newCursor(); + XmlOptions options =3D new XmlOptions(); + options.setSavePrettyPrint(); + options.setSavePrettyPrintIndent(4); + String xmlString =3D nodeCursor.xmlText(options); + txtpnlContent.setText(xmlString); + } + } + + // Don't respond to these events. + public void mouseEntered(MouseEvent event) + {} + + public void mouseExited(MouseEvent event) + {} + + public void mousePressed(MouseEvent event) + {} + + public void mouseReleased(MouseEvent event) + {} + }); + + // Add a listener to get mouse clicks on the Refresh button. + btnRefresh.addMouseListener(new MouseListener() + { + public void mouseClicked(MouseEvent event) + { + // Get the text from the file path box and make a file fro= m it. + String filePath =3D txtFileName.getText(); + File xmlFile =3D new File(filePath); + + // If the path points to a file, build the tree all over a= gain. + if (xmlFile.exists()) + { + treeXmlTree.setXmlFile(xmlFile); + txtpnlContent.setText(""); + } else + { + JOptionPane.showMessageDialog(null, + "The path you gave appears " + + "not to point to a file.", + "XmlTree Message", JOptionPane.ERROR_MESSAGE); + } + + } + + // Don't respond to these events. + public void mouseEntered(MouseEvent event) + {} + + public void mouseExited(MouseEvent event) + {} + + public void mousePressed(MouseEvent event) + {} + + public void mouseReleased(MouseEvent event) + {} + }); + + // Size all the components to their preferred size. + pack(); + this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + this.setSize(600, 640); + this.setVisible(true); + } +} \ No newline at end of file Added: xmlbeans/trunk/samples/XmlTree/src/org/apache/xmlbeans/samples/xmltr= ee/XmlTreeTest.java URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/XmlTree/src/org/a= pache/xmlbeans/samples/xmltree/XmlTreeTest.java?rev=3D191227&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- xmlbeans/trunk/samples/XmlTree/src/org/apache/xmlbeans/samples/xmltree/= XmlTreeTest.java (added) +++ xmlbeans/trunk/samples/XmlTree/src/org/apache/xmlbeans/samples/xmltree/= XmlTreeTest.java Fri Jun 17 16:48:00 2005 @@ -0,0 +1,42 @@ +/* Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli= ed. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.xmlbeans.samples.xmltree; + +import java.io.File; + +/** + * A class with which to test the XmlTree sample. + */ +final class XmlTreeTest +{ + /** + * Tests the XmlTree sample. + *=20 + * @param args An array in which the first item is a path to an XML fi= le. + */ + public static void main(String[] args) + { + boolean isStarted =3D start(args); +// assert !isStarted; + } + + private static boolean start(String[] args) + { + File xmlFile =3D new File(args[0]); + XmlTreeFrame frame =3D new XmlTreeFrame(xmlFile); + return frame.isVisible(); + } +} \ No newline at end of file Added: xmlbeans/trunk/samples/XmlTree/xml/PurchaseOrder.xml URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/XmlTree/xml/Purch= aseOrder.xml?rev=3D191227&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- xmlbeans/trunk/samples/XmlTree/xml/PurchaseOrder.xml (added) +++ xmlbeans/trunk/samples/XmlTree/xml/PurchaseOrder.xml Fri Jun 17 16:48:0= 0 2005 @@ -0,0 +1,44 @@ + + + + Gladys Kravitz +
Anytown, PA
+
+ 2001-12-17T09:30:47-05:00 + + Burnham's Celestial Handbook, Vol 1 + 5 + 21.79 + 2 + + + Burnham's Celestial Handbook, Vol 2 + 5 + 19.89 + 2 + + + Burnham's Celestial Handbook, Vol 3 + 5 + 19.89 + 1 + + + UPS + 0.74 + +
--------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org For additional commands, e-mail: commits-help@xmlbeans.apache.org