xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ce...@apache.org
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 GMT
Added: xmlbeans/trunk/samples/XmlTree/src/org/apache/xmlbeans/samples/xmltree/XmlModel.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/XmlTree/src/org/apache/xmlbeans/samples/xmltree/XmlModel.java?rev=191227&view=auto
==============================================================================
--- 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 implied.
+ *   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 data
+ * 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 information 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 = new Vector();
+
+    /**
+     * Creates a new instance of the model using <em>entry</em> as a root
+     * node.
+     * 
+     * @param entry The root node.
+     */
+    public XmlModel(XmlEntry entry)
+    {
+        m_rootEntry = entry;
+    }
+
+    /**
+     * Gets the child of <em>node</em> at <em>index</em>.
+     * 
+     * @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 = (XmlEntry) node;
+        return entry.getChild(index);
+    }
+
+    /**
+     * Gets the number of children that <em>node</em> has.
+     * 
+     * @param node The tree node whose children should be counted.
+     * @return The number of children.
+     */
+    public int getChildCount(Object node)
+    {
+        XmlEntry entry = (XmlEntry) node;
+        return entry.getChildCount();
+    }
+
+    /**
+     * Gets the index of <em>childNode</em> as a child of <em>parentNode</em>.
+     * 
+     * @param parentNode The parent tree node whose children should be checked.
+     * @param childNode The tree node whose child index should be returned.
+     * @return The index of <em>childNode</em>; -1 if either
+     *         <em>parentNode</em> or <em>childNode</em> is null.
+     */
+    public int getIndexOfChild(Object parentNode, Object childNode)
+    {
+        int childIndex = 0;
+        XmlEntry parent = (XmlEntry) parentNode;
+        XmlEntry[] children = parent.getChildren();
+        for (int i = 0; i < children.length; i++)
+        {
+            if (children[i].equals(childNode))
+            {
+                childIndex = i;
+            }
+        }
+        return childIndex;
+    }
+
+    /**
+     * Gets the root of this model.
+     * 
+     * @return An XmlEntry instance representing the XML's root element.
+     */
+    public Object getRoot()
+    {
+        return m_rootEntry;
+    }
+
+    /**
+     * Determines whether <em>node</em> has any children, returning
+     * <code>true</code> if it doesn't.
+     * 
+     * @param node The node to test.
+     * @return <code>true</code> if <em>node</em> has no children;
+     *         otherwise, <code>false</code>.
+     */
+    public boolean isLeaf(Object node)
+    {
+        XmlEntry entry = (XmlEntry) node;
+        return entry.getChildCount() == 0;
+    }
+
+    /**
+     * Called when the user has altered the value for the item identified by
+     * <em>treePath</em> to <em>newValue</em>.
+     * 
+     * @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.
+     * 
+     * @param treeModelListener The listener to add.
+     */
+    public void addTreeModelListener(TreeModelListener treeModelListener)
+    {
+        m_treeModelListeners.addElement(treeModelListener);
+    }
+
+    /**
+     * Removes a listener added by addTreeModelListener.
+     * 
+     * @param treeModelListener The listener to remove.
+     */
+    public void removeTreeModelListener(TreeModelListener treeModelListener)
+    {
+        m_treeModelListeners.removeElement(treeModelListener);
+    }
+}
\ No newline at end of file

Added: xmlbeans/trunk/samples/XmlTree/src/org/apache/xmlbeans/samples/xmltree/XmlTree.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/XmlTree/src/org/apache/xmlbeans/samples/xmltree/XmlTree.java?rev=191227&view=auto
==============================================================================
--- 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 implied.
+ *   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 attributes. See
+ * {@link XmlEntry}and {@link XmlModel}for information on how information
+ * about the underlying XML is retrieved for use in the tree. Those classes use
+ * XMLBeans to provide a wrapper by which the tree exposes the underlying XML.
+ */
+final class XmlTree extends JTree
+{
+    /**
+     * Receives <root> XML instance, executing methods that 
+     * edit the received instance or create a new one.
+     * 
+     * @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 = new File(args[0]);
+        XmlTreeFrame thisSample = new XmlTreeFrame(xmlFile);
+    }
+    
+    /**
+     * Constructs the tree using <em>xmlFile</em> as an original source of
+     * nodes.
+     * 
+     * @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 will be
+     * refreshed to represent <em>xmlFile</em>.
+     * 
+     * @param xmlFile The XML file the new tree should represent.
+     */
+    public void setXmlFile(File xmlFile)
+    {
+        initComponents(xmlFile);
+    }
+
+    /**
+     * Parses <em>xmlFile</em> into XMLBeans types (XmlObject instances),
+     * returning the instance representing the root.
+     * 
+     * @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 = XmlObject.Factory.newInstance();
+        try
+        {
+            xml = 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.
+     * 
+     * @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 = new XmlEntry(parseXml(xmlFile));
+        XmlModel treemodel = new XmlModel(rootEntry);
+
+        // Set UI properties.
+        setModel(treemodel);
+        setRootVisible(true);
+        setShowsRootHandles(true);
+        setAutoscrolls(true);
+        setEditable(false);
+        getSelectionModel().setSelectionMode(
+                TreeSelectionModel.SINGLE_TREE_SELECTION);
+        DefaultTreeCellRenderer renderer = 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.
+     * 
+     * @param path The path to a GIF file.
+     * @return An icon instance.
+     */
+    private static ImageIcon createImageIcon(String path)
+    {
+        File imgFile = new File(path);
+        URL imgUrl = null;
+        try
+        {
+            imgUrl = imgFile.toURL();
+        } catch (MalformedURLException e)
+        {
+            e.printStackTrace();
+        }
+        if (imgUrl != 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/xmltree/XmlTreeFrame.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/XmlTree/src/org/apache/xmlbeans/samples/xmltree/XmlTreeFrame.java?rev=191227&view=auto
==============================================================================
--- 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 implied.
+ *   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 XmlTree},
+ * along with a pane within which to display the XML corresponding to a node
+ * 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.
+     * 
+     * @param xmlFile The file containing XML that the tree should represent.
+     */
+    public XmlTreeFrame(File xmlFile)
+    {
+        initComponents(xmlFile);
+    }
+
+    /**
+     * Initializes UI components, setting properties and adding event listeners.
+     * 
+     * @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 button.
+        pnlSelectionPanel = new JPanel();
+        pnlSelectionPanel.setLayout(new GridBagLayout());
+
+        // Create the text box to display the XML file path.
+        txtFileName = new JTextField();
+        GridBagConstraints gridBagConstraints;
+        gridBagConstraints = new GridBagConstraints();
+        gridBagConstraints.gridx = 0;
+        gridBagConstraints.gridy = 0;
+        gridBagConstraints.anchor = GridBagConstraints.WEST;
+        gridBagConstraints.insets = new Insets(4, 4, 0, 4);
+        gridBagConstraints.weightx = 1;
+        gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
+        txtFileName.setText(xmlFile.getAbsolutePath());
+        pnlSelectionPanel.add(txtFileName, gridBagConstraints);
+
+        // Create the refresh button.
+        btnRefresh = new JButton();
+        btnRefresh.setText("Refresh");
+        gridBagConstraints = new GridBagConstraints();
+        gridBagConstraints.gridwidth = 1;
+        gridBagConstraints.gridx = 1;
+        gridBagConstraints.gridy = 0;
+        gridBagConstraints.anchor = GridBagConstraints.EAST;
+        pnlSelectionPanel.add(btnRefresh, gridBagConstraints);
+
+        // Add the selection panel to this frame.
+        gridBagConstraints = new GridBagConstraints();
+        gridBagConstraints.gridx = 0;
+        gridBagConstraints.gridy = 0;
+        gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
+        gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
+        gridBagConstraints.weightx = 1;
+        gridBagConstraints.weighty = 0;
+        getContentPane().add(pnlSelectionPanel, gridBagConstraints);
+
+        // Create the split plane that separates the tree and the content panes.
+        splTreeContent = 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 = new JPanel();
+        scrTree = new JScrollPane();
+        treeXmlTree = new XmlTree(xmlFile);
+        scrTree.setViewportView(treeXmlTree);
+        pnlTree.setLayout(new GridBagLayout());
+        gridBagConstraints = new GridBagConstraints();
+        gridBagConstraints.fill = GridBagConstraints.BOTH;
+        gridBagConstraints.anchor = GridBagConstraints.NORTH;
+        gridBagConstraints.weightx = 1.0;
+        gridBagConstraints.weighty = 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 = new JPanel();
+        scrContent = new JScrollPane();
+        txtpnlContent = new JTextPane();
+        scrContent.setViewportView(txtpnlContent);
+        pnlContent.setLayout(new GridBagLayout());
+        gridBagConstraints = new GridBagConstraints();
+        gridBagConstraints.fill = GridBagConstraints.BOTH;
+        gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
+        gridBagConstraints.weightx = 1;
+        gridBagConstraints.weighty = 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 = new GridBagConstraints();
+        gridBagConstraints.gridx = 0;
+        gridBagConstraints.gridy = 1;
+        gridBagConstraints.weightx = 1;
+        gridBagConstraints.weighty = 1;
+        gridBagConstraints.fill = GridBagConstraints.BOTH;
+        gridBagConstraints.gridheight = GridBagConstraints.REMAINDER;
+        gridBagConstraints.anchor = 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() == 1)
+                {
+                    XmlEntry selection = (XmlEntry) treeXmlTree
+                            .getLastSelectedPathComponent();
+                    // selection might be null if the user clicked one of the
+                    // expandy/collapsy things without selecting a node.
+                    if (selection == null)
+                    {
+                        return;
+                    }
+                    // Get the pretty-printed XML text and put it in the
+                    // window on the right.
+                    XmlObject node = selection.getXml();
+                    XmlCursor nodeCursor = node.newCursor();
+                    XmlOptions options = new XmlOptions();
+                    options.setSavePrettyPrint();
+                    options.setSavePrettyPrintIndent(4);
+                    String xmlString = 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 from it.
+                String filePath = txtFileName.getText();
+                File xmlFile = new File(filePath);
+
+                // If the path points to a file, build the tree all over again.
+                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/xmltree/XmlTreeTest.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/XmlTree/src/org/apache/xmlbeans/samples/xmltree/XmlTreeTest.java?rev=191227&view=auto
==============================================================================
--- 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 implied.
+ *   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.
+     * 
+     * @param args An array in which the first item is a path to an XML file.
+     */
+    public static void main(String[] args)
+    {
+        boolean isStarted = start(args);
+//        assert !isStarted;
+    }
+
+    private static boolean start(String[] args)
+    {
+        File xmlFile = new File(args[0]);
+        XmlTreeFrame frame = 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/PurchaseOrder.xml?rev=191227&view=auto
==============================================================================
--- xmlbeans/trunk/samples/XmlTree/xml/PurchaseOrder.xml (added)
+++ xmlbeans/trunk/samples/XmlTree/xml/PurchaseOrder.xml Fri Jun 17 16:48:00 2005
@@ -0,0 +1,44 @@
+<!--
+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 implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ -->
+<purchase-order xmlns="http://xmlbeans.apache.org/samples/enumeration/schemaenum/easypo">
+    <customer>
+        <name>Gladys Kravitz</name>
+        <address>Anytown, PA</address>
+    </customer>
+    <date>2001-12-17T09:30:47-05:00</date>
+    <line-item>
+        <description>Burnham's Celestial Handbook, Vol 1</description>
+        <per-unit-ounces>5</per-unit-ounces>
+        <price>21.79</price>
+        <quantity>2</quantity>
+    </line-item>
+    <line-item>
+        <description>Burnham's Celestial Handbook, Vol 2</description>
+        <per-unit-ounces>5</per-unit-ounces>
+        <price>19.89</price>
+        <quantity>2</quantity>
+    </line-item>
+    <line-item>
+        <description>Burnham's Celestial Handbook, Vol 3</description>
+        <per-unit-ounces>5</per-unit-ounces>
+        <price>19.89</price>
+        <quantity>1</quantity>
+    </line-item>
+    <shipper>
+        <name>UPS</name>
+        <per-ounce-rate>0.74</per-ounce-rate>
+    </shipper>
+</purchase-order>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org


Mime
View raw message