[llvm-commits] [llvm-gcc-4.2] r43913 [16/80] - in /llvm-gcc-4.2/trunk: boehm-gc/ boehm-gc/Mac_files/ boehm-gc/cord/ boehm-gc/doc/ boehm-gc/include/ boehm-gc/include/private/ boehm-gc/tests/ libffi/ libffi/include/ libffi/src/ libffi/src/alpha/ libffi/src/arm/ libffi/src/cris/ libffi/src/frv/ libffi/src/ia64/ libffi/src/m32r/ libffi/src/m68k/ libffi/src/mips/ libffi/src/pa/ libffi/src/powerpc/ libffi/src/s390/ libffi/src/sh/ libffi/src/sh64/ libffi/src/sparc/ libffi/src/x86/ libffi/testsuite/ libffi/testsuite/config/ li...
Bill Wendling
isanbard at gmail.com
Thu Nov 8 14:57:11 PST 2007
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/java2d/J2dBenchmarkGUI.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/java2d/J2dBenchmarkGUI.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/java2d/J2dBenchmarkGUI.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/java2d/J2dBenchmarkGUI.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,891 @@
+/* J2dBenchmarkGUI.java -- GUI for java2d benchmarker
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+package gnu.classpath.examples.java2d;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.GridLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.border.BevelBorder;
+
+/**
+ * Extends the J2dBenchmark to provide a GUI for selecting options and tests.
+ */
+public class J2dBenchmarkGUI
+ implements ActionListener
+{
+
+ JLabel errorLabel;
+
+ JCheckBox noClipping;
+
+ JCheckBox withClipping;
+
+ JCheckBox zeroClipping;
+
+ JCheckBox singleBuffer;
+
+ JCheckBox doubleBuffer;
+
+ public J2dBenchmarkGUI()
+ {
+ super();
+ }
+
+ public static void main(String[] args)
+ {
+ new J2dBenchmarkGUI().run();
+ }
+
+ /**
+ * Sets up the initial GUI
+ */
+ public void run()
+ {
+ // Store all elements in a hashtable so that they can be passed into the
+ // harness easily.
+ Hashtable elements = new Hashtable();
+
+ // Set up frame
+ final JFrame frame = new JFrame("Java2D benchmark");
+ errorLabel = new JLabel(" ");
+
+ JPanel panel = new JPanel();
+ panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
+ Container content = frame.getContentPane();
+
+ // Display options for dimensions, iterations, test size, etc
+ JPanel options = new JPanel(new GridLayout(0, 2));
+
+ options.add(new JLabel("Height: "));
+ JTextField heightField = new JTextField(Integer.toString(J2dBenchmark.DEFAULT_SCREEN_HEIGHT));
+ heightField.setColumns(5);
+ options.add(heightField);
+ elements.put("height", heightField);
+
+ options.add(new JLabel("Width: "));
+ JTextField widthField = new JTextField(Integer.toString(J2dBenchmark.DEFAULT_SCREEN_WIDTH));
+ widthField.setColumns(5);
+ options.add(widthField);
+ elements.put("width", widthField);
+
+ options.add(new JLabel("Iterations: "));
+ JTextField iterField = new JTextField("1");
+ iterField.setColumns(5);
+ options.add(iterField);
+ elements.put("iterations", iterField);
+
+ options.add(new JLabel("Test size: "));
+ JTextField testSizeField = new JTextField(Integer.toString(J2dBenchmark.DEFAULT_TEST_SIZE));
+ testSizeField.setColumns(5);
+ options.add(testSizeField);
+ elements.put("size", testSizeField);
+
+ options.add(new JLabel("Test without clipping: "));
+ noClipping = new JCheckBox("", true);
+ noClipping.addActionListener(this);
+ options.add(noClipping);
+ elements.put("noclip", noClipping);
+
+ options.add(new JLabel("Test with clipping: "));
+ withClipping = new JCheckBox("", true);
+ withClipping.addActionListener(this);
+ options.add(withClipping);
+ elements.put("withclip", withClipping);
+
+ options.add(new JLabel("Test with clipping to zero: "));
+ zeroClipping = new JCheckBox("", true);
+ zeroClipping.addActionListener(this);
+ options.add(zeroClipping);
+ elements.put("zeroclip", zeroClipping);
+
+ options.add(new JLabel("Run single-buffer test: "));
+ singleBuffer = new JCheckBox("", true);
+ singleBuffer.addActionListener(this);
+ options.add(singleBuffer);
+ elements.put("singlebuffer", singleBuffer);
+
+ options.add(new JLabel("Run double-buffer test: "));
+ doubleBuffer = new JCheckBox("", true);
+ doubleBuffer.addActionListener(this);
+ options.add(doubleBuffer);
+ elements.put("doublebuffer", doubleBuffer);
+
+ // Allow user to select tests to run
+ JPanel tests = new JPanel();
+ tests.setLayout(new BoxLayout(tests, BoxLayout.PAGE_AXIS));
+ tests.setBorder(new BevelBorder(BevelBorder.RAISED));
+ tests.add(new JLabel("Shapes to test:"));
+
+ JCheckBox test_arcDraw = new JCheckBox("Arc", true);
+ tests.add(test_arcDraw);
+ elements.put("test_arcDraw", test_arcDraw);
+
+ JCheckBox test_ccurveDraw = new JCheckBox("Cubic Curve", true);
+ tests.add(test_ccurveDraw);
+ elements.put("test_ccurveDraw", test_ccurveDraw);
+
+ JCheckBox test_ellipseDraw = new JCheckBox("Ellipse", true);
+ tests.add(test_ellipseDraw);
+ elements.put("test_ellipseDraw", test_ellipseDraw);
+
+ /*
+ JCheckBox test_pathDraw = new JCheckBox("General Path", true);
+ tests.add(test_pathDraw);
+ elements.put("test_pathDraw", test_pathDraw);
+ */
+
+ JCheckBox test_lineDraw = new JCheckBox("Line", true);
+ tests.add(test_lineDraw);
+ elements.put("test_lineDraw", test_lineDraw);
+
+ JCheckBox test_qcurveDraw = new JCheckBox("Quadratic Curve", true);
+ tests.add(test_qcurveDraw);
+ elements.put("test_qcurveDraw", test_qcurveDraw);
+
+ JCheckBox test_rectDraw = new JCheckBox("Rectangle", true);
+ tests.add(test_rectDraw);
+ elements.put("test_rectDraw", test_rectDraw);
+
+ JCheckBox test_rrectDraw = new JCheckBox("Round Rectangle", true);
+ tests.add(test_rrectDraw);
+ elements.put("test_rrectDraw", test_rrectDraw);
+
+ JCheckBox test_image = new JCheckBox("Images", true);
+ tests.add(test_image);
+ elements.put("test_image", test_image);
+
+ // Additional image-processing options
+ JPanel extras = new JPanel();
+ extras.setBorder(new BevelBorder(BevelBorder.LOWERED));
+ GridBagLayout layout = new GridBagLayout();
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.anchor = GridBagConstraints.NORTHWEST;
+ gbc.insets = new Insets(5, 2, 15, 15);
+ extras.setLayout(layout);
+
+ // Filling (solid, gradient, or texture)
+ JPanel opt_Fill = new JPanel();
+ opt_Fill.setLayout(new BoxLayout(opt_Fill, BoxLayout.PAGE_AXIS));
+ JLabel opt_FillLabel = new JLabel("Filling:");
+ opt_FillLabel.setBorder(new BevelBorder(BevelBorder.RAISED));
+ opt_Fill.add(opt_FillLabel);
+
+ ButtonGroup opt_FillGroup = new ButtonGroup();
+ JRadioButton opt_FillSolid = new JRadioButton("Solid colour", true);
+ opt_FillSolid.setActionCommand("solid");
+ opt_Fill.add(opt_FillSolid);
+ opt_FillGroup.add(opt_FillSolid);
+ JRadioButton opt_FillGradient = new JRadioButton("Gradient", false);
+ opt_FillGradient.setActionCommand("gradient");
+ opt_Fill.add(opt_FillGradient);
+ opt_FillGroup.add(opt_FillGradient);
+ JRadioButton opt_FillTexture = new JRadioButton("Texture", false);
+ opt_FillTexture.setActionCommand("texture");
+ opt_Fill.add(opt_FillTexture);
+ opt_FillGroup.add(opt_FillTexture);
+ JTextField opt_FillTextureFile = new JTextField("texture file");
+ opt_FillTextureFile.setAlignmentX(JComponent.LEFT_ALIGNMENT);
+ opt_Fill.add(opt_FillTextureFile);
+ elements.put("opt_FillGroup", opt_FillGroup);
+ elements.put("opt_FillTextureFile", opt_FillTextureFile);
+ layout.setConstraints(opt_Fill, gbc);
+ extras.add(opt_Fill);
+
+ // Stroke
+ JPanel opt_Stroke = new JPanel();
+ opt_Stroke.setLayout(new BoxLayout(opt_Stroke, BoxLayout.PAGE_AXIS));
+ JLabel opt_StrokeLabel = new JLabel("Stroke:");
+ opt_StrokeLabel.setBorder(new BevelBorder(BevelBorder.RAISED));
+ opt_Stroke.add(opt_StrokeLabel);
+ JCheckBox opt_StrokeRandom = new JCheckBox("random", false);
+ elements.put("opt_StrokeRandom", opt_StrokeRandom);
+ opt_Stroke.add(opt_StrokeRandom);
+ gbc.gridwidth = GridBagConstraints.REMAINDER;
+ layout.setConstraints(opt_Stroke, gbc);
+ extras.add(opt_Stroke);
+
+ // Anti-Alias
+ JPanel opt_Alias = new JPanel();
+ opt_Alias.setLayout(new BoxLayout(opt_Alias, BoxLayout.PAGE_AXIS));
+ JLabel opt_AliasLabel = new JLabel("Anti-Aliasing:");
+ opt_AliasLabel.setBorder(new BevelBorder(BevelBorder.RAISED));
+ opt_Alias.add(opt_AliasLabel);
+ JCheckBox opt_AliasOn = new JCheckBox("on", false);
+ elements.put("opt_AliasOn", opt_AliasOn);
+ opt_Alias.add(opt_AliasOn);
+ gbc.gridwidth = 1;
+ layout.setConstraints(opt_Alias, gbc);
+ extras.add(opt_Alias);
+
+ // Alpha composite
+ JPanel opt_Composite = new JPanel();
+ opt_Composite.setLayout(new BoxLayout(opt_Composite, BoxLayout.PAGE_AXIS));
+ JLabel opt_CompositeLabel = new JLabel("Alpha Composite:");
+ opt_CompositeLabel.setBorder(new BevelBorder(BevelBorder.RAISED));
+ opt_Composite.add(opt_CompositeLabel);
+ JTextField opt_CompositeValue = new JTextField("1.0");
+ opt_CompositeValue.setAlignmentX(JComponent.LEFT_ALIGNMENT);
+ elements.put("opt_CompositeValue", opt_CompositeValue);
+ opt_Composite.add(opt_CompositeValue);
+ gbc.gridwidth = GridBagConstraints.REMAINDER;
+ layout.setConstraints(opt_Composite, gbc);
+ extras.add(opt_Composite);
+
+ // Transformations
+ // TODO: allow user-defined matrices for AffineTransform
+ // (backend already has hooks for it, need to create gui)
+ JLabel opt_TransformLabel = new JLabel("Transformations:");
+ opt_TransformLabel.setBorder(new BevelBorder(BevelBorder.RAISED));
+ gbc.insets = new Insets(5, 2, 0, 15);
+ layout.setConstraints(opt_TransformLabel, gbc);
+ extras.add(opt_TransformLabel);
+
+ JPanel opt_Transform_Translate = new JPanel(new GridLayout(0, 2, 5, 5));
+ opt_Transform_Translate.add(new JLabel("x-axis translation "));
+ JTextField opt_TransformTranslateX = new JTextField("0");
+ opt_TransformTranslateX.setAlignmentX(JComponent.LEFT_ALIGNMENT);
+ opt_Transform_Translate.add(opt_TransformTranslateX);
+ elements.put("opt_TransformTranslateX", opt_TransformTranslateX);
+ opt_Transform_Translate.add(new JLabel("y-axis translation "));
+ JTextField opt_TransformTranslateY = new JTextField("0");
+ opt_TransformTranslateY.setAlignmentX(JComponent.LEFT_ALIGNMENT);
+ opt_Transform_Translate.add(opt_TransformTranslateY);
+ elements.put("opt_TransformTranslateY", opt_TransformTranslateY);
+ gbc.gridwidth = 1;
+ gbc.insets = new Insets(0, 2, 5, 15);
+ layout.setConstraints(opt_Transform_Translate, gbc);
+ extras.add(opt_Transform_Translate);
+
+ JPanel opt_Transform_Shear = new JPanel(new GridLayout(0, 2, 5, 5));
+ opt_Transform_Shear.add(new JLabel("x-axis shear "));
+ JTextField opt_TransformShearX = new JTextField("0");
+ opt_TransformShearX.setAlignmentX(JComponent.LEFT_ALIGNMENT);
+ opt_Transform_Shear.add(opt_TransformShearX);
+ elements.put("opt_TransformShearX", opt_TransformShearX);
+ opt_Transform_Shear.add(new JLabel("y-axis shear "));
+ JTextField opt_TransformShearY = new JTextField("0");
+ opt_Transform_Shear.add(opt_TransformShearY);
+ elements.put("opt_TransformShearY", opt_TransformShearY);
+ gbc.gridwidth = GridBagConstraints.REMAINDER;
+ layout.setConstraints(opt_Transform_Shear, gbc);
+ extras.add(opt_Transform_Shear);
+
+ JPanel opt_Transform_Rotate = new JPanel(new GridLayout(0, 2, 5, 5));
+ opt_Transform_Rotate.add(new JLabel("rotation (radians) "));
+ JTextField opt_TransformRotate = new JTextField("0");
+ opt_Transform_Rotate.add(opt_TransformRotate);
+ elements.put("opt_TransformRotate", opt_TransformRotate);
+ layout.setConstraints(opt_Transform_Rotate, gbc);
+ extras.add(opt_Transform_Rotate);
+
+ // Final submit button
+ JPanel submit = new JPanel();
+ submit.setLayout(new BoxLayout(submit, BoxLayout.PAGE_AXIS));
+
+ JButton rectButton = new JButton("Run benchmark");
+ rectButton.setAlignmentX(JComponent.CENTER_ALIGNMENT);
+ submit.add(rectButton, BorderLayout.CENTER);
+
+ errorLabel.setAlignmentX(JComponent.CENTER_ALIGNMENT);
+ errorLabel.setForeground(Color.RED);
+ submit.add(errorLabel);
+
+ rectButton.addActionListener(new Harness(elements, errorLabel));
+
+ // Lay it all out
+ JPanel body = new JPanel();
+ body.setLayout(new BoxLayout(body, BoxLayout.LINE_AXIS));
+ options.setAlignmentX(JComponent.LEFT_ALIGNMENT);
+ body.add(options);
+ body.add(Box.createHorizontalStrut(50));
+ tests.setAlignmentX(JComponent.RIGHT_ALIGNMENT);
+ body.add(tests);
+
+ body.setAlignmentX(JComponent.CENTER_ALIGNMENT);
+ panel.add(body);
+ extras.setAlignmentX(JComponent.CENTER_ALIGNMENT);
+ panel.add(extras);
+ submit.setAlignmentX(JComponent.CENTER_ALIGNMENT);
+ panel.add(submit);
+
+ content.add(panel, BorderLayout.CENTER);
+
+ // Leave some breathing space in the frame
+ frame.pack();
+
+ frame.addWindowListener(new WindowAdapter()
+ {
+ public void windowClosing(WindowEvent e)
+ {
+ frame.setVisible(false);
+ System.exit(0);
+ }
+ });
+
+ frame.show();
+ }
+
+ /**
+ * Handles user events on the options GUI, ensuring that user input is valid
+ */
+ public void actionPerformed(ActionEvent ev)
+ {
+ if (! noClipping.isSelected() && ! withClipping.isSelected()
+ && ! zeroClipping.isSelected())
+ errorLabel.setText("You must select at least one clipping option");
+
+ else if (! singleBuffer.isSelected() && ! doubleBuffer.isSelected())
+ errorLabel.setText("You must select at least one buffering option");
+
+ else
+ errorLabel.setText(" ");
+ }
+
+ /**
+ * Parses GUI input and sets options in the benchmarker
+ */
+ private class Harness
+ implements ActionListener
+ {
+ Hashtable elements;
+
+ JLabel errorLabel;
+
+ /**
+ * Creates a new Harness object
+ *
+ * @param elements Hashtable containing the swing elements from the GUI
+ * @param errorLabel JLabel on which to display any error messages
+ */
+ public Harness(Hashtable elements, JLabel errorLabel)
+ {
+ super();
+
+ this.elements = elements;
+ this.errorLabel = errorLabel;
+ }
+
+ /**
+ * Handles user button-clicks, parsing the form, setting options, and
+ * starting the J2dBenchmark
+ *
+ * @param ae event that triggered this action
+ */
+ public void actionPerformed(ActionEvent ae)
+ {
+ try
+ {
+ // Create benchmarker object
+ final JFrame frame = new JFrame("Java2D benchmark");
+ J2dBenchmarkWrapper speed = new J2dBenchmarkWrapper(frame);
+
+ // Set options
+ speed.setDimensions(Integer.parseInt(((JTextField) elements.get("width")).getText()),
+ Integer.parseInt(((JTextField) elements.get("height")).getText()));
+
+ speed.setIterations(Integer.parseInt(((JTextField) elements.get("iterations")).getText()));
+ speed.setTestSize(Integer.parseInt(((JTextField) elements.get("size")).getText()));
+
+ speed.setClipping(((JCheckBox) elements.get("noclip")).isSelected(),
+ ((JCheckBox) elements.get("withclip")).isSelected(),
+ ((JCheckBox) elements.get("zeroclip")).isSelected());
+
+ speed.setBuffers(((JCheckBox) elements.get("singlebuffer")).isSelected(),
+ ((JCheckBox) elements.get("doublebuffer")).isSelected());
+
+ // Set additional processing options
+ speed.setFill(((ButtonGroup) elements.get("opt_FillGroup")).getSelection().getActionCommand(),
+ ((JTextField) elements.get("opt_FillTextureFile")).getText());
+
+ speed.setStroke(((JCheckBox) elements.get("opt_StrokeRandom")).isSelected());
+
+ speed.setAlias(((JCheckBox) elements.get("opt_AliasOn")).isSelected());
+
+ speed.setComposite(Float.parseFloat(((JTextField) elements.get("opt_CompositeValue")).getText()));
+
+ speed.setTranslation(Integer.parseInt(((JTextField) elements.get("opt_TransformTranslateX")).getText()),
+ Integer.parseInt(((JTextField) elements.get("opt_TransformTranslateY")).getText()));
+
+ speed.setRotation(Double.parseDouble(((JTextField) elements.get("opt_TransformRotate")).getText()));
+
+ speed.setShear(Double.parseDouble(((JTextField) elements.get("opt_TransformShearX")).getText()),
+ Double.parseDouble(((JTextField) elements.get("opt_TransformShearY")).getText()));
+
+ // Set tests
+ int testSuite = 0;
+ if (((JCheckBox) elements.get("test_arcDraw")).isSelected())
+ testSuite |= J2dBenchmarkWrapper.J2DTEST_ARC;
+ if (((JCheckBox) elements.get("test_ccurveDraw")).isSelected())
+ testSuite |= J2dBenchmarkWrapper.J2DTEST_CUBICCURVE;
+ if (((JCheckBox) elements.get("test_ellipseDraw")).isSelected())
+ testSuite |= J2dBenchmarkWrapper.J2DTEST_ELLIPSE;
+ //if (((JCheckBox)elements.get("test_pathDraw")).isSelected())
+ // testSuite |= J2dBenchmarkWrapper.J2DTEST_GENERALPATH;
+ if (((JCheckBox) elements.get("test_lineDraw")).isSelected())
+ testSuite |= J2dBenchmarkWrapper.J2DTEST_LINE;
+ if (((JCheckBox) elements.get("test_qcurveDraw")).isSelected())
+ testSuite |= J2dBenchmarkWrapper.J2DTEST_QUADCURVE;
+ if (((JCheckBox) elements.get("test_rectDraw")).isSelected())
+ testSuite |= J2dBenchmarkWrapper.J2DTEST_RECTANGLE;
+ if (((JCheckBox) elements.get("test_rrectDraw")).isSelected())
+ testSuite |= J2dBenchmarkWrapper.J2DTEST_ROUNDRECTANGLE;
+ if (((JCheckBox) elements.get("test_image")).isSelected())
+ testSuite |= J2dBenchmarkWrapper.J2DTEST_IMAGE;
+
+ if (testSuite != 0)
+ {
+ speed.setTests(testSuite);
+
+ String initResult = speed.init();
+
+ if (initResult == null)
+ {
+ // Create graphics.
+ frame.add(speed, BorderLayout.CENTER);
+ frame.setSize(
+ Integer.parseInt(((JTextField) elements.get("width")).getText()),
+ Integer.parseInt(((JTextField) elements.get("height")).getText()));
+ frame.setVisible(true);
+
+ // Insets are correctly set only after the native peer was
+ // created.
+ Insets insets = frame.getInsets();
+ frame.setSize(frame.getWidth() + insets.right + insets.left,
+ frame.getHeight() + insets.top + insets.bottom);
+
+ // Clear any old error messages
+ errorLabel.setText(" ");
+ }
+ else
+ errorLabel.setText(initResult);
+ }
+ else
+ errorLabel.setText("Please select at least one test.");
+ }
+ catch (NumberFormatException e)
+ {
+ errorLabel.setText("Please enter valid integers");
+ }
+ }
+ }
+
+ /**
+ * Wrapper for the J2dBenchmark, which outputs the results to a GUI
+ * instead of the command-line
+ */
+ private class J2dBenchmarkWrapper
+ extends J2dBenchmark
+ {
+ JFrame myFrame;
+
+ ResultsDisplay display;
+
+ /**
+ * Create new J2dBenchmarkWrapper object
+ *
+ * @param frame parent frame
+ */
+ public J2dBenchmarkWrapper(JFrame frame)
+ {
+ // Redirect log messages to the custom handler
+ logger.setUseParentHandlers(false);
+ display = new ResultsDisplay();
+ display.setLevel(Level.INFO);
+ logger.addHandler(display);
+
+ myFrame = frame;
+ }
+
+ /**
+ * Set dimensions of benchmarking canvas
+ *
+ * @param width width of canvas
+ * @param height height of canvas
+ */
+ public void setDimensions(int width, int height)
+ {
+ screenHeight = height;
+ screenWidth = width;
+ setSize(width, height);
+ }
+
+ /**
+ * Set number of iterations
+ *
+ * @param it number of iterations
+ */
+ public void setIterations(int it)
+ {
+ iterations = it;
+ }
+
+ /**
+ * Set size of each test
+ *
+ * @param size size of test
+ */
+ public void setTestSize(int size)
+ {
+ testSize = size;
+ }
+
+ /**
+ * Set clipping options
+ *
+ * @param no run test with no clipping
+ * @param with run test with clipping
+ * @param zero run test with clipping to zero
+ */
+ public void setClipping(boolean no, boolean with, boolean zero)
+ {
+ this.noClippingFlag = no;
+ this.withClippingFlag = with;
+ this.zeroClippingFlag = zero;
+ }
+
+ /**
+ * Set buffering options
+ *
+ * @param single run test without double-buffering
+ * @param doubleb run test with double-buffering
+ */
+ public void setBuffers(boolean single, boolean doubleb)
+ {
+ this.singleBufferFlag = single;
+ this.doubleBufferFlag = doubleb;
+ }
+
+ /**
+ * Set fill options
+ *
+ * @param type fill type: "solid", "gradient", or "texture"
+ * @param file filename to use if texturing
+ */
+ public void setFill(String type, String file)
+ {
+ if (type.equals("gradient"))
+ this.gradientFlag = true;
+ else if (type.equals("texture"))
+ {
+ this.texture = file;
+ }
+ }
+
+ /**
+ * Set stroke options
+ *
+ * @param stroke boolean flag to use random stroking or not
+ */
+ public void setStroke(boolean stroke)
+ {
+ this.strokeFlag = stroke;
+ }
+
+ /**
+ * Set anti-aliasing options
+ *
+ * @param alias boolean flag to use anti-aliasing or not
+ */
+ public void setAlias(boolean alias)
+ {
+ this.antialiasFlag = alias;
+ }
+
+ /**
+ * Set alpha composite
+ *
+ * @param alpha alpha composite
+ */
+ public void setComposite(float alpha)
+ {
+ this.composite = alpha;
+ }
+
+ /**
+ * Set translation values
+ *
+ * @param x x-axis translation
+ * @param y y-axis translation
+ */
+ public void setTranslation(int x, int y)
+ {
+ this.xtranslate = x;
+ this.ytranslate = y;
+ }
+
+ /**
+ * Set rotation
+ *
+ * @param theta angle to rotate by (radians)
+ */
+ public void setRotation(double theta)
+ {
+ this.rotate = theta;
+ }
+
+ /**
+ * Set shear values
+ *
+ * @param x x-axis shear value
+ * @param y-axis shear value
+ */
+ public void setShear(double x, double y)
+ {
+ this.xshear = x;
+ this.yshear = y;
+ }
+
+ /**
+ * Set tests to run
+ *
+ * @param tests bit-shifted list of tests (see J2dBenchmark constants)
+ */
+ public void setTests(int tests)
+ {
+ awtTests = tests;
+ }
+
+ /**
+ * Saves test report after each iteration
+ */
+ void printReport()
+ {
+ // Report test results to the GUI display
+ ArrayList results = new ArrayList();
+ for (Iterator i = testSetMap.testIterator(); i.hasNext();)
+ {
+ TestRecorder recorder = testSetMap.getTest((String) i.next());
+
+ results.add("TEST " + recorder.getTestName() + ": average "
+ + recorder.getAverage() + "ms [" + recorder.getMinTime()
+ + "-" + recorder.getMaxTime() + "]");
+ }
+
+ display.report(results);
+ }
+
+ /**
+ * Disables current frame and displays test results
+ */
+ void testComplete()
+ {
+ // Clear benchmarking canvas and display results instead
+ myFrame.setVisible(false);
+
+ display.show();
+ }
+ }
+
+ /**
+ * GUI to display results of benchmarking
+ */
+ private class ResultsDisplay
+ extends Handler
+ implements ActionListener
+ {
+ /**
+ * Allow user to select results from each iteration
+ */
+ JComboBox iterations;
+
+ /**
+ * Area to print results in
+ */
+ JTextArea results;
+
+ /**
+ * Allow user to view summary or full details of test report
+ */
+ JCheckBox details;
+
+ /**
+ * Store all test results
+ */
+ ArrayList testResults;
+
+ /**
+ * Store all test details
+ */
+ ArrayList testDetails;
+
+ /**
+ * Initialize variables
+ */
+ public ResultsDisplay()
+ {
+ testResults = new ArrayList();
+ testDetails = new ArrayList();
+ testDetails.add(new ArrayList());
+ }
+
+ /**
+ * Parse all results and display on a GUI
+ */
+ public void show()
+ {
+ // Set up panel
+ JFrame frame = new JFrame("Java2D benchmark results");
+ Container cp = frame.getContentPane();
+
+ // Non-editable text area for the results
+ results = new JTextArea();
+ results.setEditable(false);
+ results.setRows(15);
+ results.setColumns(60);
+
+ // Checkbox to optionally display details (ie log messages)
+ details = new JCheckBox("Details", false);
+ details.addActionListener(this);
+
+ // Combo box to allow selection of iteration number
+ iterations = new JComboBox();
+ iterations.addActionListener(this);
+ for (int i = 0; i < testResults.size(); i++)
+ iterations.addItem("Iteration #" + (i + 1));
+
+ // Lay it all out
+ JPanel topleft = new JPanel();
+ topleft.add(new JLabel("View results from: "));
+ topleft.add(iterations);
+ topleft.setAlignmentX(JComponent.LEFT_ALIGNMENT);
+ details.setAlignmentX(JComponent.RIGHT_ALIGNMENT);
+ JPanel top = new JPanel();
+ top.setLayout(new BoxLayout(top, BoxLayout.LINE_AXIS));
+ top.add(topleft);
+ top.add(details);
+
+ cp.add(top, BorderLayout.NORTH);
+ cp.add(new JScrollPane(results), BorderLayout.SOUTH);
+
+ frame.pack();
+ frame.show();
+ }
+
+ /**
+ * This overrides the logger publish method, which accepts log messages and
+ * saves them for later display
+ *
+ * @param record information about the log event
+ */
+ public void publish(LogRecord record)
+ {
+ ((ArrayList) testDetails.get(testDetails.size() - 1)).add(record.getMessage());
+ }
+
+ /**
+ * Accepts a test summary report, generated after each iteration of a test
+ *
+ * @param results test results
+ */
+ public void report(ArrayList results)
+ {
+ testResults.add(results);
+ testDetails.add(new ArrayList());
+ }
+
+ /**
+ * Provided as part of the Handler interface; not used
+ */
+ public void flush()
+ {
+ }
+
+ /**
+ * Provided as part of the Handler interface; not used
+ */
+ public void close()
+ {
+ }
+
+ /**
+ * Handle user-generated events on the results GUI
+ */
+ public void actionPerformed(ActionEvent ev)
+ {
+ // Display information about the requested iteration
+ int iteration = iterations.getSelectedIndex();
+ String message = "";
+
+ // Display summary or details, as requested
+ Iterator it;
+ if (details.isSelected())
+ it = ((ArrayList) testDetails.get(iteration)).iterator();
+ else
+ it = ((ArrayList) testResults.get(iteration)).iterator();
+
+ // Parse the ArrayList's
+ while (it.hasNext())
+ {
+ message = message + ((String) it.next() + "\n");
+ }
+
+ // Output to screen
+ results.setText(message);
+ }
+ }
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/java2d/JNIOverhead.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/java2d/JNIOverhead.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/java2d/JNIOverhead.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/java2d/JNIOverhead.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,390 @@
+/* JNIOverhead.java - demonstrator for classpath/gcj fillrect performance issue
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA. */
+
+package gnu.classpath.examples.java2d;
+
+import gnu.classpath.examples.swing.DemoFactory;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+
+/**
+ * @author Norman Hendrich
+ */
+public class JNIOverhead
+ extends JPanel
+ implements ActionListener
+{
+
+ static JNIOverhead fillRectDemo;
+
+ LCDCanvas lcd;
+ Worker worker;
+ JLabel label;
+ JCheckBox translate;
+ JCheckBox lines;
+
+ int nx = 128;
+ int ny = 64;
+ int matrix[][], future[][];
+ int generation = 0;
+
+ // 20 msec, or 50 repaints per sec (theoretically)
+ int sleepMillis = 20;
+ long lastMillis = System.currentTimeMillis();
+
+ boolean enableRepaints = true;
+
+ /**
+ * If true, test translation.
+ */
+ boolean testTranslation = false;
+
+ /**
+ * If true, paint lines rather than rectangles
+ */
+ boolean paintLines;
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ }
+
+ public JNIOverhead()
+ {
+ setSize(nx, ny);
+ createContent();
+ }
+
+ public void createContent()
+ {
+ setLayout(new BorderLayout());
+
+ JPanel p = new JPanel(new BorderLayout());
+ lcd = new LCDCanvas();
+ label = new JLabel();
+ label.setText("not running");
+
+ translate = new JCheckBox("translate");
+ translate.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent event)
+ {
+ testTranslation = translate.isSelected();
+ }
+ });
+
+ lines = new JCheckBox("lines");
+ lines.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent event)
+ {
+ paintLines = lines.isSelected();
+ }
+ });
+
+ JPanel bottom = new JPanel();
+ bottom.add(lines);
+ bottom.add(translate);
+
+ p.add(lcd, BorderLayout.CENTER);
+ p.add(bottom, BorderLayout.SOUTH);
+ p.add(label, BorderLayout.NORTH);
+ add(p);
+ }
+
+ public void setSize(int _nx,int _ny )
+ {
+ nx = _nx;
+ ny = _ny;
+ matrix = new int[nx][ny];
+ future = new int[nx][ny];
+ }
+
+ public void initFrameContent()
+ {
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ add(closePanel, BorderLayout.SOUTH);
+ }
+
+ public void setSleepMillis(int millis)
+ {
+ sleepMillis = millis;
+ }
+
+ public class LCDCanvas extends JPanel
+ {
+ private int sx, sy;
+ private Color activePixel = new Color(30, 30, 40);
+ private Color passivePixel = new Color(200, 180, 240);
+ private Color gridPixel = new Color(255, 240, 240);
+
+ public LCDCanvas()
+ {
+ super();
+ sx = 4 * nx;
+ sy = 4 * ny;
+ }
+
+ public void paintComponent(Graphics g)
+ {
+ // for buffered drawing - not used atm
+ // g.drawImage( buffer, 0, 0, null );
+ long t1 = System.currentTimeMillis();
+
+ g.setColor(gridPixel);
+ g.fillRect(0, 0, sx, sy);
+
+ Color pixelColor = null;
+
+ int dx, dy;
+
+ if (paintLines)
+ {
+ for (int ix = 0; ix < nx; ix++)
+ for (int iy = 0; iy < ny; iy++)
+ {
+ if (matrix[ix][iy] != 0)
+ pixelColor = activePixel;
+ else
+ pixelColor = passivePixel;
+
+ dx = 4 * ix;
+ dy = 4 * iy;
+ g.setColor(pixelColor);
+
+ if (testTranslation)
+ {
+ g.translate(dx, dy);
+ g.drawLine(0, 0, 5, 5);
+ g.translate(- dx, - dy);
+ }
+ else
+ g.drawLine(dx, dy, dx + 5, dy + 5);
+ }
+ }
+ else
+ for (int ix = 0; ix < nx; ix++)
+ {
+ for (int iy = 0; iy < ny; iy++)
+ {
+ if (matrix[ix][iy] != 0)
+ pixelColor = activePixel;
+ else
+ pixelColor = passivePixel;
+
+ dx = 4 * ix;
+ dy = 4 * iy;
+ g.setColor(pixelColor);
+
+ if (testTranslation)
+ {
+ g.translate(dx, dy);
+ g.fillRect(0, 0, 3, 3);
+ g.translate(- dx, - dy);
+ }
+ else
+ g.fillRect(dx, dy, 3, 3);
+ }
+ }
+
+ long t2 = System.currentTimeMillis();
+
+ label.setText("paintComponent took " + (t2 - t1) + " msec. " + "("
+ + (nx * ny + 1) + " "
+ + (paintLines ? "drawLine" : "fillRect") + " calls)");
+
+ }
+
+ public Dimension getPreferredSize()
+ {
+ return new Dimension(sx,sy);
+ }
+
+ public Dimension getMinimumSize()
+ {
+ return new Dimension(sx,sy);
+ }
+ }
+
+ public class Worker extends Thread
+ {
+ public void run()
+ {
+ boolean running = true;
+ while(running)
+ {
+ iteration();
+
+ if (enableRepaints)
+ display();
+
+ if (sleepMillis > 0)
+ {
+ try
+ {
+ Thread.sleep( sleepMillis );
+ }
+ catch(InterruptedException ie)
+ {
+ running = false;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * stupid animation algorithm: show binary representation of current
+ * iteration.
+ */
+ public void iteration()
+ {
+ generation++;
+
+ for (int i = 0; i < nx; i++)
+ {
+ long tmp1 = 1L << i;
+ for (int j = 0; j < ny; j++)
+ {
+ // count neighbors
+ long tmp2 = (1L << j);
+
+
+ long tmp3 = generation & tmp1 & tmp2;
+ if (tmp3 != 0)
+ matrix[i][j] = 1;
+ else
+ matrix[i][j] = 0;
+ }
+ }
+
+ if ((generation % 100) == 0)
+ {
+ long t = System.currentTimeMillis();
+ // System.out.println(
+ // " generation= " + generation +
+ // " iterations/sec= " + 100.0*1000/(t-lastMillis) );
+ lastMillis = t;
+ }
+ }
+
+ public void display()
+ {
+ lcd.repaint();
+ }
+
+ public static void usage()
+ {
+ System.out.println(
+ "Usage: <java> FillRect2 [-sleep <millis>] [-size <int>] [-nopaint]\n"
+ + "Example: jamvm FillRect2 -sleep 10 -size 100\n"
+ );
+ System.exit(0);
+ }
+
+ public static void main(String args[])
+ throws Exception
+ {
+ fillRectDemo = new JNIOverhead();
+ for (int i = 0; i < args.length; i++)
+ {
+ if ("-help".equals(args[i]))
+ {
+ usage();
+ }
+ if ("-sleep".equals(args[i]))
+ {
+ fillRectDemo.setSleepMillis( Integer.parseInt(args[i + 1]));
+ i++;
+ }
+ if ("-size".equals(args[i]))
+ {
+ int size = Integer.parseInt(args[i + 1]);
+ fillRectDemo.setSize(size, size);
+ i++;
+ }
+ if ("-nopaint".equals(args[i]))
+ {
+ fillRectDemo.enableRepaints = false;
+ }
+ }
+
+ SwingUtilities.invokeLater (new Runnable()
+ {
+ public void run()
+ {
+
+ fillRectDemo.initFrameContent();
+ JFrame frame = new JFrame("FillRect performance test");
+ frame.getContentPane().add(fillRectDemo);
+ frame.pack();
+ frame.show();
+ fillRectDemo.worker = fillRectDemo.new Worker();
+ fillRectDemo.worker.start();
+ }
+ });
+ }
+
+ /**
+ * Returns a DemoFactory that creates a SliderDemo.
+ *
+ * @return a DemoFactory that creates a SliderDemo
+ */
+ public static DemoFactory createDemoFactory()
+ {
+ return new DemoFactory()
+ {
+ public JComponent createDemo()
+ {
+ fillRectDemo = new JNIOverhead();
+ SwingUtilities.invokeLater
+ (new Runnable()
+ {
+ public void run()
+ {
+ fillRectDemo.worker = fillRectDemo.new Worker();
+ fillRectDemo.worker.start();
+ }
+ });
+ return fillRectDemo;
+ }
+ };
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/java2d/bench.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/java2d/bench.c?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/java2d/bench.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/java2d/bench.c Thu Nov 8 16:56:19 2007
@@ -0,0 +1,606 @@
+/* bench.c -- native benchmark for Cairo library (meant to test java2d)
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA. */
+
+#include "bench.h"
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gtk/gtk.h>
+#include <sys/timeb.h>
+
+G_DEFINE_TYPE (Benchmark, benchmark, GTK_TYPE_DRAWING_AREA);
+
+// Needed for the gtk widget, but not used:
+static void
+benchmark_class_init (BenchmarkClass *klass)
+{
+}
+
+static void
+benchmark_init (Benchmark *obj)
+{
+}
+
+// The Arc2D's PathIterator uses some transforms, so we condense the required
+// functionality of AffineTransform
+static void
+doTransform (double rx, double ry, double theta, double *cvec)
+{
+ // Define identity matrix (corresponds to new AffineTransform())
+ double m00 = 1;
+ double m10 = 0;
+ double m01 = 0;
+ double m11 = 1;
+ double m02 = 0;
+ double m12 = 0;
+
+ // AffineTransform.scale(rx, ry)
+ m00 = m00 * rx;
+ m01 = m01 * ry;
+ m10 = m10 * rx;
+ m11 = m11 * ry;
+
+ // AffineTransform.rotate(theta)
+ double c = cos(theta);
+ double s = sin(theta);
+ double n00 = m00 * c + m01 * s;
+ double n01 = m00 * -s + m01 * c;
+ double n10 = m10 * c + m11 * s;
+ double n11 = m10 * -s + m11 * c;
+
+ m00 = n00;
+ m01 = n01;
+ m10 = n10;
+ m11 = n11;
+
+ // AffineTransform.transform(cvec, 0, cvec, 0, 1)
+ double dstPts[2];
+ dstPts[0] = (float) (m00 * cvec[0] + m01 * cvec[1] + m02);
+ dstPts[1] = (float) (m10 * cvec[0] + m11 * cvec[1] + m12);
+ cvec[0] = dstPts[0];
+ cvec[1] = dstPts[1];
+}
+
+// Place an arc on the cairo path, simulating java2d's Arc2D
+static void
+setupArc(cairo_t *cr, GtkWidget *bench, int shift)
+{
+ double x, y;
+
+ // Normally passed into the Arc2D constructor
+ x = bench->allocation.x + (rand() % (bench->allocation.width - minSize + 1));
+ y = bench->allocation.y + (rand() % (bench->allocation.height - minSize + 1));
+
+ int angle = rand() % 360;
+ int length = (rand() % 360) - angle;
+ int width = rand() % (int)((bench->allocation.width - x - 10) + 10);
+ int height = rand() % (int)((bench->allocation.height - y - 10) + 10);
+
+ // This is from the ArcPath iterator
+ double start = angle * (M_PI / 180);
+ double extent = length * (M_PI / 180);
+
+ if (extent < 0)
+ {
+ extent = -extent;
+ start = 2 * M_PI - extent + start;
+ }
+
+ int limit;
+ if (width < 0 || height < 0) // We assume type == 0; ie, Arc2D.OPEN
+ limit = -1;
+ else if (extent == 0)
+ limit = 0;
+ else if (extent <= M_PI / 2.0)
+ limit = 1;
+ else if (extent <= M_PI)
+ limit = 2;
+ else if (extent <= 3.0 * (M_PI / 2.0))
+ limit = 3;
+ else
+ limit = 4;
+
+ // This is from CairoGraphics2D.walkPath
+ double xnew = 0;
+ double ynew = 0;
+ double coords[6];
+
+ cairo_fill_rule_t cfillrule = CAIRO_FILL_RULE_WINDING;
+ cairo_set_fill_rule(cr, cfillrule);
+
+ // First iteration will move to the starting point
+ double rx = width / 2;
+ double ry = height / 2;
+ double xmid = x + rx;
+ double ymid = y + ry;
+ coords[0] = xmid + rx * cos(start);
+ coords[1] = ymid - ry * sin(start);
+
+ if (shift == 1)
+ {
+ xnew = floor(coords[0]) + 0.5;
+ ynew = floor(coords[1]) + 0.5;
+ }
+ else
+ {
+ xnew = coords[0];
+ ynew = coords[1];
+ }
+
+ cairo_move_to(cr, xnew, ynew);
+
+ // Iterate through segments of the arc
+ int current;
+ for (current = 1; current <= limit; current++)
+ {
+ // Back to the ArcPath iterator's getCurrent
+ double kappa = (sqrt(2.0) - 1.0) * (4.0 / 3.0);
+ double quad = (M_PI / 2.0);
+
+ double curr_begin = start + (current - 1) * quad;
+ double curr_extent;
+
+ if (start + extent - curr_begin < quad)
+ curr_extent = (start + extent) - curr_begin;
+ else
+ curr_extent = quad;
+
+ double portion_of_a_quadrant = curr_extent / quad;
+
+ double x0 = xmid + rx * cos(curr_begin);
+ double y0 = ymid - ry * sin(curr_begin);
+
+ double x1 = xmid + rx * cos(curr_begin + curr_extent);
+ double y1 = ymid - ry * sin(curr_begin + curr_extent);
+
+ double cvec[2];
+ double len = kappa * portion_of_a_quadrant;
+ double angle = curr_begin;
+
+ cvec[0] = 0;
+ cvec[1] = len;
+ doTransform(rx, ry, angle, cvec);
+ coords[0] = x0 + cvec[0];
+ coords[1] = y0 - cvec[1];
+
+ cvec[0] = 0;
+ cvec[1] = -len;
+ doTransform(rx, ry, angle, cvec);
+ doTransform(1, 1, curr_extent, cvec);
+ coords[2] = x1 + cvec[0];
+ coords[3] = y1 - cvec[1];
+
+ coords[4] = x1;
+ coords[5] = y1;
+
+ // draw it, from CairoGraphics2D.walkPath
+ if (shift == 1)
+ {
+ xnew = floor(coords[4]) + 0.5;
+ ynew = floor(coords[5]) + 0.5;
+ cairo_curve_to(cr, floor(coords[0]) + 0.5, floor(coords[1]) + 0.5,
+ floor(coords[2]) + 0.5, floor(coords[3]) + 0.5,
+ xnew, ynew);
+ }
+ else
+ {
+ xnew = coords[4];
+ ynew = coords[5];
+ cairo_curve_to(cr, coords[0], coords[1], coords[2],
+ coords[3], xnew, ynew);
+ }
+ }
+
+ // Randomize the colour, just for asthetics =)
+ cairo_set_source_rgb(cr, (rand() % 100 / (float)100),
+ (rand() % 100 / (float)100),
+ (rand() % 100 / (float)100));
+
+}
+
+// Place a beizer curve on the cairo path, simulating java2d's CubicCurve2D
+static void
+setupCurve(cairo_t *cr, GtkWidget *bench, int shift)
+{
+ // These are options when creating a new curve
+ int x1 = bench->allocation.x + (rand() % (bench->allocation.width - minSize));
+ int y1 = bench->allocation.y + (rand() % (bench->allocation.height - minSize));
+ int xc1 = bench->allocation.x + (rand() % (bench->allocation.width - minSize));
+ int yc1 = bench->allocation.y + (rand() % (bench->allocation.height - minSize));
+ int xc2 = bench->allocation.x + (rand() % (bench->allocation.width - minSize));
+ int yc2 = bench->allocation.y + (rand() % (bench->allocation.height - minSize));
+ int x2 = bench->allocation.x + (rand() % (bench->allocation.width - minSize));
+ int y2 = bench->allocation.y + (rand() % (bench->allocation.height - minSize));
+
+ // From CairoGraphics2D.walkPath
+ double xnew = 0;
+ double ynew = 0;
+ double coords[6];
+
+ cairo_fill_rule_t cfillrule = CAIRO_FILL_RULE_WINDING;
+ cairo_set_fill_rule(cr, cfillrule);
+
+ // And into CubicCurve's PathIterator...
+ // start by moving to the starting coordinate
+ coords[0] = (float) x1;
+ coords[1] = (float) y1;
+
+ if (shift == 1)
+ {
+ xnew = floor(coords[0]) + 0.5;
+ ynew = floor(coords[1]) + 0.5;
+ }
+ else
+ {
+ xnew = coords[0];
+ ynew = coords[1];
+ }
+
+ cairo_move_to(cr, xnew, ynew);
+
+ // Now the curve itself
+ coords[0] = (float) xc1;
+ coords[1] = (float) yc1;
+ coords[2] = (float) xc2;
+ coords[3] = (float) yc2;
+ coords[4] = (float) x2;
+ coords[5] = (float) y2;
+
+ if (shift == 1)
+ {
+ xnew = floor(coords[4]) + 0.5;
+ ynew = floor(coords[5]) + 0.5;
+ cairo_curve_to(cr, floor(coords[0]) + 0.5, floor(coords[1]) + 0.5,
+ floor(coords[2]) + 0.5, floor(coords[3]) + 0.5,
+ xnew, ynew);
+ }
+ else
+ {
+ xnew = coords[4];
+ ynew = coords[5];
+ cairo_curve_to(cr, coords[0], coords[1], coords[2],
+ coords[3], xnew, ynew);
+ }
+
+ // Randomize colour for asthetics
+ cairo_set_source_rgb(cr, (rand() % 100 / (float)100),
+ (rand() % 100 / (float)100),
+ (rand() % 100 / (float)100));
+}
+
+// Place a line on the cairo path, simulating java2d's Line2D
+static void
+setupLine(cairo_t *cr, GtkWidget *bench, int shift)
+{
+ // These are set when you create a line
+ int x1 = bench->allocation.x + (rand() % (bench->allocation.width - minSize));
+ int y1 = bench->allocation.y + (rand() % (bench->allocation.height - minSize));
+ int x2 = bench->allocation.x + (rand() % (bench->allocation.width - minSize));
+ int y2 = bench->allocation.y + (rand() % (bench->allocation.height - minSize));
+
+ // This is from CairoGraphics2D.walkPath
+ double xnew = 0;
+ double ynew = 0;
+ double coords[6];
+
+ cairo_fill_rule_t cfillrule = CAIRO_FILL_RULE_WINDING;
+ cairo_set_fill_rule(cr, cfillrule);
+
+ // And into Line2D's PathIterator
+ coords[0] = (float) x1;
+ coords[1] = (float) y1;
+
+ if (shift == 1)
+ {
+ xnew = floor(coords[0]) + 0.5;
+ ynew = floor(coords[1]) + 0.5;
+ }
+ else
+ {
+ xnew = coords[0];
+ ynew = coords[1];
+ }
+
+ cairo_move_to(cr, xnew, ynew);
+
+ coords[0] = (float) x2;
+ coords[1] = (float) y2;
+
+ if (shift == 1)
+ {
+ xnew = floor(coords[0]) + 0.5;
+ ynew = floor(coords[1]) + 0.5;
+ }
+ else
+ {
+ xnew = coords[0];
+ ynew = coords[1];
+ }
+
+ cairo_line_to(cr, xnew, ynew);
+
+ // Randomize colour for asthetics
+ cairo_set_source_rgb(cr, (rand() % 100 / (float)100),
+ (rand() % 100 / (float)100),
+ (rand() % 100 / (float)100));
+}
+
+// Place a rectangle on the cairo path, simulating java2d's Rectangle2D
+static void
+setupRect(cairo_t *cr, GtkWidget *bench, int shift)
+{
+ // These are set when you create a rectangle
+ int x1 = bench->allocation.x + (rand() % (bench->allocation.width - minSize));
+ int y1 = bench->allocation.y + (rand() % (bench->allocation.height - minSize));
+ int x2 = bench->allocation.x + (rand() % (bench->allocation.width - minSize));
+ int y2 = bench->allocation.y + (rand() % (bench->allocation.height - minSize));
+
+ // draw() and fill() have been optimized to ignore the PathIterator.
+ // We do the same here.
+ double xnew = 0;
+ double ynew = 0;
+
+ if (shift == 1)
+ {
+ xnew = floor(x1) + 0.5;
+ ynew = floor(y1) + 0.5;
+ }
+ else
+ {
+ xnew = x1;
+ ynew = y1;
+ }
+
+ cairo_rectangle(cr, x1, y1, x2, y2);
+
+ // Randomize colour for asthetics
+ cairo_set_source_rgb(cr, (rand() % 100 / (float)100),
+ (rand() % 100 / (float)100),
+ (rand() % 100 / (float)100));
+}
+
+// The real work gets done here: this function is called when the widget
+// is drawn on screen.
+static void
+draw (GtkWidget *bench, cairo_t *cr)
+{
+ // Setup
+ struct timeb t1, t2;
+ int i, timeElapsed;
+
+ cairo_set_line_width(cr, lineWidth);
+
+ if (antialias == 0)
+ cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
+ else
+ cairo_set_antialias(cr, CAIRO_ANTIALIAS_GRAY);
+
+ // Tell the user what's going on
+ printf("Testing native cairo drawing..\n");
+ printf(" Screen size is %d x %d \n", screenWidth, screenHeight);
+ printf(" Line width is %d\n", lineWidth);
+ printf(" Test size: %d\n", testSize);
+
+ if (antialias == 0)
+ printf(" Anti-alias is off\n");
+ else
+ printf(" Anti-alias is on\n");
+
+ printf("\n");
+ fflush(stdout);
+
+ // Draw & fill Arc
+ if (arcTest == 1)
+ {
+ // Draw
+ ftime(&t1);
+ for (i = 0; i < testSize; i++)
+ {
+ setupArc(cr, bench, 1);
+ cairo_stroke (cr);
+ }
+
+ ftime(&t2);
+ timeElapsed = 1000 * (t2.time - t1.time) + (t2.millitm - t1.millitm);
+ printf("Draw arc: %d ms\n", timeElapsed);
+ fflush(stdout);
+
+ // Fill
+ ftime(&t1);
+ for (i = 0; i < testSize; i++)
+ {
+ setupArc(cr, bench, 0);
+ cairo_fill (cr);
+ }
+
+ ftime(&t2);
+ timeElapsed = 1000 * (t2.time - t1.time) + (t2.millitm - t1.millitm);
+ printf("Fill arc: %d ms\n", timeElapsed);
+ }
+
+ // Draw cubic curve
+ if (curveTest == 1)
+ {
+ ftime(&t1);
+ for (i = 0; i < testSize; i++)
+ {
+ setupCurve(cr, bench, 1);
+ cairo_stroke (cr);
+ }
+
+ ftime(&t2);
+ timeElapsed = 1000 * (t2.time - t1.time) + (t2.millitm - t1.millitm);
+ printf("Draw cubic curve: %d ms\n", timeElapsed);
+ }
+
+ // Ellipse: skip; this is just a special case of arc
+ // General path: skip; this doesn't even work in java2d
+
+ // Draw Line
+ if (lineTest == 1)
+ {
+ ftime(&t1);
+ for (i = 0; i < testSize; i++)
+ {
+ setupLine(cr, bench, 1);
+ cairo_stroke (cr);
+ }
+
+ ftime(&t2);
+ timeElapsed = 1000 * (t2.time - t1.time) + (t2.millitm - t1.millitm);
+ printf("Draw line: %d ms\n", timeElapsed);
+ }
+
+ // Draw & fill Rectangle
+ if (rectTest == 1)
+ {
+ // Draw
+ ftime(&t1);
+ for (i = 0; i < testSize; i++)
+ {
+ setupRect(cr, bench, 1);
+ cairo_stroke (cr);
+ }
+
+ ftime(&t2);
+ timeElapsed = 1000 * (t2.time - t1.time) + (t2.millitm - t1.millitm);
+ printf("Draw rectangle: %d ms\n", timeElapsed);
+
+ // Fill
+ ftime(&t1);
+ for (i = 0; i < testSize; i++)
+ {
+ setupRect(cr, bench, 0);
+ cairo_fill (cr);
+ }
+
+ ftime(&t2);
+ timeElapsed = 1000 * (t2.time - t1.time) + (t2.millitm - t1.millitm);
+ printf("Fill rectangle: %d ms\n", timeElapsed);
+ }
+
+ // Round rectangle: skip, it's just a combination of lines and curves
+ // Image: skip?
+
+ printf("\n");
+}
+
+GtkWidget *
+benchmark_new (void)
+{
+ return g_object_new (BENCHMARK_TYPE, NULL);
+}
+
+int
+main (int argc, char **argv)
+{
+ // Set defaults
+ minSize = 10;
+ arcTest = 0;
+ curveTest = 0;
+ lineTest = 0;
+ rectTest = 0;
+ screenWidth = 320;
+ screenHeight = 240;
+ testSize = 1000;
+ antialias = 0;
+ lineWidth = 1;
+
+ // Process any command-line user options
+ int i;
+ for (i = 1; i < argc; i++)
+ {
+ // Process options first
+ if (!strcmp(argv[i], "-a"))
+ antialias = 1;
+ else if (!strcmp(argv[i], "-h"))
+ screenHeight = atoi(argv[++i]);
+ else if (!strcmp(argv[i], "-l"))
+ lineWidth = atoi(argv[++i]);
+ else if (!strcmp(argv[i], "-t"))
+ testSize = atoi(argv[++i]);
+ else if (!strcmp(argv[i], "-w"))
+ screenWidth = atoi(argv[++i]);
+ else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--h")
+ || !strcmp(argv[i], "-help") || !strcmp(argv[i], "--help"))
+ {
+ printf("Cairo benchmarker, meant to measure JNI overhead\n");
+ printf("Usage: bench [-a] [-h height] [-t test size] [-w width] [tests...]\n");
+ printf("\n");
+ printf(" Valid options: -a turn on anti-aliasing (default off)\n");
+ printf(" -h set screen height (default 240)\n");
+ printf(" -l set stroke line width (default 1)\n");
+ printf(" -t set test size (default 1000)\n");
+ printf(" -w set screen width (default 320)\n");
+ printf(" -h | --help\n");
+ printf(" Valid tests: arc\n");
+ printf(" curve\n");
+ printf(" line\n");
+ printf(" rect\n");
+ printf(" (default: run all)\n");
+ exit (0);
+ }
+
+ // Process tests
+ else if (!strcmp(argv[i], "arc"))
+ arcTest = 1;
+ else if (!strcmp(argv[i], "curve"))
+ curveTest = 1;
+ else if (!strcmp(argv[i], "line"))
+ lineTest = 1;
+ else if (!strcmp(argv[i], "rect"))
+ rectTest = 1;
+ }
+
+ // If no tests were specified, we default to running all of them
+ if (arcTest == 0 && curveTest == 0 && lineTest == 0 && rectTest == 0)
+ {
+ arcTest = 1;
+ curveTest = 1;
+ lineTest = 1;
+ rectTest = 1;
+ }
+
+ // Set up gtk widget
+ GtkWidget *window, *bench;
+ gtk_init (&argc, &argv);
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_resize(GTK_WINDOW(window), screenWidth, screenHeight);
+ gtk_window_set_title(GTK_WINDOW(window), "cairo benchmark");
+
+ // Set up benchmkar and cairo surface
+ bench = benchmark_new ();
+ gtk_container_add (GTK_CONTAINER (window), bench);
+ gtk_widget_show_all (window);
+
+ cairo_t *cr;
+ cr = gdk_cairo_create (bench->window);
+
+ // Run tests
+ draw (bench, cr);
+
+ // Hold output on screen until user exits.
+ printf("Press any key to exit.\n");
+ getchar();
+ exit(0);
+gtk_main();
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/java2d/bench.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/java2d/bench.h?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/java2d/bench.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/java2d/bench.h Thu Nov 8 16:56:19 2007
@@ -0,0 +1,64 @@
+/* bench.h -- native benchmark for Cairo library (meant to test java2d)
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA. */
+
+#ifndef __BENCH_H__
+#define __BENCH_H__
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define BENCHMARK_TYPE (benchmark_get_type())
+#define BENCHMARK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj, BENCHMARK_TYPE, Benchmark)
+#define BENCHMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BENCHMARK_TYPE, BenchmarkClass);
+#define IS_BENCHMARK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BENCHMARK_TYPE))
+#define IS_BENCHMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BENCHMARK_TYPE))
+#define BENCHMARK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BENCHMARK_TYPE, BenchmarkClass))
+
+typedef struct _Benchmark Benchmark;
+typedef struct _BenchmarkClass BenchmarkClass;
+
+struct _Benchmark {
+ GtkDrawingArea parent;
+
+};
+
+struct _BenchmarkClass {
+ GtkDrawingAreaClass parent_class;
+};
+
+GType benchmark_get_type (void);
+GtkWidget *benchmark_new (void);
+
+static int minSize;
+static int antialias;
+static int arcTest;
+static int curveTest;
+static int lineTest;
+static int rectTest;
+
+static int screenHeight;
+static int screenWidth;
+static int testSize;
+static int lineWidth;
+
+G_END_DECLS
+
+#endif
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/jawt/DemoJAWT.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/jawt/DemoJAWT.c?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/jawt/DemoJAWT.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/jawt/DemoJAWT.c Thu Nov 8 16:56:19 2007
@@ -0,0 +1,150 @@
+/* DemoJAWT.c -- native portion of AWT Native Interface demo
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA. */
+
+#include "DemoJAWT.h"
+#include "jawt_md.h"
+#include <string.h>
+
+JNIEXPORT void JNICALL
+Java_gnu_classpath_examples_jawt_DemoJAWT_paintIt (JNIEnv* env,
+ jobject canvas,
+ jobject graphics,
+ jboolean on)
+{
+ JAWT awt;
+ JAWT_DrawingSurface* surface;
+ JAWT_DrawingSurfaceInfo* surface_info;
+ JAWT_X11DrawingSurfaceInfo* surface_info_x11;
+ jint lock;
+ GC gc;
+ int c;
+ char* test_string = "JAWT";
+ XColor orange;
+ XColor yellow;
+ XColor blue;
+ Display* display;
+ Drawable drawable;
+ Status status;
+
+ awt.version = JAWT_VERSION_1_3;
+ if (JAWT_GetAWT (env, &awt) == JNI_FALSE)
+ {
+ printf ("couldn't find AWT\n");
+ return;
+ }
+
+ surface = awt.GetDrawingSurface (env, canvas);
+ if (surface == NULL)
+ {
+ printf ("drawing surface is NULL\n");
+ return;
+ }
+
+ lock = surface->Lock (surface);
+ if ((lock & JAWT_LOCK_ERROR) != 0)
+ {
+ printf ("couldn't lock drawing surface\n");
+ awt.FreeDrawingSurface (surface);
+ return;
+ }
+
+ surface_info = surface->GetDrawingSurfaceInfo (surface);
+ if (surface_info == NULL)
+ {
+ printf ("couldn't get surface information\n");
+ surface->Unlock (surface);
+ awt.FreeDrawingSurface (surface);
+ return;
+ }
+
+ surface_info_x11 = (JAWT_X11DrawingSurfaceInfo*) surface_info->platformInfo;
+
+ display = surface_info_x11->display;
+ drawable = surface_info_x11->drawable;
+
+ gc = XCreateGC (display, drawable, 0, 0);
+ XSetBackground (display, gc, 0);
+
+ orange.red = 254 * 65535 / 255;
+ orange.green = 90 * 65535 / 255;
+ orange.blue = 16 * 65535 / 255;
+
+ /* assume color lookups succeed */
+ status = XAllocColor (display, DefaultColormap (display,
+ DefaultScreen (display)),
+ &orange);
+
+ if (!status)
+ {
+ printf ("color allocation failed\n");
+ goto cleanup;
+ }
+
+ yellow.red = 255 * 65535 / 255;
+ yellow.green = 255 * 65535 / 255;
+ yellow.blue = 0 * 65535 / 255;
+
+ XAllocColor (display, DefaultColormap (display,
+ DefaultScreen (display)),
+ &yellow);
+
+ if (!status)
+ {
+ printf ("color allocation failed\n");
+ goto cleanup;
+ }
+
+ blue.red = 16 * 65535 / 255;
+ blue.green = 30 * 65535 / 255;
+ blue.blue = 137 * 65535 / 255;
+
+ XAllocColor (display, DefaultColormap (display,
+ DefaultScreen (display)),
+ &blue);
+
+ if (!status)
+ {
+ printf ("color allocation failed\n");
+ goto cleanup;
+ }
+
+ for (c = 5; c >= 0; c--)
+ {
+ if (c % 2 == on)
+ XSetForeground (display, gc, yellow.pixel);
+ else
+ XSetForeground (display, gc, orange.pixel);
+
+ XFillArc (display, drawable, gc, 140 - c * 15, 140 - c * 15, c * 30, c * 30, 0, 360 * 64);
+ }
+
+ XSetForeground (display, gc, blue.pixel);
+ XDrawString (display, drawable,
+ gc, 129, 145, test_string, strlen (test_string));
+
+ cleanup:
+ XFreeGC (display, gc);
+
+ surface->FreeDrawingSurfaceInfo (surface_info);
+
+ surface->Unlock (surface);
+
+ awt.FreeDrawingSurface (surface);
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/jawt/DemoJAWT.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/jawt/DemoJAWT.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/jawt/DemoJAWT.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/jawt/DemoJAWT.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,77 @@
+/* DemoJAWT.java -- AWT Native Interface demo
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA. */
+
+package gnu.classpath.examples.jawt;
+
+import java.awt.*;
+import java.awt.event.*;
+
+public class DemoJAWT extends Canvas
+{
+ static
+ {
+ System.loadLibrary ("DemoJAWT");
+ }
+
+ public native void paintIt (Graphics g, boolean on);
+
+ public void paint (Graphics g)
+ {
+ paintIt (g, on);
+ }
+
+ private boolean on;
+
+ public static void main (String[] args)
+ {
+ Frame f = new Frame ("GNU Classpath JAWT Demo");
+
+ f.setBounds (0, 0, 300, 300);
+
+ f.setResizable (false);
+
+ DemoJAWT jawtDemo = new DemoJAWT ();
+ f.add (jawtDemo);
+
+ f.addWindowListener (new WindowAdapter ()
+ {
+ public void windowClosing (WindowEvent evt)
+ {
+ System.exit (0);
+ }
+ });
+
+ f.show ();
+
+ while (true)
+ {
+ try
+ {
+ Thread.sleep (500);
+ }
+ catch (InterruptedException ie)
+ {
+ // ignored
+ }
+ jawtDemo.on = ! jawtDemo.on;
+ f.repaint();
+ }
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestBeans.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestBeans.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestBeans.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestBeans.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,55 @@
+/* TestBeans.java -- Tests the dynamic interface of the beans.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA. */
+
+package gnu.classpath.examples.management;
+
+import java.lang.management.ManagementFactory;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.management.DynamicMBean;
+
+public class TestBeans
+{
+ public static void main(String[] args)
+ throws Exception
+ {
+ List beans = new ArrayList();
+ /* FIXME: When there's a server, this will be easier... :) */
+ beans.add(ManagementFactory.getOperatingSystemMXBean());
+ beans.add(ManagementFactory.getRuntimeMXBean());
+ beans.add(ManagementFactory.getThreadMXBean());
+ beans.add(ManagementFactory.getCompilationMXBean());
+ beans.add(ManagementFactory.getClassLoadingMXBean());
+ beans.add(ManagementFactory.getMemoryMXBean());
+ beans.addAll(ManagementFactory.getMemoryPoolMXBeans());
+ beans.addAll(ManagementFactory.getMemoryManagerMXBeans());
+ beans.addAll(ManagementFactory.getGarbageCollectorMXBeans());
+ Iterator it = beans.iterator();
+ while (it.hasNext())
+ {
+ DynamicMBean bean = (DynamicMBean) it.next();
+ if (bean != null)
+ System.out.println(bean.getMBeanInfo());
+ }
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestClassLoading.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestClassLoading.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestClassLoading.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestClassLoading.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,41 @@
+/* TestClassLoading.java -- Tests the class loading bean.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA. */
+
+package gnu.classpath.examples.management;
+
+import java.lang.management.ClassLoadingMXBean;
+import java.lang.management.ManagementFactory;
+
+public class TestClassLoading
+{
+ public static void main(String[] args)
+ {
+ ClassLoadingMXBean bean = ManagementFactory.getClassLoadingMXBean();
+ System.out.println("Bean: " + bean);
+ System.out.println("Loaded classes: " + bean.getLoadedClassCount());
+ System.out.println("Unloaded classes: " + bean.getUnloadedClassCount());
+ System.out.println("Total loaded classes: " + bean.getTotalLoadedClassCount());
+ boolean verbosity = bean.isVerbose();
+ System.out.println("Verbose class output: " + (verbosity ? "yes" : "no"));
+ System.out.println("Changing verbose setting...");
+ bean.setVerbose(!verbosity);
+ System.out.println("Verbose class output: " + (bean.isVerbose() ? "yes" : "no"));
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestCompilation.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestCompilation.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestCompilation.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestCompilation.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,48 @@
+/* TestCompilation.java -- Tests the compilation bean.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA. */
+
+package gnu.classpath.examples.management;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.CompilationMXBean;
+
+public class TestCompilation
+{
+
+ public static void main(String[] args)
+ {
+ CompilationMXBean bean = ManagementFactory.getCompilationMXBean();
+ if (bean == null)
+ {
+ System.out.println("The compilation bean is not supported by this VM.");
+ System.exit(-1);
+ }
+ System.out.println("Bean: " + bean);
+ System.out.println("JIT compiler name: " + bean.getName());
+ boolean timeMonitoring = bean.isCompilationTimeMonitoringSupported();
+ System.out.println("Compilation time monitoring supported: " + timeMonitoring);
+ if (timeMonitoring)
+ {
+ System.out.println("Compilation time: "
+ + bean.getTotalCompilationTime() + "ms");
+ }
+ }
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestGarbageCollector.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestGarbageCollector.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestGarbageCollector.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestGarbageCollector.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,53 @@
+/* TestGarbageCollector.java -- Tests the garbage collector beans.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA. */
+
+package gnu.classpath.examples.management;
+
+import java.lang.management.GarbageCollectorMXBean;
+import java.lang.management.ManagementFactory;
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+public class TestGarbageCollector
+{
+
+ public static void main(String[] args)
+ {
+ Iterator beans = ManagementFactory.getGarbageCollectorMXBeans().iterator();
+ while (beans.hasNext())
+ {
+ GarbageCollectorMXBean bean = (GarbageCollectorMXBean) beans.next();
+ System.out.println("Bean: " + bean);
+ System.out.println("Name: " + bean.getName());
+ System.out.println("Memory pool names: "
+ + Arrays.toString(bean.getMemoryPoolNames()));
+ System.out.println("Is valid: "
+ + (bean.isValid() ? "yes" : "no"));
+ System.out.println("Collection count: "
+ + bean.getCollectionCount());
+ System.out.println("Collection time: "
+ + bean.getCollectionTime() + "ms");
+ }
+ }
+}
+
+
+
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestMemory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestMemory.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestMemory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestMemory.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,52 @@
+/* TestMemory.java -- Tests the memory bean.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA. */
+
+package gnu.classpath.examples.management;
+
+import java.lang.management.MemoryMXBean;
+import java.lang.management.ManagementFactory;
+
+public class TestMemory
+{
+ public static void main(String[] args)
+ {
+ MemoryMXBean bean = ManagementFactory.getMemoryMXBean();
+ System.out.println("Bean: " + bean);
+ System.out.println("Heap memory usage: "
+ + bean.getHeapMemoryUsage());
+ System.out.println("Non-heap memory usage: "
+ + bean.getNonHeapMemoryUsage());
+ System.out.println("Objects pending finalization: "
+ + bean.getObjectPendingFinalizationCount());
+ System.out.println("Running garbage collector via bean...");
+ bean.gc();
+ System.out.println("Heap memory usage: "
+ + bean.getHeapMemoryUsage());
+ System.out.println("Non-heap memory usage: "
+ + bean.getNonHeapMemoryUsage());
+ System.out.println("Objects pending finalization: "
+ + bean.getObjectPendingFinalizationCount());
+ boolean verbosity = bean.isVerbose();
+ System.out.println("Verbose memory output: " + (verbosity ? "yes" : "no"));
+ System.out.println("Changing verbose setting...");
+ bean.setVerbose(!verbosity);
+ System.out.println("Verbose memory output: " + (bean.isVerbose() ? "yes" : "no"));
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestMemoryManager.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestMemoryManager.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestMemoryManager.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestMemoryManager.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,49 @@
+/* TestMemoryManager.java -- Tests the memory manager beans.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA. */
+
+package gnu.classpath.examples.management;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryManagerMXBean;
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+public class TestMemoryManager
+{
+
+ public static void main(String[] args)
+ {
+ Iterator beans = ManagementFactory.getMemoryManagerMXBeans().iterator();
+ while (beans.hasNext())
+ {
+ MemoryManagerMXBean bean = (MemoryManagerMXBean) beans.next();
+ System.out.println("Bean: " + bean);
+ System.out.println("Name: " + bean.getName());
+ System.out.println("Memory pool names: "
+ + Arrays.toString(bean.getMemoryPoolNames()));
+ System.out.println("Is valid: "
+ + (bean.isValid() ? "yes" : "no"));
+ }
+ }
+}
+
+
+
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestMemoryPool.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestMemoryPool.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestMemoryPool.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestMemoryPool.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,93 @@
+/* TestMemoryPool.java -- Tests the memory pool beans.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA. */
+
+package gnu.classpath.examples.management;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryPoolMXBean;
+import java.lang.management.MemoryUsage;
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+public class TestMemoryPool
+{
+
+ /**
+ * 1mb in bytes
+ */
+ private static final int MB = 1 << 20;
+
+ public static void main(String[] args)
+ {
+ Iterator beans = ManagementFactory.getMemoryPoolMXBeans().iterator();
+ while (beans.hasNext())
+ {
+ MemoryPoolMXBean bean = (MemoryPoolMXBean) beans.next();
+ System.out.println("Bean: " + bean);
+ System.out.println("Name: " + bean.getName());
+ System.out.println("Collection usage: " + bean.getCollectionUsage());
+ boolean collectionUsage = bean.isCollectionUsageThresholdSupported();
+ System.out.println("Collection usage threshold supported: "
+ + collectionUsage);
+ if (collectionUsage)
+ {
+ System.out.println("Collection usage threshold: "
+ + bean.getCollectionUsageThreshold());
+ System.out.println("Setting collection usage threshold to 1MB ("
+ + MB + " bytes)");
+ bean.setCollectionUsageThreshold(MB);
+ System.out.println("Collection usage threshold: "
+ + bean.getCollectionUsageThreshold());
+ System.out.println("Collection usage threshold count: "
+ + bean.getCollectionUsageThresholdCount());
+ System.out.println("Collection usage threshold exceeded: "
+ + (bean.isCollectionUsageThresholdExceeded()
+ ? "yes" : "no"));
+ }
+ System.out.println("Memory manager names: "
+ + Arrays.toString(bean.getMemoryManagerNames()));
+ System.out.println("Peak usage: " + bean.getPeakUsage());
+ System.out.println("Current usage: " + bean.getUsage());
+ System.out.println("Resetting peak usage...");
+ bean.resetPeakUsage();
+ System.out.println("Peak usage: " + bean.getPeakUsage());
+ System.out.println("Current usage: " + bean.getUsage());
+ boolean usage = bean.isUsageThresholdSupported();
+ System.out.println("Usage threshold supported: " + usage);
+ if (usage)
+ {
+ System.out.println("Usage threshold: "
+ + bean.getUsageThreshold());
+ System.out.println("Setting usage threshold to 1MB ("
+ + MB + " bytes)");
+ bean.setUsageThreshold(MB);
+ System.out.println("Usage threshold: "
+ + bean.getUsageThreshold());
+ System.out.println("Usage threshold count: "
+ + bean.getUsageThresholdCount());
+ System.out.println("Usage threshold exceeded: "
+ + (bean.isUsageThresholdExceeded()
+ ? "yes" : "no"));
+ }
+ System.out.println("Valid: " + (bean.isValid() ? "yes" : "no"));
+ }
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestOS.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestOS.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestOS.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestOS.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,37 @@
+/* TestOS.java -- Tests the OS bean.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA. */
+
+package gnu.classpath.examples.management;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.OperatingSystemMXBean;
+
+public class TestOS
+{
+ public static void main(String[] args)
+ {
+ OperatingSystemMXBean osBean = ManagementFactory.getOperatingSystemMXBean();
+ System.out.println("Bean: " + osBean);
+ System.out.println("OS Name: " + osBean.getName());
+ System.out.println("OS Version: " + osBean.getVersion());
+ System.out.println("Architecture: " + osBean.getArch());
+ System.out.println("Processors: " + osBean.getAvailableProcessors());
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestRuntime.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestRuntime.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestRuntime.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestRuntime.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,54 @@
+/* TestRuntime.java -- Tests the runtime bean.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA. */
+
+package gnu.classpath.examples.management;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.RuntimeMXBean;
+
+import java.util.Date;
+
+public class TestRuntime
+{
+
+ public static void main(String[] args)
+ {
+ RuntimeMXBean vmBean = ManagementFactory.getRuntimeMXBean();
+ System.out.println("Bean: " + vmBean);
+ boolean bootClassPath = vmBean.isBootClassPathSupported();
+ System.out.println("Boot Class Path Supported: " + bootClassPath);
+ if (bootClassPath)
+ System.out.println("Boot Class Path: " + vmBean.getBootClassPath());
+ System.out.println("Class Path: " + vmBean.getClassPath());
+ System.out.println("Input Arguments: " + vmBean.getInputArguments());
+ System.out.println("Library Path: " + vmBean.getLibraryPath());
+ System.out.println("Management Spec. Version: " + vmBean.getManagementSpecVersion());
+ System.out.println("Name: " + vmBean.getName());
+ System.out.println("Spec Name: " + vmBean.getSpecName());
+ System.out.println("Spec Vendor: " + vmBean.getSpecVendor());
+ System.out.println("Spec Version: " + vmBean.getSpecVersion());
+ System.out.println("Start Time: " + new Date(vmBean.getStartTime()));
+ System.out.println("System Properties: " + vmBean.getSystemProperties());
+ System.out.println("Uptime: " + vmBean.getUptime() + "ms");
+ System.out.println("VM Name: " + vmBean.getVmName());
+ System.out.println("VM Vendor: " + vmBean.getVmVendor());
+ System.out.println("VM Version: " + vmBean.getVmVersion());
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestThread.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestThread.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestThread.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/management/TestThread.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,118 @@
+/* TestThread.java -- Tests the thread bean.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA. */
+
+package gnu.classpath.examples.management;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
+
+import java.util.Arrays;
+
+public class TestThread
+{
+
+ public static void main(String[] args)
+ {
+ ThreadMXBean bean = ManagementFactory.getThreadMXBean();
+ System.out.println("Bean: " + bean);
+ System.out.println("Monitor deadlocked threads: " + bean.findMonitorDeadlockedThreads());
+ long[] ids = bean.getAllThreadIds();
+ System.out.println("Live thread ids: " + Arrays.toString(ids));
+ boolean currentTimeMonitoring = bean.isCurrentThreadCpuTimeSupported();
+ System.out.println("Current thread CPU time monitoring supported: " + currentTimeMonitoring);
+ if (currentTimeMonitoring)
+ {
+ boolean timeEnabled = bean.isThreadCpuTimeEnabled();
+ System.out.println("Is time monitoring enabled... " +
+ (timeEnabled ? "yes" : "no"));
+ if (!timeEnabled)
+ {
+ System.out.println("Enabling...");
+ bean.setThreadCpuTimeEnabled(true);
+ timeEnabled = bean.isThreadCpuTimeEnabled();
+ System.out.println("Should now be enabled... " +
+ (timeEnabled ? "yes" : "no"));
+ }
+ if (timeEnabled)
+ {
+ System.out.println("Current thread CPU time: "
+ + bean.getCurrentThreadCpuTime()
+ + "ns");
+ System.out.println("Current thread user time: "
+ + bean.getCurrentThreadUserTime()
+ + "ns");
+ }
+ }
+ System.out.println("Daemon thread count: " + bean.getDaemonThreadCount());
+ System.out.println("Peak thread count: " + bean.getPeakThreadCount());
+ System.out.println("Resetting...");
+ bean.resetPeakThreadCount();
+ System.out.println("Peak thread count: " + bean.getPeakThreadCount());
+ System.out.println("Thread count: " + bean.getThreadCount());
+ boolean timeMonitoring = bean.isThreadCpuTimeSupported();
+ System.out.println("Thread CPU time monitoring supported: " + timeMonitoring);
+ if (timeMonitoring)
+ {
+ for (int a = 0; a < ids.length; ++a)
+ {
+ System.out.println("Thread " + a
+ + " CPU time: "
+ + bean.getThreadCpuTime(ids[a]) + "ns");
+ System.out.println("Thread "
+ + a + " user time: "
+ + bean.getThreadUserTime(ids[a]) + "ns");
+ }
+ }
+ System.out.println("Current thread info: "
+ + bean.getThreadInfo(Thread.currentThread().getId()));
+ System.out.println("All thread info: " + Arrays.toString(bean.getThreadInfo(ids)));
+ System.out.println("Total started threads: " + bean.getTotalStartedThreadCount());
+ boolean contentionMonitoring = bean.isThreadContentionMonitoringSupported();
+ System.out.println("Thread contention monitoring supported: " + contentionMonitoring);
+ if (contentionMonitoring)
+ {
+ boolean contentionEnabled = bean.isThreadContentionMonitoringEnabled();
+ System.out.println("Thread contention monitoring shouldn't be enabled... " +
+ (contentionEnabled ? "but it is" : "true"));
+ if (!contentionEnabled)
+ {
+ System.out.println("Enabling...");
+ bean.setThreadContentionMonitoringEnabled(true);
+ contentionEnabled = bean.isThreadContentionMonitoringEnabled();
+ System.out.println("Should now be enabled... " +
+ (contentionEnabled ? "it is" : "nope"));
+ }
+ if (contentionEnabled)
+ {
+ ThreadInfo[] info = bean.getThreadInfo(ids);
+ for (int a = 0; a < info.length; ++a)
+ {
+ System.out.println("Blocked time for thread "
+ + info[a].getThreadId() + ": "
+ + info[a].getBlockedTime() + "ms");
+ System.out.println("Waited time for thread "
+ + info[a].getThreadId() + ": "
+ + info[a].getWaitedTime() + "ms");
+ }
+ }
+ }
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/midi/Demo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/midi/Demo.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/midi/Demo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/midi/Demo.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,137 @@
+/* Demo.java -- And example of MIDI support
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA. */
+
+package gnu.classpath.examples.midi;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.sound.midi.*;
+
+/**
+ * An example how javax.sound.midi facilities work.
+ */
+public class Demo extends Frame implements ItemListener
+{
+ Choice midiInChoice = new Choice();
+ Choice midiOutChoice = new Choice();
+
+ MidiDevice inDevice = null;
+ MidiDevice outDevice = null;
+
+ ArrayList inDevices = new ArrayList();
+ ArrayList outDevices = new ArrayList();
+
+ public Demo () throws Exception
+ {
+ MenuBar mb = new MenuBar ();
+ Menu menu = new Menu ("File");
+ MenuItem quit = new MenuItem("Quit", new MenuShortcut('Q'));
+ quit.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ System.exit(0);
+ }
+ });
+ menu.add (quit);
+ mb.add(menu);
+
+ setTitle("synthcity: the GNU Classpath MIDI Demo");
+ setLayout(new FlowLayout());
+
+ MidiDevice.Info[] infos = MidiSystem.getMidiDeviceInfo();
+
+ for (int i = 0; i < infos.length; i++)
+ {
+ MidiDevice device = MidiSystem.getMidiDevice(infos[i]);
+ if (device.getMaxReceivers() > 0)
+ {
+ midiOutChoice.addItem(infos[i].getDescription());
+ outDevices.add(device);
+ }
+ if (device.getMaxTransmitters() > 0)
+ {
+ midiInChoice.addItem(infos[i].getDescription());
+ inDevices.add(device);
+ }
+ }
+
+ setMenuBar (mb);
+ add(new Label("MIDI IN: "));
+ add(midiInChoice);
+ add(new Label(" MIDI OUT: "));
+ add(midiOutChoice);
+
+ midiInChoice.addItemListener(this);
+ midiOutChoice.addItemListener(this);
+
+ pack();
+ show();
+ }
+
+ public void itemStateChanged (ItemEvent e)
+ {
+ try
+ {
+ if (e.getItemSelectable() == midiInChoice)
+ {
+ if (inDevice != null)
+ inDevice.close();
+ inDevice = (MidiDevice)
+ inDevices.get(midiInChoice.getSelectedIndex());
+ }
+
+ if (e.getItemSelectable() == midiOutChoice)
+ {
+ if (outDevice != null)
+ outDevice.close();
+ outDevice = (MidiDevice)
+ outDevices.get(midiOutChoice.getSelectedIndex());
+ }
+
+ if (inDevice != null && outDevice != null)
+ {
+ if (! inDevice.isOpen())
+ inDevice.open();
+ if (! outDevice.isOpen())
+ outDevice.open();
+ Transmitter t = inDevice.getTransmitter();
+ if (t == null)
+ System.err.println (inDevice + ".getTransmitter() == null");
+ Receiver r = outDevice.getReceiver();
+ if (r == null)
+ System.err.println (outDevice + ".getReceiver() == null");
+
+ if (t != null && r != null)
+ t.setReceiver (r);
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ public static void main (String args[]) throws Exception
+ {
+ new Demo();
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/print/Demo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/print/Demo.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/print/Demo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/print/Demo.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,391 @@
+/* Demo.java -- Simple Java Print Service Demo
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.print;
+
+import java.awt.BorderLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import javax.print.DocFlavor;
+import javax.print.DocPrintJob;
+import javax.print.PrintException;
+import javax.print.PrintService;
+import javax.print.PrintServiceLookup;
+import javax.print.ServiceUI;
+import javax.print.SimpleDoc;
+import javax.print.attribute.Attribute;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
+import javax.swing.JTextField;
+
+
+/**
+ * A simple demo showing the use of the Java Print Service API.
+ * @author Wolfgang Baer (WBaer at gmx.de)
+ */
+public class Demo extends JFrame
+ implements ActionListener
+{
+ // The discovered print services
+ private static PrintService[] services;
+
+ // variables for the PrintPanel demo
+ private HashPrintRequestAttributeSet atts;
+ private PrintService dialogSelectedService;
+ private JTextField dialogSelectedService_Tf;
+ private JList dialogSelectedServiceAtts;
+ private JComboBox dialogSelectedServicedocFormat;
+ private JTextField selectedFileTf;
+ private File selectedFile;
+
+ // variables for the PrintServicePanel demo
+ private JComboBox serviceBox;
+ private JList docFormat;
+ private JList attCategories;
+
+ static
+ {
+ // lookup all services without any constraints
+ services = PrintServiceLookup.lookupPrintServices(null, null);
+ }
+
+ /**
+ * Constructs the Print Demo
+ * @param title - the demo title.
+ */
+ public Demo(String title)
+ {
+ super(title);
+ JPanel content = new JPanel(new BorderLayout());
+
+ JTabbedPane tabbed = new JTabbedPane();
+ tabbed.addTab("Discover print services", createPrintServicePanel());
+ tabbed.addTab("Print a file", createPrintPanel());
+
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+
+ content.add(tabbed, BorderLayout.CENTER);
+ content.add(closePanel, BorderLayout.SOUTH);
+ getContentPane().add(content);
+ }
+
+ private JPanel createPrintServicePanel()
+ {
+ JPanel panel = new JPanel(new GridBagLayout());
+ GridBagConstraints c = new GridBagConstraints();
+
+ c.insets = new Insets(5,5,5,5);
+ c.gridx = 0;
+ c.gridy = 0;
+ c.anchor = GridBagConstraints.WEST;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ JLabel serviceBoxLb = new JLabel("Available print services: ");
+ panel.add(serviceBoxLb, c);
+
+ c.gridx = 1;
+ c.gridy = 0;
+ serviceBox = new JComboBox(services);
+ serviceBox.setActionCommand("SERVICE");
+ serviceBox.addActionListener(this);
+ panel.add(serviceBox, c);
+
+ c.gridx = 0;
+ c.gridy = 1;
+ JLabel docFormatLb = new JLabel("Supported DocFormat: ");
+ panel.add(docFormatLb, c);
+
+ c.gridx = 1;
+ c.gridy = 1;
+ docFormat = new JList(services[0].getSupportedDocFlavors());
+ docFormat.setVisibleRowCount(3);
+ JScrollPane scrollPane = new JScrollPane(docFormat);
+ panel.add(scrollPane, c);
+
+ c.gridx = 0;
+ c.gridy = 2;
+ JLabel categoriesLb = new JLabel("Supported Attribute categories: ");
+ panel.add(categoriesLb, c);
+
+ c.gridx = 1;
+ c.gridy = 2;
+ attCategories = new JList(services[0].getSupportedAttributeCategories());
+ attCategories.setVisibleRowCount(3);
+ JScrollPane scrollPane2 = new JScrollPane(attCategories);
+ panel.add(scrollPane2, c);
+
+ return panel;
+ }
+
+ private JPanel createPrintPanel()
+ {
+ JPanel panel = new JPanel(new GridBagLayout());
+ GridBagConstraints c = new GridBagConstraints();
+
+ c.insets = new Insets(5,5,5,5);
+ c.gridx = 0;
+ c.gridy = 0;
+ c.gridwidth = 2;
+ JButton serviceBtn = new JButton("Show print dialog ...");
+ serviceBtn.addActionListener(this);
+ panel.add(serviceBtn, c);
+
+ c.gridx = 0;
+ c.gridy = 1;
+ c.gridwidth = 1;
+ c.anchor = GridBagConstraints.WEST;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ JLabel selectedLb = new JLabel("Selected print service: ");
+ panel.add(selectedLb, c);
+
+ c.gridx = 1;
+ c.gridy = 1;
+ dialogSelectedService_Tf = new JTextField(25);
+ panel.add(dialogSelectedService_Tf, c);
+
+ c.gridx = 0;
+ c.gridy = 2;
+ JLabel selectedAttsLb = new JLabel("Selected Attributes: ");
+ panel.add(selectedAttsLb, c);
+
+ c.gridx = 1;
+ c.gridy = 2;
+ c.weighty = 1.5;
+ c.fill = GridBagConstraints.BOTH;
+ dialogSelectedServiceAtts = new JList();
+ dialogSelectedServiceAtts.setVisibleRowCount(3);
+ JScrollPane scrollPane = new JScrollPane(dialogSelectedServiceAtts);
+ panel.add(scrollPane, c);
+
+ c.gridx = 0;
+ c.gridy = 3;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ JLabel fileLb = new JLabel("File to print: ");
+ panel.add(fileLb, c);
+
+ c.gridx = 1;
+ c.gridy = 3;
+ selectedFileTf = new JTextField(25);
+ panel.add(selectedFileTf, c);
+
+ c.gridx = 2;
+ c.gridy = 3;
+ c.fill = GridBagConstraints.NONE;
+ JButton fileBt = new JButton("Choose file");
+ fileBt.addActionListener(this);
+ panel.add(fileBt, c);
+
+ c.gridx = 0;
+ c.gridy = 4;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ JLabel docFormatLb = new JLabel("Document format of file: ");
+ panel.add(docFormatLb, c);
+
+ c.gridx = 1;
+ c.gridy = 4;
+ dialogSelectedServicedocFormat = new JComboBox();
+ panel.add(dialogSelectedServicedocFormat, c);
+
+ c.gridx = 0;
+ c.gridy = 5;
+ c.gridwidth = 2;
+ c.anchor = GridBagConstraints.CENTER;
+ c.fill = GridBagConstraints.NONE;
+ JButton printBt = new JButton("Print");
+ printBt.setActionCommand("PRINT");
+ printBt.addActionListener(this);
+ panel.add(printBt, c);
+
+ return panel;
+ }
+
+ /**
+ * Simple action control - only one listener
+ * @param event
+ */
+ public void actionPerformed(ActionEvent event)
+ {
+ if (event.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ else if (event.getActionCommand().equals("Choose file"))
+ {
+ JFileChooser chooser = new JFileChooser();
+ chooser.showOpenDialog(this);
+
+ selectedFile = chooser.getSelectedFile();
+
+ if (selectedFile != null)
+ selectedFileTf.setText(selectedFile.getName());
+ else
+ selectedFileTf.setText("None selected");
+ }
+ else if (event.getActionCommand().equals("Show print dialog ..."))
+ {
+ atts = new HashPrintRequestAttributeSet();
+ dialogSelectedService = ServiceUI.printDialog(null, 50, 50, services,
+ null, null, atts);
+
+ if (dialogSelectedService != null)
+ {
+ dialogSelectedService_Tf.setText(dialogSelectedService.getName());
+
+ // we do not want to have the class representation in the dialog
+ // as we later always use an InputStream to open the file selected
+
+ // use set to remove duplicates
+ DocFlavor[] docflavors = dialogSelectedService.getSupportedDocFlavors();
+ HashSet set = new HashSet();
+ for (int i=0; i < docflavors.length; i++)
+ {
+ String charset = docflavors[i].getParameter("charset");
+ String mimetype = docflavors[i].getMediaType() + "/" + docflavors[i].getMediaSubtype();
+ if (charset != null)
+ mimetype += "; charset=" + charset;
+ set.add(mimetype);
+ }
+
+ dialogSelectedServicedocFormat.removeAllItems();
+ for (Iterator it = set.iterator(); it.hasNext(); )
+ dialogSelectedServicedocFormat.addItem(it.next());
+ }
+ else
+ dialogSelectedService_Tf.setText("None selected");
+
+ Attribute[] attsArray = atts.toArray();
+ String[] attsSTr = new String[attsArray.length];
+ for (int i = 0; i < attsSTr.length; i++)
+ attsSTr[i] = attsArray[i].getName() + " - " + attsArray[i].toString();
+
+ dialogSelectedServiceAtts.setListData(attsSTr);
+
+ validate();
+ }
+ else if (event.getActionCommand().equals("PRINT"))
+ {
+ if (selectedFile != null && dialogSelectedService != null)
+ {
+ DocPrintJob job = dialogSelectedService.createPrintJob();
+
+ // choose correct docflavor
+ String mimetype = (String) dialogSelectedServicedocFormat.getSelectedItem();
+
+ DocFlavor flavor = null;
+ if (mimetype.equals(DocFlavor.INPUT_STREAM.GIF.getMimeType()))
+ flavor = DocFlavor.INPUT_STREAM.GIF;
+ else if (mimetype.equals(DocFlavor.INPUT_STREAM.AUTOSENSE.getMimeType()))
+ flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
+ else if (mimetype.equals(DocFlavor.INPUT_STREAM.JPEG.getMimeType()))
+ flavor = DocFlavor.INPUT_STREAM.JPEG;
+ else if (mimetype.equals(DocFlavor.INPUT_STREAM.PCL.getMimeType()))
+ flavor = DocFlavor.INPUT_STREAM.PCL;
+ else if (mimetype.equals(DocFlavor.INPUT_STREAM.PDF.getMimeType()))
+ flavor = DocFlavor.INPUT_STREAM.PDF;
+ else if (mimetype.equals(DocFlavor.INPUT_STREAM.PNG.getMimeType()))
+ flavor = DocFlavor.INPUT_STREAM.PNG;
+ else if (mimetype.equals(DocFlavor.INPUT_STREAM.POSTSCRIPT.getMimeType()))
+ flavor = DocFlavor.INPUT_STREAM.POSTSCRIPT;
+ else if (mimetype.equals(DocFlavor.INPUT_STREAM.TEXT_HTML_HOST.getMimeType()))
+ flavor = DocFlavor.INPUT_STREAM.TEXT_HTML_HOST;
+ else if (mimetype.equals(DocFlavor.INPUT_STREAM.TEXT_PLAIN_HOST.getMimeType()))
+ flavor = DocFlavor.INPUT_STREAM.TEXT_PLAIN_HOST;
+ else
+ flavor = new DocFlavor(mimetype, "java.io.InputStream");
+
+ try
+ {
+ SimpleDoc doc = new SimpleDoc(new FileInputStream(selectedFile), flavor, null);
+ job.print(doc, atts);
+ }
+ catch (FileNotFoundException e)
+ {
+ JOptionPane.showMessageDialog(this, "The file was not found.");
+ e.printStackTrace();
+ }
+ catch (PrintException e)
+ {
+ JOptionPane.showMessageDialog(this, e, "PrintException", JOptionPane.ERROR_MESSAGE);
+ e.printStackTrace();
+ }
+ }
+ else
+ JOptionPane.showMessageDialog(this, "Please select a file to print using the FileChooser", "No file selected", JOptionPane.INFORMATION_MESSAGE);
+ }
+ else if (event.getActionCommand().equals("SERVICE"))
+ { // A new service was selected
+ PrintService selected = (PrintService) serviceBox.getSelectedItem();
+
+ DocFlavor[] flavors = selected.getSupportedDocFlavors();
+ docFormat.setListData(flavors);
+ attCategories.setListData(selected.getSupportedAttributeCategories());
+ }
+ }
+
+ /**
+ * Main method.
+ * @param args - nothing defined.
+ */
+ public static void main(String[] args)
+ {
+ Demo app = new Demo("GNU Classpath printing demo");
+ app.pack();
+ app.setVisible(true);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/ButtonDemo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/ButtonDemo.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/ButtonDemo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/ButtonDemo.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,319 @@
+/* ButtonDemo.java -- An example showing various buttons in Swing.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JToggleButton;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+import javax.swing.plaf.metal.MetalIconFactory;
+
+/**
+ * A simple button demo showing various buttons in different states.
+ */
+public class ButtonDemo
+ extends JPanel
+ implements ActionListener
+{
+
+ private JCheckBox buttonState;
+ private JButton button1;
+ private JButton button2;
+ private JButton button3;
+ private JButton button4;
+
+ private JCheckBox toggleState;
+ private JToggleButton toggle1;
+ private JToggleButton toggle2;
+ private JToggleButton toggle3;
+ private JToggleButton toggle4;
+
+ private JCheckBox checkBoxState;
+ private JCheckBox checkBox1;
+ private JCheckBox checkBox2;
+ private JCheckBox checkBox3;
+
+ private JCheckBox radioState;
+ private JRadioButton radio1;
+ private JRadioButton radio2;
+ private JRadioButton radio3;
+
+ /**
+ * Creates a new demo instance.
+ */
+ public ButtonDemo()
+ {
+ createContent();
+ // initFrameContent() is only called (from main) when running this app
+ // standalone
+ }
+
+ /**
+ * When the demo is run independently, the frame is displayed, so we should
+ * initialise the content panel (including the demo content and a close
+ * button). But when the demo is run as part of the Swing activity board,
+ * only the demo content panel is used, the frame itself is never displayed,
+ * so we can avoid this step.
+ */
+ void initFrameContent()
+ {
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ add(closePanel, BorderLayout.SOUTH);
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
+ private void createContent()
+ {
+ setLayout(new BorderLayout());
+ JPanel panel = new JPanel(new GridLayout(4, 1));
+ panel.add(createButtonPanel());
+ panel.add(createTogglePanel());
+ panel.add(createCheckBoxPanel());
+ panel.add(createRadioPanel());
+ add(panel);
+ }
+
+ private JPanel createButtonPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.buttonState = new JCheckBox("Enabled", true);
+ this.buttonState.setActionCommand("BUTTON_STATE");
+ this.buttonState.addActionListener(this);
+ panel.add(this.buttonState, BorderLayout.EAST);
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setBorder(BorderFactory.createTitledBorder("JButton"));
+ this.button1 = new JButton("Button 1");
+
+ this.button2 = new JButton("Button 2");
+ this.button2.setIcon(MetalIconFactory.getInternalFrameDefaultMenuIcon());
+
+ this.button3 = new JButton("Button 3");
+ this.button3.setIcon(MetalIconFactory.getFileChooserHomeFolderIcon());
+ this.button3.setHorizontalTextPosition(SwingConstants.CENTER);
+ this.button3.setVerticalTextPosition(SwingConstants.BOTTOM);
+
+ this.button4 = new JButton("Button 4");
+ this.button4.setIcon(MetalIconFactory.getFileChooserUpFolderIcon());
+ this.button4.setText(null);
+
+ buttonPanel.add(button1);
+ buttonPanel.add(button2);
+ buttonPanel.add(button3);
+ buttonPanel.add(button4);
+
+ panel.add(buttonPanel);
+
+ return panel;
+ }
+
+ private JPanel createTogglePanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+
+ this.toggleState = new JCheckBox("Enabled", true);
+ this.toggleState.setActionCommand("TOGGLE_STATE");
+ this.toggleState.addActionListener(this);
+
+ panel.add(this.toggleState, BorderLayout.EAST);
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setBorder(BorderFactory.createTitledBorder("JToggleButton"));
+
+ this.toggle1 = new JToggleButton("Toggle 1");
+
+ this.toggle2 = new JToggleButton("Toggle 2");
+ this.toggle2.setIcon(MetalIconFactory.getInternalFrameDefaultMenuIcon());
+
+ this.toggle3 = new JToggleButton("Toggle 3");
+ this.toggle3.setIcon(MetalIconFactory.getFileChooserHomeFolderIcon());
+ this.toggle3.setHorizontalTextPosition(SwingConstants.CENTER);
+ this.toggle3.setVerticalTextPosition(SwingConstants.BOTTOM);
+
+ this.toggle4 = new JToggleButton("Toggle 4");
+ this.toggle4.setIcon(MetalIconFactory.getFileChooserUpFolderIcon());
+ this.toggle4.setText(null);
+
+ ButtonGroup toggleGroup = new ButtonGroup();
+ toggleGroup.add(toggle1);
+ toggleGroup.add(toggle2);
+ toggleGroup.add(toggle3);
+ toggleGroup.add(toggle4);
+
+ buttonPanel.add(toggle1);
+ buttonPanel.add(toggle2);
+ buttonPanel.add(toggle3);
+ buttonPanel.add(toggle4);
+
+ panel.add(buttonPanel);
+
+ return panel;
+ }
+
+ private JPanel createCheckBoxPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+
+ this.checkBoxState = new JCheckBox("Enabled", true);
+ this.checkBoxState.setActionCommand("CHECKBOX_STATE");
+ this.checkBoxState.addActionListener(this);
+
+ panel.add(this.checkBoxState, BorderLayout.EAST);
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setBorder(BorderFactory.createTitledBorder("JCheckBox"));
+ this.checkBox1 = new JCheckBox("CheckBox 1");
+
+ this.checkBox2 = new JCheckBox("CheckBox 2");
+
+ this.checkBox3 = new JCheckBox("CheckBox 3");
+
+ buttonPanel.add(checkBox1);
+ buttonPanel.add(checkBox2);
+ buttonPanel.add(checkBox3);
+
+ panel.add(buttonPanel);
+
+ return panel;
+ }
+
+ private JPanel createRadioPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+
+ this.radioState = new JCheckBox("Enabled", true);
+ this.radioState.setActionCommand("RADIO_STATE");
+ this.radioState.addActionListener(this);
+ panel.add(this.radioState, BorderLayout.EAST);
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setBorder(BorderFactory.createTitledBorder("JRadioButton"));
+ this.radio1 = new JRadioButton("Radio 1");
+
+ this.radio2 = new JRadioButton("Radio 2");
+
+ this.radio3 = new JRadioButton("Radio 3");
+
+ ButtonGroup radioGroup = new ButtonGroup();
+ radioGroup.add(radio1);
+ radioGroup.add(radio2);
+ radioGroup.add(radio3);
+
+ buttonPanel.add(radio1);
+ buttonPanel.add(radio2);
+ buttonPanel.add(radio3);
+
+ panel.add(buttonPanel);
+
+ return panel;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("BUTTON_STATE"))
+ {
+ button1.setEnabled(buttonState.isSelected());
+ button2.setEnabled(buttonState.isSelected());
+ button3.setEnabled(buttonState.isSelected());
+ button4.setEnabled(buttonState.isSelected());
+ }
+ else if (e.getActionCommand().equals("TOGGLE_STATE"))
+ {
+ toggle1.setEnabled(toggleState.isSelected());
+ toggle2.setEnabled(toggleState.isSelected());
+ toggle3.setEnabled(toggleState.isSelected());
+ toggle4.setEnabled(toggleState.isSelected());
+ }
+ else if (e.getActionCommand().equals("CHECKBOX_STATE"))
+ {
+ checkBox1.setEnabled(checkBoxState.isSelected());
+ checkBox2.setEnabled(checkBoxState.isSelected());
+ checkBox3.setEnabled(checkBoxState.isSelected());
+ }
+ else if (e.getActionCommand().equals("RADIO_STATE"))
+ {
+ radio1.setEnabled(radioState.isSelected());
+ radio2.setEnabled(radioState.isSelected());
+ radio3.setEnabled(radioState.isSelected());
+ }
+ else if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ SwingUtilities.invokeLater
+ (new Runnable()
+ {
+ public void run()
+ {
+ ButtonDemo app = new ButtonDemo();
+ app.initFrameContent();
+ JFrame frame = new JFrame("ButtonDemo");
+ frame.getContentPane().add(app);
+ frame.pack();
+ frame.setVisible(true);
+ }
+ });
+ }
+
+ /**
+ * Returns a DemoFactory that creates a ButtonDemo.
+ *
+ * @return a DemoFactory that creates a ButtonDemo
+ */
+ public static DemoFactory createDemoFactory()
+ {
+ return new DemoFactory()
+ {
+ public JComponent createDemo()
+ {
+ return new ButtonDemo();
+ }
+ };
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/ComboBoxDemo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/ComboBoxDemo.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/ComboBoxDemo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/ComboBoxDemo.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,386 @@
+/* ComboBoxDemo.java -- An example showing various combo boxes in Swing.
+ Copyright (C) 2005, 2006, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+import javax.swing.plaf.metal.MetalIconFactory;
+
+/**
+ * A simple demo showing various combo boxes in different states.
+ */
+public class ComboBoxDemo
+ extends JPanel
+ implements ActionListener
+{
+
+ class CustomCellRenderer extends DefaultListCellRenderer
+ {
+ public Component getListCellRendererComponent(JList list,
+ Object value,
+ int index,
+ boolean isSelected,
+ boolean cellHasFocus)
+ {
+ DefaultListCellRenderer result = (DefaultListCellRenderer)
+ super.getListCellRendererComponent(list, value, index, isSelected,
+ cellHasFocus);
+ Icon icon = (Icon) value;
+ result.setIcon(icon);
+ result.setText("Index = " + index);
+ return result;
+ }
+ }
+
+ private JCheckBox comboState1;
+ private JComboBox combo1;
+ private JComboBox combo2;
+
+ private JCheckBox comboState2;
+ private JComboBox combo3;
+ private JComboBox combo4;
+
+ private JCheckBox comboState3;
+ private JComboBox combo5;
+ private JComboBox combo6;
+
+ private JCheckBox comboState4;
+ private JComboBox combo7;
+ private JComboBox combo8;
+
+ private JCheckBox comboState5;
+ private JComboBox combo9;
+ private JComboBox combo10;
+
+ private JCheckBox comboState6;
+ private JComboBox combo11;
+ private JComboBox combo12;
+
+ /**
+ * Creates a new demo instance.
+ */
+ public ComboBoxDemo()
+ {
+ super();
+ createContent();
+ }
+
+ /**
+ * When the demo is run independently, the frame is displayed, so we should
+ * initialise the content panel (including the demo content and a close
+ * button). But when the demo is run as part of the Swing activity board,
+ * only the demo content panel is used, the frame itself is never displayed,
+ * so we can avoid this step.
+ */
+ void initFrameContent()
+ {
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ add(closePanel, BorderLayout.SOUTH);
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
+ private void createContent()
+ {
+ setLayout(new BorderLayout());
+ JPanel panel = new JPanel(new GridLayout(6, 1));
+ panel.add(createPanel1());
+ panel.add(createPanel2());
+ panel.add(createPanel3());
+ panel.add(createPanel4());
+ panel.add(createPanel5());
+ panel.add(createPanel6());
+ add(panel);
+ }
+
+ private JPanel createPanel1()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.comboState1 = new JCheckBox("Enabled", true);
+ this.comboState1.setActionCommand("COMBO_STATE1");
+ this.comboState1.addActionListener(this);
+ panel.add(this.comboState1, BorderLayout.EAST);
+
+ JPanel controlPanel = new JPanel();
+ controlPanel.setBorder(BorderFactory.createTitledBorder("Regular: "));
+ this.combo1 = new JComboBox(new Object[] {"Australia", "New Zealand",
+ "England"});
+
+ this.combo2 = new JComboBox(new Object[] {"Australia", "New Zealand",
+ "England"});
+ this.combo2.setEditable(true);
+
+ controlPanel.add(combo1);
+ controlPanel.add(combo2);
+
+ panel.add(controlPanel);
+
+ return panel;
+ }
+
+ private JPanel createPanel2()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.comboState2 = new JCheckBox("Enabled", true);
+ this.comboState2.setActionCommand("COMBO_STATE2");
+ this.comboState2.addActionListener(this);
+ panel.add(this.comboState2, BorderLayout.EAST);
+
+ JPanel controlPanel = new JPanel();
+ controlPanel.setBorder(BorderFactory.createTitledBorder("Large Font: "));
+ this.combo3 = new JComboBox(new Object[] {"Australia", "New Zealand",
+ "England"});
+ this.combo3.setFont(new Font("Dialog", Font.PLAIN, 20));
+
+ this.combo4 = new JComboBox(new Object[] {"Australia", "New Zealand",
+ "England"});
+ this.combo4.setEditable(true);
+ this.combo4.setFont(new Font("Dialog", Font.PLAIN, 20));
+
+ controlPanel.add(combo3);
+ controlPanel.add(combo4);
+
+ panel.add(controlPanel);
+
+ return panel;
+ }
+
+ private JPanel createPanel3()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.comboState3 = new JCheckBox("Enabled", true);
+ this.comboState3.setActionCommand("COMBO_STATE3");
+ this.comboState3.addActionListener(this);
+ panel.add(this.comboState3, BorderLayout.EAST);
+
+ JPanel controlPanel = new JPanel();
+ controlPanel.setBorder(BorderFactory.createTitledBorder("Colored Background: "));
+ this.combo5 = new JComboBox(new Object[] {"Australia", "New Zealand",
+ "England"});
+ this.combo5.setBackground(Color.yellow);
+
+ this.combo6 = new JComboBox(new Object[] {"Australia", "New Zealand",
+ "England"});
+ this.combo6.setEditable(true);
+ this.combo6.setBackground(Color.yellow);
+
+ controlPanel.add(combo5);
+ controlPanel.add(combo6);
+
+ panel.add(controlPanel);
+
+ return panel;
+ }
+
+ /**
+ * This panel contains combo boxes that are empty.
+ *
+ * @return A panel.
+ */
+ private JPanel createPanel4()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.comboState4 = new JCheckBox("Enabled", true);
+ this.comboState4.setActionCommand("COMBO_STATE4");
+ this.comboState4.addActionListener(this);
+ panel.add(this.comboState4, BorderLayout.EAST);
+
+ JPanel controlPanel = new JPanel();
+ controlPanel.setBorder(BorderFactory.createTitledBorder("Empty: "));
+ this.combo7 = new JComboBox();
+ this.combo8 = new JComboBox();
+ this.combo8.setEditable(true);
+
+ controlPanel.add(combo7);
+ controlPanel.add(combo8);
+
+ panel.add(controlPanel);
+
+ return panel;
+ }
+
+ /**
+ * This panel contains combo boxes that are narrow but contain long text
+ * items.
+ *
+ * @return A panel.
+ */
+ private JPanel createPanel5()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.comboState5 = new JCheckBox("Enabled", true);
+ this.comboState5.setActionCommand("COMBO_STATE5");
+ this.comboState5.addActionListener(this);
+ panel.add(this.comboState5, BorderLayout.EAST);
+
+ JPanel controlPanel = new JPanel();
+ controlPanel.setBorder(BorderFactory.createTitledBorder("Narrow: "));
+ this.combo9 = new JComboBox(new Object[] {
+ "A really long item that will be truncated when displayed"});
+ this.combo9.setPreferredSize(new Dimension(100, 30));
+ this.combo10 = new JComboBox(new Object[] {
+ "A really long item that will be truncated when displayed"});
+ this.combo10.setPreferredSize(new Dimension(100, 30));
+ this.combo10.setEditable(true);
+
+ controlPanel.add(combo9);
+ controlPanel.add(combo10);
+
+ panel.add(controlPanel);
+
+ return panel;
+ }
+
+ /**
+ * This panel contains combo boxes with a custom renderer.
+ *
+ * @return A panel.
+ */
+ private JPanel createPanel6()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.comboState6 = new JCheckBox("Enabled", true);
+ this.comboState6.setActionCommand("COMBO_STATE6");
+ this.comboState6.addActionListener(this);
+ panel.add(this.comboState6, BorderLayout.EAST);
+
+ JPanel controlPanel = new JPanel();
+ controlPanel.setBorder(BorderFactory.createTitledBorder("Custom Renderer: "));
+ this.combo11 = new JComboBox(new Object[] {
+ MetalIconFactory.getFileChooserHomeFolderIcon(),
+ MetalIconFactory.getFileChooserNewFolderIcon()});
+ this.combo11.setPreferredSize(new Dimension(100, 30));
+ this.combo11.setRenderer(new CustomCellRenderer());
+ this.combo12 = new JComboBox(new Object[] {
+ MetalIconFactory.getFileChooserHomeFolderIcon(),
+ MetalIconFactory.getFileChooserNewFolderIcon()});
+ this.combo12.setPreferredSize(new Dimension(100, 30));
+ this.combo12.setRenderer(new CustomCellRenderer());
+ this.combo12.setEditable(true);
+
+ controlPanel.add(combo11);
+ controlPanel.add(combo12);
+
+ panel.add(controlPanel);
+
+ return panel;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("COMBO_STATE1"))
+ {
+ combo1.setEnabled(comboState1.isSelected());
+ combo2.setEnabled(comboState1.isSelected());
+ }
+ else if (e.getActionCommand().equals("COMBO_STATE2"))
+ {
+ combo3.setEnabled(comboState2.isSelected());
+ combo4.setEnabled(comboState2.isSelected());
+ }
+ else if (e.getActionCommand().equals("COMBO_STATE3"))
+ {
+ combo5.setEnabled(comboState3.isSelected());
+ combo6.setEnabled(comboState3.isSelected());
+ }
+ else if (e.getActionCommand().equals("COMBO_STATE4"))
+ {
+ combo7.setEnabled(comboState4.isSelected());
+ combo8.setEnabled(comboState4.isSelected());
+ }
+ else if (e.getActionCommand().equals("COMBO_STATE5"))
+ {
+ combo9.setEnabled(comboState5.isSelected());
+ combo10.setEnabled(comboState5.isSelected());
+ }
+ else if (e.getActionCommand().equals("COMBO_STATE6"))
+ {
+ combo11.setEnabled(comboState6.isSelected());
+ combo12.setEnabled(comboState6.isSelected());
+ }
+ else if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ SwingUtilities.invokeLater
+ (new Runnable()
+ {
+ public void run()
+ {
+ ComboBoxDemo app = new ComboBoxDemo();
+ app.initFrameContent();
+ JFrame frame = new JFrame();
+ frame.getContentPane().add(app);
+ frame.pack();
+ frame.setVisible(true);
+ }
+ });
+ }
+
+ /**
+ * Returns a DemoFactory that creates a ComboBoxDemo.
+ *
+ * @return a DemoFactory that creates a ComboBoxDemo
+ */
+ public static DemoFactory createDemoFactory()
+ {
+ return new DemoFactory()
+ {
+ public JComponent createDemo()
+ {
+ return new ComboBoxDemo();
+ }
+ };
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/Demo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/Demo.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/Demo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/Demo.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,711 @@
+/* SwingDemo.java -- An example of using the javax.swing UI.
+ Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+
+package gnu.classpath.examples.swing;
+
+import gnu.classpath.examples.java2d.JNIOverhead;
+
+import java.awt.*;
+import java.awt.event.*;
+
+import javax.swing.*;
+import javax.swing.tree.*;
+
+import javax.swing.plaf.basic.BasicLookAndFeel;
+import javax.swing.plaf.metal.DefaultMetalTheme;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+import javax.swing.plaf.metal.MetalTheme;
+import javax.swing.plaf.metal.OceanTheme;
+
+import java.lang.reflect.Method;
+import java.net.URL;
+
+public class Demo
+{
+ JFrame frame;
+
+ /**
+ * The main desktop. This is package private to avoid synthetic accessor
+ * method.
+ */
+ JDesktopPane desktop;
+
+ /**
+ * The themes menu. This is implemented as a field so that the L&F switcher
+ * can disable the menu when a non-Metal L&F is selected.
+ */
+ JMenu themesMenu;
+
+ static Color blueGray = new Color(0xdc, 0xda, 0xd5);
+
+ private static Icon stockIcon(String s)
+ {
+ return getIcon("/gnu/classpath/examples/icons/stock-" + s + ".png", s);
+ }
+
+ static Icon bigStockIcon(String s)
+ {
+ return getIcon("/gnu/classpath/examples/icons/big-" + s + ".png", s);
+ }
+
+ private static Icon getIcon(String location, String name)
+ {
+ URL url = Demo.class.getResource(location);
+ if (url == null) System.err.println("WARNING " + location + " not found.");
+ return new ImageIcon(url, name);
+ }
+
+ private JMenuBar mkMenuBar()
+ {
+ JMenuBar bar = new JMenuBar();
+
+ JMenu file = new JMenu("File");
+ JMenu edit = new JMenu("Edit");
+ JMenu help = new JMenu("Help");
+
+ file.setMnemonic(KeyEvent.VK_F);
+ edit.setMnemonic(KeyEvent.VK_E);
+ help.setMnemonic(KeyEvent.VK_H);
+
+ file.add(new JMenuItem("New", stockIcon("new")));
+ file.add(new JMenuItem("Open", stockIcon("open")));
+
+ JMenu recent = new JMenu("Recent Files...");
+ recent.add(new JMenuItem("war-and-peace.txt"));
+ recent.add(new JMenuItem("taming-of-shrew.txt"));
+ recent.add(new JMenuItem("sun-also-rises.txt"));
+ file.add(recent);
+ file.add(new JMenuItem("Save", stockIcon("save")));
+ file.add(new JMenuItem("Save as...", stockIcon("save-as")));
+
+ JMenuItem exit = new JMenuItem("Exit", stockIcon("quit"));
+ exit.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ System.exit(1);
+ }
+ });
+
+ file.add(exit);
+
+ edit.add(new JMenuItem("Cut", stockIcon("cut")));
+ edit.add(new JMenuItem("Copy", stockIcon("copy")));
+ edit.add(new JMenuItem("Paste", stockIcon("paste")));
+
+ JMenu preferences = new JMenu("Preferences...");
+ preferences.add(new JCheckBoxMenuItem("Microphone Active",
+ stockIcon("mic")));
+ preferences.add(new JCheckBoxMenuItem("Check Spelling",
+ stockIcon("spell-check")));
+ preferences.add(new JCheckBoxMenuItem("World Peace"));
+ preferences.add(new JSeparator());
+ preferences.add(new JRadioButtonMenuItem("Radio Button"));
+ edit.add(preferences);
+
+ JMenu examples = new JMenu("Examples");
+ examples.add(new JMenuItem(new PopupAction("Buttons",
+ ButtonDemo.createDemoFactory())));
+ examples.add(new JMenuItem(new PopupAction("Slider",
+ SliderDemo.createDemoFactory())));
+ examples.add(new JMenuItem(new PopupAction("ProgressBar",
+ ProgressBarDemo.createDemoFactory())));
+ examples.add(new JMenuItem(new PopupAction("Scrollbar",
+ ScrollBarDemo.createDemoFactory())));
+ examples.add(new JMenuItem(new PopupAction("Spinner",
+ SpinnerDemo.createDemoFactory())));
+ examples.add(new JMenuItem(new PopupAction("TextField",
+ TextFieldDemo.createDemoFactory())));
+ examples.add(new JMenuItem(new PopupAction("TextArea",
+ TextAreaDemo.createDemoFactory())));
+ examples.add(new JMenuItem(new PopupAction("FileChooser",
+ FileChooserDemo.createDemoFactory())));
+
+ examples.add(new JMenuItem(new PopupAction("ComboBox",
+ ComboBoxDemo.createDemoFactory())));
+
+ examples.add(new JMenuItem(new PopupAction("Table",
+ TableDemo.createDemoFactory())));
+ examples.add(new JMenuItem(new PopupAction("List",
+ ListDemo.createDemoFactory())));
+ examples.add(new JMenuItem(new PopupAction("TabbedPane",
+ TabbedPaneDemo.createDemoFactory())));
+ examples.add(new JMenuItem(new PopupAction("Tree",
+ TreeDemo.createDemoFactory())));
+ examples.add(new JMenuItem(new PopupAction("Theme Editor",
+ MetalThemeEditor.createDemoFactory())));
+
+ examples.add(new JMenuItem(new PopupAction("DocumentFilter",
+ DocumentFilterDemo.createDemoFactory())));
+
+ examples.add(new JMenuItem(new PopupAction("NavigationFilter",
+ NavigationFilterDemo.createDemoFactory())));
+ examples.add(new JMenuItem(new PopupAction("JNI Overhead",
+ JNIOverhead.createDemoFactory())));
+
+
+ final JMenuItem vmMenu;
+
+ help.add(new JMenuItem("just play with the widgets"));
+ help.add(new JMenuItem("and enjoy the sensation of"));
+ help.add(new JMenuItem("your neural connections growing"));
+ help.add(new JSeparator());
+ help.add(vmMenu = new JMenuItem("Really, which VM is this running on?"));
+ vmMenu.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent ae)
+ {
+ String message = "This is "
+ + System.getProperty("java.vm.name")
+ + " Version "
+ + System.getProperty("java.vm.version")
+ + " distributed by "
+ + System.getProperty("java.vm.vendor")
+ + ".";
+
+ String gnuClasspath = System.getProperty("gnu.classpath.version");
+ if(gnuClasspath != null)
+ message += "\nThe runtime's libraries are "
+ + "kindly provided by the "
+ + "members of GNU Classpath and are in version "
+ + gnuClasspath + ".";
+
+ JOptionPane.showMessageDialog(vmMenu, message);
+ }
+ });
+
+ // Installs the BasicLookAndFeel.
+ UIManager.installLookAndFeel("(Basic Look And Feel)",
+ InstantiableBasicLookAndFeel.class.getName());
+
+ // Create L&F menu.
+ JMenu lafMenu = new JMenu("Look and Feel");
+ ButtonGroup lafGroup = new ButtonGroup();
+ UIManager.LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels();
+ String currentLaf = UIManager.getLookAndFeel().getClass().getName();
+ for (int i = 0; i < lafs.length; ++i)
+ {
+ UIManager.LookAndFeelInfo laf = lafs[i];
+ ChangeLAFAction action = new ChangeLAFAction(laf);
+ JRadioButtonMenuItem lafItem = new JRadioButtonMenuItem(action);
+ boolean selected = laf.getClassName().equals(currentLaf);
+ lafItem.setSelected(selected);
+ lafMenu.add(lafItem);
+
+ lafGroup.add(lafItem);
+ }
+
+ // Create themes menu.
+ themesMenu = new JMenu("Themes");
+ ButtonGroup themesGroup = new ButtonGroup();
+
+ // In order to make the demo runable on a 1.4 type VM we have to avoid calling
+ // MetalLookAndFeel.getCurrentTheme(). We simply check whether this method exists
+ // and is public.
+ Method m = null;
+ try
+ {
+ m = MetalLookAndFeel.class.getMethod("getCurrentTheme", null);
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ // Ignore it.
+ }
+
+ if (m != null)
+ {
+ JRadioButtonMenuItem ocean =
+ new JRadioButtonMenuItem(new ChangeThemeAction(new OceanTheme()));
+ ocean.setSelected(MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme);
+ themesMenu.add(ocean);
+ themesGroup.add(ocean);
+
+ JRadioButtonMenuItem steel =
+ new JRadioButtonMenuItem(new ChangeThemeAction(new DefaultMetalTheme()));
+ ocean.setSelected(MetalLookAndFeel.getCurrentTheme()
+ instanceof DefaultMetalTheme);
+ themesMenu.add(steel);
+ themesGroup.add(steel);
+ }
+ else
+ {
+ themesMenu.setEnabled(false);
+ }
+
+ bar.add(file);
+ bar.add(edit);
+ bar.add(examples);
+ bar.add(lafMenu);
+ bar.add(themesMenu);
+ bar.add(help);
+ return bar;
+ }
+
+ private static void triggerDialog(final JButton but, final String dir)
+ {
+ but.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ JOptionPane.showConfirmDialog(but,
+ "Sure you want to go " + dir + "?",
+ "Confirm",
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.QUESTION_MESSAGE,
+ bigStockIcon("warning"));
+ }
+ });
+ }
+
+ static JToolBar mkToolBar()
+ {
+ JToolBar bar = new JToolBar();
+
+ JButton b = mkButton(stockIcon("go-back"));
+ triggerDialog(b, "back");
+ bar.add(b);
+
+ b = mkButton(stockIcon("go-down"));
+ triggerDialog(b, "down");
+ bar.add(b);
+
+ b = mkButton(stockIcon("go-forward"));
+ triggerDialog(b, "forward");
+ bar.add(b);
+ return bar;
+ }
+
+ private static String valign2str(int a)
+ {
+ switch (a)
+ {
+ case SwingConstants.CENTER:
+ return "Center";
+ case SwingConstants.TOP:
+ return "Top";
+ case SwingConstants.BOTTOM:
+ return "Bottom";
+ default:
+ return "Unknown";
+ }
+ }
+
+ static String halign2str(int a)
+ {
+ switch (a)
+ {
+ case SwingConstants.CENTER:
+ return "Center";
+ case SwingConstants.RIGHT:
+ return "Right";
+ case SwingConstants.LEFT:
+ return "Left";
+ default:
+ return "Unknown";
+ }
+ }
+
+ private static JButton mkButton(String title, Icon icon,
+ int hAlign, int vAlign,
+ int hPos, int vPos)
+ {
+ JButton b;
+ if (icon == null)
+ b = new JButton(title);
+ else if (title == null)
+ b = new JButton(icon);
+ else
+ b = new JButton(title, icon);
+
+ b.setToolTipText(title);
+ if (hAlign != -1) b.setHorizontalAlignment(hAlign);
+ if (vAlign != -1) b.setVerticalAlignment(vAlign);
+ if (hPos != -1) b.setHorizontalTextPosition(hPos);
+ if (vPos != -1) b.setVerticalTextPosition(vPos);
+ return b;
+ }
+
+ static JButton mkButton(String title)
+ {
+ return mkButton(title, null, -1, -1, -1, -1);
+ }
+
+ static JButton mkButton(Icon i)
+ {
+ return mkButton(null, i, -1, -1, -1, -1);
+ }
+
+
+ private static JScrollPane mkScrollPane(JComponent inner)
+ {
+ JScrollPane jsp;
+ jsp = new JScrollPane(inner,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+
+ return jsp;
+ }
+
+ public Demo()
+ {
+ frame = new JFrame("Swing Activity Board");
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.setJMenuBar(mkMenuBar());
+ JComponent component = (JComponent) frame.getContentPane();
+ component.setLayout(new BorderLayout());
+ component.add(mkToolBar(), BorderLayout.NORTH);
+ JPanel main = new JPanel();
+ main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS));
+ desktop = createDesktop();
+
+ // Put the desktop in a scrollpane. The scrollbars may show then
+ // up when the them or LaF is changed.
+ main.add(new JScrollPane(desktop));
+ main.add(mkButtonBar());
+ component.add(main, BorderLayout.CENTER);
+ frame.pack();
+ frame.show();
+ }
+
+ public static class LaterMain
+ implements Runnable
+ {
+ public void run()
+ {
+ Demo demo = new Demo();
+ }
+ }
+
+ public static void main(String args[])
+ {
+ SwingUtilities.invokeLater(new LaterMain());
+ }
+
+ private static JButton mkBigButton(String title)
+ {
+ JButton b = new JButton(title);
+ b.setMargin(new Insets(5,5,5,5));
+ return b;
+ }
+
+ private static JPanel mkPanel(JComponent[] inners)
+ {
+ JPanel p = new JPanel();
+ for (int i = 0; i < inners.length; ++i)
+ {
+ p.add(inners[i]);
+ }
+ return p;
+ }
+
+ static JButton mkDisposerButton(final JFrame c)
+ {
+ JButton close = mkBigButton("Close");
+ close.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ c.dispose();
+ }
+ });
+ return close;
+ }
+
+ public static JColorChooser mkColorChooser()
+ {
+ return new JColorChooser();
+ }
+
+ /**
+ * This action brings up a new Window with the specified content.
+ */
+ private class PopupAction
+ extends AbstractAction
+ {
+ /**
+ * The component to be shown.
+ */
+ private DemoFactory demoFactory;
+
+ /**
+ * Creates a new PopupAction with the specified name and showing the
+ * component created by the specified DemoFactory when activated.
+ *
+ * @param n the name of the action
+ * @param factory the demo factory
+ */
+ PopupAction(String n, DemoFactory factory)
+ {
+ putValue(NAME, n);
+ demoFactory = factory;
+ }
+
+ /**
+ * Brings up the new window showing the component stored in the
+ * constructor.
+ *
+ * @param e the action event that triggered the action
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ JInternalFrame frame = new JInternalFrame((String) getValue(NAME));
+ frame.setClosable(true);
+ frame.setIconifiable(true);
+ frame.setMaximizable(true);
+ frame.setResizable(true);
+ frame.setContentPane(demoFactory.createDemo());
+ frame.pack();
+ desktop.add(frame);
+ frame.setVisible(true);
+ }
+ }
+
+ /**
+ * Create the tree.
+ *
+ * @return thr scroll pane, containing the tree.
+ */
+ private static JComponent mkTree()
+ {
+ DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root node");
+
+ addChildren("Node", root, 12);
+
+ JTree tree = new JTree(root);
+ tree.setLargeModel(true);
+ DefaultTreeSelectionModel dtsm = new DefaultTreeSelectionModel();
+ dtsm.setSelectionMode(DefaultTreeSelectionModel.SINGLE_TREE_SELECTION);
+ tree.setSelectionModel(dtsm);
+
+ // Make it editable.
+ tree.setEditable(true);
+
+ JComponent t = mkScrollPane(tree);
+ t.setPreferredSize(new Dimension(200,200));
+ return t;
+ }
+
+ /**
+ * Add the specified number of children to this parent node. For each
+ * child, the method is called recursively adding the nChildren-3 number of
+ * grandchildren.
+ *
+ * @param parent the parent node
+ * @param nChildren the number of children
+ */
+ private static void addChildren(String name, DefaultMutableTreeNode parent,
+ int nChildren)
+ {
+ for (int i = 0; i < nChildren; i++)
+ {
+ String child_name = parent+"."+i;
+ DefaultMutableTreeNode child = new DefaultMutableTreeNode
+ (child_name);
+ parent.add(child);
+ addChildren(child_name, child, nChildren-3);
+ }
+ }
+
+ private JPanel mkButtonBar()
+ {
+ JPanel panel = new JPanel(new GridLayout(3, 1, 5, 5));
+ panel.add(new JButton(new PopupAction("Buttons",
+ ButtonDemo.createDemoFactory())));
+ panel.add(new JButton(new PopupAction("Slider",
+ SliderDemo.createDemoFactory())));
+ panel.add(new JButton(new PopupAction("ProgressBar",
+ ProgressBarDemo.createDemoFactory())));
+ panel.add(new JButton(new PopupAction("ScrollBar",
+ ScrollBarDemo.createDemoFactory())));
+ panel.add(new JButton(new PopupAction("Spinner",
+ SpinnerDemo.createDemoFactory())));
+ panel.add(new JButton(new PopupAction("TextField",
+ TextFieldDemo.createDemoFactory())));
+ panel.add(new JButton(new PopupAction("TextArea",
+ TextAreaDemo.createDemoFactory())));
+ panel.add(new JButton(new PopupAction("FileChooser",
+ FileChooserDemo.createDemoFactory())));
+ panel.add(new JButton(new PopupAction("ComboBox",
+ ComboBoxDemo.createDemoFactory())));
+ panel.add(new JButton(new PopupAction("Table",
+ TableDemo.createDemoFactory())));
+ panel.add(new JButton(new PopupAction("List",
+ ListDemo.createDemoFactory())));
+ panel.add(new JButton(new PopupAction("TabbedPane",
+ TabbedPaneDemo.createDemoFactory())));
+ panel.add(new JButton(new PopupAction("Tree",
+ TreeDemo.createDemoFactory())));
+ panel.add(new JButton(new PopupAction("Theme Editor",
+ MetalThemeEditor.createDemoFactory())));
+ panel.add(new JButton(new PopupAction("JNI Overhead",
+ JNIOverhead.createDemoFactory())));
+
+ JButton exitDisposer = mkDisposerButton(frame);
+ panel.add(exitDisposer);
+
+ panel.setMaximumSize(new Dimension(Integer.MAX_VALUE,
+ panel.getPreferredSize().height));
+ exitDisposer.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ System.exit(1);
+ }
+ });
+ return panel;
+ }
+
+ /**
+ * Creates and returns the main desktop.
+ *
+ * @return the main desktop
+ */
+ private JDesktopPane createDesktop()
+ {
+ JDesktopPane d = new DemoDesktop();
+ d.setPreferredSize(new Dimension(900, 500));
+ return d;
+ }
+
+ /**
+ * This Action is used to switch Metal themes.
+ */
+ class ChangeThemeAction extends AbstractAction
+ {
+ /**
+ * The theme to switch to.
+ */
+ MetalTheme theme;
+
+ /**
+ * Creates a new ChangeThemeAction for the specified theme.
+ *
+ * @param t the theme to switch to
+ */
+ ChangeThemeAction(MetalTheme t)
+ {
+ theme = t;
+ putValue(NAME, t.getName());
+ }
+
+ /**
+ * Changes the theme to the one specified in the constructor.
+ *
+ * @param event the action event that triggered this action
+ */
+ public void actionPerformed(ActionEvent event)
+ {
+ MetalLookAndFeel.setCurrentTheme(theme);
+ try
+ {
+ // Only switch theme if we have a metal L&F. It is still necessary
+ // to install a new MetalLookAndFeel instance.
+ if (UIManager.getLookAndFeel() instanceof MetalLookAndFeel)
+ UIManager.setLookAndFeel(new MetalLookAndFeel());
+ }
+ catch (UnsupportedLookAndFeelException ex)
+ {
+ ex.printStackTrace();
+ }
+ SwingUtilities.updateComponentTreeUI(frame);
+ }
+
+ }
+
+ /**
+ * This Action is used to switch Metal themes.
+ */
+ class ChangeLAFAction extends AbstractAction
+ {
+ /**
+ * The theme to switch to.
+ */
+ private UIManager.LookAndFeelInfo laf;
+
+ /**
+ * Creates a new ChangeLAFAction for the specified L&F.
+ *
+ * @param l the L&F to switch to
+ */
+ ChangeLAFAction(UIManager.LookAndFeelInfo l)
+ {
+ laf = l;
+ putValue(NAME, laf.getName());
+ }
+
+ /**
+ * Changes the theme to the one specified in the constructor.
+ *
+ * @param event the action event that triggered this action
+ */
+ public void actionPerformed(ActionEvent event)
+ {
+ try
+ {
+ UIManager.setLookAndFeel(laf.getClassName());
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ SwingUtilities.updateComponentTreeUI(frame);
+ themesMenu.setEnabled(laf.getClassName()
+ .equals("javax.swing.plaf.metal.MetalLookAndFeel"));
+ }
+ }
+
+ /**
+ * An implementation of BasicLookAndFeel which can be instantiated.
+ *
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ *
+ */
+ public static class InstantiableBasicLookAndFeel extends BasicLookAndFeel
+ {
+ public String getDescription()
+ {
+ return "An instantiable implementation of BasicLookAndFeel";
+ }
+
+ public String getID()
+ {
+ return "instantiableBasicLookAndFeel";
+ }
+
+ public String getName()
+ {
+ return "Instantiable Basic Look And Feel";
+ }
+
+ public boolean isNativeLookAndFeel()
+ {
+ return false;
+ }
+
+ public boolean isSupportedLookAndFeel()
+ {
+ return true;
+ }
+ }
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/DemoDesktop.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/DemoDesktop.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/DemoDesktop.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/DemoDesktop.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,82 @@
+/* DemoDesktop.java -- A custom desktop for the demo
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.Graphics;
+
+import javax.swing.ImageIcon;
+import javax.swing.JDesktopPane;
+
+/**
+ * A customized Desktop for the GNU Classpath Swing demo that paints the
+ * GNU Classpath Icon in the middle of the desktop.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public class DemoDesktop
+ extends JDesktopPane
+{
+
+ /**
+ * The icon that's painted centered on the desktop.
+ */
+ private ImageIcon image;
+
+ /**
+ * Creates a new desktop.
+ */
+ DemoDesktop()
+ {
+ super();
+ String badge = "/gnu/classpath/examples/icons/badge.png";
+ image = new ImageIcon(getClass().getResource(badge));
+ }
+
+ /**
+ * Paints the desktop including the icon.
+ *
+ * @param g the graphics to use for painting
+ */
+ protected void paintComponent(Graphics g)
+ {
+ super.paintComponent(g);
+ image.paintIcon(this, g, (getWidth() - image.getIconWidth()) / 2,
+ (getHeight() - image.getIconHeight()) / 2);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/DemoFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/DemoFactory.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/DemoFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/DemoFactory.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,57 @@
+/* DemoFactory.java -- Creates components used as separate Swing demos
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.swing;
+
+import javax.swing.JComponent;
+
+/**
+ * Creates components used in the Swing demo as separate demos.
+ *
+ * @author Roman Kennke (kennke at aicas.de)
+ */
+public interface DemoFactory
+{
+
+ /**
+ * Creates the component that should be as demo application.
+ *
+ * @return the component that should be as demo application
+ */
+ JComponent createDemo();
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/DocumentFilterDemo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/DocumentFilterDemo.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/DocumentFilterDemo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/DocumentFilterDemo.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,289 @@
+/* DpocumentFilterDemo.java -- An example for the DocumentFilter class.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.GridLayout;
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.StringSelection;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.SwingUtilities;
+import javax.swing.text.AbstractDocument;
+import javax.swing.text.AttributeSet;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.DocumentFilter;
+import javax.swing.text.TextAction;
+
+/**
+ * A demonstration of the <code>javax.swing.text.DocumentFilter</code> class.
+ *
+ * <p>Similar to a dialog in a popular programming IDE the user can insert
+ * a CVS URL into a textfield and the filter will split the components apart
+ * and will put them into the right textfields saving the user a lot of
+ * typing time.</p>
+ *
+ * @author Robert Schuster
+ */
+public class DocumentFilterDemo
+ extends JPanel
+ implements ActionListener
+{
+ JTextField target;
+
+ JTextField host;
+ JTextField repositoryPath;
+ JTextField user;
+ JTextField password;
+ JComboBox connectionType;
+
+ /**
+ * Creates a new demo instance.
+ */
+ public DocumentFilterDemo()
+ {
+ createContent();
+ // initFrameContent() is only called (from main) when running this app
+ // standalone
+ }
+
+ /**
+ * When the demo is run independently, the frame is displayed, so we should
+ * initialise the content panel (including the demo content and a close
+ * button). But when the demo is run as part of the Swing activity board,
+ * only the demo content panel is used, the frame itself is never displayed,
+ * so we can avoid this step.
+ */
+ void initFrameContent()
+ {
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ add(closePanel, BorderLayout.SOUTH);
+ }
+
+ private void createContent()
+ {
+ setLayout(new BorderLayout());
+
+ JPanel panel = new JPanel(new GridLayout(7, 2));
+ panel.add(new JLabel("CVS URL:"));
+ panel.add(target = new JTextField(20));
+ target.setBackground(Color.RED);
+
+ panel.add(new JLabel("Host:"));
+ panel.add(host = new JTextField(20));
+
+ panel.add(new JLabel("Repository Path:"));
+ panel.add(repositoryPath = new JTextField(20));
+
+ panel.add(new JLabel("Username:"));
+ panel.add(user = new JTextField(20));
+
+ panel.add(new JLabel("Password:"));
+ panel.add(password = new JTextField(20));
+
+ panel.add(new JLabel("Connection Type:"));
+ panel.add(connectionType = new JComboBox());
+
+ JButton helpButton = new JButton("Help");
+ panel.add(helpButton);
+
+ helpButton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent ae)
+ {
+ JOptionPane.showMessageDialog(DocumentFilterDemo.this,
+ "Paste a CVS URL into the red " +
+ "textfield.\nIf you do not want to " +
+ "look up a CVS URL yourself click " +
+ "on the 'provide me an example' " +
+ "button.\nThis will paste a proper " +
+ "string into your clipboard.");
+ }
+ });
+
+ JButton exampleButton = new JButton("Provide me an example!");
+ panel.add(exampleButton);
+ exampleButton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent ae)
+ {
+ try
+ {
+ Toolkit tk = Toolkit.getDefaultToolkit();
+ Clipboard cb = tk.getSystemSelection();
+ StringSelection selection
+ = new StringSelection(":extssh:gnu at cvs.savannah.gnu.org:" +
+ "/cvs/example/project");
+
+ cb.setContents(selection, selection);
+
+ // Confirm success with a beep.
+ tk.beep();
+ }
+ catch (IllegalStateException ise)
+ {
+ JOptionPane.showMessageDialog(DocumentFilterDemo.this,
+ "Clipboard is currently" +
+ " unavailable.",
+ "Error",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
+ });
+
+ connectionType.addItem("pserver");
+ connectionType.addItem("ext");
+ connectionType.addItem("extssh");
+
+ add(panel);
+
+ AbstractDocument doc = (AbstractDocument) target.getDocument();
+ doc.setDocumentFilter(new CVSFilter());
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("CLOSE"))
+ System.exit(0);
+
+ }
+
+ public static void main(String[] args)
+ {
+ SwingUtilities.invokeLater
+ (new Runnable()
+ {
+ public void run()
+ {
+ DocumentFilterDemo app = new DocumentFilterDemo();
+ app.initFrameContent();
+ JFrame frame = new JFrame("DocumentFilterDemo");
+ frame.getContentPane().add(app);
+ frame.pack();
+ frame.setVisible(true);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ }
+ });
+ }
+
+ /**
+ * Returns a DemoFactory that creates a DocumentFilterDemo.
+ *
+ * @return a DemoFactory that creates a DocumentFilterDemo
+ */
+ public static DemoFactory createDemoFactory()
+ {
+ return new DemoFactory()
+ {
+ public JComponent createDemo()
+ {
+ return new DocumentFilterDemo();
+ }
+ };
+ }
+
+ class CVSFilter extends DocumentFilter
+ {
+ // example: pserver:anonymous at cvs.sourceforge.net:/cvsroot/fmj
+ String cvsPattern = ":?(pserver|ext|extssh):(\\w)+(:(\\w)+)?@(\\w|\\.)+:/(\\w|/)*";
+
+ public void insertString(DocumentFilter.FilterBypass fb,
+ int offset, String string,
+ AttributeSet attr)
+ throws BadLocationException
+ {
+ filterString(fb, offset, 0, string, attr, true);
+ }
+
+ public void replace(DocumentFilter.FilterBypass fb,
+ int offset, int length,
+ String string,
+ AttributeSet attr)
+ throws BadLocationException
+ {
+ filterString(fb, offset, length, string, attr, false);
+ }
+
+ public void filterString(DocumentFilter.FilterBypass fb,
+ int offset, int length, String string,
+ AttributeSet attr, boolean insertion)
+ throws BadLocationException
+ {
+ if(string.matches(cvsPattern))
+ {
+ // Split off the connection type part.
+ String[] result = string.split(":", 2);
+
+ // If the string contained a leading colon, result[0]
+ // will be empty at that point. We simply repeat the split
+ // operation on the remaining string and continue.
+ if(result[0].equals(""))
+ result = result[1].split(":", 2);
+
+ connectionType.setSelectedItem(result[0]);
+
+ // Split off the username and password part
+ result = result[1].split("@", 2);
+
+ // Break username and password in half
+ String[] userCredentials = result[0].split(":");
+ user.setText(userCredentials[0]);
+
+ // If the result has two entries the second one will
+ // be the password.
+ if (userCredentials.length == 2)
+ password.setText(userCredentials[1]);
+
+ // Now break the host part apart.
+ result = result[1].split(":");
+
+ host.setText(result[0]);
+
+ repositoryPath.setText(result[1]);
+ }
+
+ // The unmodified string is put into the document.
+ if (insertion)
+ fb.insertString(offset, string, attr);
+ else
+ fb.replace(offset, length, string, attr);
+ }
+
+ }
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/FileChooserDemo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/FileChooserDemo.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/FileChooserDemo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/FileChooserDemo.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,264 @@
+/* FileChooserDemo.java -- An example showing file choosers in Swing.
+ Copyright (C) 2005, 2006, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+
+import javax.swing.BorderFactory;
+import javax.swing.DefaultListModel;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.SwingUtilities;
+import javax.swing.filechooser.FileFilter;
+
+/**
+ * A simple demo showing the {@link JFileChooser} component used in different
+ * ways.
+ */
+public class FileChooserDemo
+ extends JPanel
+ implements ActionListener
+{
+ /**
+ * A file filter for Java source files.
+ */
+ static class JavaFileFilter extends FileFilter
+ {
+ public String getDescription()
+ {
+ return "Java Source Files (.java)";
+ }
+ public boolean accept(File f)
+ {
+ if (f != null)
+ {
+ return f.getName().endsWith(".java") || f.isDirectory();
+ }
+ else
+ return false;
+ }
+ }
+
+ /** A label to display the selected file. */
+ JLabel selectedFileLabel;
+
+ /**
+ * A list showing the selected files (where multi selections are
+ * allowed).
+ */
+ JList selectedFilesList;
+
+ /** A label to display the return code for the JFileChooser. */
+ JLabel returnCodeLabel;
+
+ /**
+ * Creates a new demo instance.
+ */
+ public FileChooserDemo()
+ {
+ super();
+ createContent();
+ }
+
+ /**
+ * When the demo is run independently, the frame is displayed, so we should
+ * initialise the content panel (including the demo content and a close
+ * button). But when the demo is run as part of the Swing activity board,
+ * only the demo content panel is used, the frame itself is never displayed,
+ * so we can avoid this step.
+ */
+ void initFrameContent()
+ {
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ add(closePanel, BorderLayout.SOUTH);
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
+ private void createContent()
+ {
+ setLayout(new BorderLayout());
+
+ // create a panel of buttons to select the different styles of file
+ // chooser...
+ JPanel buttonPanel = new JPanel(new GridLayout(5, 1));
+ JButton openButton = new JButton("Open...");
+ openButton.setActionCommand("OPEN");
+ openButton.addActionListener(this);
+ buttonPanel.add(openButton);
+ JButton saveButton = new JButton("Save...");
+ saveButton.setActionCommand("SAVE");
+ saveButton.addActionListener(this);
+ buttonPanel.add(saveButton);
+ JButton queryButton = new JButton("Select Directory...");
+ queryButton.setActionCommand("SELECT_DIRECTORY");
+ queryButton.addActionListener(this);
+ buttonPanel.add(queryButton);
+ JButton openJavaButton = new JButton("Open Java file...");
+ openJavaButton.setActionCommand("OPEN_JAVA");
+ openJavaButton.addActionListener(this);
+ buttonPanel.add(openJavaButton);
+ JButton openMultiButton = new JButton("Open multiple files...");
+ openMultiButton.setActionCommand("OPEN_MULTI");
+ openMultiButton.addActionListener(this);
+ buttonPanel.add(openMultiButton);
+ add(buttonPanel, BorderLayout.WEST);
+
+ // create a panel to display the selected file(s) and the return code
+ JPanel displayPanel = new JPanel(new BorderLayout());
+
+ selectedFileLabel = new JLabel("-");
+ selectedFileLabel.setBorder(BorderFactory.createTitledBorder("Selected File/Directory: "));
+ displayPanel.add(selectedFileLabel, BorderLayout.NORTH);
+
+ selectedFilesList = new JList();
+ JScrollPane sp = new JScrollPane(selectedFilesList);
+ sp.setBorder(BorderFactory.createTitledBorder("Selected Files: "));
+ displayPanel.add(sp);
+
+ returnCodeLabel = new JLabel("0");
+ returnCodeLabel.setBorder(BorderFactory.createTitledBorder("Return Code:"));
+ displayPanel.add(returnCodeLabel, BorderLayout.SOUTH);
+
+ add(displayPanel);
+ }
+
+ /**
+ * When the user clicks on a button, launch the appropriate file chooser
+ * and report the results.
+ *
+ * @param e the event.
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ int option = 0;
+ File selectedFile = null;
+ File[] selectedFiles = new File[0];
+
+ if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ else if (e.getActionCommand().equals("OPEN"))
+ {
+ JFileChooser chooser = new JFileChooser();
+ option = chooser.showOpenDialog(this);
+ selectedFile = chooser.getSelectedFile();
+ selectedFiles = chooser.getSelectedFiles();
+ }
+ else if (e.getActionCommand().equals("OPEN_MULTI"))
+ {
+ JFileChooser chooser = new JFileChooser();
+ chooser.setMultiSelectionEnabled(true);
+ option = chooser.showOpenDialog(this);
+ selectedFile = chooser.getSelectedFile();
+ selectedFiles = chooser.getSelectedFiles();
+ }
+ else if (e.getActionCommand().equals("OPEN_JAVA"))
+ {
+ JFileChooser chooser = new JFileChooser();
+ chooser.setAcceptAllFileFilterUsed(false);
+ chooser.setFileFilter(new JavaFileFilter());
+ option = chooser.showOpenDialog(this);
+ selectedFile = chooser.getSelectedFile();
+ selectedFiles = chooser.getSelectedFiles();
+ }
+ else if (e.getActionCommand().equals("SAVE"))
+ {
+ JFileChooser chooser = new JFileChooser();
+ option = chooser.showSaveDialog(this);
+ selectedFile = chooser.getSelectedFile();
+ selectedFiles = chooser.getSelectedFiles();
+ }
+ else if (e.getActionCommand().equals("SELECT_DIRECTORY"))
+ {
+ JFileChooser chooser = new JFileChooser();
+ chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ option = chooser.showDialog(this, "Select");
+ selectedFile = chooser.getSelectedFile();
+ selectedFiles = chooser.getSelectedFiles();
+ }
+
+ // display the selection and return code
+ if (selectedFile != null)
+ selectedFileLabel.setText(selectedFile.toString());
+ else
+ selectedFileLabel.setText("null");
+ DefaultListModel listModel = new DefaultListModel();
+ for (int i = 0; i < selectedFiles.length; i++)
+ listModel.addElement(selectedFiles[i]);
+ selectedFilesList.setModel(listModel);
+ returnCodeLabel.setText(Integer.toString(option));
+ }
+
+ public static void main(String[] args)
+ {
+ SwingUtilities.invokeLater
+ (new Runnable()
+ {
+ public void run()
+ {
+ FileChooserDemo app = new FileChooserDemo();
+ app.initFrameContent();
+ JFrame frame = new JFrame("FileChooser Demo");
+ frame.getContentPane().add(app);
+ frame.pack();
+ frame.setVisible(true);
+ }
+ });
+ }
+
+ /**
+ * Returns a DemoFactory that creates a FileChooserDemo.
+ *
+ * @return a DemoFactory that creates a FileChooserDemo
+ */
+ public static DemoFactory createDemoFactory()
+ {
+ return new DemoFactory()
+ {
+ public JComponent createDemo()
+ {
+ return new FileChooserDemo();
+ }
+ };
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/HtmlDemo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/HtmlDemo.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/HtmlDemo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/HtmlDemo.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,298 @@
+/* HtmlDemo.java -- HTML viewer demo
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextPane;
+import javax.swing.SwingUtilities;
+import javax.swing.text.Element;
+import javax.swing.text.html.HTMLDocument;
+
+/**
+ * Parses and displays HTML content.
+ *
+ * @author Audrius Meskauskas (audriusa at bioinformatics.org)
+ */
+public class HtmlDemo extends JPanel
+{
+
+ JTextPane html = new JTextPane();
+
+ JTextArea text = new JTextArea("<html><body>" +
+ "123456789HR!<hr>987654321"+
+ "123456789BR!<br>987654321"+
+ "<p id='insertHere'>Insertion target</p><p>"+
+ "<font color=red>ma</font>"+
+ "<sup>sup</sup>normal<sub>sub</sub>normal</p><p>Table:"+
+ "<table><tr>a<td>b<td>c<tr>x<td>y<td>z</table></body></html>");
+
+ JPanel buttons;
+
+ int n;
+
+ public HtmlDemo()
+ {
+ super();
+ html.setContentType("text/html"); // not now.
+ createContent();
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel uses a BorderLayout(), and
+ * the BorderLayout.SOUTH area is empty, to allow callers to add controls to
+ * the bottom of the panel if they want to (a close button is added if this
+ * demo is being run as a standalone demo).
+ */
+ private void createContent()
+ {
+ setLayout(new BorderLayout());
+
+ JPanel center = new JPanel();
+ GridLayout layout = new GridLayout();
+ layout.setRows(2);
+ center.setLayout(layout);
+ center.add(new JScrollPane(text));
+ center.add(new JScrollPane(html));
+
+ buttons = new JPanel();
+
+ JButton parse = new JButton("parse");
+ parse.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent event)
+ {
+ String t = text.getText();
+ System.out.println("HtmlDemo.java.createContent:Parsing started");
+ html.setText(t);
+ System.out.println("HtmlDemo.java.createContent:Parsing completed");
+ }
+ });
+
+ buttons.add(parse);
+
+ JButton insertBeforeEnd = new JButton("before end");
+ insertBeforeEnd.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent event)
+ {
+ HTMLDocument doc = (HTMLDocument) html.getDocument();
+ Element el = doc.getElement("insertHere");
+ System.out.println("Element found:"+el);
+ try
+ {
+ doc.insertBeforeEnd(el,"before end "+(n++));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ });
+
+ JButton insertBeforeStart = new JButton("before start");
+ insertBeforeStart.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent event)
+ {
+ HTMLDocument doc = (HTMLDocument) html.getDocument();
+ Element el = doc.getElement("insertHere");
+ System.out.println("Element found:"+el);
+ try
+ {
+ doc.insertBeforeStart(el,"before start "+(n++));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ });
+
+ JButton insertAfterEnd = new JButton("after end");
+ insertAfterEnd.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent event)
+ {
+ HTMLDocument doc = (HTMLDocument) html.getDocument();
+ Element el = doc.getElement("insertHere");
+ System.out.println("Element found:"+el);
+ try
+ {
+ doc.insertAfterEnd(el,"after end "+(n++));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ });
+
+ JButton insertAfterStart = new JButton("after start");
+ insertAfterStart.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent event)
+ {
+ HTMLDocument doc = (HTMLDocument) html.getDocument();
+ Element el = doc.getElement("insertHere");
+ System.out.println("Element found:"+el);
+ try
+ {
+ doc.insertAfterStart(el,"after start "+(n++));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ });
+
+
+ JButton setInner = new JButton("inner");
+ setInner.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent event)
+ {
+ HTMLDocument doc = (HTMLDocument) html.getDocument();
+ Element el = doc.getElement("insertHere");
+ System.out.println("Element found:"+el);
+ try
+ {
+ doc.setInnerHTML(el,"inner "+(n++));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ });
+
+ JButton setOuter = new JButton("outer");
+ setOuter.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent event)
+ {
+ HTMLDocument doc = (HTMLDocument) html.getDocument();
+ Element el = doc.getElement("insertHere");
+ System.out.println("Element found:"+el);
+ try
+ {
+ doc.setOuterHTML(el,"outer "+(n++));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ });
+
+
+ buttons.add(insertBeforeStart);
+ buttons.add(insertAfterStart);
+ buttons.add(insertBeforeEnd);
+ buttons.add(insertAfterEnd);
+
+ buttons.add(setInner);
+ buttons.add(setOuter);
+
+ add(center, BorderLayout.CENTER);
+ add(buttons, BorderLayout.SOUTH);
+ }
+
+ /**
+ * The executable method to display the editable table.
+ *
+ * @param args
+ * unused.
+ */
+ public static void main(String[] args)
+ {
+ SwingUtilities.invokeLater
+ (new Runnable()
+ {
+ public void run()
+ {
+ HtmlDemo demo = new HtmlDemo();
+
+ JButton exit = new JButton("exit");
+ exit.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent event)
+ {
+ System.exit(0);
+ }
+ });
+
+ demo.buttons.add(exit);
+
+ JFrame frame = new JFrame();
+ frame.getContentPane().add(demo);
+ frame.setSize(new Dimension(700, 480));
+ frame.setVisible(true);
+ }
+ });
+ }
+
+ /**
+ * Returns a DemoFactory that creates a HtmlDemo.
+ *
+ * @return a DemoFactory that creates a HtmlDemo
+ */
+ public static DemoFactory createDemoFactory()
+ {
+ return new DemoFactory()
+ {
+ public JComponent createDemo()
+ {
+ return new HtmlDemo();
+ }
+ };
+ }
+}
+
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/ListDemo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/ListDemo.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/ListDemo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/ListDemo.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,231 @@
+/* ListDemo.java -- Demostrates JList
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.DefaultListModel;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+import javax.swing.ListCellRenderer;
+import javax.swing.SwingUtilities;
+
+public class ListDemo
+ extends JPanel
+ implements ActionListener
+{
+
+ private static class LabelCellRenderer
+ extends DefaultListCellRenderer
+ {
+ public Component getListCellRendererComponent(JList list,
+ Object value,
+ int index,
+ boolean isSelected,
+ boolean cellHasFocus)
+ {
+ Component c = super.getListCellRendererComponent(list, value, index,
+ isSelected,
+ cellHasFocus);
+ return c;
+ }
+ }
+
+ private static class CheckCellRenderer
+ extends JCheckBox
+ implements ListCellRenderer
+ {
+ public Component getListCellRendererComponent(JList list,
+ Object value,
+ int index,
+ boolean isSelected,
+ boolean cellHasFocus)
+ {
+ setSelected(isSelected);
+ setText(value.toString());
+
+ return this;
+ }
+ }
+
+ ListDemo()
+ {
+ super();
+ createContent();
+ }
+
+ private void createContent()
+ {
+
+ String foo[] = new String[] {
+ "non alcoholic ",
+ "carbonated ",
+ "malted ",
+ "fresh squeezed ",
+ "imported ",
+ "high fructose ",
+ "enriched "
+ };
+
+ String bar[] = new String[] {
+ "orange juice",
+ "ginger beer",
+ "yak milk",
+ "corn syrup",
+ "herbal remedy"
+ };
+
+ final DefaultListModel mod = new DefaultListModel();
+ final JList list1 = new JList(mod);
+ final JList list2 = new JList(mod);
+
+ list2.setSelectionModel(list1.getSelectionModel());
+ for (int i = 0; i < bar.length; ++i)
+ for (int j = 0; j < foo.length; ++j)
+ mod.addElement(foo[j] + bar[i]);
+
+ list1.setCellRenderer(new LabelCellRenderer());
+ list2.setCellRenderer(new CheckCellRenderer());
+
+ JButton add = new JButton("add element");
+ add.addActionListener(new ActionListener()
+ {
+ int i = 0;
+ public void actionPerformed(ActionEvent e)
+ {
+ mod.addElement("new element " + i);
+ ++i;
+ }
+ });
+
+ JButton del = new JButton("delete selected");
+ del.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ for (int i = 0; i < mod.getSize(); ++i)
+ if (list1.isSelectedIndex(i))
+ mod.remove(i);
+ }
+ });
+
+
+ JSplitPane splitter = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
+ splitter.add(new JScrollPane(list1), JSplitPane.LEFT);
+ splitter.add(new JScrollPane(list2), JSplitPane.RIGHT);
+
+ setLayout(new BorderLayout());
+ JPanel p2 = new JPanel();
+ p2.setLayout(new GridLayout(1, 2));
+ p2.add(add);
+ p2.add(del);
+
+ add(p2, BorderLayout.NORTH);
+ add(splitter, BorderLayout.CENTER);
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ }
+
+ /**
+ * When the demo is run independently, the frame is displayed, so we should
+ * initialise the content panel (including the demo content and a close
+ * button). But when the demo is run as part of the Swing activity board,
+ * only the demo content panel is used, the frame itself is never displayed,
+ * so we can avoid this step.
+ */
+ void initFrameContent()
+ {
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ add(closePanel, BorderLayout.SOUTH);
+ }
+
+ public static void main(String[] args)
+ {
+ SwingUtilities.invokeLater
+ (new Runnable()
+ {
+ public void run()
+ {
+ ListDemo app = new ListDemo();
+ app.initFrameContent();
+ JFrame frame = new JFrame("List Demo");
+ frame.getContentPane().add(app);
+ frame.pack();
+ frame.setVisible(true);
+ }
+ });
+ }
+
+ /**
+ * Returns a DemoFactory that creates a ListDemo.
+ *
+ * @return a DemoFactory that creates a ListDemo
+ */
+ public static DemoFactory createDemoFactory()
+ {
+ return new DemoFactory()
+ {
+ public JComponent createDemo()
+ {
+ return new ListDemo();
+ }
+ };
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/MetalThemeEditor.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/MetalThemeEditor.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/MetalThemeEditor.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/MetalThemeEditor.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,585 @@
+/* MetalThemeEditor.java -- Edit themes using this application
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.swing;
+
+import gnu.javax.swing.plaf.metal.CustomizableTheme;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.Window;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JColorChooser;
+import javax.swing.JComponent;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+
+/**
+ * This application serves two purposes: 1. demonstrate the color chooser
+ * component, 2. make creating new Metal themes as easy as possible.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public class MetalThemeEditor
+ extends JPanel
+{
+ /**
+ * An icon to display a chosen color in a button.
+ */
+ private class ColorIcon implements Icon
+ {
+ /**
+ * The color to be shown on the icon.
+ */
+ Color color;
+
+ /**
+ * Creates a new ColorIcon.
+ *
+ * @param c the color to be displayed
+ */
+ ColorIcon(Color c)
+ {
+ color = c;
+ }
+
+ /**
+ * Returns the icon height, which is 10.
+ *
+ * @return 10
+ */
+ public int getIconHeight()
+ {
+ return 10;
+ }
+
+ /**
+ * Returns the icon width, which is 30.
+ *
+ * @return 30
+ */
+ public int getIconWidth()
+ {
+ return 30;
+ }
+
+ /**
+ * Paints the icon.
+ *
+ * @param c the component to paint on
+ * @param g the graphics to use
+ * @param x the x location
+ * @param y the y location
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ g.setColor(color);
+ g.fillRect(x, y, 30, 10);
+ }
+
+ }
+
+ /**
+ * Opens up a color chooser and lets the user select a color for the theme.
+ */
+ private class ChooseColorAction implements ActionListener
+ {
+
+ /**
+ * The button that will get updated when a new color is selected.
+ */
+ private JButton button;
+
+ /**
+ * Specifies which color of the theme should be updated. See constants in
+ * the MetalThemeEditor class.
+ */
+ private int colorType;
+
+ /**
+ * Creates a new ChooseColorAction. The specified button will have its
+ * icon updated to the new color if appropriate.
+ *
+ * @param b the button to update
+ * @param type the color type to update
+ */
+ ChooseColorAction(JButton b, int type)
+ {
+ button = b;
+ colorType = type;
+ }
+
+ /**
+ * Opens a color chooser and lets the user select a color.
+ */
+ public void actionPerformed(ActionEvent event)
+ {
+ Color c = JColorChooser.showDialog(button, "Choose a color",
+ getColor(colorType));
+ if (c != null)
+ {
+ setColor(colorType, c);
+ button.setIcon(new ColorIcon(c));
+ }
+ }
+ }
+
+ /**
+ * Denotes the primary1 color of the theme.
+ */
+ private static final int PRIMARY1 = 0;
+
+ /**
+ * Denotes the primary2 color of the theme.
+ */
+ private static final int PRIMARY2 = 1;
+
+ /**
+ * Denotes the primary3 color of the theme.
+ */
+ private static final int PRIMARY3 = 2;
+
+ /**
+ * Denotes the secondary1 color of the theme.
+ */
+ private static final int SECONDARY1 = 3;
+
+ /**
+ * Denotes the secondary2 color of the theme.
+ */
+ private static final int SECONDARY2 = 4;
+
+ /**
+ * Denotes the secondary3 color of the theme.
+ */
+ private static final int SECONDARY3 = 5;
+
+ /**
+ * The theme that is edited.
+ */
+ CustomizableTheme theme;
+
+ /**
+ * Creates a new instance of the MetalThemeEditor.
+ */
+ MetalThemeEditor()
+ {
+ theme = new CustomizableTheme();
+ setBorder(BorderFactory.createEmptyBorder(12, 12, 11, 11));
+ setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
+ add(createConfigurationPanel());
+ add(Box.createVerticalStrut(17));
+ add(createButtonPanel());
+ }
+
+ /**
+ * Creates the main panel of the MetalThemeEditor. This is the upper
+ * area where the colors can be selected.
+ *
+ * @return the main panel
+ */
+ private JPanel createConfigurationPanel()
+ {
+ JPanel p = new JPanel();
+ p.setLayout(new GridBagLayout());
+ GridBagConstraints c = new GridBagConstraints();
+ c.weightx = 1;
+ c.weighty = 0;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ Insets labelInsets = new Insets(0, 0, 11, 6);
+ Insets buttonInsets = new Insets(0, 0, 11, 0);
+
+ // Primary 1
+ JLabel primary1Label = new JLabel("Primary 1:");
+ c.gridx = 0;
+ c.gridy = 0;
+ c.insets = labelInsets;
+ p.add(primary1Label, c);
+
+ Icon p1Icon = new ColorIcon(theme.getPrimary1());
+ JButton primary1Button = new JButton(p1Icon);
+ primary1Button.addActionListener(new ChooseColorAction(primary1Button,
+ PRIMARY1));
+ //c.weightx = 0;
+ c.gridx = 1;
+ c.insets = buttonInsets;
+ p.add(primary1Button, c);
+ primary1Label.setLabelFor(primary1Button);
+
+ // Primary 2
+ JLabel primary2Label = new JLabel("Primary 2:");
+ c.gridx = 0;
+ c.gridy = 1;
+ c.insets = labelInsets;
+ p.add(primary2Label, c);
+
+ Icon p2Icon = new ColorIcon(theme.getPrimary2());
+ JButton primary2Button = new JButton(p2Icon);
+ primary2Button.addActionListener(new ChooseColorAction(primary2Button,
+ PRIMARY2));
+ c.gridx = 1;
+ c.insets = buttonInsets;
+ p.add(primary2Button, c);
+ primary2Label.setLabelFor(primary2Button);
+
+ // Primary 3
+ JLabel primary3Label = new JLabel("Primary 3:");
+ c.gridx = 0;
+ c.gridy = 2;
+ c.insets = labelInsets;
+ p.add(primary3Label, c);
+
+ Icon p3Icon = new ColorIcon(theme.getPrimary3());
+ JButton primary3Button = new JButton(p3Icon);
+ primary3Button.addActionListener(new ChooseColorAction(primary3Button,
+ PRIMARY3));
+ c.gridx = 1;
+ c.insets = buttonInsets;
+ p.add(primary3Button, c);
+ primary3Label.setLabelFor(primary3Button);
+
+ // Secondary 1
+ JLabel secondary1Label = new JLabel("Secondary 1:");
+ c.gridx = 0;
+ c.gridy = 3;
+ c.insets = labelInsets;
+ p.add(secondary1Label, c);
+
+ Icon s1Icon = new ColorIcon(theme.getSecondary1());
+ JButton secondary1Button = new JButton(s1Icon);
+ secondary1Button.addActionListener(new ChooseColorAction(secondary1Button,
+ SECONDARY1));
+ c.gridx = 1;
+ c.insets = buttonInsets;
+ p.add(secondary1Button, c);
+ secondary1Label.setLabelFor(secondary1Button);
+
+ // Secondary 2
+ JLabel secondary2Label = new JLabel("Secondary 2:");
+ c.gridx = 0;
+ c.gridy = 4;
+ c.insets = labelInsets;
+ p.add(secondary2Label, c);
+
+ Icon s2Icon = new ColorIcon(theme.getSecondary2());
+ JButton secondary2Button = new JButton(s2Icon);
+ secondary2Button.addActionListener(new ChooseColorAction(secondary2Button,
+ SECONDARY2));
+ c.gridx = 1;
+ c.insets = buttonInsets;
+ p.add(secondary2Button, c);
+ secondary2Label.setLabelFor(secondary2Button);
+
+ // Secondary 3
+ JLabel secondary3Label = new JLabel("Secondary 3:");
+ c.gridx = 0;
+ c.gridy = 5;
+ c.insets = labelInsets;
+ p.add(secondary3Label, c);
+
+ Icon s3Icon = new ColorIcon(theme.getSecondary3());
+ JButton secondary3Button = new JButton(s3Icon);
+ secondary3Button.addActionListener(new ChooseColorAction(secondary3Button,
+ SECONDARY3));
+ c.gridx = 1;
+ c.insets = buttonInsets;
+ p.add(secondary3Button, c);
+ secondary3Label.setLabelFor(secondary3Button);
+
+ return p;
+ }
+
+ /**
+ * Creates the button panel at the bottom of the MetalThemeEditor.
+ *
+ * @return the button panel
+ */
+ private JPanel createButtonPanel()
+ {
+ JPanel p = new JPanel();
+ p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
+ p.add(Box.createHorizontalGlue());
+
+ JButton applyButton = new JButton("Apply");
+ applyButton.addActionListener
+ (new ActionListener()
+ {
+ public void actionPerformed(ActionEvent ev)
+ {
+ try
+ {
+ CustomizableTheme copy = (CustomizableTheme) theme.clone();
+ MetalLookAndFeel.setCurrentTheme(copy);
+ UIManager.setLookAndFeel(new MetalLookAndFeel());
+ Window w = SwingUtilities.getWindowAncestor(MetalThemeEditor.this);
+ SwingUtilities.updateComponentTreeUI(w);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ });
+ p.add(applyButton);
+
+ p.add(Box.createHorizontalStrut(5));
+
+ JButton exportButton = new JButton("Export as Java File");
+ exportButton.addActionListener
+ (new ActionListener()
+ {
+ public void actionPerformed(ActionEvent ev)
+ {
+ export();
+ }
+ });
+ p.add(exportButton);
+
+ return p;
+ }
+
+ /**
+ * Exports the current theme as Java source file. This will prompt the user
+ * to choose a filename.
+ */
+ void export()
+ {
+ JFileChooser chooser = new JFileChooser();
+ int confirm = chooser.showSaveDialog(this);
+ if (confirm == JFileChooser.APPROVE_OPTION)
+ exportToFile(chooser.getSelectedFile());
+ }
+
+ /**
+ * Writes out the current configured Metal theme as Java source file.
+ *
+ * @param file the file to write into
+ */
+ void exportToFile(File file)
+ {
+ String fileName = file.getName();
+ if (! fileName.endsWith(".java"))
+ {
+ JOptionPane.showMessageDialog(this,
+ "Filename does not denote a Java source file",
+ "Invalid filename",
+ JOptionPane.ERROR_MESSAGE);
+ return;
+ }
+
+ String className = fileName.substring(0, fileName.length() - 5);
+ Color p1 = theme.getPrimary1();
+ Color p2 = theme.getPrimary2();
+ Color p3 = theme.getPrimary3();
+ Color s1 = theme.getSecondary1();
+ Color s2 = theme.getSecondary2();
+ Color s3 = theme.getSecondary3();
+
+ try
+ {
+ FileOutputStream out = new FileOutputStream(file);
+ Writer writer = new OutputStreamWriter(out);
+ writer.write("import javax.swing.plaf.ColorUIResource;\n");
+ writer.write("import javax.swing.plaf.metal.DefaultMetalTheme;\n");
+ writer.write("public class " + className + " extends DefaultMetalTheme\n");
+ writer.write("{\n");
+ writer.write(" protected ColorUIResource getPrimary1()\n");
+ writer.write(" {\n");
+ writer.write(" return new ColorUIResource(" + p1.getRGB() + ");\n");
+ writer.write(" }\n");
+ writer.write(" protected ColorUIResource getPrimary2()\n");
+ writer.write(" {\n");
+ writer.write(" return new ColorUIResource(" + p2.getRGB() + ");\n");
+ writer.write(" }\n");
+ writer.write(" protected ColorUIResource getPrimary3()\n");
+ writer.write(" {\n");
+ writer.write(" return new ColorUIResource(" + p3.getRGB() + ");\n");
+ writer.write(" }\n");
+ writer.write(" protected ColorUIResource getSecondary1()\n");
+ writer.write(" {\n");
+ writer.write(" return new ColorUIResource(" + s1.getRGB() + ");\n");
+ writer.write(" }\n");
+ writer.write(" protected ColorUIResource getSecondary2()\n");
+ writer.write(" {\n");
+ writer.write(" return new ColorUIResource(" + s2.getRGB() + ");\n");
+ writer.write(" }\n");
+ writer.write(" protected ColorUIResource getSecondary3()\n");
+ writer.write(" {\n");
+ writer.write(" return new ColorUIResource(" + s3.getRGB() + ");\n");
+ writer.write(" }\n");
+ writer.write("}\n");
+ writer.close();
+ out.close();
+ }
+ catch (FileNotFoundException ex)
+ {
+ ex.printStackTrace();
+ }
+ catch (IOException ex)
+ {
+ ex.printStackTrace();
+ }
+
+ }
+
+ /**
+ * Returns the color of the theme with the specified type. For the possible
+ * types see the constants of this class.
+ *
+ * @param colorType the color type to fetch from the theme
+ *
+ * @return the current color of the specified type
+ *
+ * @throws IllegalArgumentException for illegal color types
+ */
+ Color getColor(int colorType)
+ {
+ Color color = null;
+ switch (colorType)
+ {
+ case PRIMARY1:
+ color = theme.getPrimary1();
+ break;
+ case PRIMARY2:
+ color = theme.getPrimary2();
+ break;
+ case PRIMARY3:
+ color = theme.getPrimary3();
+ break;
+ case SECONDARY1:
+ color = theme.getSecondary1();
+ break;
+ case SECONDARY2:
+ color = theme.getSecondary2();
+ break;
+ case SECONDARY3:
+ color = theme.getSecondary3();
+ break;
+ default:
+ throw new IllegalArgumentException("Unknown color type: " + colorType);
+ }
+ return color;
+ }
+
+ /**
+ * Sets the color of the specified type in the current theme.
+ *
+ * @param colorType the color type
+ * @param color the color to set
+ *
+ * @throws IllegalArgumentException for illegal color types
+ */
+ void setColor(int colorType, Color color)
+ {
+ switch (colorType)
+ {
+ case PRIMARY1:
+ theme.setPrimary1(color);
+ break;
+ case PRIMARY2:
+ theme.setPrimary2(color);
+ break;
+ case PRIMARY3:
+ theme.setPrimary3(color);
+ break;
+ case SECONDARY1:
+ theme.setSecondary1(color);
+ break;
+ case SECONDARY2:
+ theme.setSecondary2(color);
+ break;
+ case SECONDARY3:
+ theme.setSecondary3(color);
+ break;
+ default:
+ throw new IllegalArgumentException("Illegal color type: " + colorType);
+ }
+ }
+
+ /**
+ * The entry point to the application.
+ *
+ * @param args ignored
+ */
+ public static void main(String[] args)
+ {
+ JFrame f = new JFrame("MetalThemeEditor");
+ f.setContentPane(new MetalThemeEditor());
+ f.pack();
+ f.setVisible(true);
+ }
+
+ /**
+ * Returns a DemoFactory that creates a MetalThemeEditor.
+ *
+ * @return a DemoFactory that creates a MetalThemeEditor
+ */
+ public static DemoFactory createDemoFactory()
+ {
+ return new DemoFactory()
+ {
+ public JComponent createDemo()
+ {
+ return new MetalThemeEditor();
+ }
+ };
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/MiniDemo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/MiniDemo.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/MiniDemo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/MiniDemo.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,233 @@
+/* MiniDemo.java -- A Swing demo suitable for embedded environments
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Font;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
+import javax.swing.JTextField;
+import javax.swing.SwingUtilities;
+import javax.swing.plaf.metal.DefaultMetalTheme;
+import javax.swing.plaf.metal.MetalIconFactory;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+
+/**
+ * A Swing demo suitable for embedded environments (e.g. small display,
+ * b/w graphics etc).
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public class MiniDemo extends JFrame
+{
+
+ /**
+ * Creates a new MiniDemo instance.
+ */
+ MiniDemo()
+ {
+ createGUI();
+ }
+
+ private void createGUI()
+ {
+ JTabbedPane tabPane = new JTabbedPane(JTabbedPane.TOP,
+ JTabbedPane.SCROLL_TAB_LAYOUT);
+
+ // Setup scrolling list in first tab.
+ Object[] listData = new Object[]{"Milk", "Beer", "Wine", "Water",
+ "Orange juice", "Tea", "Coffee", "Whiskey",
+ "Lemonade", "Apple juice", "Gin Tonic",
+ "Pangalactic Garleblaster", "Coke"};
+ JList list = new JList(listData);
+ JScrollPane sp = new JScrollPane(list);
+ tabPane.addTab("List", sp);
+
+ // Setup some buttons in the second tab.
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setLayout(new GridLayout(4, 1));
+ // JButtons
+ JPanel jButtonPanel = new JPanel();
+ jButtonPanel.setLayout(new BorderLayout());
+ final JCheckBox buttonState1 = new JCheckBox("Enabled", true);
+ jButtonPanel.add(buttonState1, BorderLayout.EAST);
+ JPanel jButtonContainer = new JPanel();
+ final JButton jButton1 = new JButton("JButton");
+ final JButton jButton2 =
+ new JButton(MetalIconFactory.getInternalFrameDefaultMenuIcon());
+ jButtonContainer.add(jButton1);
+ jButtonContainer.add(jButton2);
+ jButtonPanel.add(jButtonContainer, BorderLayout.CENTER);
+ buttonState1.addActionListener(
+ new ActionListener()
+ {
+ public void actionPerformed(ActionEvent ev)
+ {
+ boolean enabled = buttonState1.isSelected();
+ jButton1.setEnabled(enabled);
+ jButton2.setEnabled(enabled);
+ }
+ });
+ buttonPanel.add(jButtonPanel);
+ // JToggleButtons
+ JPanel jToggleButtonPanel = new JPanel();
+ jToggleButtonPanel.setLayout(new BorderLayout());
+ final JCheckBox buttonState2 = new JCheckBox("Enabled", true);
+ jToggleButtonPanel.add(buttonState2, BorderLayout.EAST);
+ JPanel jToggleButtonContainer = new JPanel();
+ final JButton jToggleButton1 = new JButton("JToggleButton");
+ final JButton jToggleButton2 =
+ new JButton(MetalIconFactory.getInternalFrameDefaultMenuIcon());
+ jToggleButtonContainer.add(jToggleButton1);
+ jToggleButtonContainer.add(jToggleButton2);
+ jToggleButtonPanel.add(jToggleButtonContainer, BorderLayout.CENTER);
+ buttonState2.addActionListener(
+ new ActionListener()
+ {
+ public void actionPerformed(ActionEvent ev)
+ {
+ boolean enabled = buttonState2.isSelected();
+ jToggleButton1.setEnabled(enabled);
+ jToggleButton2.setEnabled(enabled);
+ }
+ });
+ buttonPanel.add(jToggleButtonPanel);
+ tabPane.addTab("Buttons", buttonPanel);
+
+ // ComboBoxes
+ JPanel comboBoxPanel = new JPanel();
+ JComboBox comboBox = new JComboBox(listData);
+ comboBoxPanel.add(comboBox);
+ tabPane.add("ComboBox", comboBoxPanel);
+
+ // TextFields
+ JPanel textFieldPanel = new JPanel();
+ textFieldPanel.setLayout(new BoxLayout(textFieldPanel, BoxLayout.Y_AXIS));
+ textFieldPanel.add(Box.createVerticalStrut(70));
+ JPanel leftAlignedPanel = new JPanel(new BorderLayout());
+ JPanel textFieldPanel1 = new JPanel();
+ textFieldPanel1.setLayout(new BoxLayout(textFieldPanel1,
+ BoxLayout.X_AXIS));
+ final JTextField textfield1 = new JTextField("Hello World!");
+ textfield1.setHorizontalAlignment(JTextField.LEFT);
+ textfield1.setFont(new Font("Dialog", Font.PLAIN, 8));
+ textFieldPanel1.add(textfield1);
+ final JTextField textfield2 = new JTextField("Hello World!");
+ textfield2.setHorizontalAlignment(JTextField.LEFT);
+ textfield2.setFont(new Font("Dialog", Font.ITALIC, 12));
+ textFieldPanel1.add(textfield2);
+ final JTextField textfield3 = new JTextField("Hello World!");
+ textfield3.setHorizontalAlignment(JTextField.LEFT);
+ textfield3.setFont(new Font("Dialog", Font.BOLD, 14));
+ textFieldPanel1.add(textfield3);
+ leftAlignedPanel.add(textFieldPanel1);
+ JPanel statePanel = new JPanel();
+ statePanel.setLayout(new BoxLayout(statePanel, BoxLayout.Y_AXIS));
+ statePanel.add(Box.createVerticalGlue());
+ final JCheckBox enabled1 = new JCheckBox("enabled");
+ enabled1.setSelected(true);
+ enabled1.addActionListener(
+ new ActionListener()
+ {
+ public void actionPerformed(ActionEvent ev)
+ {
+ boolean enabled = enabled1.isSelected();
+ textfield1.setEnabled(enabled);
+ textfield2.setEnabled(enabled);
+ textfield3.setEnabled(enabled);
+ }
+ });
+ statePanel.add(enabled1);
+ final JCheckBox editable1 = new JCheckBox("editable");
+ editable1.setSelected(true);
+ editable1.addActionListener(
+ new ActionListener()
+ {
+ public void actionPerformed(ActionEvent ev)
+ {
+ boolean editable = editable1.isSelected();
+ textfield1.setEditable(editable);
+ textfield2.setEditable(editable);
+ textfield3.setEditable(editable);
+ }
+ });
+ statePanel.add(editable1);
+ statePanel.add(Box.createVerticalGlue());
+ leftAlignedPanel.add(statePanel, BorderLayout.EAST);
+ textFieldPanel.add(leftAlignedPanel);
+ System.err.println(leftAlignedPanel.getPreferredSize());
+ textFieldPanel.add(Box.createVerticalStrut(70));
+ //panel.add(rightAlignedPanel);
+ tabPane.add("TextField", textFieldPanel);
+ setContentPane(tabPane);
+ }
+
+ /**
+ * Starts the demo application.
+ *
+ * @param args the command line arguments (ignored)
+ */
+ public static void main(String[] args)
+ {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run()
+ {
+ MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
+ MiniDemo demo = new MiniDemo();
+ demo.setSize(320, 200);
+ demo.setUndecorated(true);
+ demo.setVisible(true);
+ demo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ }
+ });
+ }
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/NavigationFilterDemo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/NavigationFilterDemo.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/NavigationFilterDemo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/NavigationFilterDemo.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,205 @@
+/* NavigationFilterDemo.java -- An example for the NavigationFilter class.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Point;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.JTextComponent;
+import javax.swing.text.NavigationFilter;
+import javax.swing.text.Position;
+import javax.swing.text.Utilities;
+
+/**
+ * A demonstration of the <code>javax.swing.text.NavigationFilter</code> class.
+ *
+ * <p>It shows a NavigationFilter which lets you walk word-wise
+ * through a text.</p>
+ *
+ * @author Robert Schuster
+ */
+public class NavigationFilterDemo
+ extends JPanel
+ implements ActionListener
+{
+
+ JTextArea textArea;
+
+ /**
+ * Creates a new demo instance.
+ */
+ public NavigationFilterDemo()
+ {
+ createContent();
+ // initFrameContent() is only called (from main) when running this app
+ // standalone
+ }
+
+ /**
+ * When the demo is run independently, the frame is displayed, so we should
+ * initialise the content panel (including the demo content and a close
+ * button). But when the demo is run as part of the Swing activity board,
+ * only the demo content panel is used, the frame itself is never displayed,
+ * so we can avoid this step.
+ */
+ void initFrameContent()
+ {
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ add(closePanel, BorderLayout.SOUTH);
+ }
+
+ private void createContent()
+ {
+ setLayout(new BorderLayout());
+
+ add(textArea = new JTextArea(10, 20));
+
+ textArea.setWrapStyleWord(true);
+
+ textArea.setLineWrap(true);
+
+ textArea.setNavigationFilter(new WordFilter());
+
+ textArea.setText("GNU Classpath, Essential Libraries for Java, " +
+ "is a GNU project to create free core class " +
+ "libraries for use with virtual machines and " +
+ "compilers for the java programming language.");
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("CLOSE"))
+ System.exit(0);
+
+ }
+
+ public static void main(String[] args)
+ {
+ SwingUtilities.invokeLater
+ (new Runnable()
+ {
+ public void run()
+ {
+ NavigationFilterDemo app = new NavigationFilterDemo();
+ app.initFrameContent();
+ JFrame frame = new JFrame("NavigationFilterDemo");
+ frame.getContentPane().add(app);
+ frame.pack();
+ frame.setVisible(true);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ }
+ });
+ }
+
+ /**
+ * Returns a DemoFactory that creates a NavigationFilterDemo.
+ *
+ * @return a DemoFactory that creates a NavigationFilterDemo
+ */
+ public static DemoFactory createDemoFactory()
+ {
+ return new DemoFactory()
+ {
+ public JComponent createDemo()
+ {
+ return new NavigationFilterDemo();
+ }
+ };
+ }
+
+ class WordFilter extends NavigationFilter
+ {
+ public int getNextVisualPositionFrom(JTextComponent text,
+ int pos,
+ Position.Bias bias,
+ int direction,
+ Position.Bias[] biasRet)
+ throws BadLocationException
+ {
+ Point pt;
+
+ int newpos = pos;
+ switch (direction)
+ {
+ case SwingConstants.NORTH:
+ // Find out where the caret want to be positioned ideally.
+ pt = text.getCaret().getMagicCaretPosition();
+
+ // Calculate its position above.
+ newpos = Utilities.getPositionAbove(text, pos, (pt != null) ? pt.x : 0);
+
+ // If we have a valid position, then calculate the next word start
+ // from there.
+ if (newpos != -1)
+ return Utilities.getWordStart(text, newpos);
+ else
+ return pos;
+ case SwingConstants.SOUTH:
+ // Find out where the caret want to be positioned ideally.
+ pt = text.getCaret().getMagicCaretPosition();
+
+ // Calculate its position below.
+ newpos = Utilities.getPositionBelow(text, pos, (pt != null) ? pt.x : 0);
+
+ // If we have a valid position, then calculate the next word start
+ // from there.
+ if (newpos != -1)
+ return Utilities.getWordStart(text, newpos);
+ else
+ return pos;
+ case SwingConstants.WEST:
+ // Calculate the next word start.
+ newpos = Utilities.getWordStart(text, newpos);;
+
+ // If that means that the caret will not move, return
+ // the start of the previous word.
+ if (newpos != pos)
+ return newpos;
+ else
+ return Utilities.getPreviousWord(text, newpos);
+ case SwingConstants.EAST:
+ return Utilities.getNextWord(text, newpos);
+ default:
+ // Do whatever the super implementation did.
+ return super.getNextVisualPositionFrom(text, pos, bias,
+ direction, biasRet);
+ }
+ }
+
+ }
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/ProgressBarDemo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/ProgressBarDemo.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/ProgressBarDemo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/ProgressBarDemo.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,239 @@
+/* ProgressBarDemo.java -- A demonstration of JProgressBars
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JProgressBar;
+import javax.swing.JSlider;
+import javax.swing.SwingUtilities;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+public class ProgressBarDemo
+ extends JPanel
+ implements ActionListener
+{
+
+ /**
+ * Creates a new ProgressBarDemo window with the specified title.
+ */
+ ProgressBarDemo()
+ {
+ super();
+ createContent();
+ }
+
+ void initFrameContent()
+ {
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ add(closePanel);
+ }
+
+ private void createContent()
+ {
+ setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
+ JPanel horizontalProgressBar = createHorizontalProgressBar();
+ add(horizontalProgressBar);
+ add(Box.createVerticalStrut(10));
+ JPanel verticalProgressBar = createVerticalProgressBar();
+ add(verticalProgressBar);
+ }
+
+ private static JPanel createHorizontalProgressBar()
+ {
+ JPanel panel = new JPanel();
+ panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
+
+ // Plain progress bar.
+ final JProgressBar hor1 = new JProgressBar(JProgressBar.HORIZONTAL, 0, 100);
+ panel.add(hor1);
+ final JSlider slider1 = new JSlider(JSlider.HORIZONTAL, 0, 100, 0);
+ slider1.addChangeListener(new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent event)
+ {
+ hor1.setValue(slider1.getValue());
+ }
+ });
+ panel.add(slider1);
+
+ panel.add(Box.createVerticalStrut(5));
+
+ // Plain progress bar with some text.
+ final JProgressBar hor2 = new JProgressBar(JProgressBar.HORIZONTAL, 0, 100);
+ hor2.setString("ProgressBar Demo");
+ hor2.setStringPainted(true);
+ panel.add(hor2);
+ final JSlider slider2 = new JSlider(JSlider.HORIZONTAL, 0, 100, 0);
+ slider2.addChangeListener(new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent event)
+ {
+ hor2.setValue(slider2.getValue());
+ }
+ });
+ panel.add(slider2);
+
+ panel.add(Box.createVerticalStrut(5));
+
+ // Indeterminate progress bar.
+ final JProgressBar hor3 = new JProgressBar(JProgressBar.HORIZONTAL, 0, 100);
+ hor3.setIndeterminate(true);
+ panel.add(hor3);
+
+ panel.add(Box.createVerticalStrut(5));
+
+ // Indeterminate progress bar with text.
+ final JProgressBar hor4 = new JProgressBar(JProgressBar.HORIZONTAL, 0, 100);
+ hor4.setIndeterminate(true);
+ hor4.setString("Indeterminate ProgressBar");
+ hor4.setStringPainted(true);
+ panel.add(hor4);
+
+ return panel;
+ }
+
+ private static JPanel createVerticalProgressBar()
+ {
+ JPanel panel = new JPanel();
+ panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
+ final JProgressBar vert = new JProgressBar(JProgressBar.VERTICAL, 0, 100);
+ panel.add(vert);
+ final JSlider slider = new JSlider(JSlider.VERTICAL, 0, 100, 0);
+ slider.addChangeListener(new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent event)
+ {
+ vert.setValue(slider.getValue());
+ }
+ });
+ panel.add(slider);
+
+ panel.add(Box.createHorizontalStrut(5));
+
+ final JProgressBar vert2 = new JProgressBar(JProgressBar.VERTICAL, 0, 100);
+ vert2.setString("ProgressBar Demo");
+ panel.add(vert2);
+ vert2.setStringPainted(true);
+ final JSlider slider2 = new JSlider(JSlider.VERTICAL, 0, 100, 0);
+ slider2.addChangeListener(new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent event)
+ {
+ vert2.setValue(slider2.getValue());
+ }
+ });
+ panel.add(slider2);
+
+ panel.add(Box.createHorizontalStrut(5));
+
+ // Indeterminate progress bar.
+ final JProgressBar vert3 = new JProgressBar(JProgressBar.VERTICAL, 0, 100);
+ vert3.setIndeterminate(true);
+ panel.add(vert3);
+
+ panel.add(Box.createHorizontalStrut(5));
+
+ // Indeterminate progress bar with text.
+ final JProgressBar vert4 = new JProgressBar(JProgressBar.VERTICAL, 0, 100);
+ vert4.setIndeterminate(true);
+ vert4.setString("Indeterminate ProgressBar");
+ vert4.setStringPainted(true);
+ panel.add(vert4);
+ return panel;
+ }
+
+ public void actionPerformed(ActionEvent event)
+ {
+ if (event.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ }
+
+ /**
+ * The entry point when running as a standalone program.
+ *
+ * @param args command line arguments
+ */
+ public static void main(String[] args)
+ {
+ SwingUtilities.invokeLater(
+ new Runnable()
+ {
+ public void run()
+ {
+ ProgressBarDemo app = new ProgressBarDemo();
+ app.initFrameContent();
+ JFrame frame = new JFrame("ProgressBar Demo");
+ frame.getContentPane().add(app);
+ frame.pack();
+ frame.setVisible(true);
+ }
+ });
+ }
+
+ /**
+ * Returns a DemoFactory that creates a ProgressBarDemo.
+ *
+ * @return a DemoFactory that creates a ProgressBarDemo
+ */
+ public static DemoFactory createDemoFactory()
+ {
+ return new DemoFactory()
+ {
+ public JComponent createDemo()
+ {
+ return new ProgressBarDemo();
+ }
+ };
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/ScrollBarDemo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/ScrollBarDemo.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/ScrollBarDemo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/ScrollBarDemo.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,174 @@
+/* ScrollBarDemo.java -- An example showing scroll bars in Swing.
+ Copyright (C) 2005, 2006, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollBar;
+import javax.swing.SwingUtilities;
+
+/**
+ * A simple scroll bar demo showing various scroll bars in different states.
+ */
+public class ScrollBarDemo
+ extends JPanel
+ implements ActionListener
+{
+
+ /**
+ * Creates a new demo instance.
+ */
+ public ScrollBarDemo()
+ {
+ super();
+ createContent();
+ }
+
+ /**
+ * When the demo is run independently, the frame is displayed, so we should
+ * initialise the content panel (including the demo content and a close
+ * button). But when the demo is run as part of the Swing activity board,
+ * only the demo content panel is used, the frame itself is never displayed,
+ * so we can avoid this step.
+ */
+ void initFrameContent()
+ {
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ add(closePanel, BorderLayout.SOUTH);
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
+ private void createContent()
+ {
+ setLayout(new BorderLayout());
+ JPanel panel = createScrollBarPanel();
+ add(panel);
+ }
+
+ private JPanel createScrollBarPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+
+ JPanel horizontalPanel = new JPanel();
+
+ JScrollBar scroll1a = new JScrollBar(JScrollBar.HORIZONTAL);
+ JScrollBar scroll1b = new JScrollBar(JScrollBar.HORIZONTAL);
+ scroll1b.setEnabled(false);
+ JScrollBar scroll1c = new JScrollBar(JScrollBar.HORIZONTAL);
+ scroll1c.putClientProperty("JScrollBar.isFreeStanding", Boolean.FALSE);
+ JScrollBar scroll1d = new JScrollBar(JScrollBar.HORIZONTAL);
+ scroll1d.putClientProperty("JScrollBar.isFreeStanding", Boolean.FALSE);
+ scroll1d.setEnabled(false);
+ horizontalPanel.add(scroll1a);
+ horizontalPanel.add(scroll1b);
+ horizontalPanel.add(scroll1c);
+ horizontalPanel.add(scroll1d);
+
+ panel.add(horizontalPanel, BorderLayout.NORTH);
+
+ JPanel verticalPanel = new JPanel();
+ verticalPanel.setLayout(new GridLayout(1, 7));
+
+ JScrollBar scroll2a = new JScrollBar(JScrollBar.VERTICAL);
+ JScrollBar scroll2b = new JScrollBar(JScrollBar.VERTICAL);
+ scroll2b.setEnabled(false);
+ JScrollBar scroll2c = new JScrollBar(JScrollBar.VERTICAL);
+ scroll2c.putClientProperty("JScrollBar.isFreeStanding", Boolean.FALSE);
+ JScrollBar scroll2d = new JScrollBar(JScrollBar.VERTICAL);
+ scroll2d.setEnabled(false);
+ scroll2d.putClientProperty("JScrollBar.isFreeStanding", Boolean.FALSE);
+
+ verticalPanel.add(scroll2a);
+ verticalPanel.add(new JPanel());
+ verticalPanel.add(scroll2b);
+ verticalPanel.add(new JPanel());
+ verticalPanel.add(scroll2c);
+ verticalPanel.add(new JPanel());
+ verticalPanel.add(scroll2d);
+
+ panel.add(verticalPanel, BorderLayout.EAST);
+
+ JPanel centerPanel = new JPanel(new GridLayout(1, 2));
+ centerPanel.add(new JScrollBar(JScrollBar.HORIZONTAL));
+ centerPanel.add(new JScrollBar(JScrollBar.VERTICAL));
+ panel.add(centerPanel);
+ return panel;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ SwingUtilities.invokeLater
+ (new Runnable()
+ {
+ public void run()
+ {
+ ScrollBarDemo app = new ScrollBarDemo();
+ app.initFrameContent();
+ JFrame frame = new JFrame("ScrollBar Demo");
+ frame.getContentPane().add(app);
+ frame.pack();
+ frame.setVisible(true);
+ }});
+ }
+
+ /**
+ * Returns a DemoFactory that creates a ScrollBarDemo.
+ *
+ * @return a DemoFactory that creates a ScrollBarDemo
+ */
+ public static DemoFactory createDemoFactory()
+ {
+ return new DemoFactory()
+ {
+ public JComponent createDemo()
+ {
+ return new ScrollBarDemo();
+ }
+ };
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/SliderDemo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/SliderDemo.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/SliderDemo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/SliderDemo.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,287 @@
+/* SliderDemo.java -- An example showing JSlider in various configurations.
+ Copyright (C) 2005, 2006, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JSlider;
+import javax.swing.SwingUtilities;
+
+public class SliderDemo
+ extends JPanel
+ implements ActionListener
+{
+
+ JSlider hslider1;
+ JSlider hslider2;
+ JSlider hslider3;
+ JSlider hslider4;
+ JSlider hslider5;
+ JSlider hslider6;
+ JSlider hslider7;
+ JSlider hslider8;
+
+ JSlider vslider1;
+ JSlider vslider2;
+ JSlider vslider3;
+ JSlider vslider4;
+ JSlider vslider5;
+ JSlider vslider6;
+ JSlider vslider7;
+ JSlider vslider8;
+
+ JCheckBox enabledCheckBox;
+
+ public SliderDemo()
+ {
+ createContent();
+ }
+
+ /**
+ * When the demo is run independently, the frame is displayed, so we should
+ * initialise the content panel (including the demo content and a close
+ * button). But when the demo is run as part of the Swing activity board,
+ * only the demo content panel is used, the frame itself is never displayed,
+ * so we can avoid this step.
+ */
+ void initFrameContent()
+ {
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ add(closePanel, BorderLayout.SOUTH);
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
+ private void createContent()
+ {
+ setLayout(new BorderLayout());
+ JPanel panel = new JPanel(new GridLayout(1, 2));
+ panel.add(createHorizontalPanel());
+ panel.add(createVerticalPanel());
+ enabledCheckBox = new JCheckBox("Enabled");
+ enabledCheckBox.setSelected(true);
+ enabledCheckBox.setActionCommand("TOGGLE_ENABLED");
+ enabledCheckBox.addActionListener(this);
+ JPanel checkBoxPanel = new JPanel();
+ checkBoxPanel.add(enabledCheckBox);
+ JPanel panel2 = new JPanel(new BorderLayout());
+ panel2.add(panel);
+ panel2.add(checkBoxPanel, BorderLayout.SOUTH);
+ add(panel2);
+ }
+
+ private JPanel createHorizontalPanel()
+ {
+ JPanel panel = new JPanel(new GridLayout(8, 1));
+
+ hslider1 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ panel.add(hslider1);
+
+ hslider2 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ hslider2.setMajorTickSpacing(20);
+ hslider2.setMinorTickSpacing(5);
+ hslider2.setPaintTicks(true);
+ panel.add(hslider2);
+
+ hslider3 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ hslider3.setMajorTickSpacing(20);
+ hslider3.setMinorTickSpacing(5);
+ hslider3.setPaintLabels(true);
+ hslider3.setPaintTicks(true);
+ panel.add(hslider3);
+
+ hslider4 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ hslider4.putClientProperty("JSlider.isFilled", Boolean.TRUE);
+ hslider4.setMajorTickSpacing(20);
+ hslider4.setMinorTickSpacing(5);
+ hslider4.setPaintLabels(true);
+ hslider4.setPaintTicks(true);
+ panel.add(hslider4);
+
+ hslider5 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ hslider5.setInverted(true);
+ panel.add(hslider5);
+
+ hslider6 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ hslider6.setInverted(true);
+ hslider6.setMajorTickSpacing(20);
+ hslider6.setMinorTickSpacing(5);
+ hslider6.setPaintTicks(true);
+ panel.add(hslider6);
+
+ hslider7 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ hslider7.setInverted(true);
+ hslider7.setMajorTickSpacing(20);
+ hslider7.setMinorTickSpacing(5);
+ hslider7.setPaintLabels(true);
+ hslider7.setPaintTicks(true);
+ panel.add(hslider7);
+
+ hslider8 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ hslider8.putClientProperty("JSlider.isFilled", Boolean.TRUE);
+ hslider8.setInverted(true);
+ hslider8.setMajorTickSpacing(20);
+ hslider8.setMinorTickSpacing(5);
+ hslider8.setPaintLabels(true);
+ hslider8.setPaintTicks(true);
+ panel.add(hslider8);
+
+ return panel;
+ }
+
+ private JPanel createVerticalPanel()
+ {
+ JPanel panel = new JPanel(new GridLayout(1, 8));
+
+ vslider1 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ panel.add(vslider1);
+
+ vslider2 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ vslider2.setMajorTickSpacing(20);
+ vslider2.setMinorTickSpacing(5);
+ vslider2.setPaintTicks(true);
+ panel.add(vslider2);
+
+ vslider3 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ vslider3.setMajorTickSpacing(20);
+ vslider3.setMinorTickSpacing(5);
+ vslider3.setPaintLabels(true);
+ vslider3.setPaintTicks(true);
+ panel.add(vslider3);
+
+ vslider4 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ vslider4.putClientProperty("JSlider.isFilled", Boolean.TRUE);
+ vslider4.setMajorTickSpacing(20);
+ vslider4.setMinorTickSpacing(5);
+ vslider4.setPaintLabels(true);
+ vslider4.setPaintTicks(true);
+ panel.add(vslider4);
+
+ vslider5 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ vslider5.setInverted(true);
+ panel.add(vslider5);
+
+ vslider6 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ vslider6.setInverted(true);
+ vslider6.setMajorTickSpacing(20);
+ vslider6.setMinorTickSpacing(5);
+ vslider6.setPaintTicks(true);
+ panel.add(vslider6);
+
+ vslider7 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ vslider7.setInverted(true);
+ vslider7.setMajorTickSpacing(20);
+ vslider7.setMinorTickSpacing(5);
+ vslider7.setPaintLabels(true);
+ vslider7.setPaintTicks(true);
+ panel.add(vslider7);
+
+ vslider8 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ vslider8.putClientProperty("JSlider.isFilled", Boolean.TRUE);
+ vslider8.setInverted(true);
+ vslider8.setMajorTickSpacing(20);
+ vslider8.setMinorTickSpacing(5);
+ vslider8.setPaintLabels(true);
+ vslider8.setPaintTicks(true);
+ panel.add(vslider8);
+ return panel;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ else if (e.getActionCommand().equals("TOGGLE_ENABLED"))
+ {
+ boolean enabled = enabledCheckBox.isSelected();
+ hslider1.setEnabled(enabled);
+ hslider2.setEnabled(enabled);
+ hslider3.setEnabled(enabled);
+ hslider4.setEnabled(enabled);
+ hslider5.setEnabled(enabled);
+ hslider6.setEnabled(enabled);
+ hslider7.setEnabled(enabled);
+ hslider8.setEnabled(enabled);
+ vslider1.setEnabled(enabled);
+ vslider2.setEnabled(enabled);
+ vslider3.setEnabled(enabled);
+ vslider4.setEnabled(enabled);
+ vslider5.setEnabled(enabled);
+ vslider6.setEnabled(enabled);
+ vslider7.setEnabled(enabled);
+ vslider8.setEnabled(enabled);
+ }
+ }
+ public static void main(String[] args)
+ {
+ SwingUtilities.invokeLater
+ (new Runnable()
+ {
+ public void run()
+ {
+ SliderDemo app = new SliderDemo();
+ app.initFrameContent();
+ JFrame frame = new JFrame("Slider Demo");
+ frame.getContentPane().add(app);
+ frame.pack();
+ frame.setVisible(true);
+ }
+ });
+ }
+
+
+ /**
+ * Returns a DemoFactory that creates a SliderDemo.
+ *
+ * @return a DemoFactory that creates a SliderDemo
+ */
+ public static DemoFactory createDemoFactory()
+ {
+ return new DemoFactory()
+ {
+ public JComponent createDemo()
+ {
+ return new SliderDemo();
+ }
+ };
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/SpinnerDemo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/SpinnerDemo.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/SpinnerDemo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/SpinnerDemo.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,235 @@
+/* SpinnerDemo.java -- An example showing various spinners in Swing.
+ Copyright (C) 2006, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Font;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Calendar;
+import java.util.Date;
+
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JSpinner;
+import javax.swing.SpinnerDateModel;
+import javax.swing.SpinnerListModel;
+import javax.swing.SpinnerNumberModel;
+import javax.swing.SwingUtilities;
+
+/**
+ * A simple demo showing various spinners in different states.
+ */
+public class SpinnerDemo
+ extends JPanel
+ implements ActionListener
+{
+ private JCheckBox spinnerState1;
+ private JSpinner spinner1;
+ private JSpinner spinner2;
+
+ private JCheckBox spinnerState2;
+ private JSpinner spinner3;
+ private JSpinner spinner4;
+
+ private JCheckBox spinnerState3;
+ private JSpinner spinner5;
+ private JSpinner spinner6;
+
+ /**
+ * Creates a new demo instance.
+ */
+ public SpinnerDemo()
+ {
+ super();
+ createContent();
+ }
+
+ /**
+ * When the demo is run independently, the frame is displayed, so we should
+ * initialise the content panel (including the demo content and a close
+ * button). But when the demo is run as part of the Swing activity board,
+ * only the demo content panel is used, the frame itself is never displayed,
+ * so we can avoid this step.
+ */
+ void initFrameContent()
+ {
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ add(closePanel, BorderLayout.SOUTH);
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
+ private void createContent()
+ {
+ setLayout(new BorderLayout());
+ JPanel panel = new JPanel(new GridLayout(3, 1));
+ panel.add(createPanel1());
+ panel.add(createPanel2());
+ panel.add(createPanel3());
+ add(panel);
+ }
+
+ private JPanel createPanel1()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.spinnerState1 = new JCheckBox("Enabled", true);
+ this.spinnerState1.setActionCommand("COMBO_STATE1");
+ this.spinnerState1.addActionListener(this);
+ panel.add(this.spinnerState1, BorderLayout.EAST);
+
+ JPanel controlPanel = new JPanel();
+ controlPanel.setBorder(BorderFactory.createTitledBorder(
+ "Number Spinner: "));
+ this.spinner1 = new JSpinner(new SpinnerNumberModel(5.0, 0.0, 10.0, 0.5));
+ this.spinner2 = new JSpinner(new SpinnerNumberModel(50, 0, 100, 5));
+ this.spinner2.setFont(new Font("Dialog", Font.PLAIN, 20));
+ controlPanel.add(this.spinner1);
+ controlPanel.add(this.spinner2);
+
+ panel.add(controlPanel);
+
+ return panel;
+ }
+
+ private JPanel createPanel2()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.spinnerState2 = new JCheckBox("Enabled", true);
+ this.spinnerState2.setActionCommand("COMBO_STATE2");
+ this.spinnerState2.addActionListener(this);
+ panel.add(this.spinnerState2, BorderLayout.EAST);
+
+ JPanel controlPanel = new JPanel();
+ controlPanel.setBorder(BorderFactory.createTitledBorder("Date Spinner: "));
+ this.spinner3 = new JSpinner(new SpinnerDateModel(new Date(), null, null,
+ Calendar.DATE));
+
+ this.spinner4 = new JSpinner(new SpinnerDateModel(new Date(), null, null,
+ Calendar.YEAR));
+ this.spinner4.setFont(new Font("Dialog", Font.PLAIN, 20));
+
+ controlPanel.add(this.spinner3);
+ controlPanel.add(this.spinner4);
+
+ panel.add(controlPanel);
+
+ return panel;
+ }
+
+ private JPanel createPanel3()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.spinnerState3 = new JCheckBox("Enabled", true);
+ this.spinnerState3.setActionCommand("COMBO_STATE3");
+ this.spinnerState3.addActionListener(this);
+ panel.add(this.spinnerState3, BorderLayout.EAST);
+
+ JPanel controlPanel = new JPanel();
+ controlPanel.setBorder(BorderFactory.createTitledBorder("List Spinner: "));
+ this.spinner5 = new JSpinner(new SpinnerListModel(new Object[] {"Red",
+ "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"}));
+
+ this.spinner6 = new JSpinner(new SpinnerListModel(new Object[] {"Red",
+ "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"}));
+ this.spinner6.setValue("Yellow");
+ this.spinner6.setFont(new Font("Dialog", Font.PLAIN, 20));
+
+ controlPanel.add(this.spinner5);
+ controlPanel.add(this.spinner6);
+
+ panel.add(controlPanel);
+
+ return panel;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("COMBO_STATE1"))
+ {
+ spinner1.setEnabled(spinnerState1.isSelected());
+ spinner2.setEnabled(spinnerState1.isSelected());
+ }
+ else if (e.getActionCommand().equals("COMBO_STATE2"))
+ {
+ spinner3.setEnabled(spinnerState2.isSelected());
+ spinner4.setEnabled(spinnerState2.isSelected());
+ }
+ else if (e.getActionCommand().equals("COMBO_STATE3"))
+ {
+ spinner5.setEnabled(spinnerState3.isSelected());
+ spinner6.setEnabled(spinnerState3.isSelected());
+ }
+ else if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ SwingUtilities.invokeLater
+ (new Runnable()
+ {
+ public void run()
+ {
+ SpinnerDemo app = new SpinnerDemo();
+ app.initFrameContent();
+ JFrame frame = new JFrame("Spinner Demo");
+ frame.getContentPane().add(app);
+ frame.pack();
+ frame.setVisible(true);
+ }
+ });
+ }
+
+ /**
+ * Returns a DemoFactory that creates a SpinnerDemo.
+ *
+ * @return a DemoFactory that creates a SpinnerDemo
+ */
+ public static DemoFactory createDemoFactory()
+ {
+ return new DemoFactory()
+ {
+ public JComponent createDemo()
+ {
+ return new SpinnerDemo();
+ }
+ };
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/TabbedPaneDemo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/TabbedPaneDemo.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/TabbedPaneDemo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/TabbedPaneDemo.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,145 @@
+/* TabbedPaneDemo.java -- Demonstrates JTabbedPane
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+
+public class TabbedPaneDemo
+ extends JPanel
+ implements ActionListener
+{
+ TabbedPaneDemo()
+ {
+ super();
+ createContent();
+ }
+
+ private void createContent()
+ {
+ JPanel p = new JPanel();
+ p.setLayout(new GridLayout(2, 2));
+ JTabbedPane tabs1 = new JTabbedPane(SwingConstants.TOP);
+ tabs1.add("Top Item 1", new JButton("Content: Top Item 1"));
+ tabs1.add("Top Item 2", new JButton("Content: Top Item 2"));
+ JTabbedPane tabs2 = new JTabbedPane(SwingConstants.LEFT);
+ tabs2.add("Left Item 1", new JButton("Content: Left Item 1"));
+ tabs2.add("Left Item 2", new JButton("Content: Left Item 2"));
+ JTabbedPane tabs3 = new JTabbedPane(SwingConstants.BOTTOM);
+ tabs3.add("Bottom Item 1", new JButton("Content: Bottom Item 1"));
+ tabs3.add("Bottom Item 2", new JButton("Content: Bottom Item 2"));
+ JTabbedPane tabs4 = new JTabbedPane(SwingConstants.RIGHT);
+ tabs4.add("Right Item 1", new JButton("Content: Right Item 1"));
+ tabs4.add("Right Item 2", new JButton("Content: Right Item 2"));
+ p.add(tabs1);
+ p.add(tabs2);
+ p.add(tabs3);
+ p.add(tabs4);
+ setLayout(new BorderLayout());
+ add(p, BorderLayout.CENTER);
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ }
+
+ /**
+ * When the demo is run independently, the frame is displayed, so we should
+ * initialise the content panel (including the demo content and a close
+ * button). But when the demo is run as part of the Swing activity board,
+ * only the demo content panel is used, the frame itself is never displayed,
+ * so we can avoid this step.
+ */
+ void initFrameContent()
+ {
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ add(closePanel, BorderLayout.SOUTH);
+ }
+
+ public static void main(String[] args)
+ {
+ SwingUtilities.invokeLater
+ (new Runnable()
+ {
+ public void run()
+ {
+ TabbedPaneDemo app = new TabbedPaneDemo();
+ app.initFrameContent();
+ JFrame frame = new JFrame("TabbedPane Demo");
+ frame.getContentPane().add(app);
+ frame.pack();
+ frame.setVisible(true);
+ }
+ });
+ }
+
+ /**
+ * Returns a DemoFactory that creates a TabbedPaneDemo.
+ *
+ * @return a DemoFactory that creates a TabbedPaneDemo
+ */
+ public static DemoFactory createDemoFactory()
+ {
+ return new DemoFactory()
+ {
+ public JComponent createDemo()
+ {
+ return new TabbedPaneDemo();
+ }
+ };
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/TableDemo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/TableDemo.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/TableDemo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/TableDemo.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,418 @@
+/* TableDemo.java -- Demonstrates the use of JTable.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Rectangle;
+import java.text.DateFormat;
+import java.util.Date;
+
+import javax.swing.AbstractCellEditor;
+import javax.swing.BorderFactory;
+import javax.swing.DefaultCellEditor;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.Icon;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollBar;
+import javax.swing.JScrollPane;
+import javax.swing.JSlider;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.SwingUtilities;
+import javax.swing.border.Border;
+import javax.swing.plaf.metal.MetalIconFactory;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+
+/**
+ * Displays the editable table. The first column consists of check boxes.
+ *
+ * @author Audrius Meskauskas (audriusa at bioinformatics.org)
+ */
+public class TableDemo extends JPanel
+{
+ /**
+ * The initial row count for this table.
+ */
+ static int rows = 32;
+
+ /**
+ * The initial column count for this table.
+ */
+ static int cols = 7;
+
+
+ /**
+ * The table model.
+ */
+ class TModel extends DefaultTableModel
+ {
+
+ /**
+ * All cells are editable in our table.
+ */
+ public boolean isCellEditable(int row, int column)
+ {
+ return true;
+ }
+
+ /**
+ * Get the number of the table rows.
+ */
+ public int getRowCount()
+ {
+ return rows;
+ }
+
+ /**
+ * Get the number of the table columns.
+ */
+ public int getColumnCount()
+ {
+ return cols;
+ }
+
+ /**
+ * Set the value at the given position
+ */
+ public void setValueAt(Object aValue, int aRow, int aColumn)
+ {
+ values[aRow][aColumn] = aValue;
+ }
+
+ /**
+ * Get the value at the given position.
+ */
+ public Object getValueAt(int aRow, int aColumn)
+ {
+ return values[aRow][aColumn];
+ }
+
+ /**
+ * The column name, as suggested by model. This header should not be
+ * visible, as it is overridden by setting the header name with
+ * {@link TableColumn#setHeaderValue} in {@link TableDemo#createContent}.
+ */
+ public String getColumnName(int column)
+ {
+ return "Error "+column;
+ }
+
+ /**
+ * The first column contains booleans, the second - icons,
+ * others - default class.
+ */
+ public Class getColumnClass(int column)
+ {
+ if (column == 0)
+ return Boolean.class;
+ else if (column == 1)
+ return Icon.class;
+ else
+ return super.getColumnClass(column);
+ }
+ }
+
+ /**
+ * The scroll bar renderer.
+ */
+ class SliderCell
+ extends AbstractCellEditor
+ implements TableCellEditor, TableCellRenderer
+ {
+ /**
+ * The editor bar.
+ */
+ JSlider bar;
+
+ /**
+ * The renderer bar.
+ */
+ JSlider rendererBar;
+
+ /**
+ * The border around the bar, if required.
+ */
+ Border border = BorderFactory.createLineBorder(table.getGridColor());
+
+ SliderCell()
+ {
+ bar = new JSlider();
+ bar.setOrientation(JScrollBar.HORIZONTAL);
+ bar.setMinimum(0);
+ bar.setMaximum(rows);
+ bar.setBorder(border);
+
+ rendererBar = new JSlider();
+ rendererBar.setMinimum(0);
+ rendererBar.setMaximum(rows);
+ rendererBar.setEnabled(false);
+ }
+
+ /**
+ * Get the editor.
+ */
+ public Component getTableCellEditorComponent(JTable table, Object value,
+ boolean isSelected, int row,
+ int column)
+ {
+ if (value instanceof Integer)
+ bar.setValue(((Integer) value).intValue());
+ return bar;
+ }
+
+ /**
+ * Get the renderer.
+ */
+ public Component getTableCellRendererComponent(JTable table, Object value,
+ boolean isSelected,
+ boolean hasFocus, int row,
+ int column)
+ {
+ rendererBar.setValue(((Integer) value).intValue());
+ if (hasFocus)
+ rendererBar.setBorder(border);
+ else
+ rendererBar.setBorder(null);
+ return rendererBar;
+ }
+
+ public Object getCellEditorValue()
+ {
+ return new Integer(bar.getValue());
+ }
+
+ }
+
+ /**
+ * The table being displayed.
+ */
+ JTable table = new JTable();
+
+ /**
+ * The table model.
+ */
+ TModel model = new TModel();
+
+ /**
+ * The table value array.
+ */
+ Object[][] values;
+
+ /**
+ * The icons that appear in the icon column.
+ */
+ Icon[] icons = new Icon[]
+ {
+ MetalIconFactory.getTreeComputerIcon(),
+ MetalIconFactory.getTreeHardDriveIcon(),
+ MetalIconFactory.getTreeFolderIcon(),
+ };
+
+ /**
+ * The choices in the combo boxes
+ */
+ String [] sides = new String[]
+ {
+ "north", "south", "east", "west"
+ };
+
+
+ /**
+ * Create the table demo with the given titel.
+ */
+ public TableDemo()
+ {
+ super();
+ createContent();
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel uses a BorderLayout(), and
+ * the BorderLayout.SOUTH area is empty, to allow callers to add controls to
+ * the bottom of the panel if they want to (a close button is added if this
+ * demo is being run as a standalone demo).
+ */
+ private void createContent()
+ {
+ setLayout(new BorderLayout());
+ values = new Object[rows][];
+
+ for (int i = 0; i < values.length; i++)
+ {
+ values[i] = new Object[cols];
+ for (int j = 3; j < cols; j++)
+ {
+ values[i][j] = "" + ((char) ('a' + j)) + i;
+ }
+ values [i][0] = i % 2 == 0? Boolean.TRUE : Boolean.FALSE;
+ values [i][1] = icons [ i % icons.length ];
+ values [i][2] = sides [ i % sides.length ];
+ values [i][4] = new Integer(i);
+ }
+
+ table.setModel(model);
+
+ // Make the columns with gradually increasing width:
+ DefaultTableColumnModel cm = new DefaultTableColumnModel();
+ table.setColumnModel(cm);
+
+ for (int i = 0; i < cols; i++)
+ {
+ TableColumn column = new TableColumn(i);
+
+ // Showing the variable width columns.
+ int width = 100+10*i;
+ column.setPreferredWidth(width);
+
+ // If we do not set the header value here, the value, returned
+ // by model, is used.
+ column.setHeaderValue("Width +"+(20*i));
+
+ cm.addColumn(column);
+ }
+
+ setCustomEditors();
+ setInformativeHeaders();
+
+ // Create the table, place it into scroll pane and place
+ // the pane into this frame.
+ JScrollPane scroll = new JScrollPane();
+
+ // The horizontal scroll bar is never needed.
+ scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ scroll.getViewport().add(table);
+ add(scroll, BorderLayout.CENTER);
+
+ // Increase the row height to make the icons and sliders look better.
+ table.setRowHeight(table.getRowHeight()+2);
+ }
+
+ /**
+ * Set the more informative column headers for specific columns.
+ */
+ void setInformativeHeaders()
+ {
+ TableColumnModel cm = table.getColumnModel();
+
+ cm.getColumn(0).setHeaderValue("check");
+ cm.getColumn(1).setHeaderValue("icon");
+ cm.getColumn(2).setHeaderValue("combo");
+ cm.getColumn(3).setHeaderValue("edit combo");
+ cm.getColumn(4).setHeaderValue("slider");
+ }
+
+ /**
+ * Set the custom editors for combo boxes. This method also sets one
+ * custom renderer.
+ */
+ void setCustomEditors()
+ {
+ TableColumnModel cm = table.getColumnModel();
+
+ // Set combo-box based editor for icons (note that no custom
+ // renderer is needed for JComboBox to work with icons.
+ JComboBox combo0 = new JComboBox(icons);
+ cm.getColumn(1).setCellEditor(new DefaultCellEditor(combo0));
+
+ // Set the simple combo box editor for the third column:
+ JComboBox combo1 = new JComboBox(sides);
+ cm.getColumn(2).setCellEditor(new DefaultCellEditor(combo1));
+
+ // Set the editable combo box for the forth column:
+ JComboBox combo2 = new JComboBox(sides);
+ combo2.setEditable(true);
+ cm.getColumn(3).setCellEditor(new DefaultCellEditor(combo2));
+
+ SliderCell scrollView = new SliderCell();
+ cm.getColumn(4).setCellEditor(scrollView);
+ cm.getColumn(4).setCellRenderer(scrollView);
+
+ table.setColumnModel(cm);
+ }
+
+ /**
+ * The executable method to display the editable table.
+ *
+ * @param args
+ * unused.
+ */
+ public static void main(String[] args)
+ {
+ SwingUtilities.invokeLater
+ (new Runnable()
+ {
+ public void run()
+ {
+ TableDemo demo = new TableDemo();
+ JFrame frame = new JFrame();
+ frame.getContentPane().add(demo);
+ frame.setSize(new Dimension(640, 100));
+ frame.setVisible(true);
+ }
+ });
+ }
+
+ /**
+ * Returns a DemoFactory that creates a TableDemo.
+ *
+ * @return a DemoFactory that creates a TableDemo
+ */
+ public static DemoFactory createDemoFactory()
+ {
+ return new DemoFactory()
+ {
+ public JComponent createDemo()
+ {
+ return new TableDemo();
+ }
+ };
+ }
+}
+
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/TextAreaDemo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/TextAreaDemo.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/TextAreaDemo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/TextAreaDemo.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,620 @@
+/* TextAreaDemo.java -- An example showing various textareas in Swing.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath examples.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+ */
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.GridLayout;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Shape;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.DefaultCaret;
+import javax.swing.text.Highlighter;
+import javax.swing.text.JTextComponent;
+import javax.swing.text.View;
+import javax.swing.text.LayeredHighlighter.LayerPainter;
+
+/**
+ * A simple textare demo showing various textareas in different states.
+ */
+public class TextAreaDemo
+ extends JPanel
+ implements ActionListener
+{
+
+ /**
+ * A custom caret for demonstration purposes. This class is inspired by the
+ * CornerCaret from the OReilly Swing book.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+ static class CornerCaret
+ extends DefaultCaret
+ {
+ public CornerCaret()
+ {
+ super();
+ setBlinkRate(500);
+ }
+
+ protected synchronized void damage(Rectangle r)
+ {
+ if (r == null)
+ return;
+ x = r.x;
+ y = r.y + (r.height * 4 / 5 - 3);
+ width = 5;
+ height = 5;
+ repaint();
+ }
+
+ public void paint(Graphics g)
+ {
+ JTextComponent comp = getComponent();
+ if (comp == null)
+ return;
+ int dot = getDot();
+ Rectangle r = null;
+ try
+ {
+ r = comp.modelToView(dot);
+ }
+ catch (BadLocationException e)
+ {
+ return;
+ }
+ if (r == null)
+ return;
+ int dist = r.height * 4 / 5 - 3;
+ if ((x != r.x) || (y != r.y + dist))
+ {
+ repaint();
+ x = r.x;
+ y = r.y + dist;
+ width = 5;
+ height = 5;
+ }
+ if (isVisible())
+ {
+ g.drawLine(r.x, r.y + dist, r.x, r.y + dist + 4);
+ g.drawLine(r.x, r.y + dist + 4, r.x + 4, r.y + dist + 4);
+ }
+ }
+ }
+
+ static class DemoHighlightPainter
+ extends LayerPainter
+ {
+ static DemoHighlightPainter INSTANCE = new DemoHighlightPainter();
+
+ static Color[] colors = { Color.BLUE, Color.CYAN, Color.GRAY, Color.GREEN,
+ Color.MAGENTA, Color.ORANGE, Color.PINK,
+ Color.ORANGE, Color.RED, Color.BLUE, Color.YELLOW };
+
+ public DemoHighlightPainter()
+ {
+ super();
+ }
+
+ private void paintHighlight(Graphics g, Rectangle rect)
+ {
+ g.fillRect(rect.x, rect.y, rect.width, rect.height);
+ }
+
+ public void paint(Graphics g, int p0, int p1, Shape bounds, JTextComponent t)
+ {
+ try
+ {
+
+ for (int i = p0; i < p1; i++)
+ {
+ Rectangle r = t.modelToView(i);
+ Point l1 = t.modelToView(i + 1).getLocation();
+
+ g.setColor(colors[(int) (Math.random() * colors.length)]);
+ g.fillOval(r.x, r.y, l1.x - r.x, r.height);
+ }
+ }
+ catch (BadLocationException ble)
+ {
+ }
+
+ }
+
+ public Shape paintLayer(Graphics g, int p0, int p1, Shape bounds,
+ JTextComponent c, View view)
+ {
+ paint(g, p0, p1, bounds, c);
+
+ return bounds;
+ }
+ }
+
+ /**
+ * The non wrapping text areas and state buttons.
+ */
+ JTextArea textarea1;
+
+ JTextArea textarea2;
+
+ JTextArea textarea3;
+
+ JCheckBox enabled1;
+
+ JCheckBox editable1;
+
+ JPanel panel1;
+
+ /**
+ * The char wrapping textareas and state buttons.
+ */
+ JTextArea textarea4;
+
+ JTextArea textarea5;
+
+ JTextArea textarea6;
+
+ JCheckBox enabled2;
+
+ JCheckBox editable2;
+
+ /**
+ * The word wrapping textareas and state buttons.
+ */
+ JTextArea textarea7;
+
+ JTextArea textarea8;
+
+ JTextArea textarea9;
+
+ JCheckBox enabled3;
+
+ JCheckBox editable3;
+
+ /**
+ * The custom colored textareas and state buttons.
+ */
+ JTextArea textarea10;
+
+ JTextArea textarea11;
+
+ JTextArea textarea12;
+
+ JTextArea textarea13;
+
+ JTextArea textarea14;
+
+ JTextArea textarea14b;
+
+ JCheckBox enabled4;
+
+ JCheckBox editable4;
+
+ /**
+ * Some miscellaneous textarea demos.
+ */
+ JTextArea textarea15;
+
+ JTextArea textarea16;
+
+ JTextArea textarea17;
+
+ JCheckBox enabled5;
+
+ JCheckBox editable5;
+
+ /**
+ * Creates a new demo instance.
+ */
+ public TextAreaDemo()
+ {
+ super();
+ createContent();
+ }
+
+ /**
+ * When the demo is run independently, the frame is displayed, so we should
+ * initialise the content panel (including the demo content and a close
+ * button). But when the demo is run as part of the Swing activity board, only
+ * the demo content panel is used, the frame itself is never displayed, so we
+ * can avoid this step.
+ */
+ void initFrameContent()
+ {
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ add(closePanel, BorderLayout.SOUTH);
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel uses a BorderLayout(), and
+ * the BorderLayout.SOUTH area is empty, to allow callers to add controls to
+ * the bottom of the panel if they want to (a close button is added if this
+ * demo is being run as a standalone demo).
+ */
+ private void createContent()
+ {
+ setLayout(new BorderLayout());
+ JTabbedPane tabPane = new JTabbedPane();
+ tabPane.addTab("Non-wrap", createNonWrapPanel());
+ tabPane.addTab("Char-wrap", createCharWrapPanel());
+ tabPane.addTab("Word-wrap", createWordWrapPanel());
+ tabPane.addTab("Custom colors", createCustomColoredPanel());
+ tabPane.addTab("Misc", createMiscPanel());
+ add(tabPane);
+ }
+
+ private JPanel createNonWrapPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ panel.setBorder(BorderFactory.createTitledBorder("Not wrapping"));
+
+ panel1 = new JPanel(new GridLayout(2, 2));
+
+ textarea1 = new JTextArea("Hello World!");
+ textarea1.setFont(new Font("Dialog", Font.PLAIN, 8));
+ panel1.add(new JScrollPane(textarea1));
+
+ textarea2 = new JTextArea("Hello World!");
+ textarea2.setFont(new Font("Dialog", Font.ITALIC, 12));
+ panel1.add(new JScrollPane(textarea2));
+
+ textarea3 = new JTextArea("Hello World!");
+ textarea3.setFont(new Font("Dialog", Font.BOLD, 14));
+ panel1.add(new JScrollPane(textarea3));
+
+ panel.add(panel1);
+
+ JPanel statePanel = new JPanel();
+ statePanel.setLayout(new BoxLayout(statePanel, BoxLayout.Y_AXIS));
+ statePanel.add(Box.createVerticalGlue());
+ enabled1 = new JCheckBox("enabled");
+ enabled1.setSelected(true);
+ enabled1.addActionListener(this);
+ enabled1.setActionCommand("ENABLED1");
+ statePanel.add(enabled1);
+ editable1 = new JCheckBox("editable");
+ editable1.setSelected(true);
+ editable1.addActionListener(this);
+ editable1.setActionCommand("EDITABLE1");
+ statePanel.add(editable1);
+ statePanel.add(Box.createVerticalGlue());
+ panel.add(statePanel, BorderLayout.EAST);
+
+ return panel;
+ }
+
+ private JPanel createCharWrapPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ panel.setBorder(BorderFactory.createTitledBorder("Wrap at char bounds"));
+
+ JPanel innerPanel = new JPanel(new GridLayout(2, 2));
+
+ textarea4 = new JTextArea("Hello World!");
+ textarea4.setLineWrap(true);
+ textarea4.setFont(new Font("Dialog", Font.PLAIN, 8));
+ innerPanel.add(new JScrollPane(textarea4));
+
+ textarea5 = new JTextArea("Hello World!");
+ textarea5.setLineWrap(true);
+ textarea5.setFont(new Font("Dialog", Font.ITALIC, 12));
+ innerPanel.add(new JScrollPane(textarea5));
+
+ textarea6 = new JTextArea("Hello World!");
+ textarea6.setLineWrap(true);
+ textarea6.setFont(new Font("Dialog", Font.BOLD, 14));
+ innerPanel.add(new JScrollPane(textarea6));
+
+ panel.add(innerPanel);
+
+ JPanel statePanel = new JPanel();
+ statePanel.setLayout(new BoxLayout(statePanel, BoxLayout.Y_AXIS));
+ statePanel.add(Box.createVerticalGlue());
+ enabled2 = new JCheckBox("enabled");
+ enabled2.setSelected(true);
+ enabled2.addActionListener(this);
+ enabled2.setActionCommand("ENABLED2");
+ statePanel.add(enabled2);
+ editable2 = new JCheckBox("editable");
+ editable2.setSelected(true);
+ editable2.addActionListener(this);
+ editable2.setActionCommand("EDITABLE2");
+ statePanel.add(editable2);
+ statePanel.add(Box.createVerticalGlue());
+ panel.add(statePanel, BorderLayout.EAST);
+
+ return panel;
+ }
+
+ private JPanel createWordWrapPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ panel.setBorder(BorderFactory.createTitledBorder("Wrap at word bounds"));
+
+ JPanel innerPanel = new JPanel(new GridLayout(2, 2));
+
+ textarea7 = new JTextArea("Hello World!");
+ textarea7.setWrapStyleWord(true);
+ textarea7.setLineWrap(true);
+ textarea7.setFont(new Font("Dialog", Font.PLAIN, 8));
+ innerPanel.add(new JScrollPane(textarea7));
+
+ textarea8 = new JTextArea("Hello World!");
+ textarea8.setWrapStyleWord(true);
+ textarea8.setLineWrap(true);
+ textarea8.setFont(new Font("Dialog", Font.ITALIC, 12));
+ innerPanel.add(new JScrollPane(textarea8));
+
+ textarea9 = new JTextArea("Hello World!");
+ textarea9.setWrapStyleWord(true);
+ textarea9.setLineWrap(true);
+ textarea9.setFont(new Font("Dialog", Font.BOLD, 14));
+ innerPanel.add(new JScrollPane(textarea9));
+
+ panel.add(innerPanel);
+
+ JPanel statePanel = new JPanel();
+ statePanel.setLayout(new BoxLayout(statePanel, BoxLayout.Y_AXIS));
+ statePanel.add(Box.createVerticalGlue());
+ enabled3 = new JCheckBox("enabled");
+ enabled3.setSelected(true);
+ enabled3.addActionListener(this);
+ enabled3.setActionCommand("ENABLED3");
+ statePanel.add(enabled3);
+ editable3 = new JCheckBox("editable");
+ editable3.setSelected(true);
+ editable3.addActionListener(this);
+ editable3.setActionCommand("EDITABLE3");
+ statePanel.add(editable3);
+ statePanel.add(Box.createVerticalGlue());
+ panel.add(statePanel, BorderLayout.EAST);
+
+ return panel;
+ }
+
+ private JPanel createCustomColoredPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+
+ JPanel innerPanel = new JPanel(new GridLayout(3, 2));
+ panel.setBorder(BorderFactory.createTitledBorder("Custom colors"));
+
+ textarea10 = new JTextArea("custom foreground", 10, 15);
+ textarea10.setForeground(Color.GREEN);
+ innerPanel.add(new JScrollPane(textarea10));
+
+ textarea11 = new JTextArea("custom background", 10, 15);
+ textarea11.setBackground(Color.YELLOW);
+ innerPanel.add(new JScrollPane(textarea11));
+
+ textarea12 = new JTextArea("custom disabled textcolor", 10, 15);
+ textarea12.setDisabledTextColor(Color.BLUE);
+ innerPanel.add(new JScrollPane(textarea12));
+
+ textarea13 = new JTextArea("custom selected text color", 10, 15);
+ textarea13.setSelectedTextColor(Color.RED);
+ innerPanel.add(new JScrollPane(textarea13));
+
+ textarea14 = new JTextArea("custom selection color", 10, 15);
+ textarea14.setSelectionColor(Color.RED);
+ innerPanel.add(new JScrollPane(textarea14));
+
+ textarea14b = new JTextArea("custom selection and selected text color", 10, 15);
+ textarea14b.setSelectedTextColor(Color.WHITE);
+ textarea14b.setSelectionColor(Color.BLACK);
+ innerPanel.add(new JScrollPane(textarea14b));
+
+ panel.add(innerPanel);
+
+ JPanel statePanel = new JPanel();
+ statePanel.setLayout(new BoxLayout(statePanel, BoxLayout.Y_AXIS));
+ statePanel.add(Box.createVerticalGlue());
+ enabled4 = new JCheckBox("enabled");
+ enabled4.setSelected(true);
+ enabled4.addActionListener(this);
+ enabled4.setActionCommand("ENABLED4");
+ statePanel.add(enabled4);
+ editable4 = new JCheckBox("editable");
+ editable4.setSelected(true);
+ editable4.addActionListener(this);
+ editable4.setActionCommand("EDITABLE4");
+ statePanel.add(editable4);
+ statePanel.add(Box.createVerticalGlue());
+ panel.add(statePanel, BorderLayout.EAST);
+
+ return panel;
+ }
+
+ private JPanel createMiscPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ panel.setBorder(BorderFactory.createTitledBorder("Miscellaneous"));
+
+ JPanel innerPanel = new JPanel(new GridLayout(2, 2));
+
+ textarea15 = new JTextArea("Custom Caret");
+ textarea15.setCaret(new CornerCaret());
+ innerPanel.add(new JScrollPane(textarea15));
+
+ textarea16 = new JTextArea("Custom Caret color");
+ textarea16.setCaretColor(Color.MAGENTA);
+ innerPanel.add(new JScrollPane(textarea16));
+
+ textarea16 = new JTextArea("Custom Selection painter");
+ textarea16.setFont(new Font("Dialog", Font.PLAIN, 24));
+ textarea16.setCaret(new DefaultCaret()
+ {
+ public Highlighter.HighlightPainter getSelectionPainter()
+ {
+ return DemoHighlightPainter.INSTANCE;
+ }
+ });
+
+ innerPanel.add(new JScrollPane(textarea16));
+
+ panel.add(innerPanel);
+
+ JPanel statePanel = new JPanel();
+ statePanel.setLayout(new BoxLayout(statePanel, BoxLayout.Y_AXIS));
+ statePanel.add(Box.createVerticalGlue());
+ enabled5 = new JCheckBox("enabled");
+ enabled5.setSelected(true);
+ enabled5.addActionListener(this);
+ enabled5.setActionCommand("ENABLED5");
+ statePanel.add(enabled5);
+ editable5 = new JCheckBox("editable");
+ editable5.setSelected(true);
+ editable5.addActionListener(this);
+ editable5.setActionCommand("EDITABLE5");
+ statePanel.add(editable5);
+ statePanel.add(Box.createVerticalGlue());
+ panel.add(statePanel, BorderLayout.EAST);
+
+ return panel;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ else if (e.getActionCommand().equals("ENABLED1"))
+ {
+ boolean enabled = enabled1.isSelected();
+ textarea1.setEnabled(enabled);
+ textarea2.setEnabled(enabled);
+ textarea3.setEnabled(enabled);
+ }
+ else if (e.getActionCommand().equals("EDITABLE1"))
+ {
+ boolean editable = editable1.isSelected();
+ textarea1.setEditable(editable);
+ textarea2.setEditable(editable);
+ textarea3.setEditable(editable);
+ }
+ else if (e.getActionCommand().equals("ENABLED2"))
+ {
+ boolean enabled = enabled2.isSelected();
+ textarea4.setEnabled(enabled);
+ textarea5.setEnabled(enabled);
+ textarea6.setEnabled(enabled);
+ }
+ else if (e.getActionCommand().equals("EDITABLE2"))
+ {
+ boolean editable = editable2.isSelected();
+ textarea4.setEditable(editable);
+ textarea5.setEditable(editable);
+ textarea6.setEditable(editable);
+ }
+ else if (e.getActionCommand().equals("ENABLED3"))
+ {
+ boolean enabled = enabled3.isSelected();
+ textarea7.setEnabled(enabled);
+ textarea8.setEnabled(enabled);
+ textarea9.setEnabled(enabled);
+ }
+ else if (e.getActionCommand().equals("EDITABLE3"))
+ {
+ boolean editable = editable3.isSelected();
+ textarea7.setEditable(editable);
+ textarea8.setEditable(editable);
+ textarea9.setEditable(editable);
+ }
+ else if (e.getActionCommand().equals("ENABLED4"))
+ {
+ boolean enabled = enabled4.isSelected();
+ textarea10.setEnabled(enabled);
+ textarea11.setEnabled(enabled);
+ textarea12.setEnabled(enabled);
+ textarea13.setEnabled(enabled);
+ textarea14.setEnabled(enabled);
+ textarea14b.setEnabled(enabled);
+ }
+ else if (e.getActionCommand().equals("EDITABLE4"))
+ {
+ boolean editable = editable4.isSelected();
+ textarea10.setEditable(editable);
+ textarea11.setEditable(editable);
+ textarea12.setEditable(editable);
+ textarea13.setEditable(editable);
+ textarea14.setEditable(editable);
+ textarea14b.setEditable(editable);
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ SwingUtilities.invokeLater
+ (new Runnable()
+ {
+ public void run()
+ {
+ TextAreaDemo app = new TextAreaDemo();
+ app.initFrameContent();
+ JFrame frame = new JFrame();
+ frame.getContentPane().add(app);
+ frame.pack();
+ frame.setVisible(true);
+ }
+ });
+ }
+
+ /**
+ * Returns a DemoFactory that creates a TextAreaDemo.
+ *
+ * @return a DemoFactory that creates a TextAreaDemo
+ */
+ public static DemoFactory createDemoFactory()
+ {
+ return new DemoFactory()
+ {
+ public JComponent createDemo()
+ {
+ return new TextAreaDemo();
+ }
+ };
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/TextFieldDemo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/TextFieldDemo.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/TextFieldDemo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/TextFieldDemo.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,594 @@
+/* TextFieldDemo.java -- An example showing various textfields in Swing.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.GridLayout;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Shape;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextField;
+import javax.swing.SwingUtilities;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+import javax.swing.border.TitledBorder;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.DefaultCaret;
+import javax.swing.text.Highlighter;
+import javax.swing.text.JTextComponent;
+import javax.swing.text.View;
+import javax.swing.text.LayeredHighlighter.LayerPainter;
+
+/**
+ * A simple textfield demo showing various textfields in different states.
+ */
+public class TextFieldDemo
+ extends JPanel
+ implements ActionListener
+{
+
+ /**
+ * A custom caret for demonstration purposes. This class is inspired by the
+ * CornerCaret from the OReilly Swing book.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+ static class CornerCaret extends DefaultCaret
+ {
+ public CornerCaret()
+ {
+ super();
+ setBlinkRate(500);
+ }
+
+ protected synchronized void damage(Rectangle r)
+ {
+ if (r == null) return;
+ x = r.x;
+ y = r.y + (r.height * 4 / 5 - 3);
+ width = 5;
+ height = 5;
+ repaint();
+ }
+
+ public void paint(Graphics g)
+ {
+ JTextComponent comp = getComponent();
+ if (comp == null) return;
+ int dot = getDot();
+ Rectangle r = null;
+ try
+ {
+ r = comp.modelToView(dot);
+ }
+ catch (BadLocationException e)
+ {
+ return;
+ }
+ if (r == null) return;
+ int dist = r.height * 4 / 5 - 3;
+ if ((x != r.x) || (y != r.y + dist))
+ {
+ repaint();
+ x = r.x;
+ y = r.y + dist;
+ width = 5;
+ height = 5;
+ }
+ if (isVisible())
+ {
+ g.drawLine(r.x, r.y + dist, r.x, r.y + dist + 4);
+ g.drawLine(r.x, r.y + dist + 4, r.x + 4, r.y + dist + 4);
+ }
+ }
+ }
+
+ static class DemoHighlightPainter
+ extends LayerPainter
+ {
+
+ static DemoHighlightPainter INSTANCE = new DemoHighlightPainter();
+
+
+ static Color[] colors = { Color.BLUE, Color.CYAN, Color.GRAY, Color.GREEN,
+ Color.MAGENTA, Color.ORANGE, Color.PINK,
+ Color.ORANGE, Color.RED, Color.BLUE, Color.YELLOW };
+
+
+ public DemoHighlightPainter()
+ {
+ super();
+ }
+
+ private void paintHighlight(Graphics g, Rectangle rect)
+ {
+ g.fillRect(rect.x, rect.y, rect.width, rect.height);
+ }
+
+ public void paint(Graphics g, int p0, int p1, Shape bounds, JTextComponent t)
+ {
+ try
+ {
+
+ for (int i = p0; i < p1; i++)
+ {
+ Rectangle r = t.modelToView(i);
+ Point l1 = t.modelToView(i + 1).getLocation();
+
+ g.setColor(colors[(int) (Math.random() * colors.length)]);
+ g.fillOval(r.x, r.y, l1.x - r.x, r.height);
+ }
+ }
+ catch (BadLocationException ble)
+ {
+ }
+ }
+
+ public Shape paintLayer(Graphics g, int p0, int p1, Shape bounds,
+ JTextComponent c, View view)
+ {
+ paint(g, p0, p1, bounds, c);
+
+ return bounds;
+ }
+
+ }
+
+ /**
+ * The left aligned textfields and state buttons.
+ */
+ Compound compound1;
+
+ /**
+ * The right aligned textfields and state buttons.
+ */
+ Compound compound2;
+
+ /**
+ * The centered textfields and state buttons.
+ */
+ Compound compound3;
+
+ /**
+ * The custom colored textfields and state buttons.
+ */
+ Compound compound4;
+ Compound compound5;
+
+ /**
+ * Some miscellaneous textfield demos.
+ */
+ Compound compound6;
+
+ /**
+ * Some textfields with custom borders.
+ */
+ Compound compound7;
+
+ /**
+ * Creates a new demo instance.
+ */
+ public TextFieldDemo()
+ {
+ super();
+ createContent();
+ }
+
+ /**
+ * When the demo is run independently, the frame is displayed, so we should
+ * initialise the content panel (including the demo content and a close
+ * button). But when the demo is run as part of the Swing activity board,
+ * only the demo content panel is used, the frame itself is never displayed,
+ * so we can avoid this step.
+ */
+ void initFrameContent()
+ {
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ add(closePanel, BorderLayout.SOUTH);
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
+ private void createContent()
+ {
+ setLayout(new BorderLayout());
+ JPanel panel = new JPanel(new GridLayout(7, 1));
+ panel.add(createLeftAlignedPanel());
+ panel.add(createRightAlignedPanel());
+ panel.add(createCenteredPanel());
+ panel.add(createCustomColorPanel1());
+ panel.add(createCustomColorPanel2());
+ panel.add(createCustomBordersPanel());
+ panel.add(createMiscPanel());
+
+ // Put everything in a scroll pane to make it neccessary
+ // to reach the bottom inner panels if the screen is to small.
+ add(new JScrollPane(panel));
+ }
+
+ private JPanel createLeftAlignedPanel()
+ {
+ compound1 = createTextFieldCompound("Left aligned", 1);
+
+ compound1.setupTextfields("Hello World!",
+ JTextField.LEFT,
+ new Font[] { new Font("Dialog", Font.PLAIN, 8),
+ new Font("Dialog", Font.ITALIC, 12),
+ new Font("Dialog", Font.BOLD, 14)
+ });
+
+ return compound1.panel;
+ }
+
+ private Compound createTextFieldCompound(String title, int actionCommandNo)
+ {
+ Compound compound = new Compound();
+ compound.panel = new JPanel(new BorderLayout());
+ compound.panel.setBorder(BorderFactory.createTitledBorder(title));
+
+ compound.textFieldPanel = new JPanel();
+ compound.textFieldPanel.setLayout(new BoxLayout(compound.textFieldPanel, BoxLayout.X_AXIS));
+
+ compound.panel.add(compound.textFieldPanel);
+
+ JPanel statePanel = new JPanel();
+ statePanel.setLayout(new BoxLayout(statePanel, BoxLayout.Y_AXIS));
+ statePanel.add(Box.createVerticalGlue());
+ compound.enabled = new JCheckBox("enabled");
+ compound.enabled.setSelected(true);
+ compound.enabled.addActionListener(this);
+ compound.enabled.setActionCommand("ENABLED" + actionCommandNo);
+ statePanel.add(compound.enabled);
+ compound.editable = new JCheckBox("editable");
+ compound.editable.setSelected(true);
+ compound.editable.addActionListener(this);
+ compound.editable.setActionCommand("EDITABLE" + actionCommandNo);
+ statePanel.add(compound.editable);
+ statePanel.add(Box.createVerticalGlue());
+ compound.panel.add(statePanel, BorderLayout.EAST);
+
+ return compound;
+ }
+
+ private JPanel createRightAlignedPanel()
+ {
+ compound2 = createTextFieldCompound("Right aligned", 2);
+
+ compound2.setupTextfields("Hello World!",
+ JTextField.RIGHT,
+ new Font[] { new Font("Dialog", Font.PLAIN, 8),
+ new Font("Dialog", Font.ITALIC, 12),
+ new Font("Dialog", Font.BOLD, 14)
+ });
+
+ return compound2.panel;
+ }
+
+ private JPanel createCenteredPanel()
+ {
+ compound3 = createTextFieldCompound("Centered", 3);
+
+ compound3.setupTextfields("Hello World!",
+ JTextField.CENTER,
+ new Font[] { new Font("Dialog", Font.PLAIN, 8),
+ new Font("Dialog", Font.ITALIC, 12),
+ new Font("Dialog", Font.BOLD, 14)
+ });
+
+ return compound3.panel;
+ }
+
+ private JPanel createCustomColorPanel1()
+ {
+ compound4 = createTextFieldCompound("Custom colors I", 4);
+
+ compound4.textfield1 = new JTextField("custom foreground");
+ compound4.textfield1.setForeground(Color.RED);
+ compound4.textFieldPanel.add(compound4.textfield1);
+
+ compound4.textfield2 = new JTextField("custom background");
+ compound4.textfield2.setBackground(Color.YELLOW);
+ compound4.textFieldPanel.add(compound4.textfield2);
+
+ compound4.textfield3 = new JTextField("custom foreground and background");
+ compound4.textfield3.setForeground(Color.RED);
+ compound4.textfield3.setBackground(Color.YELLOW);
+ compound4.textFieldPanel.add(compound4.textfield3);
+
+ return compound4.panel;
+
+ }
+
+ private JPanel createCustomColorPanel2()
+ {
+ compound5 = createTextFieldCompound("Custom colors II", 5);
+
+ compound5.textfield1 = new JTextField("custom disabled textcolor");
+ compound5.textfield1.setDisabledTextColor(Color.BLUE);
+ compound5.textFieldPanel.add(compound5.textfield1);
+
+ compound5.textfield2 = new JTextField("custom selected text color");
+ compound5.textfield2.setSelectedTextColor(Color.RED);
+ compound5.textFieldPanel.add(compound5.textfield2);
+
+ compound5.textfield3 = new JTextField("custom selection color");
+ compound5.textfield3.setSelectionColor(Color.BLACK);
+ compound5.textFieldPanel.add(compound5.textfield3);
+
+ return compound5.panel;
+
+ }
+
+ private JPanel createMiscPanel()
+ {
+ compound6 = createTextFieldCompound("Miscellaneous", 6);
+
+ compound6.textfield1 = new JTextField("Custom Caret");
+ compound6.textfield1.setCaret(new CornerCaret());
+ compound6.textFieldPanel.add(compound6.textfield1);
+
+ compound6.textfield2 = new JTextField("Custom Caret color");
+ compound6.textfield2.setForeground(Color.LIGHT_GRAY);
+ compound6.textfield2.setBackground(Color.BLACK);
+ compound6.textfield2.setSelectedTextColor(Color.BLACK);
+ compound6.textfield2.setCaretColor(Color.WHITE);
+ compound6.textfield2.setSelectionColor(Color.DARK_GRAY);
+ compound6.textFieldPanel.add(compound6.textfield2);
+
+ compound6.textfield3 = new JTextField("Custom highlighter");
+ compound6.textfield3.setCaret(new DefaultCaret()
+ {
+ public Highlighter.HighlightPainter getSelectionPainter()
+ {
+ return DemoHighlightPainter.INSTANCE;
+ }
+ });
+ compound6.textFieldPanel.add(compound6.textfield3);
+
+ return compound6.panel;
+ }
+
+ private JPanel createCustomBordersPanel()
+ {
+ compound7 = createTextFieldCompound("Custom borders", 7);
+
+ compound7.textfield1 = new JTextField("red 5 pixel lineborder");
+ compound7.textfield1.setBorder(new LineBorder(Color.RED, 5));
+ compound7.textFieldPanel.add(compound7.textfield1);
+
+ compound7.textfield2 = new JTextField("complex irregular border");
+
+ CompoundBorder innerCompound = new CompoundBorder(new EmptyBorder(5, 40, 15, 10), new LineBorder(Color.BLACK));
+ CompoundBorder outerCompound = new CompoundBorder(new LineBorder(Color.BLACK), innerCompound);
+ compound7.textfield2.setBorder(outerCompound);
+ compound7.textFieldPanel.add(compound7.textfield2);
+
+ compound7.textfield3 = new JTextField("a titled border", 10);
+ compound7.textfield3.setBorder(new TitledBorder(null, "Freak Out Border", TitledBorder.CENTER, TitledBorder.LEFT));
+ compound7.textFieldPanel.add(compound7.textfield3);
+
+ return compound7.panel;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ else if (e.getActionCommand().equals("ENABLED1"))
+ {
+ boolean enabled = compound1.enabled.isSelected();
+ compound1.textfield1.setEnabled(enabled);
+ compound1.textfield2.setEnabled(enabled);
+ compound1.textfield3.setEnabled(enabled);
+ }
+ else if (e.getActionCommand().equals("EDITABLE1"))
+ {
+ boolean editable = compound1.editable.isSelected();
+ compound1.textfield1.setEditable(editable);
+ compound1.textfield2.setEditable(editable);
+ compound1.textfield3.setEditable(editable);
+ }
+ else if (e.getActionCommand().equals("ENABLED2"))
+ {
+ boolean enabled = compound2.enabled.isSelected();
+ compound2.textfield1.setEnabled(enabled);
+ compound2.textfield2.setEnabled(enabled);
+ compound2.textfield3.setEnabled(enabled);
+ }
+ else if (e.getActionCommand().equals("EDITABLE2"))
+ {
+ boolean editable = compound2.editable.isSelected();
+ compound2.textfield1.setEditable(editable);
+ compound2.textfield2.setEditable(editable);
+ compound2.textfield3.setEditable(editable);
+ }
+ else if (e.getActionCommand().equals("ENABLED3"))
+ {
+ boolean enabled = compound3.enabled.isSelected();
+ compound3.textfield1.setEnabled(enabled);
+ compound3.textfield2.setEnabled(enabled);
+ compound3.textfield3.setEnabled(enabled);
+ }
+ else if (e.getActionCommand().equals("EDITABLE3"))
+ {
+ boolean editable = compound3.editable.isSelected();
+ compound3.textfield1.setEditable(editable);
+ compound3.textfield2.setEditable(editable);
+ compound3.textfield3.setEditable(editable);
+ }
+ else if (e.getActionCommand().equals("ENABLED4"))
+ {
+ boolean enabled = compound4.enabled.isSelected();
+ compound4.textfield1.setEnabled(enabled);
+ compound4.textfield2.setEnabled(enabled);
+ compound4.textfield3.setEnabled(enabled);
+ }
+ else if (e.getActionCommand().equals("EDITABLE4"))
+ {
+ boolean editable = compound4.editable.isSelected();
+ compound4.textfield1.setEditable(editable);
+ compound4.textfield2.setEditable(editable);
+ compound4.textfield3.setEditable(editable);
+ }
+ else if (e.getActionCommand().equals("ENABLED5"))
+ {
+ boolean enabled = compound5.enabled.isSelected();
+ compound5.textfield1.setEnabled(enabled);
+ compound5.textfield2.setEnabled(enabled);
+ compound5.textfield3.setEnabled(enabled);
+ }
+ else if (e.getActionCommand().equals("EDITABLE5"))
+ {
+ boolean editable = compound5.editable.isSelected();
+ compound5.textfield1.setEditable(editable);
+ compound5.textfield2.setEditable(editable);
+ compound5.textfield3.setEditable(editable);
+ }
+ else if (e.getActionCommand().equals("ENABLED6"))
+ {
+ boolean enabled = compound6.enabled.isSelected();
+ compound6.textfield1.setEnabled(enabled);
+ compound6.textfield2.setEnabled(enabled);
+ compound6.textfield3.setEnabled(enabled);
+ }
+ else if (e.getActionCommand().equals("EDITABLE6"))
+ {
+ boolean editable = compound6.editable.isSelected();
+ compound6.textfield1.setEditable(editable);
+ compound6.textfield2.setEditable(editable);
+ compound6.textfield3.setEditable(editable);
+ }
+ else if (e.getActionCommand().equals("ENABLED7"))
+ {
+ boolean enabled = compound7.enabled.isSelected();
+ compound7.textfield1.setEnabled(enabled);
+ compound7.textfield2.setEnabled(enabled);
+ compound7.textfield3.setEnabled(enabled);
+ }
+ else if (e.getActionCommand().equals("EDITABLE7"))
+ {
+ boolean editable = compound7.editable.isSelected();
+ compound7.textfield1.setEditable(editable);
+ compound7.textfield2.setEditable(editable);
+ compound7.textfield3.setEditable(editable);
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ SwingUtilities.invokeLater
+ (new Runnable()
+ {
+ public void run()
+ {
+ TextFieldDemo app = new TextFieldDemo();
+ app.initFrameContent();
+ JFrame frame = new JFrame("TextField demo");
+ frame.getContentPane().add(app);
+ frame.pack();
+ frame.setVisible(true);
+ }
+ });
+ }
+
+ /**
+ * Returns a DemoFactory that creates a TextFieldDemo.
+ *
+ * @return a DemoFactory that creates a TextFieldDemo
+ */
+ public static DemoFactory createDemoFactory()
+ {
+ return new DemoFactory()
+ {
+ public JComponent createDemo()
+ {
+ return new TextFieldDemo();
+ }
+ };
+ }
+
+ static class Compound
+ {
+ JTextField textfield1;
+ JTextField textfield2;
+ JTextField textfield3;
+ JCheckBox enabled;
+ JCheckBox editable;
+ JPanel textFieldPanel;
+ JPanel panel;
+
+ /** Creates and initializes the textfields with the same text and
+ * alignment but with a different font.
+ *
+ * @param title The text for the textfields.
+ * @param align The alignment for the textfields.
+ * @param fonts The fonts to be used for the textfields.
+ */
+ void setupTextfields(String title, int align, Font[] fonts)
+ {
+ textfield1 = new JTextField(title);
+ textfield1.setHorizontalAlignment(align);
+ textfield1.setFont(fonts[0]);
+ textFieldPanel.add(textfield1);
+
+ textfield2 = new JTextField(title);
+ textfield2.setHorizontalAlignment(align);
+ textfield2.setFont(fonts[1]);
+ textFieldPanel.add(textfield2);
+
+ textfield3 = new JTextField(title);
+ textfield3.setHorizontalAlignment(align);
+ textfield3.setFont(fonts[2]);
+ textFieldPanel.add(textfield3);
+ }
+
+ }
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/TreeDemo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/TreeDemo.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/TreeDemo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/swing/TreeDemo.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,291 @@
+/* TreeDemo.java -- Demostrates JTree
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.JobAttributes.DefaultSelectionType;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.DebugGraphics;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTree;
+import javax.swing.SwingUtilities;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.DefaultTreeSelectionModel;
+import javax.swing.tree.TreePath;
+import javax.swing.tree.TreeSelectionModel;
+
+public class TreeDemo
+ extends JPanel
+ implements ActionListener
+{
+
+ TreeDemo()
+ {
+ super();
+ createContent();
+ }
+
+ private void createContent()
+ {
+ // non-leafs
+ DefaultMutableTreeNode root = new DefaultMutableTreeNode("Exotic Subsistence");
+ DefaultMutableTreeNode fruit = new DefaultMutableTreeNode("Interesting Fruit");
+ DefaultMutableTreeNode veg = new DefaultMutableTreeNode("Extraordinary Vegetables");
+ DefaultMutableTreeNode liq = new DefaultMutableTreeNode("Peculiar Liquids");
+
+ // leafs
+ DefaultMutableTreeNode f1 = new DefaultMutableTreeNode("Abiu");
+ DefaultMutableTreeNode f2 = new DefaultMutableTreeNode("Bamboo Shoots");
+ DefaultMutableTreeNode f3 = new DefaultMutableTreeNode("Breadfruit");
+ DefaultMutableTreeNode f4 = new DefaultMutableTreeNode("Canistel");
+ DefaultMutableTreeNode f5 = new DefaultMutableTreeNode("Duku");
+ DefaultMutableTreeNode f6 = new DefaultMutableTreeNode("Guava");
+ DefaultMutableTreeNode f7 = new DefaultMutableTreeNode("Jakfruit");
+ DefaultMutableTreeNode f8 = new DefaultMutableTreeNode("Quaribea");
+
+ DefaultMutableTreeNode v1 = new DefaultMutableTreeNode("Amaranth");
+ DefaultMutableTreeNode v2 = new DefaultMutableTreeNode("Kiwano");
+ DefaultMutableTreeNode v3 = new DefaultMutableTreeNode("Leeks");
+ DefaultMutableTreeNode v4 = new DefaultMutableTreeNode("Luffa");
+ DefaultMutableTreeNode v5 = new DefaultMutableTreeNode("Chayote");
+ DefaultMutableTreeNode v6 = new DefaultMutableTreeNode("Jicama");
+ DefaultMutableTreeNode v7 = new DefaultMutableTreeNode("Okra");
+
+ DefaultMutableTreeNode l1 = new DefaultMutableTreeNode("Alcoholic");
+ DefaultMutableTreeNode l11 = new DefaultMutableTreeNode("Caipirinha");
+ DefaultMutableTreeNode l21 = new DefaultMutableTreeNode("Mojito");
+ DefaultMutableTreeNode l31 = new DefaultMutableTreeNode("Margarita");
+ DefaultMutableTreeNode l41 = new DefaultMutableTreeNode("Martini");
+ DefaultMutableTreeNode l5 = new DefaultMutableTreeNode("Non Alcoholic");
+ DefaultMutableTreeNode l55 = new DefaultMutableTreeNode("Babaji");
+ DefaultMutableTreeNode l65 = new DefaultMutableTreeNode("Chikita");
+
+ root.add(fruit);
+ root.add(veg);
+ root.add(liq);
+ fruit.add(f1);
+ fruit.add(f2);
+ fruit.add(f3);
+ fruit.add(f4);
+ fruit.add(f5);
+ fruit.add(f6);
+ fruit.add(f7);
+ fruit.add(f8);
+ veg.add(v1);
+ veg.add(v2);
+ veg.add(v3);
+ veg.add(v4);
+ veg.add(v5);
+ veg.add(v6);
+ veg.add(v7);
+ liq.add(l1);
+ l1.add(l11);
+ l1.add(l21);
+ l1.add(l31);
+ l1.add(l41);
+ liq.add(l5);
+ l5.add(l55);
+ l5.add(l65);
+
+ final JTree tree = new JTree(root);
+ tree.setLargeModel(true);
+ tree.setEditable(true);
+ final DefaultTreeSelectionModel selModel = new DefaultTreeSelectionModel();
+ selModel.setSelectionMode(
+ DefaultTreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
+ tree.setSelectionModel(selModel);
+
+ // buttons to add and delete
+ JButton add = new JButton("add element");
+ add.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ for (int i = 0; i < tree.getRowCount(); i++)
+ {
+ if (tree.isRowSelected(i))
+ {
+ TreePath p = tree.getPathForRow(i);
+ DefaultMutableTreeNode n = (DefaultMutableTreeNode) p.
+ getLastPathComponent();
+ n.add(new DefaultMutableTreeNode("New Element"));
+
+ // The expansion state of the parent node does not change
+ // by default. We will expand it manually, to ensure that the
+ // added node is immediately visible.
+ tree.expandPath(p);
+
+ // Refresh the tree (.repaint would be not enough both in
+ // Classpath and Sun implementations).
+ DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
+ model.reload(n);
+ break;
+ }
+ }
+ }
+ });
+
+ // Demonstration of the various selection modes
+ final JCheckBox cbSingle = new JCheckBox("single selection");
+ cbSingle.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ if (cbSingle.isSelected())
+ selModel.setSelectionMode(
+ DefaultTreeSelectionModel.SINGLE_TREE_SELECTION);
+ else
+ selModel.setSelectionMode(
+ DefaultTreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
+ }
+ });
+
+ // Demonstration of the root visibility changes
+ final JCheckBox cbRoot = new JCheckBox("root");
+ cbRoot.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ tree.setRootVisible(cbRoot.isSelected());
+ }
+ });
+ cbRoot.setSelected(true);
+
+ // Demonstration of the tree selection listener.
+ final JLabel choice = new JLabel("Make a choice");
+ tree.getSelectionModel().addTreeSelectionListener(
+ new TreeSelectionListener()
+ {
+ public void valueChanged(TreeSelectionEvent event)
+ {
+ TreePath was = event.getOldLeadSelectionPath();
+ TreePath now = event.getNewLeadSelectionPath();
+ String swas =
+ was == null ? "none":was.getLastPathComponent().toString();
+ String snow =
+ now == null ? "none":now.getLastPathComponent().toString();
+ choice.setText("From "+swas+" to "+snow);
+ }
+ }
+ );
+
+ setLayout(new BorderLayout());
+
+ JPanel p2 = new JPanel();
+ p2.add(add);
+ p2.add(cbSingle);
+ p2.add(cbRoot);
+
+ tree.getSelectionModel().
+ setSelectionMode(DefaultTreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
+
+ add(p2, BorderLayout.NORTH);
+ add(new JScrollPane(tree), BorderLayout.CENTER);
+ add(choice, BorderLayout.SOUTH);
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ }
+
+ /**
+ * When the demo is run independently, the frame is displayed, so we should
+ * initialise the content panel (including the demo content and a close
+ * button). But when the demo is run as part of the Swing activity board,
+ * only the demo content panel is used, the frame itself is never displayed,
+ * so we can avoid this step.
+ */
+ void initFrameContent()
+ {
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ add(closePanel, BorderLayout.SOUTH);
+ }
+
+ public static void main(String[] args)
+ {
+ SwingUtilities.invokeLater
+ (new Runnable()
+ {
+ public void run()
+ {
+ TreeDemo app = new TreeDemo();
+ app.initFrameContent();
+ JFrame frame = new JFrame("Tree Demo");
+ frame.getContentPane().add(app);
+ frame.pack();
+ frame.setVisible(true);
+ }
+ });
+ }
+
+ /**
+ * Returns a DemoFactory that creates a TreeDemo.
+ *
+ * @return a DemoFactory that creates a TreeDemo
+ */
+ public static DemoFactory createDemoFactory()
+ {
+ return new DemoFactory()
+ {
+ public JComponent createDemo()
+ {
+ return new TreeDemo();
+ }
+ };
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/Makefile.am?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/Makefile.am Thu Nov 8 16:56:19 2007
@@ -0,0 +1,5 @@
+## Input file for automake to generate the Makefile.in used by configure
+
+SUBDIRS = sax w3c_dom relaxngDatatype
+
+EXTRA_DIST = README
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/Makefile.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/Makefile.in?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/Makefile.in Thu Nov 8 16:56:19 2007
@@ -0,0 +1,606 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = external
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
+ $(top_srcdir)/../../config/lead-dot.m4 \
+ $(top_srcdir)/../../config/multi.m4 \
+ $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
+ $(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
+ $(top_srcdir)/m4/ax_create_stdint_h.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
+CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
+CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_PLUGIN_FALSE = @CREATE_PLUGIN_FALSE@
+CREATE_PLUGIN_TRUE = @CREATE_PLUGIN_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_WRAPPERS_FALSE = @CREATE_WRAPPERS_FALSE@
+CREATE_WRAPPERS_TRUE = @CREATE_WRAPPERS_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@
+ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FASTJAR = @FASTJAR@
+FIND = @FIND@
+FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
+FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+GDK_CFLAGS = @GDK_CFLAGS@
+GDK_LIBS = @GDK_LIBS@
+GJDOC = @GJDOC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+JIKESWARNINGS = @JIKESWARNINGS@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBMAGIC = @LIBMAGIC@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
+MOZILLA_LIBS = @MOZILLA_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_ESCHER = @PATH_TO_ESCHER@
+PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGIN_DIR = @PLUGIN_DIR@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
+USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
+USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
+USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@
+VERSION = @VERSION@
+VM_BINARY = @VM_BINARY@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+XTEST_LIBS = @XTEST_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+nativeexeclibdir = @nativeexeclibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexeclibdir = @toolexeclibdir@
+vm_classes = @vm_classes@
+SUBDIRS = sax w3c_dom relaxngDatatype
+EXTRA_DIST = README
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu external/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu external/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libtool clean-recursive ctags \
+ ctags-recursive distclean distclean-generic distclean-libtool \
+ distclean-recursive distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-generic mostlyclean-libtool \
+ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/README
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/README?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/README (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/README Thu Nov 8 16:56:19 2007
@@ -0,0 +1,3 @@
+This directory contains libraries maintained externally to GNU Classpath.
+
+See the README files in the subdirectories for more information.
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/Makefile.am?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/Makefile.am Thu Nov 8 16:56:19 2007
@@ -0,0 +1,14 @@
+## Input file for automake to generate the Makefile.in used by configure
+
+EXTRA_DIST = README.txt \
+copying.txt \
+org/relaxng/datatype/Datatype.java \
+org/relaxng/datatype/DatatypeBuilder.java \
+org/relaxng/datatype/DatatypeException.java \
+org/relaxng/datatype/DatatypeLibrary.java \
+org/relaxng/datatype/DatatypeLibraryFactory.java \
+org/relaxng/datatype/DatatypeStreamingValidator.java \
+org/relaxng/datatype/ValidationContext.java \
+org/relaxng/datatype/helpers/DatatypeLibraryLoader.java \
+org/relaxng/datatype/helpers/ParameterlessDatatypeBuilder.java \
+org/relaxng/datatype/helpers/StreamingValidatorImpl.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/Makefile.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/Makefile.in?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/Makefile.in Thu Nov 8 16:56:19 2007
@@ -0,0 +1,461 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = external/relaxngDatatype
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
+ $(top_srcdir)/../../config/lead-dot.m4 \
+ $(top_srcdir)/../../config/multi.m4 \
+ $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
+ $(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
+ $(top_srcdir)/m4/ax_create_stdint_h.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
+CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
+CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_PLUGIN_FALSE = @CREATE_PLUGIN_FALSE@
+CREATE_PLUGIN_TRUE = @CREATE_PLUGIN_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_WRAPPERS_FALSE = @CREATE_WRAPPERS_FALSE@
+CREATE_WRAPPERS_TRUE = @CREATE_WRAPPERS_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@
+ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FASTJAR = @FASTJAR@
+FIND = @FIND@
+FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
+FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+GDK_CFLAGS = @GDK_CFLAGS@
+GDK_LIBS = @GDK_LIBS@
+GJDOC = @GJDOC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+JIKESWARNINGS = @JIKESWARNINGS@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBMAGIC = @LIBMAGIC@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
+MOZILLA_LIBS = @MOZILLA_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_ESCHER = @PATH_TO_ESCHER@
+PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGIN_DIR = @PLUGIN_DIR@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
+USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
+USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
+USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@
+VERSION = @VERSION@
+VM_BINARY = @VM_BINARY@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+XTEST_LIBS = @XTEST_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+nativeexeclibdir = @nativeexeclibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexeclibdir = @toolexeclibdir@
+vm_classes = @vm_classes@
+EXTRA_DIST = README.txt \
+copying.txt \
+org/relaxng/datatype/Datatype.java \
+org/relaxng/datatype/DatatypeBuilder.java \
+org/relaxng/datatype/DatatypeException.java \
+org/relaxng/datatype/DatatypeLibrary.java \
+org/relaxng/datatype/DatatypeLibraryFactory.java \
+org/relaxng/datatype/DatatypeStreamingValidator.java \
+org/relaxng/datatype/ValidationContext.java \
+org/relaxng/datatype/helpers/DatatypeLibraryLoader.java \
+org/relaxng/datatype/helpers/ParameterlessDatatypeBuilder.java \
+org/relaxng/datatype/helpers/StreamingValidatorImpl.java
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu external/relaxngDatatype/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu external/relaxngDatatype/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ $(mkdir_p) $(distdir)/org/relaxng/datatype $(distdir)/org/relaxng/datatype/helpers
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/README.txt?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/README.txt (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/README.txt Thu Nov 8 16:56:19 2007
@@ -0,0 +1,54 @@
+======================================================================
+ README FILE FOR DATATYPE INTERFACES FOR RELAX NG
+======================================================================
+
+
+
+RELAX NG supports multiple datatype vocabularies. To achive this, an
+interface between datatype vocabularies and schema processors is
+necessary. This interface is intended to be a standard Java interface
+for this purpose.
+
+
+----------------------------------------------------------------------
+LICENSE
+----------------------------------------------------------------------
+
+See copying.txt.
+
+Note: this license is the BSD license.
+
+
+
+----------------------------------------------------------------------
+FOR DEVELOPER
+----------------------------------------------------------------------
+
+If you are planning to implement a datatype library, A sample datatype
+library implementation by James Clark is available at [1], which
+comes with documentation and source code.
+
+If you are planning to implement a schema processor, then don't forget
+to check out org.relaxng.datatype.helpers.DatatypeLibraryLoader, as
+this allows you to dynamically locate datatype implementations.
+
+
+----------------------------------------------------------------------
+LINKS
+----------------------------------------------------------------------
+
+* OASIS RELAX NG TC
+ http://www.oasis-open.org/committees/relax-ng/
+* RELAX home page
+ http://www.xml.gr.jp/relax/
+
+
+----------------------------------------------------------------------
+REFERENCES
+----------------------------------------------------------------------
+[1] Sample datatype library implementation by James Clark
+ http://www.thaiopensource.com/relaxng/datatype-sample.zip
+
+Document written by Kohsuke Kawaguchi (kohsuke.kawaguchi at sun.com)
+======================================================================
+END OF README
Propchange: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/README.txt
------------------------------------------------------------------------------
svn:executable = *
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/copying.txt
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/copying.txt?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/copying.txt (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/copying.txt Thu Nov 8 16:56:19 2007
@@ -0,0 +1,30 @@
+Copyright (c) 2001, Thai Open Source Software Center Ltd, Sun Microsystems.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the names of the copyright holders nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Propchange: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/copying.txt
------------------------------------------------------------------------------
svn:executable = *
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/Datatype.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/Datatype.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/Datatype.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/Datatype.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,237 @@
+package org.relaxng.datatype;
+
+/**
+ * Datatype object.
+ *
+ * This object has the following functionality:
+ *
+ * <ol>
+ * <li> functionality to identify a class of character sequences. This is
+ * done through the isValid method.
+ *
+ * <li> functionality to produce a "value object" from a character sequence and
+ * context information.
+ *
+ * <li> functionality to test the equality of two value objects.
+ * </ol>
+ *
+ * This interface also defines the createStreamingValidator method,
+ * which is intended to efficiently support the validation of
+ * large character sequences.
+ *
+ * @author <a href="mailto:jjc at jclark.com">James Clark</a>
+ * @author <a href="mailto:kohsuke.kawaguchi at sun.com">Kohsuke KAWAGUCHI</a>
+ */
+public interface Datatype {
+
+ /**
+ * Checks if the specified 'literal' matches this Datatype
+ * with respect to the current context.
+ *
+ * @param literal
+ * the lexical representation to be checked.
+ * @param context
+ * If this datatype is context-dependent
+ * (i.e. the {@link #isContextDependent} method returns true),
+ * then the caller must provide a non-null valid context object.
+ * Otherwise, the caller can pass null.
+ *
+ * @return
+ * true if the 'literal' is a member of this Datatype;
+ * false if it's not a member of this Datatype.
+ */
+ boolean isValid( String literal, ValidationContext context );
+
+ /**
+ * Similar to the isValid method but throws an exception with diagnosis
+ * in case of errors.
+ *
+ * <p>
+ * If the specified 'literal' is a valid lexical representation for this
+ * datatype, then this method must return without throwing any exception.
+ * If not, the callee must throw an exception (with diagnosis message,
+ * if possible.)
+ *
+ * <p>
+ * The application can use this method to provide detailed error message
+ * to users. This method is kept separate from the isValid method to
+ * achieve higher performance during normal validation.
+ *
+ * @exception DatatypeException
+ * If the given literal is invalid, then this exception is thrown.
+ * If the callee supports error diagnosis, then the exception should
+ * contain a diagnosis message.
+ */
+ void checkValid( String literal, ValidationContext context )
+ throws DatatypeException;
+
+ /**
+ * Creates an instance of a streaming validator for this type.
+ *
+ * <p>
+ * By using streaming validators instead of the isValid method,
+ * the caller can avoid keeping the entire string, which is
+ * sometimes quite big, in memory.
+ *
+ * @param context
+ * If this datatype is context-dependent
+ * (i.e. the {@link #isContextDependent} method returns true),
+ * then the caller must provide a non-null valid context object.
+ * Otherwise, the caller can pass null.
+ * The callee may keep a reference to this context object
+ * only while the returned streaming validator is being used.
+ */
+ DatatypeStreamingValidator createStreamingValidator( ValidationContext context );
+
+ /**
+ * Converts lexcial value and the current context to the corresponding
+ * value object.
+ *
+ * <p>
+ * The caller cannot generally assume that the value object is
+ * a meaningful Java object. For example, the caller cannot expect
+ * this method to return <code>java.lang.Number</code> type for
+ * the "integer" type of XML Schema Part 2.
+ *
+ * <p>
+ * Also, the caller cannot assume that the equals method and
+ * the hashCode method of the value object are consistent with
+ * the semantics of the datatype. For that purpose, the sameValue
+ * method and the valueHashCode method have to be used. Note that
+ * this means you cannot use classes like
+ * <code>java.util.Hashtable</code> to store the value objects.
+ *
+ * <p>
+ * The returned value object should be used solely for the sameValue
+ * and valueHashCode methods.
+ *
+ * @param context
+ * If this datatype is context-dependent
+ * (when the {@link #isContextDependent} method returns true),
+ * then the caller must provide a non-null valid context object.
+ * Otherwise, the caller can pass null.
+ *
+ * @return null
+ * when the given lexical value is not a valid lexical
+ * value for this type.
+ */
+ Object createValue( String literal, ValidationContext context );
+
+ /**
+ * Tests the equality of two value objects which were originally
+ * created by the createValue method of this object.
+ *
+ * The behavior is undefined if objects not created by this type
+ * are passed. It is the caller's responsibility to ensure that
+ * value objects belong to this type.
+ *
+ * @return
+ * true if two value objects are considered equal according to
+ * the definition of this datatype; false if otherwise.
+ */
+ boolean sameValue( Object value1, Object value2 );
+
+
+ /**
+ * Computes the hash code for a value object,
+ * which is consistent with the sameValue method.
+ *
+ * @return
+ * hash code for the specified value object.
+ */
+ int valueHashCode( Object value );
+
+
+
+
+ /**
+ * Indicates that the datatype doesn't have ID/IDREF semantics.
+ *
+ * This value is one of the possible return values of the
+ * {@link #getIdType} method.
+ */
+ public static final int ID_TYPE_NULL = 0;
+
+ /**
+ * Indicates that RELAX NG compatibility processors should
+ * treat this datatype as having ID semantics.
+ *
+ * This value is one of the possible return values of the
+ * {@link #getIdType} method.
+ */
+ public static final int ID_TYPE_ID = 1;
+
+ /**
+ * Indicates that RELAX NG compatibility processors should
+ * treat this datatype as having IDREF semantics.
+ *
+ * This value is one of the possible return values of the
+ * {@link #getIdType} method.
+ */
+ public static final int ID_TYPE_IDREF = 2;
+
+ /**
+ * Indicates that RELAX NG compatibility processors should
+ * treat this datatype as having IDREFS semantics.
+ *
+ * This value is one of the possible return values of the
+ * {@link #getIdType} method.
+ */
+ public static final int ID_TYPE_IDREFS = 3;
+
+ /**
+ * Checks if the ID/IDREF semantics is associated with this
+ * datatype.
+ *
+ * <p>
+ * This method is introduced to support the RELAX NG DTD
+ * compatibility spec. (Of course it's always free to use
+ * this method for other purposes.)
+ *
+ * <p>
+ * If you are implementing a datatype library and have no idea about
+ * the "RELAX NG DTD compatibility" thing, just return
+ * <code>ID_TYPE_NULL</code> is fine.
+ *
+ * @return
+ * If this datatype doesn't have any ID/IDREF semantics,
+ * it returns {@link #ID_TYPE_NULL}. If it has such a semantics
+ * (for example, XSD:ID, XSD:IDREF and comp:ID type), then
+ * it returns {@link #ID_TYPE_ID}, {@link #ID_TYPE_IDREF} or
+ * {@link #ID_TYPE_IDREFS}.
+ */
+ public int getIdType();
+
+
+ /**
+ * Checks if this datatype may need a context object for
+ * the validation.
+ *
+ * <p>
+ * The callee must return true even when the context
+ * is not always necessary. (For example, the "QName" type
+ * doesn't need a context object when validating unprefixed
+ * string. But nonetheless QName must return true.)
+ *
+ * <p>
+ * XSD's <code>string</code> and <code>short</code> types
+ * are examples of context-independent datatypes.
+ * Its <code>QName</code> and <code>ENTITY</code> types
+ * are examples of context-dependent datatypes.
+ *
+ * <p>
+ * When a datatype is context-independent, then
+ * the {@link #isValid} method, the {@link #checkValid} method,
+ * the {@link #createStreamingValidator} method and
+ * the {@link #createValue} method can be called without
+ * providing a context object.
+ *
+ * @return
+ * <b>true</b> if this datatype is context-dependent
+ * (it needs a context object sometimes);
+ *
+ * <b>false</b> if this datatype is context-<b>in</b>dependent
+ * (it never needs a context object).
+ */
+ public boolean isContextDependent();
+}
Propchange: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/Datatype.java
------------------------------------------------------------------------------
svn:executable = *
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeBuilder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeBuilder.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeBuilder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeBuilder.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,45 @@
+package org.relaxng.datatype;
+
+/**
+ * Creates a user-defined type by adding parameters to
+ * the pre-defined type.
+ *
+ * @author <a href="mailto:jjc at jclark.com">James Clark</a>
+ * @author <a href="mailto:kohsuke.kawaguchi at sun.com">Kohsuke KAWAGUCHI</a>
+ */
+public interface DatatypeBuilder {
+
+ /**
+ * Adds a new parameter.
+ *
+ * @param name
+ * The name of the parameter to be added.
+ * @param strValue
+ * The raw value of the parameter. Caller may not normalize
+ * this value because any white space is potentially significant.
+ * @param context
+ * The context information which can be used by the callee to
+ * acquire additional information. This context object is
+ * valid only during this method call. The callee may not
+ * keep a reference to this object.
+ * @exception DatatypeException
+ * When the given parameter is inappropriate for some reason.
+ * The callee is responsible to recover from this error.
+ * That is, the object should behave as if no such error
+ * was occured.
+ */
+ void addParameter( String name, String strValue, ValidationContext context )
+ throws DatatypeException;
+
+ /**
+ * Derives a new Datatype from a Datatype by parameters that
+ * were already set through the addParameter method.
+ *
+ * @exception DatatypeException
+ * DatatypeException must be thrown if the derivation is
+ * somehow invalid. For example, a required parameter is missing,
+ * etc. The exception should contain a diagnosis message
+ * if possible.
+ */
+ Datatype createDatatype() throws DatatypeException;
+}
Propchange: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeBuilder.java
------------------------------------------------------------------------------
svn:executable = *
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,39 @@
+package org.relaxng.datatype;
+
+/**
+ * Signals Datatype related exceptions.
+ *
+ * @author <a href="mailto:jjc at jclark.com">James Clark</a>
+ * @author <a href="mailto:kohsuke.kawaguchi at sun.com">Kohsuke KAWAGUCHI</a>
+ */
+public class DatatypeException extends Exception {
+
+ public DatatypeException( int index, String msg ) {
+ super(msg);
+ this.index = index;
+ }
+ public DatatypeException( String msg ) {
+ this(UNKNOWN,msg);
+ }
+ /**
+ * A constructor for those datatype libraries which don't support any
+ * diagnostic information at all.
+ */
+ public DatatypeException() {
+ this(UNKNOWN,null);
+ }
+
+
+ private final int index;
+
+ public static final int UNKNOWN = -1;
+
+ /**
+ * Gets the index of the content where the error occured.
+ * UNKNOWN can be returned to indicate that no index information
+ * is available.
+ */
+ public int getIndex() {
+ return index;
+ }
+}
Propchange: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeException.java
------------------------------------------------------------------------------
svn:executable = *
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeLibrary.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeLibrary.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeLibrary.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeLibrary.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,37 @@
+package org.relaxng.datatype;
+
+/**
+ * A Datatype library
+ *
+ * @author <a href="mailto:jjc at jclark.com">James Clark</a>
+ * @author <a href="mailto:kohsuke.kawaguchi at sun.com">Kohsuke KAWAGUCHI</a>
+ */
+public interface DatatypeLibrary {
+
+ /**
+ * Creates a new instance of DatatypeBuilder.
+ *
+ * The callee should throw a DatatypeException in case of an error.
+ *
+ * @param baseTypeLocalName
+ * The local name of the base type.
+ *
+ * @return
+ * A non-null valid datatype object.
+ */
+ DatatypeBuilder createDatatypeBuilder( String baseTypeLocalName )
+ throws DatatypeException;
+
+ /**
+ * Gets or creates a pre-defined type.
+ *
+ * This is just a short-cut of
+ * <code>createDatatypeBuilder(typeLocalName).createDatatype();</code>
+ *
+ * The callee should throw a DatatypeException in case of an error.
+ *
+ * @return
+ * A non-null valid datatype object.
+ */
+ Datatype createDatatype( String typeLocalName ) throws DatatypeException;
+}
Propchange: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeLibrary.java
------------------------------------------------------------------------------
svn:executable = *
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeLibraryFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeLibraryFactory.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeLibraryFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeLibraryFactory.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,26 @@
+package org.relaxng.datatype;
+
+/**
+ * Factory class for the DatatypeLibrary class.
+ *
+ * <p>
+ * The datatype library should provide the implementation of
+ * this interface if it wants to be found by the schema processors.
+ * The implementor also have to place a file in your jar file.
+ * See the reference datatype library implementation for detail.
+ *
+ * @author <a href="mailto:jjc at jclark.com">James Clark</a>
+ * @author <a href="mailto:kohsuke.kawaguchi at sun.com">Kohsuke KAWAGUCHI</a>
+ */
+public interface DatatypeLibraryFactory
+{
+ /**
+ * Creates a new instance of a DatatypeLibrary that supports
+ * the specified namespace URI.
+ *
+ * @return
+ * <code>null</code> if the specified namespace URI is not
+ * supported.
+ */
+ DatatypeLibrary createDatatypeLibrary( String namespaceURI );
+}
Propchange: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeLibraryFactory.java
------------------------------------------------------------------------------
svn:executable = *
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeStreamingValidator.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeStreamingValidator.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeStreamingValidator.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeStreamingValidator.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,46 @@
+package org.relaxng.datatype;
+
+/**
+ * Datatype streaming validator.
+ *
+ * <p>
+ * The streaming validator is an optional feature that is useful for
+ * certain Datatypes. It allows the caller to incrementally provide
+ * the literal.
+ *
+ * @author <a href="mailto:jjc at jclark.com">James Clark</a>
+ * @author <a href="mailto:kohsuke.kawaguchi at sun.com">Kohsuke KAWAGUCHI</a>
+ */
+public interface DatatypeStreamingValidator {
+
+ /**
+ * Passes an additional fragment of the literal.
+ *
+ * <p>
+ * The application can call this method several times, then call
+ * the isValid method (or the checkValid method) to check the validity
+ * of the accumulated characters.
+ */
+ void addCharacters( char[] buf, int start, int len );
+
+ /**
+ * Tells if the accumulated literal is valid with respect to
+ * the underlying Datatype.
+ *
+ * @return
+ * True if it is valid. False if otherwise.
+ */
+ boolean isValid();
+
+ /**
+ * Similar to the isValid method, but this method throws
+ * Exception (with possibly diagnostic information), instead of
+ * returning false.
+ *
+ * @exception DatatypeException
+ * If the callee supports the diagnosis and the accumulated
+ * literal is invalid, then this exception that possibly
+ * contains diagnosis information is thrown.
+ */
+ void checkValid() throws DatatypeException;
+}
Propchange: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/DatatypeStreamingValidator.java
------------------------------------------------------------------------------
svn:executable = *
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/ValidationContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/ValidationContext.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/ValidationContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/ValidationContext.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,66 @@
+package org.relaxng.datatype;
+
+/**
+ * An interface that must be implemented by caller to
+ * provide context information that is necessary to
+ * perform validation of some Datatypes.
+ *
+ * @author <a href="mailto:jjc at jclark.com">James Clark</a>
+ * @author <a href="mailto:kohsuke.kawaguchi at sun.com">Kohsuke KAWAGUCHI</a>
+ */
+public interface ValidationContext {
+
+ /**
+ * Resolves a namespace prefix to the corresponding namespace URI.
+ *
+ * This method is used for validating the QName type, for example.
+ *
+ * <p>
+ * If the prefix is "" (empty string), it indicates
+ * an unprefixed value. The callee
+ * should resolve it as for an unprefixed
+ * element, rather than for an unprefixed attribute.
+ *
+ * <p>
+ * If the prefix is "xml", then the callee must resolve
+ * this prefix into "http://www.w3.org/XML/1998/namespace",
+ * as defined in the XML Namespaces Recommendation.
+ *
+ * @return
+ * namespace URI of this prefix.
+ * If the specified prefix is not declared,
+ * the implementation must return null.
+ */
+ String resolveNamespacePrefix( String prefix );
+
+ /**
+ * Returns the base URI of the context. The null string may be returned
+ * if no base URI is known.
+ */
+ String getBaseUri();
+
+ /**
+ * Checks if an unparsed entity is declared with the
+ * specified name.
+ *
+ * @return
+ * true
+ * if the DTD has an unparsed entity declaration for
+ * the specified name.
+ * false
+ * otherwise.
+ */
+ boolean isUnparsedEntity( String entityName );
+
+ /**
+ * Checks if a notation is declared with the
+ * specified name.
+ *
+ * @return
+ * true
+ * if the DTD has a notation declaration for the specified name.
+ * false
+ * otherwise.
+ */
+ boolean isNotation( String notationName );
+}
Propchange: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/ValidationContext.java
------------------------------------------------------------------------------
svn:executable = *
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/DatatypeLibraryLoader.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/DatatypeLibraryLoader.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/DatatypeLibraryLoader.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/DatatypeLibraryLoader.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,262 @@
+/**
+ * Copyright (c) 2001, Thai Open Source Software Center Ltd
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Thai Open Source Software Center Ltd nor
+ * the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.relaxng.datatype.helpers;
+
+import org.relaxng.datatype.DatatypeLibraryFactory;
+import org.relaxng.datatype.DatatypeLibrary;
+import java.util.Enumeration;
+import java.util.NoSuchElementException;
+import java.util.Vector;
+import java.io.Reader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URL;
+
+/**
+ * Discovers the datatype library implementation from the classpath.
+ *
+ * <p>
+ * The call of the createDatatypeLibrary method finds an implementation
+ * from a given datatype library URI at run-time.
+ */
+public class DatatypeLibraryLoader implements DatatypeLibraryFactory {
+ private final Service service = new Service(DatatypeLibraryFactory.class);
+
+ public DatatypeLibrary createDatatypeLibrary(String uri) {
+ for (Enumeration e = service.getProviders();
+ e.hasMoreElements();) {
+ DatatypeLibraryFactory factory
+ = (DatatypeLibraryFactory)e.nextElement();
+ DatatypeLibrary library = factory.createDatatypeLibrary(uri);
+ if (library != null)
+ return library;
+ }
+ return null;
+ }
+
+ private static class Service {
+ private final Class serviceClass;
+ private final Enumeration configFiles;
+ private Enumeration classNames = null;
+ private final Vector providers = new Vector();
+ private Loader loader;
+
+ private class ProviderEnumeration implements Enumeration {
+ private int nextIndex = 0;
+
+ public boolean hasMoreElements() {
+ return nextIndex < providers.size() || moreProviders();
+ }
+
+ public Object nextElement() {
+ try {
+ return providers.elementAt(nextIndex++);
+ }
+ catch (ArrayIndexOutOfBoundsException e) {
+ throw new NoSuchElementException();
+ }
+ }
+ }
+
+ private static class Singleton implements Enumeration {
+ private Object obj;
+ private Singleton(Object obj) {
+ this.obj = obj;
+ }
+
+ public boolean hasMoreElements() {
+ return obj != null;
+ }
+
+ public Object nextElement() {
+ if (obj == null)
+ throw new NoSuchElementException();
+ Object tem = obj;
+ obj = null;
+ return tem;
+ }
+ }
+
+ // JDK 1.1
+ private static class Loader {
+ Enumeration getResources(String resName) {
+ ClassLoader cl = Loader.class.getClassLoader();
+ URL url;
+ if (cl == null)
+ url = ClassLoader.getSystemResource(resName);
+ else
+ url = cl.getResource(resName);
+ return new Singleton(url);
+ }
+
+ Class loadClass(String name) throws ClassNotFoundException {
+ return Class.forName(name);
+ }
+ }
+
+ // JDK 1.2+
+ private static class Loader2 extends Loader {
+ private ClassLoader cl;
+
+ Loader2() {
+ cl = Loader2.class.getClassLoader();
+ // If the thread context class loader has the class loader
+ // of this class as an ancestor, use the thread context class
+ // loader. Otherwise, the thread context class loader
+ // probably hasn't been set up properly, so don't use it.
+ ClassLoader clt = Thread.currentThread().getContextClassLoader();
+ for (ClassLoader tem = clt; tem != null; tem = tem.getParent())
+ if (tem == cl) {
+ cl = clt;
+ break;
+ }
+ }
+
+ Enumeration getResources(String resName) {
+ try {
+ return cl.getResources(resName);
+ }
+ catch (IOException e) {
+ return new Singleton(null);
+ }
+ }
+
+ Class loadClass(String name) throws ClassNotFoundException {
+ return Class.forName(name, true, cl);
+ }
+ }
+
+ public Service(Class cls) {
+ try {
+ loader = new Loader2();
+ }
+ catch (NoSuchMethodError e) {
+ loader = new Loader();
+ }
+ serviceClass = cls;
+ String resName = "META-INF/services/" + serviceClass.getName();
+ configFiles = loader.getResources(resName);
+ }
+
+ public Enumeration getProviders() {
+ return new ProviderEnumeration();
+ }
+
+ synchronized private boolean moreProviders() {
+ for (;;) {
+ while (classNames == null) {
+ if (!configFiles.hasMoreElements())
+ return false;
+ classNames = parseConfigFile((URL)configFiles.nextElement());
+ }
+ while (classNames.hasMoreElements()) {
+ String className = (String)classNames.nextElement();
+ try {
+ Class cls = loader.loadClass(className);
+ Object obj = cls.newInstance();
+ if (serviceClass.isInstance(obj)) {
+ providers.addElement(obj);
+ return true;
+ }
+ }
+ catch (ClassNotFoundException e) { }
+ catch (InstantiationException e) { }
+ catch (IllegalAccessException e) { }
+ catch (LinkageError e) { }
+ }
+ classNames = null;
+ }
+ }
+
+ private static final int START = 0;
+ private static final int IN_NAME = 1;
+ private static final int IN_COMMENT = 2;
+
+ private static Enumeration parseConfigFile(URL url) {
+ try {
+ InputStream in = url.openStream();
+ Reader r;
+ try {
+ r = new InputStreamReader(in, "UTF-8");
+ }
+ catch (UnsupportedEncodingException e) {
+ r = new InputStreamReader(in, "UTF8");
+ }
+ r = new BufferedReader(r);
+ Vector tokens = new Vector();
+ StringBuffer tokenBuf = new StringBuffer();
+ int state = START;
+ for (;;) {
+ int n = r.read();
+ if (n < 0)
+ break;
+ char c = (char)n;
+ switch (c) {
+ case '\r':
+ case '\n':
+ state = START;
+ break;
+ case ' ':
+ case '\t':
+ break;
+ case '#':
+ state = IN_COMMENT;
+ break;
+ default:
+ if (state != IN_COMMENT) {
+ state = IN_NAME;
+ tokenBuf.append(c);
+ }
+ break;
+ }
+ if (tokenBuf.length() != 0 && state != IN_NAME) {
+ tokens.addElement(tokenBuf.toString());
+ tokenBuf.setLength(0);
+ }
+ }
+ if (tokenBuf.length() != 0)
+ tokens.addElement(tokenBuf.toString());
+ return tokens.elements();
+ }
+ catch (IOException e) {
+ return null;
+ }
+ }
+ }
+
+}
+
Propchange: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/DatatypeLibraryLoader.java
------------------------------------------------------------------------------
svn:executable = *
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/ParameterlessDatatypeBuilder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/ParameterlessDatatypeBuilder.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/ParameterlessDatatypeBuilder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/ParameterlessDatatypeBuilder.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,42 @@
+package org.relaxng.datatype.helpers;
+
+import org.relaxng.datatype.*;
+
+/**
+ * Dummy implementation of {@link DatatypeBuilder}.
+ *
+ * This implementation can be used for Datatypes which have no parameters.
+ * Any attempt to add parameters will be rejected.
+ *
+ * <p>
+ * Typical usage would be:
+ * <PRE><XMP>
+ * class MyDatatypeLibrary implements DatatypeLibrary {
+ * ....
+ * DatatypeBuilder createDatatypeBuilder( String typeName ) {
+ * return new ParameterleessDatatypeBuilder(createDatatype(typeName));
+ * }
+ * ....
+ * }
+ * </XMP></PRE>
+ *
+ * @author <a href="mailto:kohsuke.kawaguchi at sun.com">Kohsuke KAWAGUCHI</a>
+ */
+public final class ParameterlessDatatypeBuilder implements DatatypeBuilder {
+
+ /** This type object is returned for the derive method. */
+ private final Datatype baseType;
+
+ public ParameterlessDatatypeBuilder( Datatype baseType ) {
+ this.baseType = baseType;
+ }
+
+ public void addParameter( String name, String strValue, ValidationContext context )
+ throws DatatypeException {
+ throw new DatatypeException();
+ }
+
+ public Datatype createDatatype() throws DatatypeException {
+ return baseType;
+ }
+}
Propchange: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/ParameterlessDatatypeBuilder.java
------------------------------------------------------------------------------
svn:executable = *
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/StreamingValidatorImpl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/StreamingValidatorImpl.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/StreamingValidatorImpl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/StreamingValidatorImpl.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,55 @@
+package org.relaxng.datatype.helpers;
+
+import org.relaxng.datatype.*;
+
+/**
+ * Dummy implementation of {@link DatatypeStreamingValidator}.
+ *
+ * <p>
+ * This implementation can be used as a quick hack when the performance
+ * of streaming validation is not important. And this implementation
+ * also shows you how to implement the DatatypeStreamingValidator interface.
+ *
+ * <p>
+ * Typical usage would be:
+ * <PRE><XMP>
+ * class MyDatatype implements Datatype {
+ * ....
+ * public DatatypeStreamingValidator createStreamingValidator( ValidationContext context ) {
+ * return new StreamingValidatorImpl(this,context);
+ * }
+ * ....
+ * }
+ * </XMP></PRE>
+ *
+ * @author <a href="mailto:kohsuke.kawaguchi at sun.com">Kohsuke KAWAGUCHI</a>
+ */
+public final class StreamingValidatorImpl implements DatatypeStreamingValidator {
+
+ /** This buffer accumulates characters. */
+ private final StringBuffer buffer = new StringBuffer();
+
+ /** Datatype obejct that creates this streaming validator. */
+ private final Datatype baseType;
+
+ /** The current context. */
+ private final ValidationContext context;
+
+ public void addCharacters( char[] buf, int start, int len ) {
+ // append characters to the current buffer.
+ buffer.append(buf,start,len);
+ }
+
+ public boolean isValid() {
+ return baseType.isValid(buffer.toString(),context);
+ }
+
+ public void checkValid() throws DatatypeException {
+ baseType.checkValid(buffer.toString(),context);
+ }
+
+ public StreamingValidatorImpl( Datatype baseType, ValidationContext context ) {
+ this.baseType = baseType;
+ this.context = context;
+ }
+}
Propchange: llvm-gcc-4.2/trunk/libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/StreamingValidatorImpl.java
------------------------------------------------------------------------------
svn:executable = *
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/Makefile.am?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/Makefile.am Thu Nov 8 16:56:19 2007
@@ -0,0 +1,42 @@
+## Input file for automake to generate the Makefile.in used by configure
+
+EXTRA_DIST = README \
+org/xml/sax/ext/Attributes2.java \
+org/xml/sax/ext/Attributes2Impl.java \
+org/xml/sax/ext/DeclHandler.java \
+org/xml/sax/ext/DefaultHandler2.java \
+org/xml/sax/ext/EntityResolver2.java \
+org/xml/sax/ext/LexicalHandler.java \
+org/xml/sax/ext/Locator2.java \
+org/xml/sax/ext/Locator2Impl.java \
+org/xml/sax/ext/package.html \
+org/xml/sax/helpers/AttributeListImpl.java \
+org/xml/sax/helpers/AttributesImpl.java \
+org/xml/sax/helpers/DefaultHandler.java \
+org/xml/sax/helpers/LocatorImpl.java \
+org/xml/sax/helpers/NamespaceSupport.java \
+org/xml/sax/helpers/NewInstance.java \
+org/xml/sax/helpers/ParserAdapter.java \
+org/xml/sax/helpers/ParserFactory.java \
+org/xml/sax/helpers/XMLFilterImpl.java \
+org/xml/sax/helpers/XMLReaderAdapter.java \
+org/xml/sax/helpers/XMLReaderFactory.java \
+org/xml/sax/helpers/package.html \
+org/xml/sax/AttributeList.java \
+org/xml/sax/Attributes.java \
+org/xml/sax/ContentHandler.java \
+org/xml/sax/DTDHandler.java \
+org/xml/sax/DocumentHandler.java \
+org/xml/sax/EntityResolver.java \
+org/xml/sax/ErrorHandler.java \
+org/xml/sax/HandlerBase.java \
+org/xml/sax/InputSource.java \
+org/xml/sax/Locator.java \
+org/xml/sax/Parser.java \
+org/xml/sax/SAXException.java \
+org/xml/sax/SAXNotRecognizedException.java \
+org/xml/sax/SAXNotSupportedException.java \
+org/xml/sax/SAXParseException.java \
+org/xml/sax/XMLFilter.java \
+org/xml/sax/XMLReader.java \
+org/xml/sax/package.html
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/Makefile.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/Makefile.in?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/Makefile.in Thu Nov 8 16:56:19 2007
@@ -0,0 +1,489 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = external/sax
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
+ $(top_srcdir)/../../config/lead-dot.m4 \
+ $(top_srcdir)/../../config/multi.m4 \
+ $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
+ $(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
+ $(top_srcdir)/m4/ax_create_stdint_h.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
+CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
+CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_PLUGIN_FALSE = @CREATE_PLUGIN_FALSE@
+CREATE_PLUGIN_TRUE = @CREATE_PLUGIN_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_WRAPPERS_FALSE = @CREATE_WRAPPERS_FALSE@
+CREATE_WRAPPERS_TRUE = @CREATE_WRAPPERS_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@
+ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FASTJAR = @FASTJAR@
+FIND = @FIND@
+FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
+FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+GDK_CFLAGS = @GDK_CFLAGS@
+GDK_LIBS = @GDK_LIBS@
+GJDOC = @GJDOC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+JIKESWARNINGS = @JIKESWARNINGS@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBMAGIC = @LIBMAGIC@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
+MOZILLA_LIBS = @MOZILLA_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_ESCHER = @PATH_TO_ESCHER@
+PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGIN_DIR = @PLUGIN_DIR@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
+USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
+USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
+USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@
+VERSION = @VERSION@
+VM_BINARY = @VM_BINARY@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+XTEST_LIBS = @XTEST_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+nativeexeclibdir = @nativeexeclibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexeclibdir = @toolexeclibdir@
+vm_classes = @vm_classes@
+EXTRA_DIST = README \
+org/xml/sax/ext/Attributes2.java \
+org/xml/sax/ext/Attributes2Impl.java \
+org/xml/sax/ext/DeclHandler.java \
+org/xml/sax/ext/DefaultHandler2.java \
+org/xml/sax/ext/EntityResolver2.java \
+org/xml/sax/ext/LexicalHandler.java \
+org/xml/sax/ext/Locator2.java \
+org/xml/sax/ext/Locator2Impl.java \
+org/xml/sax/ext/package.html \
+org/xml/sax/helpers/AttributeListImpl.java \
+org/xml/sax/helpers/AttributesImpl.java \
+org/xml/sax/helpers/DefaultHandler.java \
+org/xml/sax/helpers/LocatorImpl.java \
+org/xml/sax/helpers/NamespaceSupport.java \
+org/xml/sax/helpers/NewInstance.java \
+org/xml/sax/helpers/ParserAdapter.java \
+org/xml/sax/helpers/ParserFactory.java \
+org/xml/sax/helpers/XMLFilterImpl.java \
+org/xml/sax/helpers/XMLReaderAdapter.java \
+org/xml/sax/helpers/XMLReaderFactory.java \
+org/xml/sax/helpers/package.html \
+org/xml/sax/AttributeList.java \
+org/xml/sax/Attributes.java \
+org/xml/sax/ContentHandler.java \
+org/xml/sax/DTDHandler.java \
+org/xml/sax/DocumentHandler.java \
+org/xml/sax/EntityResolver.java \
+org/xml/sax/ErrorHandler.java \
+org/xml/sax/HandlerBase.java \
+org/xml/sax/InputSource.java \
+org/xml/sax/Locator.java \
+org/xml/sax/Parser.java \
+org/xml/sax/SAXException.java \
+org/xml/sax/SAXNotRecognizedException.java \
+org/xml/sax/SAXNotSupportedException.java \
+org/xml/sax/SAXParseException.java \
+org/xml/sax/XMLFilter.java \
+org/xml/sax/XMLReader.java \
+org/xml/sax/package.html
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu external/sax/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu external/sax/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ $(mkdir_p) $(distdir)/org/xml/sax $(distdir)/org/xml/sax/ext $(distdir)/org/xml/sax/helpers
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/README
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/README?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/README (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/README Thu Nov 8 16:56:19 2007
@@ -0,0 +1,71 @@
+Simple API for XML (SAX), a standard application interface for processing XML.
+SAX is not maintained as part of GNU Classpath, but is used with GNU Classpath.
+
+Last imported version sax2r3 final from http://www.saxproject.org/
+
+All files are distributed with the following short notice:
+
+ NO WARRANTY! This class is in the Public Domain.
+
+The www.saxproject.org explains:
+
+ Copyright Status
+
+ SAX is free!
+
+ In fact, it's not possible to own a license to SAX, since it's been
+ placed in the public domain.
+
+ No Warranty
+
+ Because SAX is released to the public domain, there is no warranty
+ for the design or for the software implementation, to the extent
+ permitted by applicable law. Except when otherwise stated in writing
+ the copyright holders and/or other parties provide SAX "as is" without
+ warranty of any kind, either expressed or implied, including, but not
+ limited to, the implied warranties of merchantability and fitness for
+ a particular purpose. The entire risk as to the quality and
+ performance of SAX is with you. Should SAX prove defective, you assume
+ the cost of all necessary servicing, repair or correction.
+
+ In no event unless required by applicable law or agreed to in
+ writing will any copyright holder, or any other party who may modify
+ and/or redistribute SAX, be liable to you for damages, including any
+ general, special, incidental or consequential damages arising out of
+ the use or inability to use SAX (including but not limited to loss of
+ data or data being rendered inaccurate or losses sustained by you or
+ third parties or a failure of the SAX to operate with any other
+ programs), even if such holder or other party has been advised of the
+ possibility of such damages.
+
+ Copyright Disclaimers
+
+ This page includes statements to that effect by David Megginson, who
+ would have been able to claim copyright for the original work.
+
+ SAX 1.0
+
+ Version 1.0 of the Simple API for XML (SAX), created collectively by
+ the membership of the XML-DEV mailing list, is hereby released into
+ the public domain.
+
+ No one owns SAX: you may use it freely in both commercial and
+ non-commercial applications, bundle it with your software
+ distribution, include it on a CD-ROM, list the source code in a book,
+ mirror the documentation at your own web site, or use it in any other
+ way you see fit.
+
+ David Megginson, sax at megginson.com
+ 1998-05-11
+
+ SAX 2.0
+
+ I hereby abandon any property rights to SAX 2.0 (the Simple API for
+ XML), and release all of the SAX 2.0 source code, compiled code, and
+ documentation contained in this distribution into the Public
+ Domain. SAX comes with NO WARRANTY or guarantee of fitness for any
+ purpose.
+
+ David Megginson, david at megginson.com
+ 2000-05-05
+
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/AttributeList.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/AttributeList.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/AttributeList.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/AttributeList.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,193 @@
+// SAX Attribute List Interface.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: AttributeList.java,v 1.10 2004/12/11 15:41:09 dog Exp $
+
+package org.xml.sax;
+
+/**
+ * Interface for an element's attribute specifications.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This is the original SAX1 interface for reporting an element's
+ * attributes. Unlike the new {@link org.xml.sax.Attributes Attributes}
+ * interface, it does not support Namespace-related information.</p>
+ *
+ * <p>When an attribute list is supplied as part of a
+ * {@link org.xml.sax.DocumentHandler#startElement startElement}
+ * event, the list will return valid results only during the
+ * scope of the event; once the event handler returns control
+ * to the parser, the attribute list is invalid. To save a
+ * persistent copy of the attribute list, use the SAX1
+ * {@link org.xml.sax.helpers.AttributeListImpl AttributeListImpl}
+ * helper class.</p>
+ *
+ * <p>An attribute list includes only attributes that have been
+ * specified or defaulted: #IMPLIED attributes will not be included.</p>
+ *
+ * <p>There are two ways for the SAX application to obtain information
+ * from the AttributeList. First, it can iterate through the entire
+ * list:</p>
+ *
+ * <pre>
+ * public void startElement (String name, AttributeList atts) {
+ * for (int i = 0; i < atts.getLength(); i++) {
+ * String name = atts.getName(i);
+ * String type = atts.getType(i);
+ * String value = atts.getValue(i);
+ * [...]
+ * }
+ * }
+ * </pre>
+ *
+ * <p>(Note that the result of getLength() will be zero if there
+ * are no attributes.)
+ *
+ * <p>As an alternative, the application can request the value or
+ * type of specific attributes:</p>
+ *
+ * <pre>
+ * public void startElement (String name, AttributeList atts) {
+ * String identifier = atts.getValue("id");
+ * String label = atts.getValue("label");
+ * [...]
+ * }
+ * </pre>
+ *
+ * @deprecated This interface has been replaced by the SAX2
+ * {@link org.xml.sax.Attributes Attributes}
+ * interface, which includes Namespace support.
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.DocumentHandler#startElement startElement
+ * @see org.xml.sax.helpers.AttributeListImpl AttributeListImpl
+ */
+public interface AttributeList {
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Iteration methods.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Return the number of attributes in this list.
+ *
+ * <p>The SAX parser may provide attributes in any
+ * arbitrary order, regardless of the order in which they were
+ * declared or specified. The number of attributes may be
+ * zero.</p>
+ *
+ * @return The number of attributes in the list.
+ */
+ public abstract int getLength ();
+
+
+ /**
+ * Return the name of an attribute in this list (by position).
+ *
+ * <p>The names must be unique: the SAX parser shall not include the
+ * same attribute twice. Attributes without values (those declared
+ * #IMPLIED without a value specified in the start tag) will be
+ * omitted from the list.</p>
+ *
+ * <p>If the attribute name has a namespace prefix, the prefix
+ * will still be attached.</p>
+ *
+ * @param i The index of the attribute in the list (starting at 0).
+ * @return The name of the indexed attribute, or null
+ * if the index is out of range.
+ * @see #getLength
+ */
+ public abstract String getName (int i);
+
+
+ /**
+ * Return the type of an attribute in the list (by position).
+ *
+ * <p>The attribute type is one of the strings "CDATA", "ID",
+ * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES",
+ * or "NOTATION" (always in upper case).</p>
+ *
+ * <p>If the parser has not read a declaration for the attribute,
+ * or if the parser does not report attribute types, then it must
+ * return the value "CDATA" as stated in the XML 1.0 Recommentation
+ * (clause 3.3.3, "Attribute-Value Normalization").</p>
+ *
+ * <p>For an enumerated attribute that is not a notation, the
+ * parser will report the type as "NMTOKEN".</p>
+ *
+ * @param i The index of the attribute in the list (starting at 0).
+ * @return The attribute type as a string, or
+ * null if the index is out of range.
+ * @see #getLength
+ * @see #getType(java.lang.String)
+ */
+ public abstract String getType (int i);
+
+
+ /**
+ * Return the value of an attribute in the list (by position).
+ *
+ * <p>If the attribute value is a list of tokens (IDREFS,
+ * ENTITIES, or NMTOKENS), the tokens will be concatenated
+ * into a single string separated by whitespace.</p>
+ *
+ * @param i The index of the attribute in the list (starting at 0).
+ * @return The attribute value as a string, or
+ * null if the index is out of range.
+ * @see #getLength
+ * @see #getValue(java.lang.String)
+ */
+ public abstract String getValue (int i);
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Lookup methods.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Return the type of an attribute in the list (by name).
+ *
+ * <p>The return value is the same as the return value for
+ * getType(int).</p>
+ *
+ * <p>If the attribute name has a namespace prefix in the document,
+ * the application must include the prefix here.</p>
+ *
+ * @param name The name of the attribute.
+ * @return The attribute type as a string, or null if no
+ * such attribute exists.
+ * @see #getType(int)
+ */
+ public abstract String getType (String name);
+
+
+ /**
+ * Return the value of an attribute in the list (by name).
+ *
+ * <p>The return value is the same as the return value for
+ * getValue(int).</p>
+ *
+ * <p>If the attribute name has a namespace prefix in the document,
+ * the application must include the prefix here.</p>
+ *
+ * @param name the name of the attribute to return
+ * @return The attribute value as a string, or null if
+ * no such attribute exists.
+ * @see #getValue(int)
+ */
+ public abstract String getValue (String name);
+
+}
+
+// end of AttributeList.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/Attributes.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/Attributes.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/Attributes.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/Attributes.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,257 @@
+// Attributes.java - attribute list with Namespace support
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the public domain.
+// $Id: Attributes.java,v 1.10 2004/12/11 15:41:09 dog Exp $
+
+package org.xml.sax;
+
+
+/**
+ * Interface for a list of XML attributes.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This interface allows access to a list of attributes in
+ * three different ways:</p>
+ *
+ * <ol>
+ * <li>by attribute index;</li>
+ * <li>by Namespace-qualified name; or</li>
+ * <li>by qualified (prefixed) name.</li>
+ * </ol>
+ *
+ * <p>The list will not contain attributes that were declared
+ * #IMPLIED but not specified in the start tag. It will also not
+ * contain attributes used as Namespace declarations (xmlns*) unless
+ * the <code>http://xml.org/sax/features/namespace-prefixes</code>
+ * feature is set to <var>true</var> (it is <var>false</var> by
+ * default).
+ * Because SAX2 conforms to the original "Namespaces in XML"
+ * recommendation, it normally does not
+ * give namespace declaration attributes a namespace URI.
+ * </p>
+ *
+ * <p>Some SAX2 parsers may support using an optional feature flag
+ * (<code>http://xml.org/sax/features/xmlns-uris</code>) to request
+ * that those attributes be given URIs, conforming to a later
+ * backwards-incompatible revision of that recommendation. (The
+ * attribute's "local name" will be the prefix, or "xmlns" when
+ * defining a default element namespace.) For portability, handler
+ * code should always resolve that conflict, rather than requiring
+ * parsers that can change the setting of that feature flag. </p>
+ *
+ * <p>If the namespace-prefixes feature (see above) is
+ * <var>false</var>, access by qualified name may not be available; if
+ * the <code>http://xml.org/sax/features/namespaces</code> feature is
+ * <var>false</var>, access by Namespace-qualified names may not be
+ * available.</p>
+ *
+ * <p>This interface replaces the now-deprecated SAX1 {@link
+ * org.xml.sax.AttributeList AttributeList} interface, which does not
+ * contain Namespace support. In addition to Namespace support, it
+ * adds the <var>getIndex</var> methods (below).</p>
+ *
+ * <p>The order of attributes in the list is unspecified, and will
+ * vary from implementation to implementation.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.helpers.AttributesImpl
+ * @see org.xml.sax.ext.DeclHandler#attributeDecl
+ */
+public interface Attributes
+{
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Indexed access.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Return the number of attributes in the list.
+ *
+ * <p>Once you know the number of attributes, you can iterate
+ * through the list.</p>
+ *
+ * @return The number of attributes in the list.
+ * @see #getURI(int)
+ * @see #getLocalName(int)
+ * @see #getQName(int)
+ * @see #getType(int)
+ * @see #getValue(int)
+ */
+ public abstract int getLength ();
+
+
+ /**
+ * Look up an attribute's Namespace URI by index.
+ *
+ * @param index The attribute index (zero-based).
+ * @return The Namespace URI, or the empty string if none
+ * is available, or null if the index is out of
+ * range.
+ * @see #getLength
+ */
+ public abstract String getURI (int index);
+
+
+ /**
+ * Look up an attribute's local name by index.
+ *
+ * @param index The attribute index (zero-based).
+ * @return The local name, or the empty string if Namespace
+ * processing is not being performed, or null
+ * if the index is out of range.
+ * @see #getLength
+ */
+ public abstract String getLocalName (int index);
+
+
+ /**
+ * Look up an attribute's XML qualified (prefixed) name by index.
+ *
+ * @param index The attribute index (zero-based).
+ * @return The XML qualified name, or the empty string
+ * if none is available, or null if the index
+ * is out of range.
+ * @see #getLength
+ */
+ public abstract String getQName (int index);
+
+
+ /**
+ * Look up an attribute's type by index.
+ *
+ * <p>The attribute type is one of the strings "CDATA", "ID",
+ * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES",
+ * or "NOTATION" (always in upper case).</p>
+ *
+ * <p>If the parser has not read a declaration for the attribute,
+ * or if the parser does not report attribute types, then it must
+ * return the value "CDATA" as stated in the XML 1.0 Recommendation
+ * (clause 3.3.3, "Attribute-Value Normalization").</p>
+ *
+ * <p>For an enumerated attribute that is not a notation, the
+ * parser will report the type as "NMTOKEN".</p>
+ *
+ * @param index The attribute index (zero-based).
+ * @return The attribute's type as a string, or null if the
+ * index is out of range.
+ * @see #getLength
+ */
+ public abstract String getType (int index);
+
+
+ /**
+ * Look up an attribute's value by index.
+ *
+ * <p>If the attribute value is a list of tokens (IDREFS,
+ * ENTITIES, or NMTOKENS), the tokens will be concatenated
+ * into a single string with each token separated by a
+ * single space.</p>
+ *
+ * @param index The attribute index (zero-based).
+ * @return The attribute's value as a string, or null if the
+ * index is out of range.
+ * @see #getLength
+ */
+ public abstract String getValue (int index);
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Name-based query.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Look up the index of an attribute by Namespace name.
+ *
+ * @param uri The Namespace URI, or the empty string if
+ * the name has no Namespace URI.
+ * @param localName The attribute's local name.
+ * @return The index of the attribute, or -1 if it does not
+ * appear in the list.
+ */
+ public int getIndex (String uri, String localName);
+
+
+ /**
+ * Look up the index of an attribute by XML qualified (prefixed) name.
+ *
+ * @param qName The qualified (prefixed) name.
+ * @return The index of the attribute, or -1 if it does not
+ * appear in the list.
+ */
+ public int getIndex (String qName);
+
+
+ /**
+ * Look up an attribute's type by Namespace name.
+ *
+ * <p>See {@link #getType(int) getType(int)} for a description
+ * of the possible types.</p>
+ *
+ * @param uri The Namespace URI, or the empty String if the
+ * name has no Namespace URI.
+ * @param localName The local name of the attribute.
+ * @return The attribute type as a string, or null if the
+ * attribute is not in the list or if Namespace
+ * processing is not being performed.
+ */
+ public abstract String getType (String uri, String localName);
+
+
+ /**
+ * Look up an attribute's type by XML qualified (prefixed) name.
+ *
+ * <p>See {@link #getType(int) getType(int)} for a description
+ * of the possible types.</p>
+ *
+ * @param qName The XML qualified name.
+ * @return The attribute type as a string, or null if the
+ * attribute is not in the list or if qualified names
+ * are not available.
+ */
+ public abstract String getType (String qName);
+
+
+ /**
+ * Look up an attribute's value by Namespace name.
+ *
+ * <p>See {@link #getValue(int) getValue(int)} for a description
+ * of the possible values.</p>
+ *
+ * @param uri The Namespace URI, or the empty String if the
+ * name has no Namespace URI.
+ * @param localName The local name of the attribute.
+ * @return The attribute value as a string, or null if the
+ * attribute is not in the list.
+ */
+ public abstract String getValue (String uri, String localName);
+
+
+ /**
+ * Look up an attribute's value by XML qualified (prefixed) name.
+ *
+ * <p>See {@link #getValue(int) getValue(int)} for a description
+ * of the possible values.</p>
+ *
+ * @param qName The XML qualified name.
+ * @return The attribute value as a string, or null if the
+ * attribute is not in the list or if qualified names
+ * are not available.
+ */
+ public abstract String getValue (String qName);
+
+}
+
+// end of Attributes.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ContentHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ContentHandler.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ContentHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ContentHandler.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,419 @@
+// ContentHandler.java - handle main document content.
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the public domain.
+// $Id: ContentHandler.java,v 1.10 2004/12/11 15:41:09 dog Exp $
+
+package org.xml.sax;
+
+
+/**
+ * Receive notification of the logical content of a document.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This is the main interface that most SAX applications
+ * implement: if the application needs to be informed of basic parsing
+ * events, it implements this interface and registers an instance with
+ * the SAX parser using the {@link org.xml.sax.XMLReader#setContentHandler
+ * setContentHandler} method. The parser uses the instance to report
+ * basic document-related events like the start and end of elements
+ * and character data.</p>
+ *
+ * <p>The order of events in this interface is very important, and
+ * mirrors the order of information in the document itself. For
+ * example, all of an element's content (character data, processing
+ * instructions, and/or subelements) will appear, in order, between
+ * the startElement event and the corresponding endElement event.</p>
+ *
+ * <p>This interface is similar to the now-deprecated SAX 1.0
+ * DocumentHandler interface, but it adds support for Namespaces
+ * and for reporting skipped entities (in non-validating XML
+ * processors).</p>
+ *
+ * <p>Implementors should note that there is also a
+ * <code>ContentHandler</code> class in the <code>java.net</code>
+ * package; that means that it's probably a bad idea to do</p>
+ *
+ * <pre>import java.net.*;
+ * import org.xml.sax.*;
+ * </pre>
+ *
+ * <p>In fact, "import ...*" is usually a sign of sloppy programming
+ * anyway, so the user should consider this a feature rather than a
+ * bug.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1+ (sax2r3pre1)
+ * @see org.xml.sax.XMLReader
+ * @see org.xml.sax.DTDHandler
+ * @see org.xml.sax.ErrorHandler
+ */
+public interface ContentHandler
+{
+
+ /**
+ * Receive an object for locating the origin of SAX document events.
+ *
+ * <p>SAX parsers are strongly encouraged (though not absolutely
+ * required) to supply a locator: if it does so, it must supply
+ * the locator to the application by invoking this method before
+ * invoking any of the other methods in the ContentHandler
+ * interface.</p>
+ *
+ * <p>The locator allows the application to determine the end
+ * position of any document-related event, even if the parser is
+ * not reporting an error. Typically, the application will
+ * use this information for reporting its own errors (such as
+ * character content that does not match an application's
+ * business rules). The information returned by the locator
+ * is probably not sufficient for use with a search engine.</p>
+ *
+ * <p>Note that the locator will return correct information only
+ * during the invocation SAX event callbacks after
+ * {@link #startDocument startDocument} returns and before
+ * {@link #endDocument endDocument} is called. The
+ * application should not attempt to use it at any other time.</p>
+ *
+ * @param locator an object that can return the location of
+ * any SAX document event
+ * @see org.xml.sax.Locator
+ */
+ public void setDocumentLocator (Locator locator);
+
+
+ /**
+ * Receive notification of the beginning of a document.
+ *
+ * <p>The SAX parser will invoke this method only once, before any
+ * other event callbacks (except for {@link #setDocumentLocator
+ * setDocumentLocator}).</p>
+ *
+ * @throws org.xml.sax.SAXException any SAX exception, possibly
+ * wrapping another exception
+ * @see #endDocument
+ */
+ public void startDocument ()
+ throws SAXException;
+
+
+ /**
+ * Receive notification of the end of a document.
+ *
+ * <p><strong>There is an apparent contradiction between the
+ * documentation for this method and the documentation for {@link
+ * org.xml.sax.ErrorHandler#fatalError}. Until this ambiguity is
+ * resolved in a future major release, clients should make no
+ * assumptions about whether endDocument() will or will not be
+ * invoked when the parser has reported a fatalError() or thrown
+ * an exception.</strong></p>
+ *
+ * <p>The SAX parser will invoke this method only once, and it will
+ * be the last method invoked during the parse. The parser shall
+ * not invoke this method until it has either abandoned parsing
+ * (because of an unrecoverable error) or reached the end of
+ * input.</p>
+ *
+ * @throws org.xml.sax.SAXException any SAX exception, possibly
+ * wrapping another exception
+ * @see #startDocument
+ */
+ public void endDocument()
+ throws SAXException;
+
+
+ /**
+ * Begin the scope of a prefix-URI Namespace mapping.
+ *
+ * <p>The information from this event is not necessary for
+ * normal Namespace processing: the SAX XML reader will
+ * automatically replace prefixes for element and attribute
+ * names when the <code>http://xml.org/sax/features/namespaces</code>
+ * feature is <var>true</var> (the default).</p>
+ *
+ * <p>There are cases, however, when applications need to
+ * use prefixes in character data or in attribute values,
+ * where they cannot safely be expanded automatically; the
+ * start/endPrefixMapping event supplies the information
+ * to the application to expand prefixes in those contexts
+ * itself, if necessary.</p>
+ *
+ * <p>Note that start/endPrefixMapping events are not
+ * guaranteed to be properly nested relative to each other:
+ * all startPrefixMapping events will occur immediately before the
+ * corresponding {@link #startElement startElement} event,
+ * and all {@link #endPrefixMapping endPrefixMapping}
+ * events will occur immediately after the corresponding
+ * {@link #endElement endElement} event,
+ * but their order is not otherwise
+ * guaranteed.</p>
+ *
+ * <p>There should never be start/endPrefixMapping events for the
+ * "xml" prefix, since it is predeclared and immutable.</p>
+ *
+ * @param prefix the Namespace prefix being declared.
+ * An empty string is used for the default element namespace,
+ * which has no prefix.
+ * @param uri the Namespace URI the prefix is mapped to
+ * @throws org.xml.sax.SAXException the client may throw
+ * an exception during processing
+ * @see #endPrefixMapping
+ * @see #startElement
+ */
+ public void startPrefixMapping (String prefix, String uri)
+ throws SAXException;
+
+
+ /**
+ * End the scope of a prefix-URI mapping.
+ *
+ * <p>See {@link #startPrefixMapping startPrefixMapping} for
+ * details. These events will always occur immediately after the
+ * corresponding {@link #endElement endElement} event, but the order of
+ * {@link #endPrefixMapping endPrefixMapping} events is not otherwise
+ * guaranteed.</p>
+ *
+ * @param prefix the prefix that was being mapped.
+ * This is the empty string when a default mapping scope ends.
+ * @throws org.xml.sax.SAXException the client may throw
+ * an exception during processing
+ * @see #startPrefixMapping
+ * @see #endElement
+ */
+ public void endPrefixMapping (String prefix)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of the beginning of an element.
+ *
+ * <p>The Parser will invoke this method at the beginning of every
+ * element in the XML document; there will be a corresponding
+ * {@link #endElement endElement} event for every startElement event
+ * (even when the element is empty). All of the element's content will be
+ * reported, in order, before the corresponding endElement
+ * event.</p>
+ *
+ * <p>This event allows up to three name components for each
+ * element:</p>
+ *
+ * <ol>
+ * <li>the Namespace URI;</li>
+ * <li>the local name; and</li>
+ * <li>the qualified (prefixed) name.</li>
+ * </ol>
+ *
+ * <p>Any or all of these may be provided, depending on the
+ * values of the <var>http://xml.org/sax/features/namespaces</var>
+ * and the <var>http://xml.org/sax/features/namespace-prefixes</var>
+ * properties:</p>
+ *
+ * <ul>
+ * <li>the Namespace URI and local name are required when
+ * the namespaces property is <var>true</var> (the default), and are
+ * optional when the namespaces property is <var>false</var> (if one is
+ * specified, both must be);</li>
+ * <li>the qualified name is required when the namespace-prefixes property
+ * is <var>true</var>, and is optional when the namespace-prefixes property
+ * is <var>false</var> (the default).</li>
+ * </ul>
+ *
+ * <p>Note that the attribute list provided will contain only
+ * attributes with explicit values (specified or defaulted):
+ * #IMPLIED attributes will be omitted. The attribute list
+ * will contain attributes used for Namespace declarations
+ * (xmlns* attributes) only if the
+ * <code>http://xml.org/sax/features/namespace-prefixes</code>
+ * property is true (it is false by default, and support for a
+ * true value is optional).</p>
+ *
+ * <p>Like {@link #characters characters()}, attribute values may have
+ * characters that need more than one <code>char</code> value. </p>
+ *
+ * @param uri the Namespace URI, or the empty string if the
+ * element has no Namespace URI or if Namespace
+ * processing is not being performed
+ * @param localName the local name (without prefix), or the
+ * empty string if Namespace processing is not being
+ * performed
+ * @param qName the qualified name (with prefix), or the
+ * empty string if qualified names are not available
+ * @param atts the attributes attached to the element. If
+ * there are no attributes, it shall be an empty
+ * Attributes object. The value of this object after
+ * startElement returns is undefined
+ * @throws org.xml.sax.SAXException any SAX exception, possibly
+ * wrapping another exception
+ * @see #endElement
+ * @see org.xml.sax.Attributes
+ * @see org.xml.sax.helpers.AttributesImpl
+ */
+ public void startElement (String uri, String localName,
+ String qName, Attributes atts)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of the end of an element.
+ *
+ * <p>The SAX parser will invoke this method at the end of every
+ * element in the XML document; there will be a corresponding
+ * {@link #startElement startElement} event for every endElement
+ * event (even when the element is empty).</p>
+ *
+ * <p>For information on the names, see startElement.</p>
+ *
+ * @param uri the Namespace URI, or the empty string if the
+ * element has no Namespace URI or if Namespace
+ * processing is not being performed
+ * @param localName the local name (without prefix), or the
+ * empty string if Namespace processing is not being
+ * performed
+ * @param qName the qualified XML name (with prefix), or the
+ * empty string if qualified names are not available
+ * @throws org.xml.sax.SAXException any SAX exception, possibly
+ * wrapping another exception
+ */
+ public void endElement (String uri, String localName,
+ String qName)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of character data.
+ *
+ * <p>The Parser will call this method to report each chunk of
+ * character data. SAX parsers may return all contiguous character
+ * data in a single chunk, or they may split it into several
+ * chunks; however, all of the characters in any single event
+ * must come from the same external entity so that the Locator
+ * provides useful information.</p>
+ *
+ * <p>The application must not attempt to read from the array
+ * outside of the specified range.</p>
+ *
+ * <p>Individual characters may consist of more than one Java
+ * <code>char</code> value. There are two important cases where this
+ * happens, because characters can't be represented in just sixteen bits.
+ * In one case, characters are represented in a <em>Surrogate Pair</em>,
+ * using two special Unicode values. Such characters are in the so-called
+ * "Astral Planes", with a code point above U+FFFF. A second case involves
+ * composite characters, such as a base character combining with one or
+ * more accent characters. </p>
+ *
+ * <p> Your code should not assume that algorithms using
+ * <code>char</code>-at-a-time idioms will be working in character
+ * units; in some cases they will split characters. This is relevant
+ * wherever XML permits arbitrary characters, such as attribute values,
+ * processing instruction data, and comments as well as in data reported
+ * from this method. It's also generally relevant whenever Java code
+ * manipulates internationalized text; the issue isn't unique to XML.</p>
+ *
+ * <p>Note that some parsers will report whitespace in element
+ * content using the {@link #ignorableWhitespace ignorableWhitespace}
+ * method rather than this one (validating parsers <em>must</em>
+ * do so).</p>
+ *
+ * @param ch the characters from the XML document
+ * @param start the start position in the array
+ * @param length the number of characters to read from the array
+ * @throws org.xml.sax.SAXException any SAX exception, possibly
+ * wrapping another exception
+ * @see #ignorableWhitespace
+ * @see org.xml.sax.Locator
+ */
+ public void characters (char ch[], int start, int length)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of ignorable whitespace in element content.
+ *
+ * <p>Validating Parsers must use this method to report each chunk
+ * of whitespace in element content (see the W3C XML 1.0
+ * recommendation, section 2.10): non-validating parsers may also
+ * use this method if they are capable of parsing and using
+ * content models.</p>
+ *
+ * <p>SAX parsers may return all contiguous whitespace in a single
+ * chunk, or they may split it into several chunks; however, all of
+ * the characters in any single event must come from the same
+ * external entity, so that the Locator provides useful
+ * information.</p>
+ *
+ * <p>The application must not attempt to read from the array
+ * outside of the specified range.</p>
+ *
+ * @param ch the characters from the XML document
+ * @param start the start position in the array
+ * @param length the number of characters to read from the array
+ * @throws org.xml.sax.SAXException any SAX exception, possibly
+ * wrapping another exception
+ * @see #characters
+ */
+ public void ignorableWhitespace (char ch[], int start, int length)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of a processing instruction.
+ *
+ * <p>The Parser will invoke this method once for each processing
+ * instruction found: note that processing instructions may occur
+ * before or after the main document element.</p>
+ *
+ * <p>A SAX parser must never report an XML declaration (XML 1.0,
+ * section 2.8) or a text declaration (XML 1.0, section 4.3.1)
+ * using this method.</p>
+ *
+ * <p>Like {@link #characters characters()}, processing instruction
+ * data may have characters that need more than one <code>char</code>
+ * value. </p>
+ *
+ * @param target the processing instruction target
+ * @param data the processing instruction data, or null if
+ * none was supplied. The data does not include any
+ * whitespace separating it from the target
+ * @throws org.xml.sax.SAXException any SAX exception, possibly
+ * wrapping another exception
+ */
+ public void processingInstruction (String target, String data)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of a skipped entity.
+ * This is not called for entity references within markup constructs
+ * such as element start tags or markup declarations. (The XML
+ * recommendation requires reporting skipped external entities.
+ * SAX also reports internal entity expansion/non-expansion, except
+ * within markup constructs.)
+ *
+ * <p>The Parser will invoke this method each time the entity is
+ * skipped. Non-validating processors may skip entities if they
+ * have not seen the declarations (because, for example, the
+ * entity was declared in an external DTD subset). All processors
+ * may skip external entities, depending on the values of the
+ * <code>http://xml.org/sax/features/external-general-entities</code>
+ * and the
+ * <code>http://xml.org/sax/features/external-parameter-entities</code>
+ * properties.</p>
+ *
+ * @param name the name of the skipped entity. If it is a
+ * parameter entity, the name will begin with '%', and if
+ * it is the external DTD subset, it will be the string
+ * "[dtd]"
+ * @throws org.xml.sax.SAXException any SAX exception, possibly
+ * wrapping another exception
+ */
+ public void skippedEntity (String name)
+ throws SAXException;
+}
+
+// end of ContentHandler.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/DTDHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/DTDHandler.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/DTDHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/DTDHandler.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,117 @@
+// SAX DTD handler.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: DTDHandler.java,v 1.10 2004/12/11 15:41:09 dog Exp $
+
+package org.xml.sax;
+
+/**
+ * Receive notification of basic DTD-related events.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>If a SAX application needs information about notations and
+ * unparsed entities, then the application implements this
+ * interface and registers an instance with the SAX parser using
+ * the parser's setDTDHandler method. The parser uses the
+ * instance to report notation and unparsed entity declarations to
+ * the application.</p>
+ *
+ * <p>Note that this interface includes only those DTD events that
+ * the XML recommendation <em>requires</em> processors to report:
+ * notation and unparsed entity declarations.</p>
+ *
+ * <p>The SAX parser may report these events in any order, regardless
+ * of the order in which the notations and unparsed entities were
+ * declared; however, all DTD events must be reported after the
+ * document handler's startDocument event, and before the first
+ * startElement event.
+ * (If the {@link org.xml.sax.ext.LexicalHandler LexicalHandler} is
+ * used, these events must also be reported before the endDTD event.)
+ * </p>
+ *
+ * <p>It is up to the application to store the information for
+ * future use (perhaps in a hash table or object tree).
+ * If the application encounters attributes of type "NOTATION",
+ * "ENTITY", or "ENTITIES", it can use the information that it
+ * obtained through this interface to find the entity and/or
+ * notation corresponding with the attribute value.</p>
+ *
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.XMLReader#setDTDHandler
+ */
+public interface DTDHandler {
+
+
+ /**
+ * Receive notification of a notation declaration event.
+ *
+ * <p>It is up to the application to record the notation for later
+ * reference, if necessary;
+ * notations may appear as attribute values and in unparsed entity
+ * declarations, and are sometime used with processing instruction
+ * target names.</p>
+ *
+ * <p>At least one of publicId and systemId must be non-null.
+ * If a system identifier is present, and it is a URL, the SAX
+ * parser must resolve it fully before passing it to the
+ * application through this event.</p>
+ *
+ * <p>There is no guarantee that the notation declaration will be
+ * reported before any unparsed entities that use it.</p>
+ *
+ * @param name The notation name.
+ * @param publicId The notation's public identifier, or null if
+ * none was given.
+ * @param systemId The notation's system identifier, or null if
+ * none was given.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see #unparsedEntityDecl
+ * @see org.xml.sax.Attributes
+ */
+ public abstract void notationDecl (String name,
+ String publicId,
+ String systemId)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of an unparsed entity declaration event.
+ *
+ * <p>Note that the notation name corresponds to a notation
+ * reported by the {@link #notationDecl notationDecl} event.
+ * It is up to the application to record the entity for later
+ * reference, if necessary;
+ * unparsed entities may appear as attribute values.
+ * </p>
+ *
+ * <p>If the system identifier is a URL, the parser must resolve it
+ * fully before passing it to the application.</p>
+ *
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @param name The unparsed entity's name.
+ * @param publicId The entity's public identifier, or null if none
+ * was given.
+ * @param systemId The entity's system identifier.
+ * @param notationName The name of the associated notation.
+ * @see #notationDecl
+ * @see org.xml.sax.Attributes
+ */
+ public abstract void unparsedEntityDecl (String name,
+ String publicId,
+ String systemId,
+ String notationName)
+ throws SAXException;
+
+}
+
+// end of DTDHandler.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/DocumentHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/DocumentHandler.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/DocumentHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/DocumentHandler.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,232 @@
+// SAX document handler.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: DocumentHandler.java,v 1.10 2004/12/11 15:41:09 dog Exp $
+
+package org.xml.sax;
+
+/**
+ * Receive notification of general document events.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This was the main event-handling interface for SAX1; in
+ * SAX2, it has been replaced by {@link org.xml.sax.ContentHandler
+ * ContentHandler}, which provides Namespace support and reporting
+ * of skipped entities. This interface is included in SAX2 only
+ * to support legacy SAX1 applications.</p>
+ *
+ * <p>The order of events in this interface is very important, and
+ * mirrors the order of information in the document itself. For
+ * example, all of an element's content (character data, processing
+ * instructions, and/or subelements) will appear, in order, between
+ * the startElement event and the corresponding endElement event.</p>
+ *
+ * <p>Application writers who do not want to implement the entire
+ * interface can derive a class from HandlerBase, which implements
+ * the default functionality; parser writers can instantiate
+ * HandlerBase to obtain a default handler. The application can find
+ * the location of any document event using the Locator interface
+ * supplied by the Parser through the setDocumentLocator method.</p>
+ *
+ * @deprecated This interface has been replaced by the SAX2
+ * {@link org.xml.sax.ContentHandler ContentHandler}
+ * interface, which includes Namespace support.
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.Parser#setDocumentHandler
+ * @see org.xml.sax.Locator
+ * @see org.xml.sax.HandlerBase
+ */
+public interface DocumentHandler {
+
+
+ /**
+ * Receive an object for locating the origin of SAX document events.
+ *
+ * <p>SAX parsers are strongly encouraged (though not absolutely
+ * required) to supply a locator: if it does so, it must supply
+ * the locator to the application by invoking this method before
+ * invoking any of the other methods in the DocumentHandler
+ * interface.</p>
+ *
+ * <p>The locator allows the application to determine the end
+ * position of any document-related event, even if the parser is
+ * not reporting an error. Typically, the application will
+ * use this information for reporting its own errors (such as
+ * character content that does not match an application's
+ * business rules). The information returned by the locator
+ * is probably not sufficient for use with a search engine.</p>
+ *
+ * <p>Note that the locator will return correct information only
+ * during the invocation of the events in this interface. The
+ * application should not attempt to use it at any other time.</p>
+ *
+ * @param locator An object that can return the location of
+ * any SAX document event.
+ * @see org.xml.sax.Locator
+ */
+ public abstract void setDocumentLocator (Locator locator);
+
+
+ /**
+ * Receive notification of the beginning of a document.
+ *
+ * <p>The SAX parser will invoke this method only once, before any
+ * other methods in this interface or in DTDHandler (except for
+ * setDocumentLocator).</p>
+ *
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ */
+ public abstract void startDocument ()
+ throws SAXException;
+
+
+ /**
+ * Receive notification of the end of a document.
+ *
+ * <p>The SAX parser will invoke this method only once, and it will
+ * be the last method invoked during the parse. The parser shall
+ * not invoke this method until it has either abandoned parsing
+ * (because of an unrecoverable error) or reached the end of
+ * input.</p>
+ *
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ */
+ public abstract void endDocument ()
+ throws SAXException;
+
+
+ /**
+ * Receive notification of the beginning of an element.
+ *
+ * <p>The Parser will invoke this method at the beginning of every
+ * element in the XML document; there will be a corresponding
+ * endElement() event for every startElement() event (even when the
+ * element is empty). All of the element's content will be
+ * reported, in order, before the corresponding endElement()
+ * event.</p>
+ *
+ * <p>If the element name has a namespace prefix, the prefix will
+ * still be attached. Note that the attribute list provided will
+ * contain only attributes with explicit values (specified or
+ * defaulted): #IMPLIED attributes will be omitted.</p>
+ *
+ * @param name The element type name.
+ * @param atts The attributes attached to the element, if any.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see #endElement
+ * @see org.xml.sax.AttributeList
+ */
+ public abstract void startElement (String name, AttributeList atts)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of the end of an element.
+ *
+ * <p>The SAX parser will invoke this method at the end of every
+ * element in the XML document; there will be a corresponding
+ * startElement() event for every endElement() event (even when the
+ * element is empty).</p>
+ *
+ * <p>If the element name has a namespace prefix, the prefix will
+ * still be attached to the name.</p>
+ *
+ * @param name The element type name
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ */
+ public abstract void endElement (String name)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of character data.
+ *
+ * <p>The Parser will call this method to report each chunk of
+ * character data. SAX parsers may return all contiguous character
+ * data in a single chunk, or they may split it into several
+ * chunks; however, all of the characters in any single event
+ * must come from the same external entity, so that the Locator
+ * provides useful information.</p>
+ *
+ * <p>The application must not attempt to read from the array
+ * outside of the specified range.</p>
+ *
+ * <p>Note that some parsers will report whitespace using the
+ * ignorableWhitespace() method rather than this one (validating
+ * parsers must do so).</p>
+ *
+ * @param ch The characters from the XML document.
+ * @param start The start position in the array.
+ * @param length The number of characters to read from the array.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see #ignorableWhitespace
+ * @see org.xml.sax.Locator
+ */
+ public abstract void characters (char ch[], int start, int length)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of ignorable whitespace in element content.
+ *
+ * <p>Validating Parsers must use this method to report each chunk
+ * of ignorable whitespace (see the W3C XML 1.0 recommendation,
+ * section 2.10): non-validating parsers may also use this method
+ * if they are capable of parsing and using content models.</p>
+ *
+ * <p>SAX parsers may return all contiguous whitespace in a single
+ * chunk, or they may split it into several chunks; however, all of
+ * the characters in any single event must come from the same
+ * external entity, so that the Locator provides useful
+ * information.</p>
+ *
+ * <p>The application must not attempt to read from the array
+ * outside of the specified range.</p>
+ *
+ * @param ch The characters from the XML document.
+ * @param start The start position in the array.
+ * @param length The number of characters to read from the array.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see #characters
+ */
+ public abstract void ignorableWhitespace (char ch[], int start, int length)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of a processing instruction.
+ *
+ * <p>The Parser will invoke this method once for each processing
+ * instruction found: note that processing instructions may occur
+ * before or after the main document element.</p>
+ *
+ * <p>A SAX parser should never report an XML declaration (XML 1.0,
+ * section 2.8) or a text declaration (XML 1.0, section 4.3.1)
+ * using this method.</p>
+ *
+ * @param target The processing instruction target.
+ * @param data The processing instruction data, or null if
+ * none was supplied.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ */
+ public abstract void processingInstruction (String target, String data)
+ throws SAXException;
+
+}
+
+// end of DocumentHandler.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/EntityResolver.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/EntityResolver.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/EntityResolver.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/EntityResolver.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,119 @@
+// SAX entity resolver.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: EntityResolver.java,v 1.10 2004/12/11 15:41:09 dog Exp $
+
+package org.xml.sax;
+
+import java.io.IOException;
+
+
+/**
+ * Basic interface for resolving entities.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>If a SAX application needs to implement customized handling
+ * for external entities, it must implement this interface and
+ * register an instance with the SAX driver using the
+ * {@link org.xml.sax.XMLReader#setEntityResolver setEntityResolver}
+ * method.</p>
+ *
+ * <p>The XML reader will then allow the application to intercept any
+ * external entities (including the external DTD subset and external
+ * parameter entities, if any) before including them.</p>
+ *
+ * <p>Many SAX applications will not need to implement this interface,
+ * but it will be especially useful for applications that build
+ * XML documents from databases or other specialised input sources,
+ * or for applications that use URI types other than URLs.</p>
+ *
+ * <p>The following resolver would provide the application
+ * with a special character stream for the entity with the system
+ * identifier "http://www.myhost.com/today":</p>
+ *
+ * <pre>
+ * import org.xml.sax.EntityResolver;
+ * import org.xml.sax.InputSource;
+ *
+ * public class MyResolver implements EntityResolver {
+ * public InputSource resolveEntity (String publicId, String systemId)
+ * {
+ * if (systemId.equals("http://www.myhost.com/today")) {
+ * // return a special input source
+ * MyReader reader = new MyReader();
+ * return new InputSource(reader);
+ * } else {
+ * // use the default behaviour
+ * return null;
+ * }
+ * }
+ * }
+ * </pre>
+ *
+ * <p>The application can also use this interface to redirect system
+ * identifiers to local URIs or to look up replacements in a catalog
+ * (possibly by using the public identifier).</p>
+ *
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.XMLReader#setEntityResolver
+ * @see org.xml.sax.InputSource
+ */
+public interface EntityResolver {
+
+
+ /**
+ * Allow the application to resolve external entities.
+ *
+ * <p>The parser will call this method before opening any external
+ * entity except the top-level document entity. Such entities include
+ * the external DTD subset and external parameter entities referenced
+ * within the DTD (in either case, only if the parser reads external
+ * parameter entities), and external general entities referenced
+ * within the document element (if the parser reads external general
+ * entities). The application may request that the parser locate
+ * the entity itself, that it use an alternative URI, or that it
+ * use data provided by the application (as a character or byte
+ * input stream).</p>
+ *
+ * <p>Application writers can use this method to redirect external
+ * system identifiers to secure and/or local URIs, to look up
+ * public identifiers in a catalogue, or to read an entity from a
+ * database or other input source (including, for example, a dialog
+ * box). Neither XML nor SAX specifies a preferred policy for using
+ * public or system IDs to resolve resources. However, SAX specifies
+ * how to interpret any InputSource returned by this method, and that
+ * if none is returned, then the system ID will be dereferenced as
+ * a URL. </p>
+ *
+ * <p>If the system identifier is a URL, the SAX parser must
+ * resolve it fully before reporting it to the application.</p>
+ *
+ * @param publicId The public identifier of the external entity
+ * being referenced, or null if none was supplied.
+ * @param systemId The system identifier of the external entity
+ * being referenced.
+ * @return An InputSource object describing the new input source,
+ * or null to request that the parser open a regular
+ * URI connection to the system identifier.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @exception java.io.IOException A Java-specific IO exception,
+ * possibly the result of creating a new InputStream
+ * or Reader for the InputSource.
+ * @see org.xml.sax.InputSource
+ */
+ public abstract InputSource resolveEntity (String publicId,
+ String systemId)
+ throws SAXException, IOException;
+
+}
+
+// end of EntityResolver.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ErrorHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ErrorHandler.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ErrorHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ErrorHandler.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,139 @@
+// SAX error handler.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: ErrorHandler.java,v 1.10 2004/12/11 15:41:09 dog Exp $
+
+package org.xml.sax;
+
+
+/**
+ * Basic interface for SAX error handlers.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>If a SAX application needs to implement customized error
+ * handling, it must implement this interface and then register an
+ * instance with the XML reader using the
+ * {@link org.xml.sax.XMLReader#setErrorHandler setErrorHandler}
+ * method. The parser will then report all errors and warnings
+ * through this interface.</p>
+ *
+ * <p><strong>WARNING:</strong> If an application does <em>not</em>
+ * register an ErrorHandler, XML parsing errors will go unreported,
+ * except that <em>SAXParseException</em>s will be thrown for fatal errors.
+ * In order to detect validity errors, an ErrorHandler that does something
+ * with {@link #error error()} calls must be registered.</p>
+ *
+ * <p>For XML processing errors, a SAX driver must use this interface
+ * in preference to throwing an exception: it is up to the application
+ * to decide whether to throw an exception for different types of
+ * errors and warnings. Note, however, that there is no requirement that
+ * the parser continue to report additional errors after a call to
+ * {@link #fatalError fatalError}. In other words, a SAX driver class
+ * may throw an exception after reporting any fatalError.
+ * Also parsers may throw appropriate exceptions for non-XML errors.
+ * For example, {@link XMLReader#parse XMLReader.parse()} would throw
+ * an IOException for errors accessing entities or the document.</p>
+ *
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1+ (sax2r3pre1)
+ * @see org.xml.sax.XMLReader#setErrorHandler
+ * @see org.xml.sax.SAXParseException
+ */
+public interface ErrorHandler {
+
+
+ /**
+ * Receive notification of a warning.
+ *
+ * <p>SAX parsers will use this method to report conditions that
+ * are not errors or fatal errors as defined by the XML
+ * recommendation. The default behaviour is to take no
+ * action.</p>
+ *
+ * <p>The SAX parser must continue to provide normal parsing events
+ * after invoking this method: it should still be possible for the
+ * application to process the document through to the end.</p>
+ *
+ * <p>Filters may use this method to report other, non-XML warnings
+ * as well.</p>
+ *
+ * @param exception The warning information encapsulated in a
+ * SAX parse exception.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.SAXParseException
+ */
+ public abstract void warning (SAXParseException exception)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of a recoverable error.
+ *
+ * <p>This corresponds to the definition of "error" in section 1.2
+ * of the W3C XML 1.0 Recommendation. For example, a validating
+ * parser would use this callback to report the violation of a
+ * validity constraint. The default behaviour is to take no
+ * action.</p>
+ *
+ * <p>The SAX parser must continue to provide normal parsing
+ * events after invoking this method: it should still be possible
+ * for the application to process the document through to the end.
+ * If the application cannot do so, then the parser should report
+ * a fatal error even if the XML recommendation does not require
+ * it to do so.</p>
+ *
+ * <p>Filters may use this method to report other, non-XML errors
+ * as well.</p>
+ *
+ * @param exception The error information encapsulated in a
+ * SAX parse exception.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.SAXParseException
+ */
+ public abstract void error (SAXParseException exception)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of a non-recoverable error.
+ *
+ * <p><strong>There is an apparent contradiction between the
+ * documentation for this method and the documentation for {@link
+ * org.xml.sax.ContentHandler#endDocument}. Until this ambiguity
+ * is resolved in a future major release, clients should make no
+ * assumptions about whether endDocument() will or will not be
+ * invoked when the parser has reported a fatalError() or thrown
+ * an exception.</strong></p>
+ *
+ * <p>This corresponds to the definition of "fatal error" in
+ * section 1.2 of the W3C XML 1.0 Recommendation. For example, a
+ * parser would use this callback to report the violation of a
+ * well-formedness constraint.</p>
+ *
+ * <p>The application must assume that the document is unusable
+ * after the parser has invoked this method, and should continue
+ * (if at all) only for the sake of collecting additional error
+ * messages: in fact, SAX parsers are free to stop reporting any
+ * other events once this method has been invoked.</p>
+ *
+ * @param exception The error information encapsulated in a
+ * SAX parse exception.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.SAXParseException
+ */
+ public abstract void fatalError (SAXParseException exception)
+ throws SAXException;
+
+}
+
+// end of ErrorHandler.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/HandlerBase.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/HandlerBase.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/HandlerBase.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/HandlerBase.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,369 @@
+// SAX default handler base class.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: HandlerBase.java,v 1.10 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax;
+
+/**
+ * Default base class for handlers.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class implements the default behaviour for four SAX1
+ * interfaces: EntityResolver, DTDHandler, DocumentHandler,
+ * and ErrorHandler. It is now obsolete, but is included in SAX2 to
+ * support legacy SAX1 applications. SAX2 applications should use
+ * the {@link org.xml.sax.helpers.DefaultHandler DefaultHandler}
+ * class instead.</p>
+ *
+ * <p>Application writers can extend this class when they need to
+ * implement only part of an interface; parser writers can
+ * instantiate this class to provide default handlers when the
+ * application has not supplied its own.</p>
+ *
+ * <p>Note that the use of this class is optional.</p>
+ *
+ * @deprecated This class works with the deprecated
+ * {@link org.xml.sax.DocumentHandler DocumentHandler}
+ * interface. It has been replaced by the SAX2
+ * {@link org.xml.sax.helpers.DefaultHandler DefaultHandler}
+ * class.
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.EntityResolver
+ * @see org.xml.sax.DTDHandler
+ * @see org.xml.sax.DocumentHandler
+ * @see org.xml.sax.ErrorHandler
+ */
+public class HandlerBase
+ implements EntityResolver, DTDHandler, DocumentHandler, ErrorHandler
+{
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Default implementation of the EntityResolver interface.
+ ////////////////////////////////////////////////////////////////////
+
+ /**
+ * Resolve an external entity.
+ *
+ * <p>Always return null, so that the parser will use the system
+ * identifier provided in the XML document. This method implements
+ * the SAX default behaviour: application writers can override it
+ * in a subclass to do special translations such as catalog lookups
+ * or URI redirection.</p>
+ *
+ * @param publicId The public identifer, or null if none is
+ * available.
+ * @param systemId The system identifier provided in the XML
+ * document.
+ * @return The new input source, or null to require the
+ * default behaviour.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.EntityResolver#resolveEntity
+ */
+ public InputSource resolveEntity (String publicId, String systemId)
+ throws SAXException
+ {
+ return null;
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Default implementation of DTDHandler interface.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Receive notification of a notation declaration.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass if they wish to keep track of the notations
+ * declared in a document.</p>
+ *
+ * @param name The notation name.
+ * @param publicId The notation public identifier, or null if not
+ * available.
+ * @param systemId The notation system identifier.
+ * @see org.xml.sax.DTDHandler#notationDecl
+ */
+ public void notationDecl (String name, String publicId, String systemId)
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of an unparsed entity declaration.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to keep track of the unparsed entities
+ * declared in a document.</p>
+ *
+ * @param name The entity name.
+ * @param publicId The entity public identifier, or null if not
+ * available.
+ * @param systemId The entity system identifier.
+ * @param notationName The name of the associated notation.
+ * @see org.xml.sax.DTDHandler#unparsedEntityDecl
+ */
+ public void unparsedEntityDecl (String name, String publicId,
+ String systemId, String notationName)
+ {
+ // no op
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Default implementation of DocumentHandler interface.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Receive a Locator object for document events.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass if they wish to store the locator for use
+ * with other document events.</p>
+ *
+ * @param locator A locator for all SAX document events.
+ * @see org.xml.sax.DocumentHandler#setDocumentLocator
+ * @see org.xml.sax.Locator
+ */
+ public void setDocumentLocator (Locator locator)
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of the beginning of the document.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions at the beginning
+ * of a document (such as allocating the root node of a tree or
+ * creating an output file).</p>
+ *
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.DocumentHandler#startDocument
+ */
+ public void startDocument ()
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of the end of the document.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions at the beginning
+ * of a document (such as finalising a tree or closing an output
+ * file).</p>
+ *
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.DocumentHandler#endDocument
+ */
+ public void endDocument ()
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of the start of an element.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions at the start of
+ * each element (such as allocating a new tree node or writing
+ * output to a file).</p>
+ *
+ * @param name The element type name.
+ * @param attributes The specified or defaulted attributes.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.DocumentHandler#startElement
+ */
+ public void startElement (String name, AttributeList attributes)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of the end of an element.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions at the end of
+ * each element (such as finalising a tree node or writing
+ * output to a file).</p>
+ *
+ * @param name the element name
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.DocumentHandler#endElement
+ */
+ public void endElement (String name)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of character data inside an element.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method to take specific actions for each chunk of character data
+ * (such as adding the data to a node or buffer, or printing it to
+ * a file).</p>
+ *
+ * @param ch The characters.
+ * @param start The start position in the character array.
+ * @param length The number of characters to use from the
+ * character array.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.DocumentHandler#characters
+ */
+ public void characters (char ch[], int start, int length)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of ignorable whitespace in element content.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method to take specific actions for each chunk of ignorable
+ * whitespace (such as adding data to a node or buffer, or printing
+ * it to a file).</p>
+ *
+ * @param ch The whitespace characters.
+ * @param start The start position in the character array.
+ * @param length The number of characters to use from the
+ * character array.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.DocumentHandler#ignorableWhitespace
+ */
+ public void ignorableWhitespace (char ch[], int start, int length)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of a processing instruction.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions for each
+ * processing instruction, such as setting status variables or
+ * invoking other methods.</p>
+ *
+ * @param target The processing instruction target.
+ * @param data The processing instruction data, or null if
+ * none is supplied.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.DocumentHandler#processingInstruction
+ */
+ public void processingInstruction (String target, String data)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Default implementation of the ErrorHandler interface.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Receive notification of a parser warning.
+ *
+ * <p>The default implementation does nothing. Application writers
+ * may override this method in a subclass to take specific actions
+ * for each warning, such as inserting the message in a log file or
+ * printing it to the console.</p>
+ *
+ * @param e The warning information encoded as an exception.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ErrorHandler#warning
+ * @see org.xml.sax.SAXParseException
+ */
+ public void warning (SAXParseException e)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of a recoverable parser error.
+ *
+ * <p>The default implementation does nothing. Application writers
+ * may override this method in a subclass to take specific actions
+ * for each error, such as inserting the message in a log file or
+ * printing it to the console.</p>
+ *
+ * @param e The warning information encoded as an exception.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ErrorHandler#warning
+ * @see org.xml.sax.SAXParseException
+ */
+ public void error (SAXParseException e)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Report a fatal XML parsing error.
+ *
+ * <p>The default implementation throws a SAXParseException.
+ * Application writers may override this method in a subclass if
+ * they need to take specific actions for each fatal error (such as
+ * collecting all of the errors into a single report): in any case,
+ * the application must stop all regular processing when this
+ * method is invoked, since the document is no longer reliable, and
+ * the parser may no longer report parsing events.</p>
+ *
+ * @param e The error information encoded as an exception.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ErrorHandler#fatalError
+ * @see org.xml.sax.SAXParseException
+ */
+ public void fatalError (SAXParseException e)
+ throws SAXException
+ {
+ throw e;
+ }
+
+}
+
+// end of HandlerBase.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/InputSource.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/InputSource.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/InputSource.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/InputSource.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,336 @@
+// SAX input source.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: InputSource.java,v 1.12 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax;
+
+import java.io.Reader;
+import java.io.InputStream;
+
+/**
+ * A single input source for an XML entity.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class allows a SAX application to encapsulate information
+ * about an input source in a single object, which may include
+ * a public identifier, a system identifier, a byte stream (possibly
+ * with a specified encoding), and/or a character stream.</p>
+ *
+ * <p>There are two places that the application can deliver an
+ * input source to the parser: as the argument to the Parser.parse
+ * method, or as the return value of the EntityResolver.resolveEntity
+ * method.</p>
+ *
+ * <p>The SAX parser will use the InputSource object to determine how
+ * to read XML input. If there is a character stream available, the
+ * parser will read that stream directly, disregarding any text
+ * encoding declaration found in that stream.
+ * If there is no character stream, but there is
+ * a byte stream, the parser will use that byte stream, using the
+ * encoding specified in the InputSource or else (if no encoding is
+ * specified) autodetecting the character encoding using an algorithm
+ * such as the one in the XML specification. If neither a character
+ * stream nor a
+ * byte stream is available, the parser will attempt to open a URI
+ * connection to the resource identified by the system
+ * identifier.</p>
+ *
+ * <p>An InputSource object belongs to the application: the SAX parser
+ * shall never modify it in any way (it may modify a copy if
+ * necessary). However, standard processing of both byte and
+ * character streams is to close them on as part of end-of-parse cleanup,
+ * so applications should not attempt to re-use such streams after they
+ * have been handed to a parser. </p>
+ *
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.XMLReader#parse(org.xml.sax.InputSource)
+ * @see org.xml.sax.EntityResolver#resolveEntity
+ * @see java.io.InputStream
+ * @see java.io.Reader
+ */
+public class InputSource {
+
+ /**
+ * Zero-argument default constructor.
+ *
+ * @see #setPublicId
+ * @see #setSystemId
+ * @see #setByteStream
+ * @see #setCharacterStream
+ * @see #setEncoding
+ */
+ public InputSource ()
+ {
+ }
+
+
+ /**
+ * Create a new input source with a system identifier.
+ *
+ * <p>Applications may use setPublicId to include a
+ * public identifier as well, or setEncoding to specify
+ * the character encoding, if known.</p>
+ *
+ * <p>If the system identifier is a URL, it must be fully
+ * resolved (it may not be a relative URL).</p>
+ *
+ * @param systemId The system identifier (URI).
+ * @see #setPublicId
+ * @see #setSystemId
+ * @see #setByteStream
+ * @see #setEncoding
+ * @see #setCharacterStream
+ */
+ public InputSource (String systemId)
+ {
+ setSystemId(systemId);
+ }
+
+
+ /**
+ * Create a new input source with a byte stream.
+ *
+ * <p>Application writers should use setSystemId() to provide a base
+ * for resolving relative URIs, may use setPublicId to include a
+ * public identifier, and may use setEncoding to specify the object's
+ * character encoding.</p>
+ *
+ * @param byteStream The raw byte stream containing the document.
+ * @see #setPublicId
+ * @see #setSystemId
+ * @see #setEncoding
+ * @see #setByteStream
+ * @see #setCharacterStream
+ */
+ public InputSource (InputStream byteStream)
+ {
+ setByteStream(byteStream);
+ }
+
+
+ /**
+ * Create a new input source with a character stream.
+ *
+ * <p>Application writers should use setSystemId() to provide a base
+ * for resolving relative URIs, and may use setPublicId to include a
+ * public identifier.</p>
+ *
+ * <p>The character stream shall not include a byte order mark.</p>
+ *
+ * @see #setPublicId
+ * @see #setSystemId
+ * @see #setByteStream
+ * @see #setCharacterStream
+ */
+ public InputSource (Reader characterStream)
+ {
+ setCharacterStream(characterStream);
+ }
+
+
+ /**
+ * Set the public identifier for this input source.
+ *
+ * <p>The public identifier is always optional: if the application
+ * writer includes one, it will be provided as part of the
+ * location information.</p>
+ *
+ * @param publicId The public identifier as a string.
+ * @see #getPublicId
+ * @see org.xml.sax.Locator#getPublicId
+ * @see org.xml.sax.SAXParseException#getPublicId
+ */
+ public void setPublicId (String publicId)
+ {
+ this.publicId = publicId;
+ }
+
+
+ /**
+ * Get the public identifier for this input source.
+ *
+ * @return The public identifier, or null if none was supplied.
+ * @see #setPublicId
+ */
+ public String getPublicId ()
+ {
+ return publicId;
+ }
+
+
+ /**
+ * Set the system identifier for this input source.
+ *
+ * <p>The system identifier is optional if there is a byte stream
+ * or a character stream, but it is still useful to provide one,
+ * since the application can use it to resolve relative URIs
+ * and can include it in error messages and warnings (the parser
+ * will attempt to open a connection to the URI only if
+ * there is no byte stream or character stream specified).</p>
+ *
+ * <p>If the application knows the character encoding of the
+ * object pointed to by the system identifier, it can register
+ * the encoding using the setEncoding method.</p>
+ *
+ * <p>If the system identifier is a URL, it must be fully
+ * resolved (it may not be a relative URL).</p>
+ *
+ * @param systemId The system identifier as a string.
+ * @see #setEncoding
+ * @see #getSystemId
+ * @see org.xml.sax.Locator#getSystemId
+ * @see org.xml.sax.SAXParseException#getSystemId
+ */
+ public void setSystemId (String systemId)
+ {
+ this.systemId = systemId;
+ }
+
+
+ /**
+ * Get the system identifier for this input source.
+ *
+ * <p>The getEncoding method will return the character encoding
+ * of the object pointed to, or null if unknown.</p>
+ *
+ * <p>If the system ID is a URL, it will be fully resolved.</p>
+ *
+ * @return The system identifier, or null if none was supplied.
+ * @see #setSystemId
+ * @see #getEncoding
+ */
+ public String getSystemId ()
+ {
+ return systemId;
+ }
+
+
+ /**
+ * Set the byte stream for this input source.
+ *
+ * <p>The SAX parser will ignore this if there is also a character
+ * stream specified, but it will use a byte stream in preference
+ * to opening a URI connection itself.</p>
+ *
+ * <p>If the application knows the character encoding of the
+ * byte stream, it should set it with the setEncoding method.</p>
+ *
+ * @param byteStream A byte stream containing an XML document or
+ * other entity.
+ * @see #setEncoding
+ * @see #getByteStream
+ * @see #getEncoding
+ * @see java.io.InputStream
+ */
+ public void setByteStream (InputStream byteStream)
+ {
+ this.byteStream = byteStream;
+ }
+
+
+ /**
+ * Get the byte stream for this input source.
+ *
+ * <p>The getEncoding method will return the character
+ * encoding for this byte stream, or null if unknown.</p>
+ *
+ * @return The byte stream, or null if none was supplied.
+ * @see #getEncoding
+ * @see #setByteStream
+ */
+ public InputStream getByteStream ()
+ {
+ return byteStream;
+ }
+
+
+ /**
+ * Set the character encoding, if known.
+ *
+ * <p>The encoding must be a string acceptable for an
+ * XML encoding declaration (see section 4.3.3 of the XML 1.0
+ * recommendation).</p>
+ *
+ * <p>This method has no effect when the application provides a
+ * character stream.</p>
+ *
+ * @param encoding A string describing the character encoding.
+ * @see #setSystemId
+ * @see #setByteStream
+ * @see #getEncoding
+ */
+ public void setEncoding (String encoding)
+ {
+ this.encoding = encoding;
+ }
+
+
+ /**
+ * Get the character encoding for a byte stream or URI.
+ * This value will be ignored when the application provides a
+ * character stream.
+ *
+ * @return The encoding, or null if none was supplied.
+ * @see #setByteStream
+ * @see #getSystemId
+ * @see #getByteStream
+ */
+ public String getEncoding ()
+ {
+ return encoding;
+ }
+
+
+ /**
+ * Set the character stream for this input source.
+ *
+ * <p>If there is a character stream specified, the SAX parser
+ * will ignore any byte stream and will not attempt to open
+ * a URI connection to the system identifier.</p>
+ *
+ * @param characterStream The character stream containing the
+ * XML document or other entity.
+ * @see #getCharacterStream
+ * @see java.io.Reader
+ */
+ public void setCharacterStream (Reader characterStream)
+ {
+ this.characterStream = characterStream;
+ }
+
+
+ /**
+ * Get the character stream for this input source.
+ *
+ * @return The character stream, or null if none was supplied.
+ * @see #setCharacterStream
+ */
+ public Reader getCharacterStream ()
+ {
+ return characterStream;
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////////
+
+ private String publicId;
+ private String systemId;
+ private InputStream byteStream;
+ private String encoding;
+ private Reader characterStream;
+
+}
+
+// end of InputSource.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/Locator.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/Locator.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/Locator.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/Locator.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,136 @@
+// SAX locator interface for document events.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: Locator.java,v 1.10 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax;
+
+
+/**
+ * Interface for associating a SAX event with a document location.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>If a SAX parser provides location information to the SAX
+ * application, it does so by implementing this interface and then
+ * passing an instance to the application using the content
+ * handler's {@link org.xml.sax.ContentHandler#setDocumentLocator
+ * setDocumentLocator} method. The application can use the
+ * object to obtain the location of any other SAX event
+ * in the XML source document.</p>
+ *
+ * <p>Note that the results returned by the object will be valid only
+ * during the scope of each callback method: the application
+ * will receive unpredictable results if it attempts to use the
+ * locator at any other time, or after parsing completes.</p>
+ *
+ * <p>SAX parsers are not required to supply a locator, but they are
+ * very strongly encouraged to do so. If the parser supplies a
+ * locator, it must do so before reporting any other document events.
+ * If no locator has been set by the time the application receives
+ * the {@link org.xml.sax.ContentHandler#startDocument startDocument}
+ * event, the application should assume that a locator is not
+ * available.</p>
+ *
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.ContentHandler#setDocumentLocator
+ */
+public interface Locator {
+
+
+ /**
+ * Return the public identifier for the current document event.
+ *
+ * <p>The return value is the public identifier of the document
+ * entity or of the external parsed entity in which the markup
+ * triggering the event appears.</p>
+ *
+ * @return A string containing the public identifier, or
+ * null if none is available.
+ * @see #getSystemId
+ */
+ public abstract String getPublicId ();
+
+
+ /**
+ * Return the system identifier for the current document event.
+ *
+ * <p>The return value is the system identifier of the document
+ * entity or of the external parsed entity in which the markup
+ * triggering the event appears.</p>
+ *
+ * <p>If the system identifier is a URL, the parser must resolve it
+ * fully before passing it to the application. For example, a file
+ * name must always be provided as a <em>file:...</em> URL, and other
+ * kinds of relative URI are also resolved against their bases.</p>
+ *
+ * @return A string containing the system identifier, or null
+ * if none is available.
+ * @see #getPublicId
+ */
+ public abstract String getSystemId ();
+
+
+ /**
+ * Return the line number where the current document event ends.
+ * Lines are delimited by line ends, which are defined in
+ * the XML specification.
+ *
+ * <p><strong>Warning:</strong> The return value from the method
+ * is intended only as an approximation for the sake of diagnostics;
+ * it is not intended to provide sufficient information
+ * to edit the character content of the original XML document.
+ * In some cases, these "line" numbers match what would be displayed
+ * as columns, and in others they may not match the source text
+ * due to internal entity expansion. </p>
+ *
+ * <p>The return value is an approximation of the line number
+ * in the document entity or external parsed entity where the
+ * markup triggering the event appears.</p>
+ *
+ * <p>If possible, the SAX driver should provide the line position
+ * of the first character after the text associated with the document
+ * event. The first line is line 1.</p>
+ *
+ * @return The line number, or -1 if none is available.
+ * @see #getColumnNumber
+ */
+ public abstract int getLineNumber ();
+
+
+ /**
+ * Return the column number where the current document event ends.
+ * This is one-based number of Java <code>char</code> values since
+ * the last line end.
+ *
+ * <p><strong>Warning:</strong> The return value from the method
+ * is intended only as an approximation for the sake of diagnostics;
+ * it is not intended to provide sufficient information
+ * to edit the character content of the original XML document.
+ * For example, when lines contain combining character sequences, wide
+ * characters, surrogate pairs, or bi-directional text, the value may
+ * not correspond to the column in a text editor's display. </p>
+ *
+ * <p>The return value is an approximation of the column number
+ * in the document entity or external parsed entity where the
+ * markup triggering the event appears.</p>
+ *
+ * <p>If possible, the SAX driver should provide the line position
+ * of the first character after the text associated with the document
+ * event. The first column in each line is column 1.</p>
+ *
+ * @return The column number, or -1 if none is available.
+ * @see #getLineNumber
+ */
+ public abstract int getColumnNumber ();
+
+}
+
+// end of Locator.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/Parser.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/Parser.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/Parser.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/Parser.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,209 @@
+// SAX parser interface.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: Parser.java,v 1.10 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax;
+
+import java.io.IOException;
+import java.util.Locale;
+
+
+/**
+ * Basic interface for SAX (Simple API for XML) parsers.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This was the main event supplier interface for SAX1; it has
+ * been replaced in SAX2 by {@link org.xml.sax.XMLReader XMLReader},
+ * which includes Namespace support and sophisticated configurability
+ * and extensibility.</p>
+ *
+ * <p>All SAX1 parsers must implement this basic interface: it allows
+ * applications to register handlers for different types of events
+ * and to initiate a parse from a URI, or a character stream.</p>
+ *
+ * <p>All SAX1 parsers must also implement a zero-argument constructor
+ * (though other constructors are also allowed).</p>
+ *
+ * <p>SAX1 parsers are reusable but not re-entrant: the application
+ * may reuse a parser object (possibly with a different input source)
+ * once the first parse has completed successfully, but it may not
+ * invoke the parse() methods recursively within a parse.</p>
+ *
+ * @deprecated This interface has been replaced by the SAX2
+ * {@link org.xml.sax.XMLReader XMLReader}
+ * interface, which includes Namespace support.
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.EntityResolver
+ * @see org.xml.sax.DTDHandler
+ * @see org.xml.sax.DocumentHandler
+ * @see org.xml.sax.ErrorHandler
+ * @see org.xml.sax.HandlerBase
+ * @see org.xml.sax.InputSource
+ */
+public interface Parser
+{
+
+ /**
+ * Allow an application to request a locale for errors and warnings.
+ *
+ * <p>SAX parsers are not required to provide localisation for errors
+ * and warnings; if they cannot support the requested locale,
+ * however, they must throw a SAX exception. Applications may
+ * not request a locale change in the middle of a parse.</p>
+ *
+ * @param locale A Java Locale object.
+ * @exception org.xml.sax.SAXException Throws an exception
+ * (using the previous or default locale) if the
+ * requested locale is not supported.
+ * @see org.xml.sax.SAXException
+ * @see org.xml.sax.SAXParseException
+ */
+ public abstract void setLocale (Locale locale)
+ throws SAXException;
+
+
+ /**
+ * Allow an application to register a custom entity resolver.
+ *
+ * <p>If the application does not register an entity resolver, the
+ * SAX parser will resolve system identifiers and open connections
+ * to entities itself (this is the default behaviour implemented in
+ * HandlerBase).</p>
+ *
+ * <p>Applications may register a new or different entity resolver
+ * in the middle of a parse, and the SAX parser must begin using
+ * the new resolver immediately.</p>
+ *
+ * @param resolver The object for resolving entities.
+ * @see EntityResolver
+ * @see HandlerBase
+ */
+ public abstract void setEntityResolver (EntityResolver resolver);
+
+
+ /**
+ * Allow an application to register a DTD event handler.
+ *
+ * <p>If the application does not register a DTD handler, all DTD
+ * events reported by the SAX parser will be silently
+ * ignored (this is the default behaviour implemented by
+ * HandlerBase).</p>
+ *
+ * <p>Applications may register a new or different
+ * handler in the middle of a parse, and the SAX parser must
+ * begin using the new handler immediately.</p>
+ *
+ * @param handler The DTD handler.
+ * @see DTDHandler
+ * @see HandlerBase
+ */
+ public abstract void setDTDHandler (DTDHandler handler);
+
+
+ /**
+ * Allow an application to register a document event handler.
+ *
+ * <p>If the application does not register a document handler, all
+ * document events reported by the SAX parser will be silently
+ * ignored (this is the default behaviour implemented by
+ * HandlerBase).</p>
+ *
+ * <p>Applications may register a new or different handler in the
+ * middle of a parse, and the SAX parser must begin using the new
+ * handler immediately.</p>
+ *
+ * @param handler The document handler.
+ * @see DocumentHandler
+ * @see HandlerBase
+ */
+ public abstract void setDocumentHandler (DocumentHandler handler);
+
+
+ /**
+ * Allow an application to register an error event handler.
+ *
+ * <p>If the application does not register an error event handler,
+ * all error events reported by the SAX parser will be silently
+ * ignored, except for fatalError, which will throw a SAXException
+ * (this is the default behaviour implemented by HandlerBase).</p>
+ *
+ * <p>Applications may register a new or different handler in the
+ * middle of a parse, and the SAX parser must begin using the new
+ * handler immediately.</p>
+ *
+ * @param handler The error handler.
+ * @see ErrorHandler
+ * @see SAXException
+ * @see HandlerBase
+ */
+ public abstract void setErrorHandler (ErrorHandler handler);
+
+
+ /**
+ * Parse an XML document.
+ *
+ * <p>The application can use this method to instruct the SAX parser
+ * to begin parsing an XML document from any valid input
+ * source (a character stream, a byte stream, or a URI).</p>
+ *
+ * <p>Applications may not invoke this method while a parse is in
+ * progress (they should create a new Parser instead for each
+ * additional XML document). Once a parse is complete, an
+ * application may reuse the same Parser object, possibly with a
+ * different input source.</p>
+ *
+ * @param source The input source for the top-level of the
+ * XML document.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @exception java.io.IOException An IO exception from the parser,
+ * possibly from a byte stream or character stream
+ * supplied by the application.
+ * @see org.xml.sax.InputSource
+ * @see #parse(java.lang.String)
+ * @see #setEntityResolver
+ * @see #setDTDHandler
+ * @see #setDocumentHandler
+ * @see #setErrorHandler
+ */
+ public abstract void parse (InputSource source)
+ throws SAXException, IOException;
+
+
+ /**
+ * Parse an XML document from a system identifier (URI).
+ *
+ * <p>This method is a shortcut for the common case of reading a
+ * document from a system identifier. It is the exact
+ * equivalent of the following:</p>
+ *
+ * <pre>
+ * parse(new InputSource(systemId));
+ * </pre>
+ *
+ * <p>If the system identifier is a URL, it must be fully resolved
+ * by the application before it is passed to the parser.</p>
+ *
+ * @param systemId The system identifier (URI).
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @exception java.io.IOException An IO exception from the parser,
+ * possibly from a byte stream or character stream
+ * supplied by the application.
+ * @see #parse(org.xml.sax.InputSource)
+ */
+ public abstract void parse (String systemId)
+ throws SAXException, IOException;
+
+}
+
+// end of Parser.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/SAXException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/SAXException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/SAXException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/SAXException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,153 @@
+// SAX exception class.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: SAXException.java,v 1.10 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax;
+
+/**
+ * Encapsulate a general SAX error or warning.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class can contain basic error or warning information from
+ * either the XML parser or the application: a parser writer or
+ * application writer can subclass it to provide additional
+ * functionality. SAX handlers may throw this exception or
+ * any exception subclassed from it.</p>
+ *
+ * <p>If the application needs to pass through other types of
+ * exceptions, it must wrap those exceptions in a SAXException
+ * or an exception derived from a SAXException.</p>
+ *
+ * <p>If the parser or application needs to include information about a
+ * specific location in an XML document, it should use the
+ * {@link org.xml.sax.SAXParseException SAXParseException} subclass.</p>
+ *
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.SAXParseException
+ */
+public class SAXException extends Exception {
+
+
+ /**
+ * Create a new SAXException.
+ */
+ public SAXException ()
+ {
+ super();
+ this.exception = null;
+ }
+
+
+ /**
+ * Create a new SAXException.
+ *
+ * @param message The error or warning message.
+ */
+ public SAXException (String message) {
+ super(message);
+ this.exception = null;
+ }
+
+
+ /**
+ * Create a new SAXException wrapping an existing exception.
+ *
+ * <p>The existing exception will be embedded in the new
+ * one, and its message will become the default message for
+ * the SAXException.</p>
+ *
+ * @param e The exception to be wrapped in a SAXException.
+ */
+ public SAXException (Exception e)
+ {
+ super();
+ this.exception = e;
+ }
+
+
+ /**
+ * Create a new SAXException from an existing exception.
+ *
+ * <p>The existing exception will be embedded in the new
+ * one, but the new exception will have its own message.</p>
+ *
+ * @param message The detail message.
+ * @param e The exception to be wrapped in a SAXException.
+ */
+ public SAXException (String message, Exception e)
+ {
+ super(message);
+ this.exception = e;
+ }
+
+
+ /**
+ * Return a detail message for this exception.
+ *
+ * <p>If there is an embedded exception, and if the SAXException
+ * has no detail message of its own, this method will return
+ * the detail message from the embedded exception.</p>
+ *
+ * @return The error or warning message.
+ */
+ public String getMessage ()
+ {
+ String message = super.getMessage();
+
+ if (message == null && exception != null) {
+ return exception.getMessage();
+ } else {
+ return message;
+ }
+ }
+
+
+ /**
+ * Return the embedded exception, if any.
+ *
+ * @return The embedded exception, or null if there is none.
+ */
+ public Exception getException ()
+ {
+ return exception;
+ }
+
+
+ /**
+ * Override toString to pick up any embedded exception.
+ *
+ * @return A string representation of this exception.
+ */
+ public String toString ()
+ {
+ if (exception != null) {
+ return exception.toString();
+ } else {
+ return super.toString();
+ }
+ }
+
+
+
+ //////////////////////////////////////////////////////////////////////
+ // Internal state.
+ //////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * @serial The embedded exception if tunnelling, or null.
+ */
+ private Exception exception;
+
+}
+
+// end of SAXException.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/SAXNotRecognizedException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/SAXNotRecognizedException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/SAXNotRecognizedException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/SAXNotRecognizedException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,53 @@
+// SAXNotRecognizedException.java - unrecognized feature or value.
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the Public Domain.
+// $Id: SAXNotRecognizedException.java,v 1.11 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax;
+
+
+/**
+ * Exception class for an unrecognized identifier.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>An XMLReader will throw this exception when it finds an
+ * unrecognized feature or property identifier; SAX applications and
+ * extensions may use this class for other, similar purposes.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.SAXNotSupportedException
+ */
+public class SAXNotRecognizedException extends SAXException
+{
+
+ /**
+ * Default constructor.
+ */
+ public SAXNotRecognizedException ()
+ {
+ super();
+ }
+
+
+ /**
+ * Construct a new exception with the given message.
+ *
+ * @param message The text message of the exception.
+ */
+ public SAXNotRecognizedException (String message)
+ {
+ super(message);
+ }
+
+}
+
+// end of SAXNotRecognizedException.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/SAXNotSupportedException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/SAXNotSupportedException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/SAXNotSupportedException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/SAXNotSupportedException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,53 @@
+// SAXNotSupportedException.java - unsupported feature or value.
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the Public Domain.
+// $Id: SAXNotSupportedException.java,v 1.11 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax;
+
+/**
+ * Exception class for an unsupported operation.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>An XMLReader will throw this exception when it recognizes a
+ * feature or property identifier, but cannot perform the requested
+ * operation (setting a state or value). Other SAX2 applications and
+ * extensions may use this class for similar purposes.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.SAXNotRecognizedException
+ */
+public class SAXNotSupportedException extends SAXException
+{
+
+ /**
+ * Construct a new exception with no message.
+ */
+ public SAXNotSupportedException ()
+ {
+ super();
+ }
+
+
+ /**
+ * Construct a new exception with the given message.
+ *
+ * @param message The text message of the exception.
+ */
+ public SAXNotSupportedException (String message)
+ {
+ super(message);
+ }
+
+}
+
+// end of SAXNotSupportedException.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/SAXParseException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/SAXParseException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/SAXParseException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/SAXParseException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,269 @@
+// SAX exception class.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: SAXParseException.java,v 1.10 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax;
+
+/**
+ * Encapsulate an XML parse error or warning.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This exception may include information for locating the error
+ * in the original XML document, as if it came from a {@link Locator}
+ * object. Note that although the application
+ * will receive a SAXParseException as the argument to the handlers
+ * in the {@link org.xml.sax.ErrorHandler ErrorHandler} interface,
+ * the application is not actually required to throw the exception;
+ * instead, it can simply read the information in it and take a
+ * different action.</p>
+ *
+ * <p>Since this exception is a subclass of {@link org.xml.sax.SAXException
+ * SAXException}, it inherits the ability to wrap another exception.</p>
+ *
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.SAXException
+ * @see org.xml.sax.Locator
+ * @see org.xml.sax.ErrorHandler
+ */
+public class SAXParseException extends SAXException {
+
+
+ //////////////////////////////////////////////////////////////////////
+ // Constructors.
+ //////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Create a new SAXParseException from a message and a Locator.
+ *
+ * <p>This constructor is especially useful when an application is
+ * creating its own exception from within a {@link org.xml.sax.ContentHandler
+ * ContentHandler} callback.</p>
+ *
+ * @param message The error or warning message.
+ * @param locator The locator object for the error or warning (may be
+ * null).
+ * @see org.xml.sax.Locator
+ */
+ public SAXParseException (String message, Locator locator) {
+ super(message);
+ if (locator != null) {
+ init(locator.getPublicId(), locator.getSystemId(),
+ locator.getLineNumber(), locator.getColumnNumber());
+ } else {
+ init(null, null, -1, -1);
+ }
+ }
+
+
+ /**
+ * Wrap an existing exception in a SAXParseException.
+ *
+ * <p>This constructor is especially useful when an application is
+ * creating its own exception from within a {@link org.xml.sax.ContentHandler
+ * ContentHandler} callback, and needs to wrap an existing exception that is not a
+ * subclass of {@link org.xml.sax.SAXException SAXException}.</p>
+ *
+ * @param message The error or warning message, or null to
+ * use the message from the embedded exception.
+ * @param locator The locator object for the error or warning (may be
+ * null).
+ * @param e Any exception.
+ * @see org.xml.sax.Locator
+ */
+ public SAXParseException (String message, Locator locator,
+ Exception e) {
+ super(message, e);
+ if (locator != null) {
+ init(locator.getPublicId(), locator.getSystemId(),
+ locator.getLineNumber(), locator.getColumnNumber());
+ } else {
+ init(null, null, -1, -1);
+ }
+ }
+
+
+ /**
+ * Create a new SAXParseException.
+ *
+ * <p>This constructor is most useful for parser writers.</p>
+ *
+ * <p>All parameters except the message are as if
+ * they were provided by a {@link Locator}. For example, if the
+ * system identifier is a URL (including relative filename), the
+ * caller must resolve it fully before creating the exception.</p>
+ *
+ *
+ * @param message The error or warning message.
+ * @param publicId The public identifier of the entity that generated
+ * the error or warning.
+ * @param systemId The system identifier of the entity that generated
+ * the error or warning.
+ * @param lineNumber The line number of the end of the text that
+ * caused the error or warning.
+ * @param columnNumber The column number of the end of the text that
+ * cause the error or warning.
+ */
+ public SAXParseException (String message, String publicId, String systemId,
+ int lineNumber, int columnNumber)
+ {
+ super(message);
+ init(publicId, systemId, lineNumber, columnNumber);
+ }
+
+
+ /**
+ * Create a new SAXParseException with an embedded exception.
+ *
+ * <p>This constructor is most useful for parser writers who
+ * need to wrap an exception that is not a subclass of
+ * {@link org.xml.sax.SAXException SAXException}.</p>
+ *
+ * <p>All parameters except the message and exception are as if
+ * they were provided by a {@link Locator}. For example, if the
+ * system identifier is a URL (including relative filename), the
+ * caller must resolve it fully before creating the exception.</p>
+ *
+ * @param message The error or warning message, or null to use
+ * the message from the embedded exception.
+ * @param publicId The public identifier of the entity that generated
+ * the error or warning.
+ * @param systemId The system identifier of the entity that generated
+ * the error or warning.
+ * @param lineNumber The line number of the end of the text that
+ * caused the error or warning.
+ * @param columnNumber The column number of the end of the text that
+ * cause the error or warning.
+ * @param e Another exception to embed in this one.
+ */
+ public SAXParseException (String message, String publicId, String systemId,
+ int lineNumber, int columnNumber, Exception e)
+ {
+ super(message, e);
+ init(publicId, systemId, lineNumber, columnNumber);
+ }
+
+
+ /**
+ * Internal initialization method.
+ *
+ * @param publicId The public identifier of the entity which generated the exception,
+ * or null.
+ * @param systemId The system identifier of the entity which generated the exception,
+ * or null.
+ * @param lineNumber The line number of the error, or -1.
+ * @param columnNumber The column number of the error, or -1.
+ */
+ private void init (String publicId, String systemId,
+ int lineNumber, int columnNumber)
+ {
+ this.publicId = publicId;
+ this.systemId = systemId;
+ this.lineNumber = lineNumber;
+ this.columnNumber = columnNumber;
+ }
+
+
+ /**
+ * Get the public identifier of the entity where the exception occurred.
+ *
+ * @return A string containing the public identifier, or null
+ * if none is available.
+ * @see org.xml.sax.Locator#getPublicId
+ */
+ public String getPublicId ()
+ {
+ return this.publicId;
+ }
+
+
+ /**
+ * Get the system identifier of the entity where the exception occurred.
+ *
+ * <p>If the system identifier is a URL, it will have been resolved
+ * fully.</p>
+ *
+ * @return A string containing the system identifier, or null
+ * if none is available.
+ * @see org.xml.sax.Locator#getSystemId
+ */
+ public String getSystemId ()
+ {
+ return this.systemId;
+ }
+
+
+ /**
+ * The line number of the end of the text where the exception occurred.
+ *
+ * <p>The first line is line 1.</p>
+ *
+ * @return An integer representing the line number, or -1
+ * if none is available.
+ * @see org.xml.sax.Locator#getLineNumber
+ */
+ public int getLineNumber ()
+ {
+ return this.lineNumber;
+ }
+
+
+ /**
+ * The column number of the end of the text where the exception occurred.
+ *
+ * <p>The first column in a line is position 1.</p>
+ *
+ * @return An integer representing the column number, or -1
+ * if none is available.
+ * @see org.xml.sax.Locator#getColumnNumber
+ */
+ public int getColumnNumber ()
+ {
+ return this.columnNumber;
+ }
+
+
+ //////////////////////////////////////////////////////////////////////
+ // Internal state.
+ //////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * @serial The public identifier, or null.
+ * @see #getPublicId
+ */
+ private String publicId;
+
+
+ /**
+ * @serial The system identifier, or null.
+ * @see #getSystemId
+ */
+ private String systemId;
+
+
+ /**
+ * @serial The line number, or -1.
+ * @see #getLineNumber
+ */
+ private int lineNumber;
+
+
+ /**
+ * @serial The column number, or -1.
+ * @see #getColumnNumber
+ */
+ private int columnNumber;
+
+}
+
+// end of SAXParseException.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/XMLFilter.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/XMLFilter.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/XMLFilter.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/XMLFilter.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,65 @@
+// XMLFilter.java - filter SAX2 events.
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the Public Domain.
+// $Id: XMLFilter.java,v 1.10 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax;
+
+
+/**
+ * Interface for an XML filter.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>An XML filter is like an XML reader, except that it obtains its
+ * events from another XML reader rather than a primary source like
+ * an XML document or database. Filters can modify a stream of
+ * events as they pass on to the final application.</p>
+ *
+ * <p>The XMLFilterImpl helper class provides a convenient base
+ * for creating SAX2 filters, by passing on all {@link org.xml.sax.EntityResolver
+ * EntityResolver}, {@link org.xml.sax.DTDHandler DTDHandler},
+ * {@link org.xml.sax.ContentHandler ContentHandler} and {@link org.xml.sax.ErrorHandler
+ * ErrorHandler} events automatically.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.helpers.XMLFilterImpl
+ */
+public interface XMLFilter extends XMLReader
+{
+
+ /**
+ * Set the parent reader.
+ *
+ * <p>This method allows the application to link the filter to
+ * a parent reader (which may be another filter). The argument
+ * may not be null.</p>
+ *
+ * @param parent The parent reader.
+ */
+ public abstract void setParent (XMLReader parent);
+
+
+ /**
+ * Get the parent reader.
+ *
+ * <p>This method allows the application to query the parent
+ * reader (which may be another filter). It is generally a
+ * bad idea to perform any operations on the parent reader
+ * directly: they should all pass through this filter.</p>
+ *
+ * @return The parent filter, or null if none has been set.
+ */
+ public abstract XMLReader getParent ();
+
+}
+
+// end of XMLFilter.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/XMLReader.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/XMLReader.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/XMLReader.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/XMLReader.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,404 @@
+// XMLReader.java - read an XML document.
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the Public Domain.
+// $Id: XMLReader.java,v 1.11 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax;
+
+import java.io.IOException;
+
+
+/**
+ * Interface for reading an XML document using callbacks.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p><strong>Note:</strong> despite its name, this interface does
+ * <em>not</em> extend the standard Java {@link java.io.Reader Reader}
+ * interface, because reading XML is a fundamentally different activity
+ * than reading character data.</p>
+ *
+ * <p>XMLReader is the interface that an XML parser's SAX2 driver must
+ * implement. This interface allows an application to set and
+ * query features and properties in the parser, to register
+ * event handlers for document processing, and to initiate
+ * a document parse.</p>
+ *
+ * <p>All SAX interfaces are assumed to be synchronous: the
+ * {@link #parse parse} methods must not return until parsing
+ * is complete, and readers must wait for an event-handler callback
+ * to return before reporting the next event.</p>
+ *
+ * <p>This interface replaces the (now deprecated) SAX 1.0 {@link
+ * org.xml.sax.Parser Parser} interface. The XMLReader interface
+ * contains two important enhancements over the old Parser
+ * interface (as well as some minor ones):</p>
+ *
+ * <ol>
+ * <li>it adds a standard way to query and set features and
+ * properties; and</li>
+ * <li>it adds Namespace support, which is required for many
+ * higher-level XML standards.</li>
+ * </ol>
+ *
+ * <p>There are adapters available to convert a SAX1 Parser to
+ * a SAX2 XMLReader and vice-versa.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1+ (sax2r3pre1)
+ * @see org.xml.sax.XMLFilter
+ * @see org.xml.sax.helpers.ParserAdapter
+ * @see org.xml.sax.helpers.XMLReaderAdapter
+ */
+public interface XMLReader
+{
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Configuration.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Look up the value of a feature flag.
+ *
+ * <p>The feature name is any fully-qualified URI. It is
+ * possible for an XMLReader to recognize a feature name but
+ * temporarily be unable to return its value.
+ * Some feature values may be available only in specific
+ * contexts, such as before, during, or after a parse.
+ * Also, some feature values may not be programmatically accessible.
+ * (In the case of an adapter for SAX1 {@link Parser}, there is no
+ * implementation-independent way to expose whether the underlying
+ * parser is performing validation, expanding external entities,
+ * and so forth.) </p>
+ *
+ * <p>All XMLReaders are required to recognize the
+ * http://xml.org/sax/features/namespaces and the
+ * http://xml.org/sax/features/namespace-prefixes feature names.</p>
+ *
+ * <p>Typical usage is something like this:</p>
+ *
+ * <pre>
+ * XMLReader r = new MySAXDriver();
+ *
+ * // try to activate validation
+ * try {
+ * r.setFeature("http://xml.org/sax/features/validation", true);
+ * } catch (SAXException e) {
+ * System.err.println("Cannot activate validation.");
+ * }
+ *
+ * // register event handlers
+ * r.setContentHandler(new MyContentHandler());
+ * r.setErrorHandler(new MyErrorHandler());
+ *
+ * // parse the first document
+ * try {
+ * r.parse("http://www.foo.com/mydoc.xml");
+ * } catch (IOException e) {
+ * System.err.println("I/O exception reading XML document");
+ * } catch (SAXException e) {
+ * System.err.println("XML exception reading document.");
+ * }
+ * </pre>
+ *
+ * <p>Implementors are free (and encouraged) to invent their own features,
+ * using names built on their own URIs.</p>
+ *
+ * @param name The feature name, which is a fully-qualified URI.
+ * @return The current value of the feature (true or false).
+ * @exception org.xml.sax.SAXNotRecognizedException If the feature
+ * value can't be assigned or retrieved.
+ * @exception org.xml.sax.SAXNotSupportedException When the
+ * XMLReader recognizes the feature name but
+ * cannot determine its value at this time.
+ * @see #setFeature
+ */
+ public boolean getFeature (String name)
+ throws SAXNotRecognizedException, SAXNotSupportedException;
+
+
+ /**
+ * Set the value of a feature flag.
+ *
+ * <p>The feature name is any fully-qualified URI. It is
+ * possible for an XMLReader to expose a feature value but
+ * to be unable to change the current value.
+ * Some feature values may be immutable or mutable only
+ * in specific contexts, such as before, during, or after
+ * a parse.</p>
+ *
+ * <p>All XMLReaders are required to support setting
+ * http://xml.org/sax/features/namespaces to true and
+ * http://xml.org/sax/features/namespace-prefixes to false.</p>
+ *
+ * @param name The feature name, which is a fully-qualified URI.
+ * @param value The requested value of the feature (true or false).
+ * @exception org.xml.sax.SAXNotRecognizedException If the feature
+ * value can't be assigned or retrieved.
+ * @exception org.xml.sax.SAXNotSupportedException When the
+ * XMLReader recognizes the feature name but
+ * cannot set the requested value.
+ * @see #getFeature
+ */
+ public void setFeature (String name, boolean value)
+ throws SAXNotRecognizedException, SAXNotSupportedException;
+
+
+ /**
+ * Look up the value of a property.
+ *
+ * <p>The property name is any fully-qualified URI. It is
+ * possible for an XMLReader to recognize a property name but
+ * temporarily be unable to return its value.
+ * Some property values may be available only in specific
+ * contexts, such as before, during, or after a parse.</p>
+ *
+ * <p>XMLReaders are not required to recognize any specific
+ * property names, though an initial core set is documented for
+ * SAX2.</p>
+ *
+ * <p>Implementors are free (and encouraged) to invent their own properties,
+ * using names built on their own URIs.</p>
+ *
+ * @param name The property name, which is a fully-qualified URI.
+ * @return The current value of the property.
+ * @exception org.xml.sax.SAXNotRecognizedException If the property
+ * value can't be assigned or retrieved.
+ * @exception org.xml.sax.SAXNotSupportedException When the
+ * XMLReader recognizes the property name but
+ * cannot determine its value at this time.
+ * @see #setProperty
+ */
+ public Object getProperty (String name)
+ throws SAXNotRecognizedException, SAXNotSupportedException;
+
+
+ /**
+ * Set the value of a property.
+ *
+ * <p>The property name is any fully-qualified URI. It is
+ * possible for an XMLReader to recognize a property name but
+ * to be unable to change the current value.
+ * Some property values may be immutable or mutable only
+ * in specific contexts, such as before, during, or after
+ * a parse.</p>
+ *
+ * <p>XMLReaders are not required to recognize setting
+ * any specific property names, though a core set is defined by
+ * SAX2.</p>
+ *
+ * <p>This method is also the standard mechanism for setting
+ * extended handlers.</p>
+ *
+ * @param name The property name, which is a fully-qualified URI.
+ * @param value The requested value for the property.
+ * @exception org.xml.sax.SAXNotRecognizedException If the property
+ * value can't be assigned or retrieved.
+ * @exception org.xml.sax.SAXNotSupportedException When the
+ * XMLReader recognizes the property name but
+ * cannot set the requested value.
+ */
+ public void setProperty (String name, Object value)
+ throws SAXNotRecognizedException, SAXNotSupportedException;
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Event handlers.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Allow an application to register an entity resolver.
+ *
+ * <p>If the application does not register an entity resolver,
+ * the XMLReader will perform its own default resolution.</p>
+ *
+ * <p>Applications may register a new or different resolver in the
+ * middle of a parse, and the SAX parser must begin using the new
+ * resolver immediately.</p>
+ *
+ * @param resolver The entity resolver.
+ * @see #getEntityResolver
+ */
+ public void setEntityResolver (EntityResolver resolver);
+
+
+ /**
+ * Return the current entity resolver.
+ *
+ * @return The current entity resolver, or null if none
+ * has been registered.
+ * @see #setEntityResolver
+ */
+ public EntityResolver getEntityResolver ();
+
+
+ /**
+ * Allow an application to register a DTD event handler.
+ *
+ * <p>If the application does not register a DTD handler, all DTD
+ * events reported by the SAX parser will be silently ignored.</p>
+ *
+ * <p>Applications may register a new or different handler in the
+ * middle of a parse, and the SAX parser must begin using the new
+ * handler immediately.</p>
+ *
+ * @param handler The DTD handler.
+ * @see #getDTDHandler
+ */
+ public void setDTDHandler (DTDHandler handler);
+
+
+ /**
+ * Return the current DTD handler.
+ *
+ * @return The current DTD handler, or null if none
+ * has been registered.
+ * @see #setDTDHandler
+ */
+ public DTDHandler getDTDHandler ();
+
+
+ /**
+ * Allow an application to register a content event handler.
+ *
+ * <p>If the application does not register a content handler, all
+ * content events reported by the SAX parser will be silently
+ * ignored.</p>
+ *
+ * <p>Applications may register a new or different handler in the
+ * middle of a parse, and the SAX parser must begin using the new
+ * handler immediately.</p>
+ *
+ * @param handler The content handler.
+ * @see #getContentHandler
+ */
+ public void setContentHandler (ContentHandler handler);
+
+
+ /**
+ * Return the current content handler.
+ *
+ * @return The current content handler, or null if none
+ * has been registered.
+ * @see #setContentHandler
+ */
+ public ContentHandler getContentHandler ();
+
+
+ /**
+ * Allow an application to register an error event handler.
+ *
+ * <p>If the application does not register an error handler, all
+ * error events reported by the SAX parser will be silently
+ * ignored; however, normal processing may not continue. It is
+ * highly recommended that all SAX applications implement an
+ * error handler to avoid unexpected bugs.</p>
+ *
+ * <p>Applications may register a new or different handler in the
+ * middle of a parse, and the SAX parser must begin using the new
+ * handler immediately.</p>
+ *
+ * @param handler The error handler.
+ * @see #getErrorHandler
+ */
+ public void setErrorHandler (ErrorHandler handler);
+
+
+ /**
+ * Return the current error handler.
+ *
+ * @return The current error handler, or null if none
+ * has been registered.
+ * @see #setErrorHandler
+ */
+ public ErrorHandler getErrorHandler ();
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Parsing.
+ ////////////////////////////////////////////////////////////////////
+
+ /**
+ * Parse an XML document.
+ *
+ * <p>The application can use this method to instruct the XML
+ * reader to begin parsing an XML document from any valid input
+ * source (a character stream, a byte stream, or a URI).</p>
+ *
+ * <p>Applications may not invoke this method while a parse is in
+ * progress (they should create a new XMLReader instead for each
+ * nested XML document). Once a parse is complete, an
+ * application may reuse the same XMLReader object, possibly with a
+ * different input source.
+ * Configuration of the XMLReader object (such as handler bindings and
+ * values established for feature flags and properties) is unchanged
+ * by completion of a parse, unless the definition of that aspect of
+ * the configuration explicitly specifies other behavior.
+ * (For example, feature flags or properties exposing
+ * characteristics of the document being parsed.)
+ * </p>
+ *
+ * <p>During the parse, the XMLReader will provide information
+ * about the XML document through the registered event
+ * handlers.</p>
+ *
+ * <p>This method is synchronous: it will not return until parsing
+ * has ended. If a client application wants to terminate
+ * parsing early, it should throw an exception.</p>
+ *
+ * @param input The input source for the top-level of the
+ * XML document.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @exception java.io.IOException An IO exception from the parser,
+ * possibly from a byte stream or character stream
+ * supplied by the application.
+ * @see org.xml.sax.InputSource
+ * @see #parse(java.lang.String)
+ * @see #setEntityResolver
+ * @see #setDTDHandler
+ * @see #setContentHandler
+ * @see #setErrorHandler
+ */
+ public void parse (InputSource input)
+ throws IOException, SAXException;
+
+
+ /**
+ * Parse an XML document from a system identifier (URI).
+ *
+ * <p>This method is a shortcut for the common case of reading a
+ * document from a system identifier. It is the exact
+ * equivalent of the following:</p>
+ *
+ * <pre>
+ * parse(new InputSource(systemId));
+ * </pre>
+ *
+ * <p>If the system identifier is a URL, it must be fully resolved
+ * by the application before it is passed to the parser.</p>
+ *
+ * @param systemId The system identifier (URI).
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @exception java.io.IOException An IO exception from the parser,
+ * possibly from a byte stream or character stream
+ * supplied by the application.
+ * @see #parse(org.xml.sax.InputSource)
+ */
+ public void parse (String systemId)
+ throws IOException, SAXException;
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/Attributes2.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/Attributes2.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/Attributes2.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/Attributes2.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,132 @@
+// Attributes2.java - extended Attributes
+// http://www.saxproject.org
+// Public Domain: no warranty.
+// $Id: Attributes2.java,v 1.8 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax.ext;
+
+import org.xml.sax.Attributes;
+
+
+/**
+ * SAX2 extension to augment the per-attribute information
+ * provided though {@link Attributes}.
+ * If an implementation supports this extension, the attributes
+ * provided in {@link org.xml.sax.ContentHandler#startElement
+ * ContentHandler.startElement() } will implement this interface,
+ * and the <em>http://xml.org/sax/features/use-attributes2</em>
+ * feature flag will have the value <em>true</em>.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * </blockquote>
+ *
+ * <p> XMLReader implementations are not required to support this
+ * information, and it is not part of core-only SAX2 distributions.</p>
+ *
+ * <p>Note that if an attribute was defaulted (<em>!isSpecified()</em>)
+ * it will of necessity also have been declared (<em>isDeclared()</em>)
+ * in the DTD.
+ * Similarly if an attribute's type is anything except CDATA, then it
+ * must have been declared.
+ * </p>
+ *
+ * @since SAX 2.0 (extensions 1.1 alpha)
+ * @author David Brownell
+ * @version TBS
+ */
+public interface Attributes2 extends Attributes
+{
+ /**
+ * Returns false unless the attribute was declared in the DTD.
+ * This helps distinguish two kinds of attributes that SAX reports
+ * as CDATA: ones that were declared (and hence are usually valid),
+ * and those that were not (and which are never valid).
+ *
+ * @param index The attribute index (zero-based).
+ * @return true if the attribute was declared in the DTD,
+ * false otherwise.
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the
+ * supplied index does not identify an attribute.
+ */
+ public boolean isDeclared (int index);
+
+ /**
+ * Returns false unless the attribute was declared in the DTD.
+ * This helps distinguish two kinds of attributes that SAX reports
+ * as CDATA: ones that were declared (and hence are usually valid),
+ * and those that were not (and which are never valid).
+ *
+ * @param qName The XML qualified (prefixed) name.
+ * @return true if the attribute was declared in the DTD,
+ * false otherwise.
+ * @exception java.lang.IllegalArgumentException When the
+ * supplied name does not identify an attribute.
+ */
+ public boolean isDeclared (String qName);
+
+ /**
+ * Returns false unless the attribute was declared in the DTD.
+ * This helps distinguish two kinds of attributes that SAX reports
+ * as CDATA: ones that were declared (and hence are usually valid),
+ * and those that were not (and which are never valid).
+ *
+ * <p>Remember that since DTDs do not "understand" namespaces, the
+ * namespace URI associated with an attribute may not have come from
+ * the DTD. The declaration will have applied to the attribute's
+ * <em>qName</em>.
+ *
+ * @param uri The Namespace URI, or the empty string if
+ * the name has no Namespace URI.
+ * @param localName The attribute's local name.
+ * @return true if the attribute was declared in the DTD,
+ * false otherwise.
+ * @exception java.lang.IllegalArgumentException When the
+ * supplied names do not identify an attribute.
+ */
+ public boolean isDeclared (String uri, String localName);
+
+ /**
+ * Returns true unless the attribute value was provided
+ * by DTD defaulting.
+ *
+ * @param index The attribute index (zero-based).
+ * @return true if the value was found in the XML text,
+ * false if the value was provided by DTD defaulting.
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the
+ * supplied index does not identify an attribute.
+ */
+ public boolean isSpecified (int index);
+
+ /**
+ * Returns true unless the attribute value was provided
+ * by DTD defaulting.
+ *
+ * <p>Remember that since DTDs do not "understand" namespaces, the
+ * namespace URI associated with an attribute may not have come from
+ * the DTD. The declaration will have applied to the attribute's
+ * <em>qName</em>.
+ *
+ * @param uri The Namespace URI, or the empty string if
+ * the name has no Namespace URI.
+ * @param localName The attribute's local name.
+ * @return true if the value was found in the XML text,
+ * false if the value was provided by DTD defaulting.
+ * @exception java.lang.IllegalArgumentException When the
+ * supplied names do not identify an attribute.
+ */
+ public boolean isSpecified (String uri, String localName);
+
+ /**
+ * Returns true unless the attribute value was provided
+ * by DTD defaulting.
+ *
+ * @param qName The XML qualified (prefixed) name.
+ * @return true if the value was found in the XML text,
+ * false if the value was provided by DTD defaulting.
+ * @exception java.lang.IllegalArgumentException When the
+ * supplied name does not identify an attribute.
+ */
+ public boolean isSpecified (String qName);
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/Attributes2Impl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/Attributes2Impl.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/Attributes2Impl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/Attributes2Impl.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,301 @@
+// Attributes2Impl.java - extended AttributesImpl
+// http://www.saxproject.org
+// Public Domain: no warranty.
+// $Id: Attributes2Impl.java,v 1.8 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax.ext;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.helpers.AttributesImpl;
+
+
+/**
+ * SAX2 extension helper for additional Attributes information,
+ * implementing the {@link Attributes2} interface.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * </blockquote>
+ *
+ * <p>This is not part of core-only SAX2 distributions.</p>
+ *
+ * <p>The <em>specified</em> flag for each attribute will always
+ * be true, unless it has been set to false in the copy constructor
+ * or using {@link #setSpecified}.
+ * Similarly, the <em>declared</em> flag for each attribute will
+ * always be false, except for defaulted attributes (<em>specified</em>
+ * is false), non-CDATA attributes, or when it is set to true using
+ * {@link #setDeclared}.
+ * If you change an attribute's type by hand, you may need to modify
+ * its <em>declared</em> flag to match.
+ * </p>
+ *
+ * @since SAX 2.0 (extensions 1.1 alpha)
+ * @author David Brownell
+ * @version TBS
+ */
+public class Attributes2Impl extends AttributesImpl implements Attributes2
+{
+ private boolean declared [];
+ private boolean specified [];
+
+
+ /**
+ * Construct a new, empty Attributes2Impl object.
+ */
+ public Attributes2Impl () { }
+
+
+ /**
+ * Copy an existing Attributes or Attributes2 object.
+ * If the object implements Attributes2, values of the
+ * <em>specified</em> and <em>declared</em> flags for each
+ * attribute are copied.
+ * Otherwise the flag values are defaulted to assume no DTD was used,
+ * unless there is evidence to the contrary (such as attributes with
+ * type other than CDATA, which must have been <em>declared</em>).
+ *
+ * <p>This constructor is especially useful inside a
+ * {@link org.xml.sax.ContentHandler#startElement startElement} event.</p>
+ *
+ * @param atts The existing Attributes object.
+ */
+ public Attributes2Impl (Attributes atts)
+ {
+ super (atts);
+ }
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of Attributes2
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Returns the current value of the attribute's "declared" flag.
+ */
+ // javadoc mostly from interface
+ public boolean isDeclared (int index)
+ {
+ if (index < 0 || index >= getLength ())
+ throw new ArrayIndexOutOfBoundsException (
+ "No attribute at index: " + index);
+ return declared [index];
+ }
+
+
+ /**
+ * Returns the current value of the attribute's "declared" flag.
+ */
+ // javadoc mostly from interface
+ public boolean isDeclared (String uri, String localName)
+ {
+ int index = getIndex (uri, localName);
+
+ if (index < 0)
+ throw new IllegalArgumentException (
+ "No such attribute: local=" + localName
+ + ", namespace=" + uri);
+ return declared [index];
+ }
+
+
+ /**
+ * Returns the current value of the attribute's "declared" flag.
+ */
+ // javadoc mostly from interface
+ public boolean isDeclared (String qName)
+ {
+ int index = getIndex (qName);
+
+ if (index < 0)
+ throw new IllegalArgumentException (
+ "No such attribute: " + qName);
+ return declared [index];
+ }
+
+
+ /**
+ * Returns the current value of an attribute's "specified" flag.
+ *
+ * @param index The attribute index (zero-based).
+ * @return current flag value
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the
+ * supplied index does not identify an attribute.
+ */
+ public boolean isSpecified (int index)
+ {
+ if (index < 0 || index >= getLength ())
+ throw new ArrayIndexOutOfBoundsException (
+ "No attribute at index: " + index);
+ return specified [index];
+ }
+
+
+ /**
+ * Returns the current value of an attribute's "specified" flag.
+ *
+ * @param uri The Namespace URI, or the empty string if
+ * the name has no Namespace URI.
+ * @param localName The attribute's local name.
+ * @return current flag value
+ * @exception java.lang.IllegalArgumentException When the
+ * supplied names do not identify an attribute.
+ */
+ public boolean isSpecified (String uri, String localName)
+ {
+ int index = getIndex (uri, localName);
+
+ if (index < 0)
+ throw new IllegalArgumentException (
+ "No such attribute: local=" + localName
+ + ", namespace=" + uri);
+ return specified [index];
+ }
+
+
+ /**
+ * Returns the current value of an attribute's "specified" flag.
+ *
+ * @param qName The XML qualified (prefixed) name.
+ * @return current flag value
+ * @exception java.lang.IllegalArgumentException When the
+ * supplied name does not identify an attribute.
+ */
+ public boolean isSpecified (String qName)
+ {
+ int index = getIndex (qName);
+
+ if (index < 0)
+ throw new IllegalArgumentException (
+ "No such attribute: " + qName);
+ return specified [index];
+ }
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Manipulators
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Copy an entire Attributes object. The "specified" flags are
+ * assigned as true, and "declared" flags as false (except when
+ * an attribute's type is not CDATA),
+ * unless the object is an Attributes2 object.
+ * In that case those flag values are all copied.
+ *
+ * @see AttributesImpl#setAttributes
+ */
+ public void setAttributes (Attributes atts)
+ {
+ int length = atts.getLength ();
+
+ super.setAttributes (atts);
+ declared = new boolean [length];
+ specified = new boolean [length];
+
+ if (atts instanceof Attributes2) {
+ Attributes2 a2 = (Attributes2) atts;
+ for (int i = 0; i < length; i++) {
+ declared [i] = a2.isDeclared (i);
+ specified [i] = a2.isSpecified (i);
+ }
+ } else {
+ for (int i = 0; i < length; i++) {
+ declared [i] = !"CDATA".equals (atts.getType (i));
+ specified [i] = true;
+ }
+ }
+ }
+
+
+ /**
+ * Add an attribute to the end of the list, setting its
+ * "specified" flag to true. To set that flag's value
+ * to false, use {@link #setSpecified}.
+ *
+ * <p>Unless the attribute <em>type</em> is CDATA, this attribute
+ * is marked as being declared in the DTD. To set that flag's value
+ * to true for CDATA attributes, use {@link #setDeclared}.
+ *
+ * @see AttributesImpl#addAttribute
+ */
+ public void addAttribute (String uri, String localName, String qName,
+ String type, String value)
+ {
+ super.addAttribute (uri, localName, qName, type, value);
+
+ int length = getLength ();
+
+ if (length < specified.length) {
+ boolean newFlags [];
+
+ newFlags = new boolean [length];
+ System.arraycopy (declared, 0, newFlags, 0, declared.length);
+ declared = newFlags;
+
+ newFlags = new boolean [length];
+ System.arraycopy (specified, 0, newFlags, 0, specified.length);
+ specified = newFlags;
+ }
+
+ specified [length - 1] = true;
+ declared [length - 1] = !"CDATA".equals (type);
+ }
+
+
+ // javadoc entirely from superclass
+ public void removeAttribute (int index)
+ {
+ int origMax = getLength () - 1;
+
+ super.removeAttribute (index);
+ if (index != origMax) {
+ System.arraycopy (declared, index + 1, declared, index,
+ origMax - index);
+ System.arraycopy (specified, index + 1, specified, index,
+ origMax - index);
+ }
+ }
+
+
+ /**
+ * Assign a value to the "declared" flag of a specific attribute.
+ * This is normally needed only for attributes of type CDATA,
+ * including attributes whose type is changed to or from CDATA.
+ *
+ * @param index The index of the attribute (zero-based).
+ * @param value The desired flag value.
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the
+ * supplied index does not identify an attribute.
+ * @see #setType
+ */
+ public void setDeclared (int index, boolean value)
+ {
+ if (index < 0 || index >= getLength ())
+ throw new ArrayIndexOutOfBoundsException (
+ "No attribute at index: " + index);
+ declared [index] = value;
+ }
+
+
+ /**
+ * Assign a value to the "specified" flag of a specific attribute.
+ * This is the only way this flag can be cleared, except clearing
+ * by initialization with the copy constructor.
+ *
+ * @param index The index of the attribute (zero-based).
+ * @param value The desired flag value.
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the
+ * supplied index does not identify an attribute.
+ */
+ public void setSpecified (int index, boolean value)
+ {
+ if (index < 0 || index >= getLength ())
+ throw new ArrayIndexOutOfBoundsException (
+ "No attribute at index: " + index);
+ specified [index] = value;
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/DeclHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/DeclHandler.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/DeclHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/DeclHandler.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,146 @@
+// DeclHandler.java - Optional handler for DTD declaration events.
+// http://www.saxproject.org
+// Public Domain: no warranty.
+// $Id: DeclHandler.java,v 1.10 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax.ext;
+
+import org.xml.sax.SAXException;
+
+
+/**
+ * SAX2 extension handler for DTD declaration events.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This is an optional extension handler for SAX2 to provide more
+ * complete information about DTD declarations in an XML document.
+ * XML readers are not required to recognize this handler, and it
+ * is not part of core-only SAX2 distributions.</p>
+ *
+ * <p>Note that data-related DTD declarations (unparsed entities and
+ * notations) are already reported through the {@link
+ * org.xml.sax.DTDHandler DTDHandler} interface.</p>
+ *
+ * <p>If you are using the declaration handler together with a lexical
+ * handler, all of the events will occur between the
+ * {@link org.xml.sax.ext.LexicalHandler#startDTD startDTD} and the
+ * {@link org.xml.sax.ext.LexicalHandler#endDTD endDTD} events.</p>
+ *
+ * <p>To set the DeclHandler for an XML reader, use the
+ * {@link org.xml.sax.XMLReader#setProperty setProperty} method
+ * with the property name
+ * <code>http://xml.org/sax/properties/declaration-handler</code>
+ * and an object implementing this interface (or null) as the value.
+ * If the reader does not report declaration events, it will throw a
+ * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException}
+ * when you attempt to register the handler.</p>
+ *
+ * @since SAX 2.0 (extensions 1.0)
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ */
+public interface DeclHandler
+{
+
+ /**
+ * Report an element type declaration.
+ *
+ * <p>The content model will consist of the string "EMPTY", the
+ * string "ANY", or a parenthesised group, optionally followed
+ * by an occurrence indicator. The model will be normalized so
+ * that all parameter entities are fully resolved and all whitespace
+ * is removed,and will include the enclosing parentheses. Other
+ * normalization (such as removing redundant parentheses or
+ * simplifying occurrence indicators) is at the discretion of the
+ * parser.</p>
+ *
+ * @param name The element type name.
+ * @param model The content model as a normalized string.
+ * @exception SAXException The application may raise an exception.
+ */
+ public abstract void elementDecl (String name, String model)
+ throws SAXException;
+
+
+ /**
+ * Report an attribute type declaration.
+ *
+ * <p>Only the effective (first) declaration for an attribute will
+ * be reported. The type will be one of the strings "CDATA",
+ * "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY",
+ * "ENTITIES", a parenthesized token group with
+ * the separator "|" and all whitespace removed, or the word
+ * "NOTATION" followed by a space followed by a parenthesized
+ * token group with all whitespace removed.</p>
+ *
+ * <p>The value will be the value as reported to applications,
+ * appropriately normalized and with entity and character
+ * references expanded. </p>
+ *
+ * @param eName The name of the associated element.
+ * @param aName The name of the attribute.
+ * @param type A string representing the attribute type.
+ * @param mode A string representing the attribute defaulting mode
+ * ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if
+ * none of these applies.
+ * @param value A string representing the attribute's default value,
+ * or null if there is none.
+ * @exception SAXException The application may raise an exception.
+ */
+ public abstract void attributeDecl (String eName,
+ String aName,
+ String type,
+ String mode,
+ String value)
+ throws SAXException;
+
+
+ /**
+ * Report an internal entity declaration.
+ *
+ * <p>Only the effective (first) declaration for each entity
+ * will be reported. All parameter entities in the value
+ * will be expanded, but general entities will not.</p>
+ *
+ * @param name The name of the entity. If it is a parameter
+ * entity, the name will begin with '%'.
+ * @param value The replacement text of the entity.
+ * @exception SAXException The application may raise an exception.
+ * @see #externalEntityDecl
+ * @see org.xml.sax.DTDHandler#unparsedEntityDecl
+ */
+ public abstract void internalEntityDecl (String name, String value)
+ throws SAXException;
+
+
+ /**
+ * Report a parsed external entity declaration.
+ *
+ * <p>Only the effective (first) declaration for each entity
+ * will be reported.</p>
+ *
+ * <p>If the system identifier is a URL, the parser must resolve it
+ * fully before passing it to the application.</p>
+ *
+ * @param name The name of the entity. If it is a parameter
+ * entity, the name will begin with '%'.
+ * @param publicId The entity's public identifier, or null if none
+ * was given.
+ * @param systemId The entity's system identifier.
+ * @exception SAXException The application may raise an exception.
+ * @see #internalEntityDecl
+ * @see org.xml.sax.DTDHandler#unparsedEntityDecl
+ */
+ public abstract void externalEntityDecl (String name, String publicId,
+ String systemId)
+ throws SAXException;
+
+}
+
+// end of DeclHandler.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/DefaultHandler2.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/DefaultHandler2.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/DefaultHandler2.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/DefaultHandler2.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,130 @@
+// DefaultHandler2.java - extended DefaultHandler
+// http://www.saxproject.org
+// Public Domain: no warranty.
+// $Id: DefaultHandler2.java,v 1.8 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax.ext;
+
+import java.io.IOException;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+
+/**
+ * This class extends the SAX2 base handler class to support the
+ * SAX2 {@link LexicalHandler}, {@link DeclHandler}, and
+ * {@link EntityResolver2} extensions. Except for overriding the
+ * original SAX1 {@link DefaultHandler#resolveEntity resolveEntity()}
+ * method the added handler methods just return. Subclassers may
+ * override everything on a method-by-method basis.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * </blockquote>
+ *
+ * <p> <em>Note:</em> this class might yet learn that the
+ * <em>ContentHandler.setDocumentLocator()</em> call might be passed a
+ * {@link Locator2} object, and that the
+ * <em>ContentHandler.startElement()</em> call might be passed a
+ * {@link Attributes2} object.
+ *
+ * @since SAX 2.0 (extensions 1.1 alpha)
+ * @author David Brownell
+ * @version TBS
+ */
+public class DefaultHandler2 extends DefaultHandler
+ implements LexicalHandler, DeclHandler, EntityResolver2
+{
+ /** Constructs a handler which ignores all parsing events. */
+ public DefaultHandler2 () { }
+
+
+ // SAX2 ext-1.0 LexicalHandler
+
+ public void startCDATA ()
+ throws SAXException
+ {}
+
+ public void endCDATA ()
+ throws SAXException
+ {}
+
+ public void startDTD (String name, String publicId, String systemId)
+ throws SAXException
+ {}
+
+ public void endDTD ()
+ throws SAXException
+ {}
+
+ public void startEntity (String name)
+ throws SAXException
+ {}
+
+ public void endEntity (String name)
+ throws SAXException
+ {}
+
+ public void comment (char ch [], int start, int length)
+ throws SAXException
+ { }
+
+
+ // SAX2 ext-1.0 DeclHandler
+
+ public void attributeDecl (String eName, String aName,
+ String type, String mode, String value)
+ throws SAXException
+ {}
+
+ public void elementDecl (String name, String model)
+ throws SAXException
+ {}
+
+ public void externalEntityDecl (String name,
+ String publicId, String systemId)
+ throws SAXException
+ {}
+
+ public void internalEntityDecl (String name, String value)
+ throws SAXException
+ {}
+
+ // SAX2 ext-1.1 EntityResolver2
+
+ /**
+ * Tells the parser that if no external subset has been declared
+ * in the document text, none should be used.
+ */
+ public InputSource getExternalSubset (String name, String baseURI)
+ throws SAXException, IOException
+ { return null; }
+
+ /**
+ * Tells the parser to resolve the systemId against the baseURI
+ * and read the entity text from that resulting absolute URI.
+ * Note that because the older
+ * {@link DefaultHandler#resolveEntity DefaultHandler.resolveEntity()},
+ * method is overridden to call this one, this method may sometimes
+ * be invoked with null <em>name</em> and <em>baseURI</em>, and
+ * with the <em>systemId</em> already absolutized.
+ */
+ public InputSource resolveEntity (String name, String publicId,
+ String baseURI, String systemId)
+ throws SAXException, IOException
+ { return null; }
+
+ // SAX1 EntityResolver
+
+ /**
+ * Invokes
+ * {@link EntityResolver2#resolveEntity EntityResolver2.resolveEntity()}
+ * with null entity name and base URI.
+ * You only need to override that method to use this class.
+ */
+ public InputSource resolveEntity (String publicId, String systemId)
+ throws SAXException, IOException
+ { return resolveEntity (null, publicId, null, systemId); }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/EntityResolver2.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/EntityResolver2.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/EntityResolver2.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/EntityResolver2.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,197 @@
+// EntityResolver2.java - Extended SAX entity resolver.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: EntityResolver2.java,v 1.1 2004/12/23 22:38:42 mark Exp $
+
+package org.xml.sax.ext;
+
+import java.io.IOException;
+
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.SAXException;
+
+
+/**
+ * Extended interface for mapping external entity references to input
+ * sources, or providing a missing external subset. The
+ * {@link XMLReader#setEntityResolver XMLReader.setEntityResolver()} method
+ * is used to provide implementations of this interface to parsers.
+ * When a parser uses the methods in this interface, the
+ * {@link EntityResolver2#resolveEntity EntityResolver2.resolveEntity()}
+ * method (in this interface) is used <em>instead of</em> the older (SAX 1.0)
+ * {@link EntityResolver#resolveEntity EntityResolver.resolveEntity()} method.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * </blockquote>
+ *
+ * <p>If a SAX application requires the customized handling which this
+ * interface defines for external entities, it must ensure that it uses
+ * an XMLReader with the
+ * <em>http://xml.org/sax/features/use-entity-resolver2</em> feature flag
+ * set to <em>true</em> (which is its default value when the feature is
+ * recognized). If that flag is unrecognized, or its value is false,
+ * or the resolver does not implement this interface, then only the
+ * {@link EntityResolver} method will be used.
+ * </p>
+ *
+ * <p>That supports three categories of application that modify entity
+ * resolution. <em>Old Style</em> applications won't know about this interface;
+ * they will provide an EntityResolver.
+ * <em>Transitional Mode</em> provide an EntityResolver2 and automatically
+ * get the benefit of its methods in any systems (parsers or other tools)
+ * supporting it, due to polymorphism.
+ * Both <em>Old Style</em> and <em>Transitional Mode</em> applications will
+ * work with any SAX2 parser.
+ * <em>New style</em> applications will fail to run except on SAX2 parsers
+ * that support this particular feature.
+ * They will insist that feature flag have a value of "true", and the
+ * EntityResolver2 implementation they provide might throw an exception
+ * if the original SAX 1.0 style entity resolution method is invoked.
+ * </p>
+ *
+ * @see org.xml.sax.XMLReader#setEntityResolver
+ *
+ * @since SAX 2.0 (extensions 1.1 alpha)
+ * @author David Brownell
+ * @version TBD
+ */
+public interface EntityResolver2 extends EntityResolver
+{
+ /**
+ * Allows applications to provide an external subset for documents
+ * that don't explicitly define one. Documents with DOCTYPE declarations
+ * that omit an external subset can thus augment the declarations
+ * available for validation, entity processing, and attribute processing
+ * (normalization, defaulting, and reporting types including ID).
+ * This augmentation is reported
+ * through the {@link LexicalHandler#startDTD startDTD()} method as if
+ * the document text had originally included the external subset;
+ * this callback is made before any internal subset data or errors
+ * are reported.</p>
+ *
+ * <p>This method can also be used with documents that have no DOCTYPE
+ * declaration. When the root element is encountered,
+ * but no DOCTYPE declaration has been seen, this method is
+ * invoked. If it returns a value for the external subset, that root
+ * element is declared to be the root element, giving the effect of
+ * splicing a DOCTYPE declaration at the end the prolog of a document
+ * that could not otherwise be valid. The sequence of parser callbacks
+ * in that case logically resembles this:</p>
+ *
+ * <pre>
+ * ... comments and PIs from the prolog (as usual)
+ * startDTD ("rootName", source.getPublicId (), source.getSystemId ());
+ * startEntity ("[dtd]");
+ * ... declarations, comments, and PIs from the external subset
+ * endEntity ("[dtd]");
+ * endDTD ();
+ * ... then the rest of the document (as usual)
+ * startElement (..., "rootName", ...);
+ * </pre>
+ *
+ * <p>Note that the InputSource gets no further resolution.
+ * Implementations of this method may wish to invoke
+ * {@link #resolveEntity resolveEntity()} to gain benefits such as use
+ * of local caches of DTD entities. Also, this method will never be
+ * used by a (non-validating) processor that is not including external
+ * parameter entities. </p>
+ *
+ * <p>Uses for this method include facilitating data validation when
+ * interoperating with XML processors that would always require
+ * undesirable network accesses for external entities, or which for
+ * other reasons adopt a "no DTDs" policy.
+ * Non-validation motives include forcing documents to include DTDs so
+ * that attributes are handled consistently.
+ * For example, an XPath processor needs to know which attibutes have
+ * type "ID" before it can process a widely used type of reference.</p>
+ *
+ * <p><strong>Warning:</strong> Returning an external subset modifies
+ * the input document. By providing definitions for general entities,
+ * it can make a malformed document appear to be well formed.
+ * </p>
+ *
+ * @param name Identifies the document root element. This name comes
+ * from a DOCTYPE declaration (where available) or from the actual
+ * root element.
+ * @param baseURI The document's base URI, serving as an additional
+ * hint for selecting the external subset. This is always an absolute
+ * URI, unless it is null because the XMLReader was given an InputSource
+ * without one.
+ *
+ * @return An InputSource object describing the new external subset
+ * to be used by the parser, or null to indicate that no external
+ * subset is provided.
+ *
+ * @exception SAXException Any SAX exception, possibly wrapping
+ * another exception.
+ * @exception IOException Probably indicating a failure to create
+ * a new InputStream or Reader, or an illegal URL.
+ */
+ public InputSource getExternalSubset (String name, String baseURI)
+ throws SAXException, IOException;
+
+ /**
+ * Allows applications to map references to external entities into input
+ * sources, or tell the parser it should use conventional URI resolution.
+ * This method is only called for external entities which have been
+ * properly declared.
+ * This method provides more flexibility than the {@link EntityResolver}
+ * interface, supporting implementations of more complex catalogue
+ * schemes such as the one defined by the <a href=
+ "http://www.oasis-open.org/committees/entity/spec-2001-08-06.html"
+ >OASIS XML Catalogs</a> specification.</p>
+ *
+ * <p>Parsers configured to use this resolver method will call it
+ * to determine the input source to use for any external entity
+ * being included because of a reference in the XML text.
+ * That excludes the document entity, and any external entity returned
+ * by {@link #getExternalSubset getExternalSubset()}.
+ * When a (non-validating) processor is configured not to include
+ * a class of entities (parameter or general) through use of feature
+ * flags, this method is not invoked for such entities. </p>
+ *
+ * <p>Note that the entity naming scheme used here is the same one
+ * used in the {@link LexicalHandler}, or in the {@link
+ org.xml.sax.ContentHandler#skippedEntity
+ ContentHandler.skippedEntity()}
+ * method. </p>
+ *
+ * @param name Identifies the external entity being resolved.
+ * Either "[dtd]" for the external subset, or a name starting
+ * with "%" to indicate a parameter entity, or else the name of
+ * a general entity. This is never null when invoked by a SAX2
+ * parser.
+ * @param publicId The public identifier of the external entity being
+ * referenced (normalized as required by the XML specification), or
+ * null if none was supplied.
+ * @param baseURI The URI with respect to which relative systemIDs
+ * are interpreted. This is always an absolute URI, unless it is
+ * null (likely because the XMLReader was given an InputSource without
+ * one). This URI is defined by the XML specification to be the one
+ * associated with the "<" starting the relevant declaration.
+ * @param systemId The system identifier of the external entity
+ * being referenced; either a relative or absolute URI.
+ * This is never null when invoked by a SAX2 parser; only declared
+ * entities, and any external subset, are resolved by such parsers.
+ *
+ * @return An InputSource object describing the new input source to
+ * be used by the parser. Returning null directs the parser to
+ * resolve the system ID against the base URI and open a connection
+ * to resulting URI.
+ *
+ * @exception SAXException Any SAX exception, possibly wrapping
+ * another exception.
+ * @exception IOException Probably indicating a failure to create
+ * a new InputStream or Reader, or an illegal URL.
+ */
+ public InputSource resolveEntity (
+ String name,
+ String publicId,
+ String baseURI,
+ String systemId
+ ) throws SAXException, IOException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/LexicalHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/LexicalHandler.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/LexicalHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/LexicalHandler.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,212 @@
+// LexicalHandler.java - optional handler for lexical parse events.
+// http://www.saxproject.org
+// Public Domain: no warranty.
+// $Id: LexicalHandler.java,v 1.10 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax.ext;
+
+import org.xml.sax.SAXException;
+
+/**
+ * SAX2 extension handler for lexical events.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This is an optional extension handler for SAX2 to provide
+ * lexical information about an XML document, such as comments
+ * and CDATA section boundaries.
+ * XML readers are not required to recognize this handler, and it
+ * is not part of core-only SAX2 distributions.</p>
+ *
+ * <p>The events in the lexical handler apply to the entire document,
+ * not just to the document element, and all lexical handler events
+ * must appear between the content handler's startDocument and
+ * endDocument events.</p>
+ *
+ * <p>To set the LexicalHandler for an XML reader, use the
+ * {@link org.xml.sax.XMLReader#setProperty setProperty} method
+ * with the property name
+ * <code>http://xml.org/sax/properties/lexical-handler</code>
+ * and an object implementing this interface (or null) as the value.
+ * If the reader does not report lexical events, it will throw a
+ * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException}
+ * when you attempt to register the handler.</p>
+ *
+ * @since SAX 2.0 (extensions 1.0)
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ */
+public interface LexicalHandler
+{
+
+ /**
+ * Report the start of DTD declarations, if any.
+ *
+ * <p>This method is intended to report the beginning of the
+ * DOCTYPE declaration; if the document has no DOCTYPE declaration,
+ * this method will not be invoked.</p>
+ *
+ * <p>All declarations reported through
+ * {@link org.xml.sax.DTDHandler DTDHandler} or
+ * {@link org.xml.sax.ext.DeclHandler DeclHandler} events must appear
+ * between the startDTD and {@link #endDTD endDTD} events.
+ * Declarations are assumed to belong to the internal DTD subset
+ * unless they appear between {@link #startEntity startEntity}
+ * and {@link #endEntity endEntity} events. Comments and
+ * processing instructions from the DTD should also be reported
+ * between the startDTD and endDTD events, in their original
+ * order of (logical) occurrence; they are not required to
+ * appear in their correct locations relative to DTDHandler
+ * or DeclHandler events, however.</p>
+ *
+ * <p>Note that the start/endDTD events will appear within
+ * the start/endDocument events from ContentHandler and
+ * before the first
+ * {@link org.xml.sax.ContentHandler#startElement startElement}
+ * event.</p>
+ *
+ * @param name The document type name.
+ * @param publicId The declared public identifier for the
+ * external DTD subset, or null if none was declared.
+ * @param systemId The declared system identifier for the
+ * external DTD subset, or null if none was declared.
+ * (Note that this is not resolved against the document
+ * base URI.)
+ * @exception SAXException The application may raise an
+ * exception.
+ * @see #endDTD
+ * @see #startEntity
+ */
+ public abstract void startDTD (String name, String publicId,
+ String systemId)
+ throws SAXException;
+
+
+ /**
+ * Report the end of DTD declarations.
+ *
+ * <p>This method is intended to report the end of the
+ * DOCTYPE declaration; if the document has no DOCTYPE declaration,
+ * this method will not be invoked.</p>
+ *
+ * @exception SAXException The application may raise an exception.
+ * @see #startDTD
+ */
+ public abstract void endDTD ()
+ throws SAXException;
+
+
+ /**
+ * Report the beginning of some internal and external XML entities.
+ *
+ * <p>The reporting of parameter entities (including
+ * the external DTD subset) is optional, and SAX2 drivers that
+ * report LexicalHandler events may not implement it; you can use the
+ * <code
+ * >http://xml.org/sax/features/lexical-handler/parameter-entities</code>
+ * feature to query or control the reporting of parameter entities.</p>
+ *
+ * <p>General entities are reported with their regular names,
+ * parameter entities have '%' prepended to their names, and
+ * the external DTD subset has the pseudo-entity name "[dtd]".</p>
+ *
+ * <p>When a SAX2 driver is providing these events, all other
+ * events must be properly nested within start/end entity
+ * events. There is no additional requirement that events from
+ * {@link org.xml.sax.ext.DeclHandler DeclHandler} or
+ * {@link org.xml.sax.DTDHandler DTDHandler} be properly ordered.</p>
+ *
+ * <p>Note that skipped entities will be reported through the
+ * {@link org.xml.sax.ContentHandler#skippedEntity skippedEntity}
+ * event, which is part of the ContentHandler interface.</p>
+ *
+ * <p>Because of the streaming event model that SAX uses, some
+ * entity boundaries cannot be reported under any
+ * circumstances:</p>
+ *
+ * <ul>
+ * <li>general entities within attribute values</li>
+ * <li>parameter entities within declarations</li>
+ * </ul>
+ *
+ * <p>These will be silently expanded, with no indication of where
+ * the original entity boundaries were.</p>
+ *
+ * <p>Note also that the boundaries of character references (which
+ * are not really entities anyway) are not reported.</p>
+ *
+ * <p>All start/endEntity events must be properly nested.
+ *
+ * @param name The name of the entity. If it is a parameter
+ * entity, the name will begin with '%', and if it is the
+ * external DTD subset, it will be "[dtd]".
+ * @exception SAXException The application may raise an exception.
+ * @see #endEntity
+ * @see org.xml.sax.ext.DeclHandler#internalEntityDecl
+ * @see org.xml.sax.ext.DeclHandler#externalEntityDecl
+ */
+ public abstract void startEntity (String name)
+ throws SAXException;
+
+
+ /**
+ * Report the end of an entity.
+ *
+ * @param name The name of the entity that is ending.
+ * @exception SAXException The application may raise an exception.
+ * @see #startEntity
+ */
+ public abstract void endEntity (String name)
+ throws SAXException;
+
+
+ /**
+ * Report the start of a CDATA section.
+ *
+ * <p>The contents of the CDATA section will be reported through
+ * the regular {@link org.xml.sax.ContentHandler#characters
+ * characters} event; this event is intended only to report
+ * the boundary.</p>
+ *
+ * @exception SAXException The application may raise an exception.
+ * @see #endCDATA
+ */
+ public abstract void startCDATA ()
+ throws SAXException;
+
+
+ /**
+ * Report the end of a CDATA section.
+ *
+ * @exception SAXException The application may raise an exception.
+ * @see #startCDATA
+ */
+ public abstract void endCDATA ()
+ throws SAXException;
+
+
+ /**
+ * Report an XML comment anywhere in the document.
+ *
+ * <p>This callback will be used for comments inside or outside the
+ * document element, including comments in the external DTD
+ * subset (if read). Comments in the DTD must be properly
+ * nested inside start/endDTD and start/endEntity events (if
+ * used).</p>
+ *
+ * @param ch An array holding the characters in the comment.
+ * @param start The starting position in the array.
+ * @param length The number of characters to use from the array.
+ * @exception SAXException The application may raise an exception.
+ */
+ public abstract void comment (char ch[], int start, int length)
+ throws SAXException;
+
+}
+
+// end of LexicalHandler.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/Locator2.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/Locator2.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/Locator2.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/Locator2.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,75 @@
+// Locator2.java - extended Locator
+// http://www.saxproject.org
+// Public Domain: no warranty.
+// $Id: Locator2.java,v 1.8 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax.ext;
+
+import org.xml.sax.Locator;
+
+
+/**
+ * SAX2 extension to augment the entity information provided
+ * though a {@link Locator}.
+ * If an implementation supports this extension, the Locator
+ * provided in {@link org.xml.sax.ContentHandler#setDocumentLocator
+ * ContentHandler.setDocumentLocator() } will implement this
+ * interface, and the
+ * <em>http://xml.org/sax/features/use-locator2</em> feature
+ * flag will have the value <em>true</em>.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * </blockquote>
+ *
+ * <p> XMLReader implementations are not required to support this
+ * information, and it is not part of core-only SAX2 distributions.</p>
+ *
+ * @since SAX 2.0 (extensions 1.1 alpha)
+ * @author David Brownell
+ * @version TBS
+ */
+public interface Locator2 extends Locator
+{
+ /**
+ * Returns the version of XML used for the entity. This will
+ * normally be the identifier from the current entity's
+ * <em><?xml version='...' ...?></em> declaration,
+ * or be defaulted by the parser.
+ *
+ * @return Identifier for the XML version being used to interpret
+ * the entity's text, or null if that information is not yet
+ * available in the current parsing state.
+ */
+ public String getXMLVersion ();
+
+ /**
+ * Returns the name of the character encoding for the entity.
+ * If the encoding was declared externally (for example, in a MIME
+ * Content-Type header), that will be the name returned. Else if there
+ * was an <em><?xml ...encoding='...'?></em> declaration at
+ * the start of the document, that encoding name will be returned.
+ * Otherwise the encoding will been inferred (normally to be UTF-8, or
+ * some UTF-16 variant), and that inferred name will be returned.
+ *
+ * <p>When an {@link org.xml.sax.InputSource InputSource} is used
+ * to provide an entity's character stream, this method returns the
+ * encoding provided in that input stream.
+ *
+ * <p> Note that some recent W3C specifications require that text
+ * in some encodings be normalized, using Unicode Normalization
+ * Form C, before processing. Such normalization must be performed
+ * by applications, and would normally be triggered based on the
+ * value returned by this method.
+ *
+ * <p> Encoding names may be those used by the underlying JVM,
+ * and comparisons should be case-insensitive.
+ *
+ * @return Name of the character encoding being used to interpret
+ * * the entity's text, or null if this was not provided for a *
+ * character stream passed through an InputSource or is otherwise
+ * not yet available in the current parsing state.
+ */
+ public String getEncoding ();
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/Locator2Impl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/Locator2Impl.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/Locator2Impl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/Locator2Impl.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,101 @@
+// Locator2Impl.java - extended LocatorImpl
+// http://www.saxproject.org
+// Public Domain: no warranty.
+// $Id: Locator2Impl.java,v 1.1 2004/12/23 22:38:42 mark Exp $
+
+package org.xml.sax.ext;
+
+import org.xml.sax.Locator;
+import org.xml.sax.helpers.LocatorImpl;
+
+
+/**
+ * SAX2 extension helper for holding additional Entity information,
+ * implementing the {@link Locator2} interface.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * </blockquote>
+ *
+ * <p> This is not part of core-only SAX2 distributions.</p>
+ *
+ * @since SAX 2.0.2
+ * @author David Brownell
+ * @version TBS
+ */
+public class Locator2Impl extends LocatorImpl implements Locator2
+{
+ private String encoding;
+ private String version;
+
+
+ /**
+ * Construct a new, empty Locator2Impl object.
+ * This will not normally be useful, since the main purpose
+ * of this class is to make a snapshot of an existing Locator.
+ */
+ public Locator2Impl () { }
+
+ /**
+ * Copy an existing Locator or Locator2 object.
+ * If the object implements Locator2, values of the
+ * <em>encoding</em> and <em>version</em>strings are copied,
+ * otherwise they set to <em>null</em>.
+ *
+ * @param locator The existing Locator object.
+ */
+ public Locator2Impl (Locator locator)
+ {
+ super (locator);
+ if (locator instanceof Locator2) {
+ Locator2 l2 = (Locator2) locator;
+
+ version = l2.getXMLVersion ();
+ encoding = l2.getEncoding ();
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ // Locator2 method implementations
+ ////////////////////////////////////////////////////////////////////
+
+ /**
+ * Returns the current value of the version property.
+ *
+ * @see #setXMLVersion
+ */
+ public String getXMLVersion ()
+ { return version; }
+
+ /**
+ * Returns the current value of the encoding property.
+ *
+ * @see #setEncoding
+ */
+ public String getEncoding ()
+ { return encoding; }
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Setters
+ ////////////////////////////////////////////////////////////////////
+
+ /**
+ * Assigns the current value of the version property.
+ *
+ * @param version the new "version" value
+ * @see #getXMLVersion
+ */
+ public void setXMLVersion (String version)
+ { this.version = version; }
+
+ /**
+ * Assigns the current value of the encoding property.
+ *
+ * @param encoding the new "encoding" value
+ * @see #getEncoding
+ */
+ public void setEncoding (String encoding)
+ { this.encoding = encoding; }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/package.html
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/package.html?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/package.html (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/ext/package.html Thu Nov 8 16:56:19 2007
@@ -0,0 +1,46 @@
+<HTML><HEAD>
+<!-- $Id: package.html,v 1.11 2004/12/11 15:41:10 dog Exp $ -->
+</HEAD><BODY>
+
+<p>
+This package contains interfaces to SAX2 facilities that
+conformant SAX drivers won't necessarily support.
+
+<p>See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+for more information about SAX.</p>
+
+<p> This package is independent of the SAX2 core, though the functionality
+exposed generally needs to be implemented within a parser core.
+That independence has several consequences:</p>
+
+<ul>
+
+<li>SAX2 drivers are <em>not</em> required to recognize these handlers.
+</li>
+
+<li>You cannot assume that the class files will be present in every SAX2
+installation.</li>
+
+<li>This package may be updated independently of SAX2 (i.e. new
+handlers and classes may be added without updating SAX2 itself).</li>
+
+<li>The new handlers are not implemented by the SAX2
+<code>org.xml.sax.helpers.DefaultHandler</code> or
+<code>org.xml.sax.helpers.XMLFilterImpl</code> classes.
+You can subclass these if you need such behavior, or
+use the helper classes found here.</li>
+
+<li>The handlers need to be registered differently than core SAX2
+handlers.</li>
+
+</ul>
+
+<p>This package, SAX2-ext, is a standardized extension to SAX2. It is
+designed both to allow SAX parsers to pass certain types of information
+to applications, and to serve as a simple model for other SAX2 parser
+extension packages. Not all such extension packages should need to
+be recognized directly by parsers, however.
+As an example, most validation systems can be cleanly layered on top
+of parsers supporting the standardized SAX2 interfaces. </p>
+
+</BODY></HTML>
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/AttributeListImpl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/AttributeListImpl.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/AttributeListImpl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/AttributeListImpl.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,312 @@
+// SAX default implementation for AttributeList.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: AttributeListImpl.java,v 1.11 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax.helpers;
+
+import org.xml.sax.AttributeList;
+
+import java.util.Vector;
+
+
+/**
+ * Default implementation for AttributeList.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>AttributeList implements the deprecated SAX1 {@link
+ * org.xml.sax.AttributeList AttributeList} interface, and has been
+ * replaced by the new SAX2 {@link org.xml.sax.helpers.AttributesImpl
+ * AttributesImpl} interface.</p>
+ *
+ * <p>This class provides a convenience implementation of the SAX
+ * {@link org.xml.sax.AttributeList AttributeList} interface. This
+ * implementation is useful both for SAX parser writers, who can use
+ * it to provide attributes to the application, and for SAX application
+ * writers, who can use it to create a persistent copy of an element's
+ * attribute specifications:</p>
+ *
+ * <pre>
+ * private AttributeList myatts;
+ *
+ * public void startElement (String name, AttributeList atts)
+ * {
+ * // create a persistent copy of the attribute list
+ * // for use outside this method
+ * myatts = new AttributeListImpl(atts);
+ * [...]
+ * }
+ * </pre>
+ *
+ * <p>Please note that SAX parsers are not required to use this
+ * class to provide an implementation of AttributeList; it is
+ * supplied only as an optional convenience. In particular,
+ * parser writers are encouraged to invent more efficient
+ * implementations.</p>
+ *
+ * @deprecated This class implements a deprecated interface,
+ * {@link org.xml.sax.AttributeList AttributeList};
+ * that interface has been replaced by
+ * {@link org.xml.sax.Attributes Attributes},
+ * which is implemented in the
+ * {@link org.xml.sax.helpers.AttributesImpl
+ * AttributesImpl} helper class.
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.AttributeList
+ * @see org.xml.sax.DocumentHandler#startElement
+ */
+public class AttributeListImpl implements AttributeList
+{
+
+ /**
+ * Create an empty attribute list.
+ *
+ * <p>This constructor is most useful for parser writers, who
+ * will use it to create a single, reusable attribute list that
+ * can be reset with the clear method between elements.</p>
+ *
+ * @see #addAttribute
+ * @see #clear
+ */
+ public AttributeListImpl ()
+ {
+ }
+
+
+ /**
+ * Construct a persistent copy of an existing attribute list.
+ *
+ * <p>This constructor is most useful for application writers,
+ * who will use it to create a persistent copy of an existing
+ * attribute list.</p>
+ *
+ * @param atts The attribute list to copy
+ * @see org.xml.sax.DocumentHandler#startElement
+ */
+ public AttributeListImpl (AttributeList atts)
+ {
+ setAttributeList(atts);
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Methods specific to this class.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Set the attribute list, discarding previous contents.
+ *
+ * <p>This method allows an application writer to reuse an
+ * attribute list easily.</p>
+ *
+ * @param atts The attribute list to copy.
+ */
+ public void setAttributeList (AttributeList atts)
+ {
+ int count = atts.getLength();
+
+ clear();
+
+ for (int i = 0; i < count; i++) {
+ addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
+ }
+ }
+
+
+ /**
+ * Add an attribute to an attribute list.
+ *
+ * <p>This method is provided for SAX parser writers, to allow them
+ * to build up an attribute list incrementally before delivering
+ * it to the application.</p>
+ *
+ * @param name The attribute name.
+ * @param type The attribute type ("NMTOKEN" for an enumeration).
+ * @param value The attribute value (must not be null).
+ * @see #removeAttribute
+ * @see org.xml.sax.DocumentHandler#startElement
+ */
+ public void addAttribute (String name, String type, String value)
+ {
+ names.addElement(name);
+ types.addElement(type);
+ values.addElement(value);
+ }
+
+
+ /**
+ * Remove an attribute from the list.
+ *
+ * <p>SAX application writers can use this method to filter an
+ * attribute out of an AttributeList. Note that invoking this
+ * method will change the length of the attribute list and
+ * some of the attribute's indices.</p>
+ *
+ * <p>If the requested attribute is not in the list, this is
+ * a no-op.</p>
+ *
+ * @param name The attribute name.
+ * @see #addAttribute
+ */
+ public void removeAttribute (String name)
+ {
+ int i = names.indexOf(name);
+
+ if (i >= 0) {
+ names.removeElementAt(i);
+ types.removeElementAt(i);
+ values.removeElementAt(i);
+ }
+ }
+
+
+ /**
+ * Clear the attribute list.
+ *
+ * <p>SAX parser writers can use this method to reset the attribute
+ * list between DocumentHandler.startElement events. Normally,
+ * it will make sense to reuse the same AttributeListImpl object
+ * rather than allocating a new one each time.</p>
+ *
+ * @see org.xml.sax.DocumentHandler#startElement
+ */
+ public void clear ()
+ {
+ names.removeAllElements();
+ types.removeAllElements();
+ values.removeAllElements();
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.AttributeList
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Return the number of attributes in the list.
+ *
+ * @return The number of attributes in the list.
+ * @see org.xml.sax.AttributeList#getLength
+ */
+ public int getLength ()
+ {
+ return names.size();
+ }
+
+
+ /**
+ * Get the name of an attribute (by position).
+ *
+ * @param i The position of the attribute in the list.
+ * @return The attribute name as a string, or null if there
+ * is no attribute at that position.
+ * @see org.xml.sax.AttributeList#getName(int)
+ */
+ public String getName (int i)
+ {
+ if (i < 0) {
+ return null;
+ }
+ try {
+ return (String)names.elementAt(i);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ return null;
+ }
+ }
+
+
+ /**
+ * Get the type of an attribute (by position).
+ *
+ * @param i The position of the attribute in the list.
+ * @return The attribute type as a string ("NMTOKEN" for an
+ * enumeration, and "CDATA" if no declaration was
+ * read), or null if there is no attribute at
+ * that position.
+ * @see org.xml.sax.AttributeList#getType(int)
+ */
+ public String getType (int i)
+ {
+ if (i < 0) {
+ return null;
+ }
+ try {
+ return (String)types.elementAt(i);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ return null;
+ }
+ }
+
+
+ /**
+ * Get the value of an attribute (by position).
+ *
+ * @param i The position of the attribute in the list.
+ * @return The attribute value as a string, or null if
+ * there is no attribute at that position.
+ * @see org.xml.sax.AttributeList#getValue(int)
+ */
+ public String getValue (int i)
+ {
+ if (i < 0) {
+ return null;
+ }
+ try {
+ return (String)values.elementAt(i);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ return null;
+ }
+ }
+
+
+ /**
+ * Get the type of an attribute (by name).
+ *
+ * @param name The attribute name.
+ * @return The attribute type as a string ("NMTOKEN" for an
+ * enumeration, and "CDATA" if no declaration was
+ * read).
+ * @see org.xml.sax.AttributeList#getType(java.lang.String)
+ */
+ public String getType (String name)
+ {
+ return getType(names.indexOf(name));
+ }
+
+
+ /**
+ * Get the value of an attribute (by name).
+ *
+ * @param name The attribute name.
+ * @see org.xml.sax.AttributeList#getValue(java.lang.String)
+ */
+ public String getValue (String name)
+ {
+ return getValue(names.indexOf(name));
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////////
+
+ Vector names = new Vector();
+ Vector types = new Vector();
+ Vector values = new Vector();
+
+}
+
+// end of AttributeListImpl.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/AttributesImpl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/AttributesImpl.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/AttributesImpl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/AttributesImpl.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,618 @@
+// AttributesImpl.java - default implementation of Attributes.
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the public domain.
+// $Id: AttributesImpl.java,v 1.11 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax.helpers;
+
+import org.xml.sax.Attributes;
+
+
+/**
+ * Default implementation of the Attributes interface.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class provides a default implementation of the SAX2
+ * {@link org.xml.sax.Attributes Attributes} interface, with the
+ * addition of manipulators so that the list can be modified or
+ * reused.</p>
+ *
+ * <p>There are two typical uses of this class:</p>
+ *
+ * <ol>
+ * <li>to take a persistent snapshot of an Attributes object
+ * in a {@link org.xml.sax.ContentHandler#startElement startElement} event; or</li>
+ * <li>to construct or modify an Attributes object in a SAX2 driver or filter.</li>
+ * </ol>
+ *
+ * <p>This class replaces the now-deprecated SAX1 {@link
+ * org.xml.sax.helpers.AttributeListImpl AttributeListImpl}
+ * class; in addition to supporting the updated Attributes
+ * interface rather than the deprecated {@link org.xml.sax.AttributeList
+ * AttributeList} interface, it also includes a much more efficient
+ * implementation using a single array rather than a set of Vectors.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ */
+public class AttributesImpl implements Attributes
+{
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Constructors.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Construct a new, empty AttributesImpl object.
+ */
+ public AttributesImpl ()
+ {
+ length = 0;
+ data = null;
+ }
+
+
+ /**
+ * Copy an existing Attributes object.
+ *
+ * <p>This constructor is especially useful inside a
+ * {@link org.xml.sax.ContentHandler#startElement startElement} event.</p>
+ *
+ * @param atts The existing Attributes object.
+ */
+ public AttributesImpl (Attributes atts)
+ {
+ setAttributes(atts);
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.Attributes.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Return the number of attributes in the list.
+ *
+ * @return The number of attributes in the list.
+ * @see org.xml.sax.Attributes#getLength
+ */
+ public int getLength ()
+ {
+ return length;
+ }
+
+
+ /**
+ * Return an attribute's Namespace URI.
+ *
+ * @param index The attribute's index (zero-based).
+ * @return The Namespace URI, the empty string if none is
+ * available, or null if the index is out of range.
+ * @see org.xml.sax.Attributes#getURI
+ */
+ public String getURI (int index)
+ {
+ if (index >= 0 && index < length) {
+ return data[index*5];
+ } else {
+ return null;
+ }
+ }
+
+
+ /**
+ * Return an attribute's local name.
+ *
+ * @param index The attribute's index (zero-based).
+ * @return The attribute's local name, the empty string if
+ * none is available, or null if the index if out of range.
+ * @see org.xml.sax.Attributes#getLocalName
+ */
+ public String getLocalName (int index)
+ {
+ if (index >= 0 && index < length) {
+ return data[index*5+1];
+ } else {
+ return null;
+ }
+ }
+
+
+ /**
+ * Return an attribute's qualified (prefixed) name.
+ *
+ * @param index The attribute's index (zero-based).
+ * @return The attribute's qualified name, the empty string if
+ * none is available, or null if the index is out of bounds.
+ * @see org.xml.sax.Attributes#getQName
+ */
+ public String getQName (int index)
+ {
+ if (index >= 0 && index < length) {
+ return data[index*5+2];
+ } else {
+ return null;
+ }
+ }
+
+
+ /**
+ * Return an attribute's type by index.
+ *
+ * @param index The attribute's index (zero-based).
+ * @return The attribute's type, "CDATA" if the type is unknown, or null
+ * if the index is out of bounds.
+ * @see org.xml.sax.Attributes#getType(int)
+ */
+ public String getType (int index)
+ {
+ if (index >= 0 && index < length) {
+ return data[index*5+3];
+ } else {
+ return null;
+ }
+ }
+
+
+ /**
+ * Return an attribute's value by index.
+ *
+ * @param index The attribute's index (zero-based).
+ * @return The attribute's value or null if the index is out of bounds.
+ * @see org.xml.sax.Attributes#getValue(int)
+ */
+ public String getValue (int index)
+ {
+ if (index >= 0 && index < length) {
+ return data[index*5+4];
+ } else {
+ return null;
+ }
+ }
+
+
+ /**
+ * Look up an attribute's index by Namespace name.
+ *
+ * <p>In many cases, it will be more efficient to look up the name once and
+ * use the index query methods rather than using the name query methods
+ * repeatedly.</p>
+ *
+ * @param uri The attribute's Namespace URI, or the empty
+ * string if none is available.
+ * @param localName The attribute's local name.
+ * @return The attribute's index, or -1 if none matches.
+ * @see org.xml.sax.Attributes#getIndex(java.lang.String,java.lang.String)
+ */
+ public int getIndex (String uri, String localName)
+ {
+ int max = length * 5;
+ for (int i = 0; i < max; i += 5) {
+ if (data[i].equals(uri) && data[i+1].equals(localName)) {
+ return i / 5;
+ }
+ }
+ return -1;
+ }
+
+
+ /**
+ * Look up an attribute's index by qualified (prefixed) name.
+ *
+ * @param qName The qualified name.
+ * @return The attribute's index, or -1 if none matches.
+ * @see org.xml.sax.Attributes#getIndex(java.lang.String)
+ */
+ public int getIndex (String qName)
+ {
+ int max = length * 5;
+ for (int i = 0; i < max; i += 5) {
+ if (data[i+2].equals(qName)) {
+ return i / 5;
+ }
+ }
+ return -1;
+ }
+
+
+ /**
+ * Look up an attribute's type by Namespace-qualified name.
+ *
+ * @param uri The Namespace URI, or the empty string for a name
+ * with no explicit Namespace URI.
+ * @param localName The local name.
+ * @return The attribute's type, or null if there is no
+ * matching attribute.
+ * @see org.xml.sax.Attributes#getType(java.lang.String,java.lang.String)
+ */
+ public String getType (String uri, String localName)
+ {
+ int max = length * 5;
+ for (int i = 0; i < max; i += 5) {
+ if (data[i].equals(uri) && data[i+1].equals(localName)) {
+ return data[i+3];
+ }
+ }
+ return null;
+ }
+
+
+ /**
+ * Look up an attribute's type by qualified (prefixed) name.
+ *
+ * @param qName The qualified name.
+ * @return The attribute's type, or null if there is no
+ * matching attribute.
+ * @see org.xml.sax.Attributes#getType(java.lang.String)
+ */
+ public String getType (String qName)
+ {
+ int max = length * 5;
+ for (int i = 0; i < max; i += 5) {
+ if (data[i+2].equals(qName)) {
+ return data[i+3];
+ }
+ }
+ return null;
+ }
+
+
+ /**
+ * Look up an attribute's value by Namespace-qualified name.
+ *
+ * @param uri The Namespace URI, or the empty string for a name
+ * with no explicit Namespace URI.
+ * @param localName The local name.
+ * @return The attribute's value, or null if there is no
+ * matching attribute.
+ * @see org.xml.sax.Attributes#getValue(java.lang.String,java.lang.String)
+ */
+ public String getValue (String uri, String localName)
+ {
+ int max = length * 5;
+ for (int i = 0; i < max; i += 5) {
+ if (data[i].equals(uri) && data[i+1].equals(localName)) {
+ return data[i+4];
+ }
+ }
+ return null;
+ }
+
+
+ /**
+ * Look up an attribute's value by qualified (prefixed) name.
+ *
+ * @param qName The qualified name.
+ * @return The attribute's value, or null if there is no
+ * matching attribute.
+ * @see org.xml.sax.Attributes#getValue(java.lang.String)
+ */
+ public String getValue (String qName)
+ {
+ int max = length * 5;
+ for (int i = 0; i < max; i += 5) {
+ if (data[i+2].equals(qName)) {
+ return data[i+4];
+ }
+ }
+ return null;
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Manipulators.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Clear the attribute list for reuse.
+ *
+ * <p>Note that little memory is freed by this call:
+ * the current array is kept so it can be
+ * reused.</p>
+ */
+ public void clear ()
+ {
+ if (data != null) {
+ for (int i = 0; i < (length * 5); i++)
+ data [i] = null;
+ }
+ length = 0;
+ }
+
+
+ /**
+ * Copy an entire Attributes object.
+ *
+ * <p>It may be more efficient to reuse an existing object
+ * rather than constantly allocating new ones.</p>
+ *
+ * @param atts The attributes to copy.
+ */
+ public void setAttributes (Attributes atts)
+ {
+ clear();
+ length = atts.getLength();
+ if (length > 0) {
+ data = new String[length*5];
+ for (int i = 0; i < length; i++) {
+ data[i*5] = atts.getURI(i);
+ data[i*5+1] = atts.getLocalName(i);
+ data[i*5+2] = atts.getQName(i);
+ data[i*5+3] = atts.getType(i);
+ data[i*5+4] = atts.getValue(i);
+ }
+ }
+ }
+
+
+ /**
+ * Add an attribute to the end of the list.
+ *
+ * <p>For the sake of speed, this method does no checking
+ * to see if the attribute is already in the list: that is
+ * the responsibility of the application.</p>
+ *
+ * @param uri The Namespace URI, or the empty string if
+ * none is available or Namespace processing is not
+ * being performed.
+ * @param localName The local name, or the empty string if
+ * Namespace processing is not being performed.
+ * @param qName The qualified (prefixed) name, or the empty string
+ * if qualified names are not available.
+ * @param type The attribute type as a string.
+ * @param value The attribute value.
+ */
+ public void addAttribute (String uri, String localName, String qName,
+ String type, String value)
+ {
+ ensureCapacity(length+1);
+ data[length*5] = uri;
+ data[length*5+1] = localName;
+ data[length*5+2] = qName;
+ data[length*5+3] = type;
+ data[length*5+4] = value;
+ length++;
+ }
+
+
+ /**
+ * Set an attribute in the list.
+ *
+ * <p>For the sake of speed, this method does no checking
+ * for name conflicts or well-formedness: such checks are the
+ * responsibility of the application.</p>
+ *
+ * @param index The index of the attribute (zero-based).
+ * @param uri The Namespace URI, or the empty string if
+ * none is available or Namespace processing is not
+ * being performed.
+ * @param localName The local name, or the empty string if
+ * Namespace processing is not being performed.
+ * @param qName The qualified name, or the empty string
+ * if qualified names are not available.
+ * @param type The attribute type as a string.
+ * @param value The attribute value.
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the
+ * supplied index does not point to an attribute
+ * in the list.
+ */
+ public void setAttribute (int index, String uri, String localName,
+ String qName, String type, String value)
+ {
+ if (index >= 0 && index < length) {
+ data[index*5] = uri;
+ data[index*5+1] = localName;
+ data[index*5+2] = qName;
+ data[index*5+3] = type;
+ data[index*5+4] = value;
+ } else {
+ badIndex(index);
+ }
+ }
+
+
+ /**
+ * Remove an attribute from the list.
+ *
+ * @param index The index of the attribute (zero-based).
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the
+ * supplied index does not point to an attribute
+ * in the list.
+ */
+ public void removeAttribute (int index)
+ {
+ if (index >= 0 && index < length) {
+ if (index < length - 1) {
+ System.arraycopy(data, (index+1)*5, data, index*5,
+ (length-index-1)*5);
+ }
+ index = (length - 1) * 5;
+ data [index++] = null;
+ data [index++] = null;
+ data [index++] = null;
+ data [index++] = null;
+ data [index] = null;
+ length--;
+ } else {
+ badIndex(index);
+ }
+ }
+
+
+ /**
+ * Set the Namespace URI of a specific attribute.
+ *
+ * @param index The index of the attribute (zero-based).
+ * @param uri The attribute's Namespace URI, or the empty
+ * string for none.
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the
+ * supplied index does not point to an attribute
+ * in the list.
+ */
+ public void setURI (int index, String uri)
+ {
+ if (index >= 0 && index < length) {
+ data[index*5] = uri;
+ } else {
+ badIndex(index);
+ }
+ }
+
+
+ /**
+ * Set the local name of a specific attribute.
+ *
+ * @param index The index of the attribute (zero-based).
+ * @param localName The attribute's local name, or the empty
+ * string for none.
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the
+ * supplied index does not point to an attribute
+ * in the list.
+ */
+ public void setLocalName (int index, String localName)
+ {
+ if (index >= 0 && index < length) {
+ data[index*5+1] = localName;
+ } else {
+ badIndex(index);
+ }
+ }
+
+
+ /**
+ * Set the qualified name of a specific attribute.
+ *
+ * @param index The index of the attribute (zero-based).
+ * @param qName The attribute's qualified name, or the empty
+ * string for none.
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the
+ * supplied index does not point to an attribute
+ * in the list.
+ */
+ public void setQName (int index, String qName)
+ {
+ if (index >= 0 && index < length) {
+ data[index*5+2] = qName;
+ } else {
+ badIndex(index);
+ }
+ }
+
+
+ /**
+ * Set the type of a specific attribute.
+ *
+ * @param index The index of the attribute (zero-based).
+ * @param type The attribute's type.
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the
+ * supplied index does not point to an attribute
+ * in the list.
+ */
+ public void setType (int index, String type)
+ {
+ if (index >= 0 && index < length) {
+ data[index*5+3] = type;
+ } else {
+ badIndex(index);
+ }
+ }
+
+
+ /**
+ * Set the value of a specific attribute.
+ *
+ * @param index The index of the attribute (zero-based).
+ * @param value The attribute's value.
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the
+ * supplied index does not point to an attribute
+ * in the list.
+ */
+ public void setValue (int index, String value)
+ {
+ if (index >= 0 && index < length) {
+ data[index*5+4] = value;
+ } else {
+ badIndex(index);
+ }
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal methods.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Ensure the internal array's capacity.
+ *
+ * @param n The minimum number of attributes that the array must
+ * be able to hold.
+ */
+ private void ensureCapacity (int n) {
+ if (n <= 0) {
+ return;
+ }
+ int max;
+ if (data == null || data.length == 0) {
+ max = 25;
+ }
+ else if (data.length >= n * 5) {
+ return;
+ }
+ else {
+ max = data.length;
+ }
+ while (max < n * 5) {
+ max *= 2;
+ }
+
+ String newData[] = new String[max];
+ if (length > 0) {
+ System.arraycopy(data, 0, newData, 0, length*5);
+ }
+ data = newData;
+ }
+
+
+ /**
+ * Report a bad array index in a manipulator.
+ *
+ * @param index The index to report.
+ * @exception java.lang.ArrayIndexOutOfBoundsException Always.
+ */
+ private void badIndex (int index)
+ throws ArrayIndexOutOfBoundsException
+ {
+ String msg =
+ "Attempt to modify attribute at illegal index: " + index;
+ throw new ArrayIndexOutOfBoundsException(msg);
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////////
+
+ int length;
+ String data [];
+
+}
+
+// end of AttributesImpl.java
+
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/DefaultHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/DefaultHandler.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/DefaultHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/DefaultHandler.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,467 @@
+// DefaultHandler.java - default implementation of the core handlers.
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the public domain.
+// $Id: DefaultHandler.java,v 1.11 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax.helpers;
+
+import java.io.IOException;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.Attributes;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+
+/**
+ * Default base class for SAX2 event handlers.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class is available as a convenience base class for SAX2
+ * applications: it provides default implementations for all of the
+ * callbacks in the four core SAX2 handler classes:</p>
+ *
+ * <ul>
+ * <li>{@link org.xml.sax.EntityResolver EntityResolver}</li>
+ * <li>{@link org.xml.sax.DTDHandler DTDHandler}</li>
+ * <li>{@link org.xml.sax.ContentHandler ContentHandler}</li>
+ * <li>{@link org.xml.sax.ErrorHandler ErrorHandler}</li>
+ * </ul>
+ *
+ * <p>Application writers can extend this class when they need to
+ * implement only part of an interface; parser writers can
+ * instantiate this class to provide default handlers when the
+ * application has not supplied its own.</p>
+ *
+ * <p>This class replaces the deprecated SAX1
+ * {@link org.xml.sax.HandlerBase HandlerBase} class.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson,
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.EntityResolver
+ * @see org.xml.sax.DTDHandler
+ * @see org.xml.sax.ContentHandler
+ * @see org.xml.sax.ErrorHandler
+ */
+public class DefaultHandler
+ implements EntityResolver, DTDHandler, ContentHandler, ErrorHandler
+{
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Default implementation of the EntityResolver interface.
+ ////////////////////////////////////////////////////////////////////
+
+ /**
+ * Resolve an external entity.
+ *
+ * <p>Always return null, so that the parser will use the system
+ * identifier provided in the XML document. This method implements
+ * the SAX default behaviour: application writers can override it
+ * in a subclass to do special translations such as catalog lookups
+ * or URI redirection.</p>
+ *
+ * @param publicId The public identifer, or null if none is
+ * available.
+ * @param systemId The system identifier provided in the XML
+ * document.
+ * @return The new input source, or null to require the
+ * default behaviour.
+ * @exception java.io.IOException If there is an error setting
+ * up the new input source.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.EntityResolver#resolveEntity
+ */
+ public InputSource resolveEntity (String publicId, String systemId)
+ throws IOException, SAXException
+ {
+ return null;
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Default implementation of DTDHandler interface.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Receive notification of a notation declaration.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass if they wish to keep track of the notations
+ * declared in a document.</p>
+ *
+ * @param name The notation name.
+ * @param publicId The notation public identifier, or null if not
+ * available.
+ * @param systemId The notation system identifier.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.DTDHandler#notationDecl
+ */
+ public void notationDecl (String name, String publicId, String systemId)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of an unparsed entity declaration.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to keep track of the unparsed entities
+ * declared in a document.</p>
+ *
+ * @param name The entity name.
+ * @param publicId The entity public identifier, or null if not
+ * available.
+ * @param systemId The entity system identifier.
+ * @param notationName The name of the associated notation.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.DTDHandler#unparsedEntityDecl
+ */
+ public void unparsedEntityDecl (String name, String publicId,
+ String systemId, String notationName)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Default implementation of ContentHandler interface.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Receive a Locator object for document events.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass if they wish to store the locator for use
+ * with other document events.</p>
+ *
+ * @param locator A locator for all SAX document events.
+ * @see org.xml.sax.ContentHandler#setDocumentLocator
+ * @see org.xml.sax.Locator
+ */
+ public void setDocumentLocator (Locator locator)
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of the beginning of the document.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions at the beginning
+ * of a document (such as allocating the root node of a tree or
+ * creating an output file).</p>
+ *
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#startDocument
+ */
+ public void startDocument ()
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of the end of the document.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions at the end
+ * of a document (such as finalising a tree or closing an output
+ * file).</p>
+ *
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#endDocument
+ */
+ public void endDocument ()
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of the start of a Namespace mapping.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions at the start of
+ * each Namespace prefix scope (such as storing the prefix mapping).</p>
+ *
+ * @param prefix The Namespace prefix being declared.
+ * @param uri The Namespace URI mapped to the prefix.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#startPrefixMapping
+ */
+ public void startPrefixMapping (String prefix, String uri)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of the end of a Namespace mapping.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions at the end of
+ * each prefix mapping.</p>
+ *
+ * @param prefix The Namespace prefix being declared.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#endPrefixMapping
+ */
+ public void endPrefixMapping (String prefix)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of the start of an element.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions at the start of
+ * each element (such as allocating a new tree node or writing
+ * output to a file).</p>
+ *
+ * @param uri The Namespace URI, or the empty string if the
+ * element has no Namespace URI or if Namespace
+ * processing is not being performed.
+ * @param localName The local name (without prefix), or the
+ * empty string if Namespace processing is not being
+ * performed.
+ * @param qName The qualified name (with prefix), or the
+ * empty string if qualified names are not available.
+ * @param attributes The attributes attached to the element. If
+ * there are no attributes, it shall be an empty
+ * Attributes object.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#startElement
+ */
+ public void startElement (String uri, String localName,
+ String qName, Attributes attributes)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of the end of an element.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions at the end of
+ * each element (such as finalising a tree node or writing
+ * output to a file).</p>
+ *
+ * @param uri The Namespace URI, or the empty string if the
+ * element has no Namespace URI or if Namespace
+ * processing is not being performed.
+ * @param localName The local name (without prefix), or the
+ * empty string if Namespace processing is not being
+ * performed.
+ * @param qName The qualified name (with prefix), or the
+ * empty string if qualified names are not available.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#endElement
+ */
+ public void endElement (String uri, String localName, String qName)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of character data inside an element.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method to take specific actions for each chunk of character data
+ * (such as adding the data to a node or buffer, or printing it to
+ * a file).</p>
+ *
+ * @param ch The characters.
+ * @param start The start position in the character array.
+ * @param length The number of characters to use from the
+ * character array.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#characters
+ */
+ public void characters (char ch[], int start, int length)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of ignorable whitespace in element content.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method to take specific actions for each chunk of ignorable
+ * whitespace (such as adding data to a node or buffer, or printing
+ * it to a file).</p>
+ *
+ * @param ch The whitespace characters.
+ * @param start The start position in the character array.
+ * @param length The number of characters to use from the
+ * character array.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#ignorableWhitespace
+ */
+ public void ignorableWhitespace (char ch[], int start, int length)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of a processing instruction.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions for each
+ * processing instruction, such as setting status variables or
+ * invoking other methods.</p>
+ *
+ * @param target The processing instruction target.
+ * @param data The processing instruction data, or null if
+ * none is supplied.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#processingInstruction
+ */
+ public void processingInstruction (String target, String data)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of a skipped entity.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions for each
+ * processing instruction, such as setting status variables or
+ * invoking other methods.</p>
+ *
+ * @param name The name of the skipped entity.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#processingInstruction
+ */
+ public void skippedEntity (String name)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Default implementation of the ErrorHandler interface.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Receive notification of a parser warning.
+ *
+ * <p>The default implementation does nothing. Application writers
+ * may override this method in a subclass to take specific actions
+ * for each warning, such as inserting the message in a log file or
+ * printing it to the console.</p>
+ *
+ * @param e The warning information encoded as an exception.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ErrorHandler#warning
+ * @see org.xml.sax.SAXParseException
+ */
+ public void warning (SAXParseException e)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of a recoverable parser error.
+ *
+ * <p>The default implementation does nothing. Application writers
+ * may override this method in a subclass to take specific actions
+ * for each error, such as inserting the message in a log file or
+ * printing it to the console.</p>
+ *
+ * @param e The warning information encoded as an exception.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ErrorHandler#warning
+ * @see org.xml.sax.SAXParseException
+ */
+ public void error (SAXParseException e)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Report a fatal XML parsing error.
+ *
+ * <p>The default implementation throws a SAXParseException.
+ * Application writers may override this method in a subclass if
+ * they need to take specific actions for each fatal error (such as
+ * collecting all of the errors into a single report): in any case,
+ * the application must stop all regular processing when this
+ * method is invoked, since the document is no longer reliable, and
+ * the parser may no longer report parsing events.</p>
+ *
+ * @param e The error information encoded as an exception.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ErrorHandler#fatalError
+ * @see org.xml.sax.SAXParseException
+ */
+ public void fatalError (SAXParseException e)
+ throws SAXException
+ {
+ throw e;
+ }
+
+}
+
+// end of DefaultHandler.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/LocatorImpl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/LocatorImpl.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/LocatorImpl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/LocatorImpl.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,214 @@
+// SAX default implementation for Locator.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: LocatorImpl.java,v 1.11 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax.helpers;
+
+import org.xml.sax.Locator;
+
+
+/**
+ * Provide an optional convenience implementation of Locator.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class is available mainly for application writers, who
+ * can use it to make a persistent snapshot of a locator at any
+ * point during a document parse:</p>
+ *
+ * <pre>
+ * Locator locator;
+ * Locator startloc;
+ *
+ * public void setLocator (Locator locator)
+ * {
+ * // note the locator
+ * this.locator = locator;
+ * }
+ *
+ * public void startDocument ()
+ * {
+ * // save the location of the start of the document
+ * // for future use.
+ * Locator startloc = new LocatorImpl(locator);
+ * }
+ *</pre>
+ *
+ * <p>Normally, parser writers will not use this class, since it
+ * is more efficient to provide location information only when
+ * requested, rather than constantly updating a Locator object.</p>
+ *
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.Locator Locator
+ */
+public class LocatorImpl implements Locator
+{
+
+
+ /**
+ * Zero-argument constructor.
+ *
+ * <p>This will not normally be useful, since the main purpose
+ * of this class is to make a snapshot of an existing Locator.</p>
+ */
+ public LocatorImpl ()
+ {
+ }
+
+
+ /**
+ * Copy constructor.
+ *
+ * <p>Create a persistent copy of the current state of a locator.
+ * When the original locator changes, this copy will still keep
+ * the original values (and it can be used outside the scope of
+ * DocumentHandler methods).</p>
+ *
+ * @param locator The locator to copy.
+ */
+ public LocatorImpl (Locator locator)
+ {
+ setPublicId(locator.getPublicId());
+ setSystemId(locator.getSystemId());
+ setLineNumber(locator.getLineNumber());
+ setColumnNumber(locator.getColumnNumber());
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.Locator
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Return the saved public identifier.
+ *
+ * @return The public identifier as a string, or null if none
+ * is available.
+ * @see org.xml.sax.Locator#getPublicId
+ * @see #setPublicId
+ */
+ public String getPublicId ()
+ {
+ return publicId;
+ }
+
+
+ /**
+ * Return the saved system identifier.
+ *
+ * @return The system identifier as a string, or null if none
+ * is available.
+ * @see org.xml.sax.Locator#getSystemId
+ * @see #setSystemId
+ */
+ public String getSystemId ()
+ {
+ return systemId;
+ }
+
+
+ /**
+ * Return the saved line number (1-based).
+ *
+ * @return The line number as an integer, or -1 if none is available.
+ * @see org.xml.sax.Locator#getLineNumber
+ * @see #setLineNumber
+ */
+ public int getLineNumber ()
+ {
+ return lineNumber;
+ }
+
+
+ /**
+ * Return the saved column number (1-based).
+ *
+ * @return The column number as an integer, or -1 if none is available.
+ * @see org.xml.sax.Locator#getColumnNumber
+ * @see #setColumnNumber
+ */
+ public int getColumnNumber ()
+ {
+ return columnNumber;
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Setters for the properties (not in org.xml.sax.Locator)
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Set the public identifier for this locator.
+ *
+ * @param publicId The new public identifier, or null
+ * if none is available.
+ * @see #getPublicId
+ */
+ public void setPublicId (String publicId)
+ {
+ this.publicId = publicId;
+ }
+
+
+ /**
+ * Set the system identifier for this locator.
+ *
+ * @param systemId The new system identifier, or null
+ * if none is available.
+ * @see #getSystemId
+ */
+ public void setSystemId (String systemId)
+ {
+ this.systemId = systemId;
+ }
+
+
+ /**
+ * Set the line number for this locator (1-based).
+ *
+ * @param lineNumber The line number, or -1 if none is available.
+ * @see #getLineNumber
+ */
+ public void setLineNumber (int lineNumber)
+ {
+ this.lineNumber = lineNumber;
+ }
+
+
+ /**
+ * Set the column number for this locator (1-based).
+ *
+ * @param columnNumber The column number, or -1 if none is available.
+ * @see #getColumnNumber
+ */
+ public void setColumnNumber (int columnNumber)
+ {
+ this.columnNumber = columnNumber;
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////////
+
+ private String publicId;
+ private String systemId;
+ private int lineNumber;
+ private int columnNumber;
+
+}
+
+// end of LocatorImpl.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/NamespaceSupport.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/NamespaceSupport.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/NamespaceSupport.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/NamespaceSupport.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,835 @@
+// NamespaceSupport.java - generic Namespace support for SAX.
+// http://www.saxproject.org
+// Written by David Megginson
+// This class is in the Public Domain. NO WARRANTY!
+// $Id: NamespaceSupport.java,v 1.14 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax.helpers;
+
+import java.util.EmptyStackException;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+
+/**
+ * Encapsulate Namespace logic for use by applications using SAX,
+ * or internally by SAX drivers.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class encapsulates the logic of Namespace processing: it
+ * tracks the declarations currently in force for each context and
+ * automatically processes qualified XML names into their Namespace
+ * parts; it can also be used in reverse for generating XML qnames
+ * from Namespaces.</p>
+ *
+ * <p>Namespace support objects are reusable, but the reset method
+ * must be invoked between each session.</p>
+ *
+ * <p>Here is a simple session:</p>
+ *
+ * <pre>
+ * String parts[] = new String[3];
+ * NamespaceSupport support = new NamespaceSupport();
+ *
+ * support.pushContext();
+ * support.declarePrefix("", "http://www.w3.org/1999/xhtml");
+ * support.declarePrefix("dc", "http://www.purl.org/dc#");
+ *
+ * parts = support.processName("p", parts, false);
+ * System.out.println("Namespace URI: " + parts[0]);
+ * System.out.println("Local name: " + parts[1]);
+ * System.out.println("Raw name: " + parts[2]);
+ *
+ * parts = support.processName("dc:title", parts, false);
+ * System.out.println("Namespace URI: " + parts[0]);
+ * System.out.println("Local name: " + parts[1]);
+ * System.out.println("Raw name: " + parts[2]);
+ *
+ * support.popContext();
+ * </pre>
+ *
+ * <p>Note that this class is optimized for the use case where most
+ * elements do not contain Namespace declarations: if the same
+ * prefix/URI mapping is repeated for each context (for example), this
+ * class will be somewhat less efficient.</p>
+ *
+ * <p>Although SAX drivers (parsers) may choose to use this class to
+ * implement namespace handling, they are not required to do so.
+ * Applications must track namespace information themselves if they
+ * want to use namespace information.
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ */
+public class NamespaceSupport
+{
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Constants.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * The XML Namespace URI as a constant.
+ * The value is <code>http://www.w3.org/XML/1998/namespace</code>
+ * as defined in the "Namespaces in XML" * recommendation.
+ *
+ * <p>This is the Namespace URI that is automatically mapped
+ * to the "xml" prefix.</p>
+ */
+ public final static String XMLNS =
+ "http://www.w3.org/XML/1998/namespace";
+
+
+ /**
+ * The namespace declaration URI as a constant.
+ * The value is <code>http://www.w3.org/xmlns/2000/</code>, as defined
+ * in a backwards-incompatible erratum to the "Namespaces in XML"
+ * recommendation. Because that erratum postdated SAX2, SAX2 defaults
+ * to the original recommendation, and does not normally use this URI.
+ *
+ *
+ * <p>This is the Namespace URI that is optionally applied to
+ * <em>xmlns</em> and <em>xmlns:*</em> attributes, which are used to
+ * declare namespaces. </p>
+ *
+ * @since SAX 2.1alpha
+ * @see #setNamespaceDeclUris
+ * @see #isNamespaceDeclUris
+ */
+ public final static String NSDECL =
+ "http://www.w3.org/xmlns/2000/";
+
+
+ /**
+ * An empty enumeration.
+ */
+ private final static Enumeration EMPTY_ENUMERATION =
+ new Vector().elements();
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Constructor.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Create a new Namespace support object.
+ */
+ public NamespaceSupport ()
+ {
+ reset();
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Context management.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Reset this Namespace support object for reuse.
+ *
+ * <p>It is necessary to invoke this method before reusing the
+ * Namespace support object for a new session. If namespace
+ * declaration URIs are to be supported, that flag must also
+ * be set to a non-default value.
+ * </p>
+ *
+ * @see #setNamespaceDeclUris
+ */
+ public void reset ()
+ {
+ contexts = new Context[32];
+ namespaceDeclUris = false;
+ contextPos = 0;
+ contexts[contextPos] = currentContext = new Context();
+ currentContext.declarePrefix("xml", XMLNS);
+ }
+
+
+ /**
+ * Start a new Namespace context.
+ * The new context will automatically inherit
+ * the declarations of its parent context, but it will also keep
+ * track of which declarations were made within this context.
+ *
+ * <p>Event callback code should start a new context once per element.
+ * This means being ready to call this in either of two places.
+ * For elements that don't include namespace declarations, the
+ * <em>ContentHandler.startElement()</em> callback is the right place.
+ * For elements with such a declaration, it'd done in the first
+ * <em>ContentHandler.startPrefixMapping()</em> callback.
+ * A boolean flag can be used to
+ * track whether a context has been started yet. When either of
+ * those methods is called, it checks the flag to see if a new context
+ * needs to be started. If so, it starts the context and sets the
+ * flag. After <em>ContentHandler.startElement()</em>
+ * does that, it always clears the flag.
+ *
+ * <p>Normally, SAX drivers would push a new context at the beginning
+ * of each XML element. Then they perform a first pass over the
+ * attributes to process all namespace declarations, making
+ * <em>ContentHandler.startPrefixMapping()</em> callbacks.
+ * Then a second pass is made, to determine the namespace-qualified
+ * names for all attributes and for the element name.
+ * Finally all the information for the
+ * <em>ContentHandler.startElement()</em> callback is available,
+ * so it can then be made.
+ *
+ * <p>The Namespace support object always starts with a base context
+ * already in force: in this context, only the "xml" prefix is
+ * declared.</p>
+ *
+ * @see org.xml.sax.ContentHandler
+ * @see #popContext
+ */
+ public void pushContext ()
+ {
+ int max = contexts.length;
+
+ contexts [contextPos].declsOK = false;
+ contextPos++;
+
+ // Extend the array if necessary
+ if (contextPos >= max) {
+ Context newContexts[] = new Context[max*2];
+ System.arraycopy(contexts, 0, newContexts, 0, max);
+ max *= 2;
+ contexts = newContexts;
+ }
+
+ // Allocate the context if necessary.
+ currentContext = contexts[contextPos];
+ if (currentContext == null) {
+ contexts[contextPos] = currentContext = new Context();
+ }
+
+ // Set the parent, if any.
+ if (contextPos > 0) {
+ currentContext.setParent(contexts[contextPos - 1]);
+ }
+ }
+
+
+ /**
+ * Revert to the previous Namespace context.
+ *
+ * <p>Normally, you should pop the context at the end of each
+ * XML element. After popping the context, all Namespace prefix
+ * mappings that were previously in force are restored.</p>
+ *
+ * <p>You must not attempt to declare additional Namespace
+ * prefixes after popping a context, unless you push another
+ * context first.</p>
+ *
+ * @see #pushContext
+ */
+ public void popContext ()
+ {
+ contexts[contextPos].clear();
+ contextPos--;
+ if (contextPos < 0) {
+ throw new EmptyStackException();
+ }
+ currentContext = contexts[contextPos];
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Operations within a context.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Declare a Namespace prefix. All prefixes must be declared
+ * before they are referenced. For example, a SAX driver (parser)
+ * would scan an element's attributes
+ * in two passes: first for namespace declarations,
+ * then a second pass using {@link #processName processName()} to
+ * interpret prefixes against (potentially redefined) prefixes.
+ *
+ * <p>This method declares a prefix in the current Namespace
+ * context; the prefix will remain in force until this context
+ * is popped, unless it is shadowed in a descendant context.</p>
+ *
+ * <p>To declare the default element Namespace, use the empty string as
+ * the prefix.</p>
+ *
+ * <p>Note that you must <em>not</em> declare a prefix after
+ * you've pushed and popped another Namespace context, or
+ * treated the declarations phase as complete by processing
+ * a prefixed name.</p>
+ *
+ * <p>Note that there is an asymmetry in this library: {@link
+ * #getPrefix getPrefix} will not return the "" prefix,
+ * even if you have declared a default element namespace.
+ * To check for a default namespace,
+ * you have to look it up explicitly using {@link #getURI getURI}.
+ * This asymmetry exists to make it easier to look up prefixes
+ * for attribute names, where the default prefix is not allowed.</p>
+ *
+ * @param prefix The prefix to declare, or the empty string to
+ * indicate the default element namespace. This may never have
+ * the value "xml" or "xmlns".
+ * @param uri The Namespace URI to associate with the prefix.
+ * @return true if the prefix was legal, false otherwise
+ *
+ * @see #processName
+ * @see #getURI
+ * @see #getPrefix
+ */
+ public boolean declarePrefix (String prefix, String uri)
+ {
+ if (prefix.equals("xml") || prefix.equals("xmlns")) {
+ return false;
+ } else {
+ currentContext.declarePrefix(prefix, uri);
+ return true;
+ }
+ }
+
+
+ /**
+ * Process a raw XML qualified name, after all declarations in the
+ * current context have been handled by {@link #declarePrefix
+ * declarePrefix()}.
+ *
+ * <p>This method processes a raw XML qualified name in the
+ * current context by removing the prefix and looking it up among
+ * the prefixes currently declared. The return value will be the
+ * array supplied by the caller, filled in as follows:</p>
+ *
+ * <dl>
+ * <dt>parts[0]</dt>
+ * <dd>The Namespace URI, or an empty string if none is
+ * in use.</dd>
+ * <dt>parts[1]</dt>
+ * <dd>The local name (without prefix).</dd>
+ * <dt>parts[2]</dt>
+ * <dd>The original raw name.</dd>
+ * </dl>
+ *
+ * <p>All of the strings in the array will be internalized. If
+ * the raw name has a prefix that has not been declared, then
+ * the return value will be null.</p>
+ *
+ * <p>Note that attribute names are processed differently than
+ * element names: an unprefixed element name will receive the
+ * default Namespace (if any), while an unprefixed attribute name
+ * will not.</p>
+ *
+ * @param qName The XML qualified name to be processed.
+ * @param parts An array supplied by the caller, capable of
+ * holding at least three members.
+ * @param isAttribute A flag indicating whether this is an
+ * attribute name (true) or an element name (false).
+ * @return The supplied array holding three internalized strings
+ * representing the Namespace URI (or empty string), the
+ * local name, and the XML qualified name; or null if there
+ * is an undeclared prefix.
+ * @see #declarePrefix
+ * @see java.lang.String#intern */
+ public String [] processName (String qName, String parts[],
+ boolean isAttribute)
+ {
+ String myParts[] = currentContext.processName(qName, isAttribute);
+ if (myParts == null) {
+ return null;
+ } else {
+ parts[0] = myParts[0];
+ parts[1] = myParts[1];
+ parts[2] = myParts[2];
+ return parts;
+ }
+ }
+
+
+ /**
+ * Look up a prefix and get the currently-mapped Namespace URI.
+ *
+ * <p>This method looks up the prefix in the current context.
+ * Use the empty string ("") for the default Namespace.</p>
+ *
+ * @param prefix The prefix to look up.
+ * @return The associated Namespace URI, or null if the prefix
+ * is undeclared in this context.
+ * @see #getPrefix
+ * @see #getPrefixes
+ */
+ public String getURI (String prefix)
+ {
+ return currentContext.getURI(prefix);
+ }
+
+
+ /**
+ * Return an enumeration of all prefixes whose declarations are
+ * active in the current context.
+ * This includes declarations from parent contexts that have
+ * not been overridden.
+ *
+ * <p><strong>Note:</strong> if there is a default prefix, it will not be
+ * returned in this enumeration; check for the default prefix
+ * using the {@link #getURI getURI} with an argument of "".</p>
+ *
+ * @return An enumeration of prefixes (never empty).
+ * @see #getDeclaredPrefixes
+ * @see #getURI
+ */
+ public Enumeration getPrefixes ()
+ {
+ return currentContext.getPrefixes();
+ }
+
+
+ /**
+ * Return one of the prefixes mapped to a Namespace URI.
+ *
+ * <p>If more than one prefix is currently mapped to the same
+ * URI, this method will make an arbitrary selection; if you
+ * want all of the prefixes, use the {@link #getPrefixes}
+ * method instead.</p>
+ *
+ * <p><strong>Note:</strong> this will never return the empty (default) prefix;
+ * to check for a default prefix, use the {@link #getURI getURI}
+ * method with an argument of "".</p>
+ *
+ * @param uri the namespace URI
+ * @return one of the prefixes currently mapped to the URI supplied,
+ * or null if none is mapped or if the URI is assigned to
+ * the default namespace
+ * @see #getPrefixes(java.lang.String)
+ * @see #getURI
+ */
+ public String getPrefix (String uri)
+ {
+ return currentContext.getPrefix(uri);
+ }
+
+
+ /**
+ * Return an enumeration of all prefixes for a given URI whose
+ * declarations are active in the current context.
+ * This includes declarations from parent contexts that have
+ * not been overridden.
+ *
+ * <p>This method returns prefixes mapped to a specific Namespace
+ * URI. The xml: prefix will be included. If you want only one
+ * prefix that's mapped to the Namespace URI, and you don't care
+ * which one you get, use the {@link #getPrefix getPrefix}
+ * method instead.</p>
+ *
+ * <p><strong>Note:</strong> the empty (default) prefix is <em>never</em> included
+ * in this enumeration; to check for the presence of a default
+ * Namespace, use the {@link #getURI getURI} method with an
+ * argument of "".</p>
+ *
+ * @param uri The Namespace URI.
+ * @return An enumeration of prefixes (never empty).
+ * @see #getPrefix
+ * @see #getDeclaredPrefixes
+ * @see #getURI
+ */
+ public Enumeration getPrefixes (String uri)
+ {
+ Vector prefixes = new Vector();
+ Enumeration allPrefixes = getPrefixes();
+ while (allPrefixes.hasMoreElements()) {
+ String prefix = (String)allPrefixes.nextElement();
+ if (uri.equals(getURI(prefix))) {
+ prefixes.addElement(prefix);
+ }
+ }
+ return prefixes.elements();
+ }
+
+
+ /**
+ * Return an enumeration of all prefixes declared in this context.
+ *
+ * <p>The empty (default) prefix will be included in this
+ * enumeration; note that this behaviour differs from that of
+ * {@link #getPrefix} and {@link #getPrefixes}.</p>
+ *
+ * @return An enumeration of all prefixes declared in this
+ * context.
+ * @see #getPrefixes
+ * @see #getURI
+ */
+ public Enumeration getDeclaredPrefixes ()
+ {
+ return currentContext.getDeclaredPrefixes();
+ }
+
+ /**
+ * Controls whether namespace declaration attributes are placed
+ * into the {@link #NSDECL NSDECL} namespace
+ * by {@link #processName processName()}. This may only be
+ * changed before any contexts have been pushed.
+ *
+ * @since SAX 2.1alpha
+ *
+ * @exception IllegalStateException when attempting to set this
+ * after any context has been pushed.
+ */
+ public void setNamespaceDeclUris (boolean value)
+ {
+ if (contextPos != 0)
+ throw new IllegalStateException ();
+ if (value == namespaceDeclUris)
+ return;
+ namespaceDeclUris = value;
+ if (value)
+ currentContext.declarePrefix ("xmlns", NSDECL);
+ else {
+ contexts[contextPos] = currentContext = new Context();
+ currentContext.declarePrefix("xml", XMLNS);
+ }
+ }
+
+ /**
+ * Returns true if namespace declaration attributes are placed into
+ * a namespace. This behavior is not the default.
+ *
+ * @since SAX 2.1alpha
+ */
+ public boolean isNamespaceDeclUris ()
+ { return namespaceDeclUris; }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////////
+
+ private Context contexts[];
+ private Context currentContext;
+ private int contextPos;
+ private boolean namespaceDeclUris;
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal classes.
+ ////////////////////////////////////////////////////////////////////
+
+ /**
+ * Internal class for a single Namespace context.
+ *
+ * <p>This module caches and reuses Namespace contexts,
+ * so the number allocated
+ * will be equal to the element depth of the document, not to the total
+ * number of elements (i.e. 5-10 rather than tens of thousands).
+ * Also, data structures used to represent contexts are shared when
+ * possible (child contexts without declarations) to further reduce
+ * the amount of memory that's consumed.
+ * </p>
+ */
+ final class Context {
+
+ /**
+ * Create the root-level Namespace context.
+ */
+ Context ()
+ {
+ copyTables();
+ }
+
+
+ /**
+ * (Re)set the parent of this Namespace context.
+ * The context must either have been freshly constructed,
+ * or must have been cleared.
+ *
+ * @param context The parent Namespace context object.
+ */
+ void setParent (Context parent)
+ {
+ this.parent = parent;
+ declarations = null;
+ prefixTable = parent.prefixTable;
+ uriTable = parent.uriTable;
+ elementNameTable = parent.elementNameTable;
+ attributeNameTable = parent.attributeNameTable;
+ defaultNS = parent.defaultNS;
+ declSeen = false;
+ declsOK = true;
+ }
+
+ /**
+ * Makes associated state become collectible,
+ * invalidating this context.
+ * {@link #setParent} must be called before
+ * this context may be used again.
+ */
+ void clear ()
+ {
+ parent = null;
+ prefixTable = null;
+ uriTable = null;
+ elementNameTable = null;
+ attributeNameTable = null;
+ defaultNS = null;
+ }
+
+
+ /**
+ * Declare a Namespace prefix for this context.
+ *
+ * @param prefix The prefix to declare.
+ * @param uri The associated Namespace URI.
+ * @see org.xml.sax.helpers.NamespaceSupport#declarePrefix
+ */
+ void declarePrefix (String prefix, String uri)
+ {
+ // Lazy processing...
+ if (!declsOK)
+ throw new IllegalStateException (
+ "can't declare any more prefixes in this context");
+ if (!declSeen) {
+ copyTables();
+ }
+ if (declarations == null) {
+ declarations = new Vector();
+ }
+
+ prefix = prefix.intern();
+ uri = uri.intern();
+ if ("".equals(prefix)) {
+ if ("".equals(uri)) {
+ defaultNS = null;
+ } else {
+ defaultNS = uri;
+ }
+ } else {
+ prefixTable.put(prefix, uri);
+ uriTable.put(uri, prefix); // may wipe out another prefix
+ }
+ declarations.addElement(prefix);
+ }
+
+
+ /**
+ * Process an XML qualified name in this context.
+ *
+ * @param qName The XML qualified name.
+ * @param isAttribute true if this is an attribute name.
+ * @return An array of three strings containing the
+ * URI part (or empty string), the local part,
+ * and the raw name, all internalized, or null
+ * if there is an undeclared prefix.
+ * @see org.xml.sax.helpers.NamespaceSupport#processName
+ */
+ String [] processName (String qName, boolean isAttribute)
+ {
+ String name[];
+ Hashtable table;
+
+ // detect errors in call sequence
+ declsOK = false;
+
+ // Select the appropriate table.
+ if (isAttribute) {
+ table = attributeNameTable;
+ } else {
+ table = elementNameTable;
+ }
+
+ // Start by looking in the cache, and
+ // return immediately if the name
+ // is already known in this content
+ name = (String[])table.get(qName);
+ if (name != null) {
+ return name;
+ }
+
+ // We haven't seen this name in this
+ // context before. Maybe in the parent
+ // context, but we can't assume prefix
+ // bindings are the same.
+ name = new String[3];
+ name[2] = qName.intern();
+ int index = qName.indexOf(':');
+
+
+ // No prefix.
+ if (index == -1) {
+ if (isAttribute) {
+ if (qName == "xmlns" && namespaceDeclUris)
+ name[0] = NSDECL;
+ else
+ name[0] = "";
+ } else if (defaultNS == null) {
+ name[0] = "";
+ } else {
+ name[0] = defaultNS;
+ }
+ name[1] = name[2];
+ }
+
+ // Prefix
+ else {
+ String prefix = qName.substring(0, index);
+ String local = qName.substring(index+1);
+ String uri;
+ if ("".equals(prefix)) {
+ uri = defaultNS;
+ } else {
+ uri = (String)prefixTable.get(prefix);
+ }
+ if (uri == null
+ || (!isAttribute && "xmlns".equals (prefix))) {
+ return null;
+ }
+ name[0] = uri;
+ name[1] = local.intern();
+ }
+
+ // Save in the cache for future use.
+ // (Could be shared with parent context...)
+ table.put(name[2], name);
+ return name;
+ }
+
+
+ /**
+ * Look up the URI associated with a prefix in this context.
+ *
+ * @param prefix The prefix to look up.
+ * @return The associated Namespace URI, or null if none is
+ * declared.
+ * @see org.xml.sax.helpers.NamespaceSupport#getURI
+ */
+ String getURI (String prefix)
+ {
+ if ("".equals(prefix)) {
+ return defaultNS;
+ } else if (prefixTable == null) {
+ return null;
+ } else {
+ return (String)prefixTable.get(prefix);
+ }
+ }
+
+
+ /**
+ * Look up one of the prefixes associated with a URI in this context.
+ *
+ * <p>Since many prefixes may be mapped to the same URI,
+ * the return value may be unreliable.</p>
+ *
+ * @param uri The URI to look up.
+ * @return The associated prefix, or null if none is declared.
+ * @see org.xml.sax.helpers.NamespaceSupport#getPrefix
+ */
+ String getPrefix (String uri)
+ {
+ if (uriTable == null) {
+ return null;
+ } else {
+ return (String)uriTable.get(uri);
+ }
+ }
+
+
+ /**
+ * Return an enumeration of prefixes declared in this context.
+ *
+ * @return An enumeration of prefixes (possibly empty).
+ * @see org.xml.sax.helpers.NamespaceSupport#getDeclaredPrefixes
+ */
+ Enumeration getDeclaredPrefixes ()
+ {
+ if (declarations == null) {
+ return EMPTY_ENUMERATION;
+ } else {
+ return declarations.elements();
+ }
+ }
+
+
+ /**
+ * Return an enumeration of all prefixes currently in force.
+ *
+ * <p>The default prefix, if in force, is <em>not</em>
+ * returned, and will have to be checked for separately.</p>
+ *
+ * @return An enumeration of prefixes (never empty).
+ * @see org.xml.sax.helpers.NamespaceSupport#getPrefixes
+ */
+ Enumeration getPrefixes ()
+ {
+ if (prefixTable == null) {
+ return EMPTY_ENUMERATION;
+ } else {
+ return prefixTable.keys();
+ }
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////
+ // Internal methods.
+ ////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Copy on write for the internal tables in this context.
+ *
+ * <p>This class is optimized for the normal case where most
+ * elements do not contain Namespace declarations.</p>
+ */
+ private void copyTables ()
+ {
+ if (prefixTable != null) {
+ prefixTable = (Hashtable)prefixTable.clone();
+ } else {
+ prefixTable = new Hashtable();
+ }
+ if (uriTable != null) {
+ uriTable = (Hashtable)uriTable.clone();
+ } else {
+ uriTable = new Hashtable();
+ }
+ elementNameTable = new Hashtable();
+ attributeNameTable = new Hashtable();
+ declSeen = true;
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////
+ // Protected state.
+ ////////////////////////////////////////////////////////////////
+
+ Hashtable prefixTable;
+ Hashtable uriTable;
+ Hashtable elementNameTable;
+ Hashtable attributeNameTable;
+ String defaultNS = null;
+ boolean declsOK = true;
+
+
+
+ ////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////
+
+ private Vector declarations = null;
+ private boolean declSeen = false;
+ private Context parent = null;
+ }
+}
+
+// end of NamespaceSupport.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/NewInstance.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/NewInstance.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/NewInstance.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/NewInstance.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,79 @@
+// NewInstance.java - create a new instance of a class by name.
+// http://www.saxproject.org
+// Written by Edwin Goei, edwingo at apache.org
+// and by David Brownell, dbrownell at users.sourceforge.net
+// NO WARRANTY! This class is in the Public Domain.
+// $Id: NewInstance.java,v 1.9 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax.helpers;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * Create a new instance of a class by name.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class contains a static method for creating an instance of a
+ * class from an explicit class name. It tries to use the thread's context
+ * ClassLoader if possible and falls back to using
+ * Class.forName(String).</p>
+ *
+ * <p>This code is designed to compile and run on JDK version 1.1 and later
+ * including versions of Java 2.</p>
+ *
+ * @author Edwin Goei, David Brownell
+ * @version 2.0.1 (sax2r2)
+ */
+class NewInstance {
+
+ /**
+ * Creates a new instance of the specified class name
+ *
+ * Package private so this code is not exposed at the API level.
+ */
+ static Object newInstance (ClassLoader classLoader, String className)
+ throws ClassNotFoundException, IllegalAccessException,
+ InstantiationException
+ {
+ Class driverClass;
+ if (classLoader == null) {
+ driverClass = Class.forName(className);
+ } else {
+ driverClass = classLoader.loadClass(className);
+ }
+ return driverClass.newInstance();
+ }
+
+ /**
+ * Figure out which ClassLoader to use. For JDK 1.2 and later use
+ * the context ClassLoader.
+ */
+ static ClassLoader getClassLoader ()
+ {
+ Method m = null;
+
+ try {
+ m = Thread.class.getMethod("getContextClassLoader", null);
+ } catch (NoSuchMethodException e) {
+ // Assume that we are running JDK 1.1, use the current ClassLoader
+ return NewInstance.class.getClassLoader();
+ }
+
+ try {
+ return (ClassLoader) m.invoke(Thread.currentThread(), null);
+ } catch (IllegalAccessException e) {
+ // assert(false)
+ throw new UnknownError(e.getMessage());
+ } catch (InvocationTargetException e) {
+ // assert(e.getTargetException() instanceof SecurityException)
+ throw new UnknownError(e.getMessage());
+ }
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/ParserAdapter.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/ParserAdapter.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/ParserAdapter.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/ParserAdapter.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,1046 @@
+// ParserAdapter.java - adapt a SAX1 Parser to a SAX2 XMLReader.
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the public domain.
+// $Id: ParserAdapter.java,v 1.12 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax.helpers;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Vector;
+
+import org.xml.sax.Parser; // deprecated
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.AttributeList; // deprecated
+import org.xml.sax.EntityResolver;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.DocumentHandler; // deprecated
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+import org.xml.sax.XMLReader;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+
+
+/**
+ * Adapt a SAX1 Parser as a SAX2 XMLReader.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class wraps a SAX1 {@link org.xml.sax.Parser Parser}
+ * and makes it act as a SAX2 {@link org.xml.sax.XMLReader XMLReader},
+ * with feature, property, and Namespace support. Note
+ * that it is not possible to report {@link org.xml.sax.ContentHandler#skippedEntity
+ * skippedEntity} events, since SAX1 does not make that information available.</p>
+ *
+ * <p>This adapter does not test for duplicate Namespace-qualified
+ * attribute names.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.helpers.XMLReaderAdapter
+ * @see org.xml.sax.XMLReader
+ * @see org.xml.sax.Parser
+ */
+public class ParserAdapter implements XMLReader, DocumentHandler
+{
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Constructors.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Construct a new parser adapter.
+ *
+ * <p>Use the "org.xml.sax.parser" property to locate the
+ * embedded SAX1 driver.</p>
+ *
+ * @exception SAXException If the embedded driver
+ * cannot be instantiated or if the
+ * org.xml.sax.parser property is not specified.
+ */
+ public ParserAdapter ()
+ throws SAXException
+ {
+ super();
+
+ String driver = System.getProperty("org.xml.sax.parser");
+
+ try {
+ setup(ParserFactory.makeParser());
+ } catch (ClassNotFoundException e1) {
+ throw new
+ SAXException("Cannot find SAX1 driver class " +
+ driver, e1);
+ } catch (IllegalAccessException e2) {
+ throw new
+ SAXException("SAX1 driver class " +
+ driver +
+ " found but cannot be loaded", e2);
+ } catch (InstantiationException e3) {
+ throw new
+ SAXException("SAX1 driver class " +
+ driver +
+ " loaded but cannot be instantiated", e3);
+ } catch (ClassCastException e4) {
+ throw new
+ SAXException("SAX1 driver class " +
+ driver +
+ " does not implement org.xml.sax.Parser");
+ } catch (NullPointerException e5) {
+ throw new
+ SAXException("System property org.xml.sax.parser not specified");
+ }
+ }
+
+
+ /**
+ * Construct a new parser adapter.
+ *
+ * <p>Note that the embedded parser cannot be changed once the
+ * adapter is created; to embed a different parser, allocate
+ * a new ParserAdapter.</p>
+ *
+ * @param parser The SAX1 parser to embed.
+ * @exception java.lang.NullPointerException If the parser parameter
+ * is null.
+ */
+ public ParserAdapter (Parser parser)
+ {
+ super();
+ setup(parser);
+ }
+
+
+ /**
+ * Internal setup method.
+ *
+ * @param parser The embedded parser.
+ * @exception java.lang.NullPointerException If the parser parameter
+ * is null.
+ */
+ private void setup (Parser parser)
+ {
+ if (parser == null) {
+ throw new
+ NullPointerException("Parser argument must not be null");
+ }
+ this.parser = parser;
+ atts = new AttributesImpl();
+ nsSupport = new NamespaceSupport();
+ attAdapter = new AttributeListAdapter();
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.XMLReader.
+ ////////////////////////////////////////////////////////////////////
+
+
+ //
+ // Internal constants for the sake of convenience.
+ //
+ private final static String FEATURES = "http://xml.org/sax/features/";
+ private final static String NAMESPACES = FEATURES + "namespaces";
+ private final static String NAMESPACE_PREFIXES = FEATURES + "namespace-prefixes";
+ private final static String XMLNS_URIs = FEATURES + "xmlns-uris";
+
+
+ /**
+ * Set a feature flag for the parser.
+ *
+ * <p>The only features recognized are namespaces and
+ * namespace-prefixes.</p>
+ *
+ * @param name The feature name, as a complete URI.
+ * @param value The requested feature value.
+ * @exception SAXNotRecognizedException If the feature
+ * can't be assigned or retrieved.
+ * @exception SAXNotSupportedException If the feature
+ * can't be assigned that value.
+ * @see org.xml.sax.XMLReader#setFeature
+ */
+ public void setFeature (String name, boolean value)
+ throws SAXNotRecognizedException, SAXNotSupportedException
+ {
+ if (name.equals(NAMESPACES)) {
+ checkNotParsing("feature", name);
+ namespaces = value;
+ if (!namespaces && !prefixes) {
+ prefixes = true;
+ }
+ } else if (name.equals(NAMESPACE_PREFIXES)) {
+ checkNotParsing("feature", name);
+ prefixes = value;
+ if (!prefixes && !namespaces) {
+ namespaces = true;
+ }
+ } else if (name.equals(XMLNS_URIs)) {
+ checkNotParsing("feature", name);
+ uris = value;
+ } else {
+ throw new SAXNotRecognizedException("Feature: " + name);
+ }
+ }
+
+
+ /**
+ * Check a parser feature flag.
+ *
+ * <p>The only features recognized are namespaces and
+ * namespace-prefixes.</p>
+ *
+ * @param name The feature name, as a complete URI.
+ * @return The current feature value.
+ * @exception SAXNotRecognizedException If the feature
+ * value can't be assigned or retrieved.
+ * @exception SAXNotSupportedException If the
+ * feature is not currently readable.
+ * @see org.xml.sax.XMLReader#setFeature
+ */
+ public boolean getFeature (String name)
+ throws SAXNotRecognizedException, SAXNotSupportedException
+ {
+ if (name.equals(NAMESPACES)) {
+ return namespaces;
+ } else if (name.equals(NAMESPACE_PREFIXES)) {
+ return prefixes;
+ } else if (name.equals(XMLNS_URIs)) {
+ return uris;
+ } else {
+ throw new SAXNotRecognizedException("Feature: " + name);
+ }
+ }
+
+
+ /**
+ * Set a parser property.
+ *
+ * <p>No properties are currently recognized.</p>
+ *
+ * @param name The property name.
+ * @param value The property value.
+ * @exception SAXNotRecognizedException If the property
+ * value can't be assigned or retrieved.
+ * @exception SAXNotSupportedException If the property
+ * can't be assigned that value.
+ * @see org.xml.sax.XMLReader#setProperty
+ */
+ public void setProperty (String name, Object value)
+ throws SAXNotRecognizedException, SAXNotSupportedException
+ {
+ throw new SAXNotRecognizedException("Property: " + name);
+ }
+
+
+ /**
+ * Get a parser property.
+ *
+ * <p>No properties are currently recognized.</p>
+ *
+ * @param name The property name.
+ * @return The property value.
+ * @exception SAXNotRecognizedException If the property
+ * value can't be assigned or retrieved.
+ * @exception SAXNotSupportedException If the property
+ * value is not currently readable.
+ * @see org.xml.sax.XMLReader#getProperty
+ */
+ public Object getProperty (String name)
+ throws SAXNotRecognizedException, SAXNotSupportedException
+ {
+ throw new SAXNotRecognizedException("Property: " + name);
+ }
+
+
+ /**
+ * Set the entity resolver.
+ *
+ * @param resolver The new entity resolver.
+ * @see org.xml.sax.XMLReader#setEntityResolver
+ */
+ public void setEntityResolver (EntityResolver resolver)
+ {
+ entityResolver = resolver;
+ }
+
+
+ /**
+ * Return the current entity resolver.
+ *
+ * @return The current entity resolver, or null if none was supplied.
+ * @see org.xml.sax.XMLReader#getEntityResolver
+ */
+ public EntityResolver getEntityResolver ()
+ {
+ return entityResolver;
+ }
+
+
+ /**
+ * Set the DTD handler.
+ *
+ * @param handler the new DTD handler
+ * @see org.xml.sax.XMLReader#setEntityResolver
+ */
+ public void setDTDHandler (DTDHandler handler)
+ {
+ dtdHandler = handler;
+ }
+
+
+ /**
+ * Return the current DTD handler.
+ *
+ * @return the current DTD handler, or null if none was supplied
+ * @see org.xml.sax.XMLReader#getEntityResolver
+ */
+ public DTDHandler getDTDHandler ()
+ {
+ return dtdHandler;
+ }
+
+
+ /**
+ * Set the content handler.
+ *
+ * @param handler the new content handler
+ * @see org.xml.sax.XMLReader#setEntityResolver
+ */
+ public void setContentHandler (ContentHandler handler)
+ {
+ contentHandler = handler;
+ }
+
+
+ /**
+ * Return the current content handler.
+ *
+ * @return The current content handler, or null if none was supplied.
+ * @see org.xml.sax.XMLReader#getEntityResolver
+ */
+ public ContentHandler getContentHandler ()
+ {
+ return contentHandler;
+ }
+
+
+ /**
+ * Set the error handler.
+ *
+ * @param handler The new error handler.
+ * @see org.xml.sax.XMLReader#setEntityResolver
+ */
+ public void setErrorHandler (ErrorHandler handler)
+ {
+ errorHandler = handler;
+ }
+
+
+ /**
+ * Return the current error handler.
+ *
+ * @return The current error handler, or null if none was supplied.
+ * @see org.xml.sax.XMLReader#getEntityResolver
+ */
+ public ErrorHandler getErrorHandler ()
+ {
+ return errorHandler;
+ }
+
+
+ /**
+ * Parse an XML document.
+ *
+ * @param systemId The absolute URL of the document.
+ * @exception java.io.IOException If there is a problem reading
+ * the raw content of the document.
+ * @exception SAXException If there is a problem
+ * processing the document.
+ * @see #parse(org.xml.sax.InputSource)
+ * @see org.xml.sax.Parser#parse(java.lang.String)
+ */
+ public void parse (String systemId)
+ throws IOException, SAXException
+ {
+ parse(new InputSource(systemId));
+ }
+
+
+ /**
+ * Parse an XML document.
+ *
+ * @param input An input source for the document.
+ * @exception java.io.IOException If there is a problem reading
+ * the raw content of the document.
+ * @exception SAXException If there is a problem
+ * processing the document.
+ * @see #parse(java.lang.String)
+ * @see org.xml.sax.Parser#parse(org.xml.sax.InputSource)
+ */
+ public void parse (InputSource input)
+ throws IOException, SAXException
+ {
+ if (parsing) {
+ throw new SAXException("Parser is already in use");
+ }
+ setupParser();
+ parsing = true;
+ try {
+ parser.parse(input);
+ } finally {
+ parsing = false;
+ }
+ parsing = false;
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.DocumentHandler.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Adapter implementation method; do not call.
+ * Adapt a SAX1 document locator event.
+ *
+ * @param locator A document locator.
+ * @see org.xml.sax.ContentHandler#setDocumentLocator
+ */
+ public void setDocumentLocator (Locator locator)
+ {
+ this.locator = locator;
+ if (contentHandler != null) {
+ contentHandler.setDocumentLocator(locator);
+ }
+ }
+
+
+ /**
+ * Adapter implementation method; do not call.
+ * Adapt a SAX1 start document event.
+ *
+ * @exception SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.DocumentHandler#startDocument
+ */
+ public void startDocument ()
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.startDocument();
+ }
+ }
+
+
+ /**
+ * Adapter implementation method; do not call.
+ * Adapt a SAX1 end document event.
+ *
+ * @exception SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.DocumentHandler#endDocument
+ */
+ public void endDocument ()
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.endDocument();
+ }
+ }
+
+
+ /**
+ * Adapter implementation method; do not call.
+ * Adapt a SAX1 startElement event.
+ *
+ * <p>If necessary, perform Namespace processing.</p>
+ *
+ * @param qName The qualified (prefixed) name.
+ * @param qAtts The XML attribute list (with qnames).
+ * @exception SAXException The client may raise a
+ * processing exception.
+ */
+ public void startElement (String qName, AttributeList qAtts)
+ throws SAXException
+ {
+ // These are exceptions from the
+ // first pass; they should be
+ // ignored if there's a second pass,
+ // but reported otherwise.
+ Vector exceptions = null;
+
+ // If we're not doing Namespace
+ // processing, dispatch this quickly.
+ if (!namespaces) {
+ if (contentHandler != null) {
+ attAdapter.setAttributeList(qAtts);
+ contentHandler.startElement("", "", qName.intern(),
+ attAdapter);
+ }
+ return;
+ }
+
+
+ // OK, we're doing Namespace processing.
+ nsSupport.pushContext();
+ int length = qAtts.getLength();
+
+ // First pass: handle NS decls
+ for (int i = 0; i < length; i++) {
+ String attQName = qAtts.getName(i);
+
+ if (!attQName.startsWith("xmlns"))
+ continue;
+ // Could be a declaration...
+ String prefix;
+ int n = attQName.indexOf(':');
+
+ // xmlns=...
+ if (n == -1 && attQName.length () == 5) {
+ prefix = "";
+ } else if (n != 5) {
+ // XML namespaces spec doesn't discuss "xmlnsf:oo"
+ // (and similarly named) attributes ... at most, warn
+ continue;
+ } else // xmlns:foo=...
+ prefix = attQName.substring(n+1);
+
+ String value = qAtts.getValue(i);
+ if (!nsSupport.declarePrefix(prefix, value)) {
+ reportError("Illegal Namespace prefix: " + prefix);
+ continue;
+ }
+ if (contentHandler != null)
+ contentHandler.startPrefixMapping(prefix, value);
+ }
+
+ // Second pass: copy all relevant
+ // attributes into the SAX2 AttributeList
+ // using updated prefix bindings
+ atts.clear();
+ for (int i = 0; i < length; i++) {
+ String attQName = qAtts.getName(i);
+ String type = qAtts.getType(i);
+ String value = qAtts.getValue(i);
+
+ // Declaration?
+ if (attQName.startsWith("xmlns")) {
+ String prefix;
+ int n = attQName.indexOf(':');
+
+ if (n == -1 && attQName.length () == 5) {
+ prefix = "";
+ } else if (n != 5) {
+ // XML namespaces spec doesn't discuss "xmlnsf:oo"
+ // (and similarly named) attributes ... ignore
+ prefix = null;
+ } else {
+ prefix = attQName.substring(6);
+ }
+ // Yes, decl: report or prune
+ if (prefix != null) {
+ if (prefixes) {
+ if (uris)
+ // note funky case: localname can be null
+ // when declaring the default prefix, and
+ // yet the uri isn't null.
+ atts.addAttribute (nsSupport.XMLNS, prefix,
+ attQName.intern(), type, value);
+ else
+ atts.addAttribute ("", "",
+ attQName.intern(), type, value);
+ }
+ continue;
+ }
+ }
+
+ // Not a declaration -- report
+ try {
+ String attName[] = processName(attQName, true, true);
+ atts.addAttribute(attName[0], attName[1], attName[2],
+ type, value);
+ } catch (SAXException e) {
+ if (exceptions == null)
+ exceptions = new Vector();
+ exceptions.addElement(e);
+ atts.addAttribute("", attQName, attQName, type, value);
+ }
+ }
+
+ // now handle the deferred exception reports
+ if (exceptions != null && errorHandler != null) {
+ for (int i = 0; i < exceptions.size(); i++)
+ errorHandler.error((SAXParseException)
+ (exceptions.elementAt(i)));
+ }
+
+ // OK, finally report the event.
+ if (contentHandler != null) {
+ String name[] = processName(qName, false, false);
+ contentHandler.startElement(name[0], name[1], name[2], atts);
+ }
+ }
+
+
+ /**
+ * Adapter implementation method; do not call.
+ * Adapt a SAX1 end element event.
+ *
+ * @param qName The qualified (prefixed) name.
+ * @exception SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.DocumentHandler#endElement
+ */
+ public void endElement (String qName)
+ throws SAXException
+ {
+ // If we're not doing Namespace
+ // processing, dispatch this quickly.
+ if (!namespaces) {
+ if (contentHandler != null) {
+ contentHandler.endElement("", "", qName.intern());
+ }
+ return;
+ }
+
+ // Split the name.
+ String names[] = processName(qName, false, false);
+ if (contentHandler != null) {
+ contentHandler.endElement(names[0], names[1], names[2]);
+ Enumeration prefixes = nsSupport.getDeclaredPrefixes();
+ while (prefixes.hasMoreElements()) {
+ String prefix = (String)prefixes.nextElement();
+ contentHandler.endPrefixMapping(prefix);
+ }
+ }
+ nsSupport.popContext();
+ }
+
+
+ /**
+ * Adapter implementation method; do not call.
+ * Adapt a SAX1 characters event.
+ *
+ * @param ch An array of characters.
+ * @param start The starting position in the array.
+ * @param length The number of characters to use.
+ * @exception SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.DocumentHandler#characters
+ */
+ public void characters (char ch[], int start, int length)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.characters(ch, start, length);
+ }
+ }
+
+
+ /**
+ * Adapter implementation method; do not call.
+ * Adapt a SAX1 ignorable whitespace event.
+ *
+ * @param ch An array of characters.
+ * @param start The starting position in the array.
+ * @param length The number of characters to use.
+ * @exception SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.DocumentHandler#ignorableWhitespace
+ */
+ public void ignorableWhitespace (char ch[], int start, int length)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.ignorableWhitespace(ch, start, length);
+ }
+ }
+
+
+ /**
+ * Adapter implementation method; do not call.
+ * Adapt a SAX1 processing instruction event.
+ *
+ * @param target The processing instruction target.
+ * @param data The remainder of the processing instruction
+ * @exception SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.DocumentHandler#processingInstruction
+ */
+ public void processingInstruction (String target, String data)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.processingInstruction(target, data);
+ }
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal utility methods.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Initialize the parser before each run.
+ */
+ private void setupParser ()
+ {
+ // catch an illegal "nonsense" state.
+ if (!prefixes && !namespaces)
+ throw new IllegalStateException ();
+
+ nsSupport.reset();
+ if (uris)
+ nsSupport.setNamespaceDeclUris (true);
+
+ if (entityResolver != null) {
+ parser.setEntityResolver(entityResolver);
+ }
+ if (dtdHandler != null) {
+ parser.setDTDHandler(dtdHandler);
+ }
+ if (errorHandler != null) {
+ parser.setErrorHandler(errorHandler);
+ }
+ parser.setDocumentHandler(this);
+ locator = null;
+ }
+
+
+ /**
+ * Process a qualified (prefixed) name.
+ *
+ * <p>If the name has an undeclared prefix, use only the qname
+ * and make an ErrorHandler.error callback in case the app is
+ * interested.</p>
+ *
+ * @param qName The qualified (prefixed) name.
+ * @param isAttribute true if this is an attribute name.
+ * @return The name split into three parts.
+ * @exception SAXException The client may throw
+ * an exception if there is an error callback.
+ */
+ private String [] processName (String qName, boolean isAttribute,
+ boolean useException)
+ throws SAXException
+ {
+ String parts[] = nsSupport.processName(qName, nameParts,
+ isAttribute);
+ if (parts == null) {
+ if (useException)
+ throw makeException("Undeclared prefix: " + qName);
+ reportError("Undeclared prefix: " + qName);
+ parts = new String[3];
+ parts[0] = parts[1] = "";
+ parts[2] = qName.intern();
+ }
+ return parts;
+ }
+
+
+ /**
+ * Report a non-fatal error.
+ *
+ * @param message The error message.
+ * @exception SAXException The client may throw
+ * an exception.
+ */
+ void reportError (String message)
+ throws SAXException
+ {
+ if (errorHandler != null)
+ errorHandler.error(makeException(message));
+ }
+
+
+ /**
+ * Construct an exception for the current context.
+ *
+ * @param message The error message.
+ */
+ private SAXParseException makeException (String message)
+ {
+ if (locator != null) {
+ return new SAXParseException(message, locator);
+ } else {
+ return new SAXParseException(message, null, null, -1, -1);
+ }
+ }
+
+
+ /**
+ * Throw an exception if we are parsing.
+ *
+ * <p>Use this method to detect illegal feature or
+ * property changes.</p>
+ *
+ * @param type The type of thing (feature or property).
+ * @param name The feature or property name.
+ * @exception SAXNotSupportedException If a
+ * document is currently being parsed.
+ */
+ private void checkNotParsing (String type, String name)
+ throws SAXNotSupportedException
+ {
+ if (parsing) {
+ throw new SAXNotSupportedException("Cannot change " +
+ type + ' ' +
+ name + " while parsing");
+
+ }
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////////
+
+ private NamespaceSupport nsSupport;
+ private AttributeListAdapter attAdapter;
+
+ private boolean parsing = false;
+ private String nameParts[] = new String[3];
+
+ private Parser parser = null;
+
+ private AttributesImpl atts = null;
+
+ // Features
+ private boolean namespaces = true;
+ private boolean prefixes = false;
+ private boolean uris = false;
+
+ // Properties
+
+ // Handlers
+ Locator locator;
+
+ EntityResolver entityResolver = null;
+ DTDHandler dtdHandler = null;
+ ContentHandler contentHandler = null;
+ ErrorHandler errorHandler = null;
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Inner class to wrap an AttributeList when not doing NS proc.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Adapt a SAX1 AttributeList as a SAX2 Attributes object.
+ *
+ * <p>This class is in the Public Domain, and comes with NO
+ * WARRANTY of any kind.</p>
+ *
+ * <p>This wrapper class is used only when Namespace support
+ * is disabled -- it provides pretty much a direct mapping
+ * from SAX1 to SAX2, except that names and types are
+ * interned whenever requested.</p>
+ */
+ final class AttributeListAdapter implements Attributes
+ {
+
+ /**
+ * Construct a new adapter.
+ */
+ AttributeListAdapter ()
+ {
+ }
+
+
+ /**
+ * Set the embedded AttributeList.
+ *
+ * <p>This method must be invoked before any of the others
+ * can be used.</p>
+ *
+ * @param The SAX1 attribute list (with qnames).
+ */
+ void setAttributeList (AttributeList qAtts)
+ {
+ this.qAtts = qAtts;
+ }
+
+
+ /**
+ * Return the length of the attribute list.
+ *
+ * @return The number of attributes in the list.
+ * @see org.xml.sax.Attributes#getLength
+ */
+ public int getLength ()
+ {
+ return qAtts.getLength();
+ }
+
+
+ /**
+ * Return the Namespace URI of the specified attribute.
+ *
+ * @param The attribute's index.
+ * @return Always the empty string.
+ * @see org.xml.sax.Attributes#getURI
+ */
+ public String getURI (int i)
+ {
+ return "";
+ }
+
+
+ /**
+ * Return the local name of the specified attribute.
+ *
+ * @param The attribute's index.
+ * @return Always the empty string.
+ * @see org.xml.sax.Attributes#getLocalName
+ */
+ public String getLocalName (int i)
+ {
+ return "";
+ }
+
+
+ /**
+ * Return the qualified (prefixed) name of the specified attribute.
+ *
+ * @param The attribute's index.
+ * @return The attribute's qualified name, internalized.
+ */
+ public String getQName (int i)
+ {
+ return qAtts.getName(i).intern();
+ }
+
+
+ /**
+ * Return the type of the specified attribute.
+ *
+ * @param The attribute's index.
+ * @return The attribute's type as an internalized string.
+ */
+ public String getType (int i)
+ {
+ return qAtts.getType(i).intern();
+ }
+
+
+ /**
+ * Return the value of the specified attribute.
+ *
+ * @param The attribute's index.
+ * @return The attribute's value.
+ */
+ public String getValue (int i)
+ {
+ return qAtts.getValue(i);
+ }
+
+
+ /**
+ * Look up an attribute index by Namespace name.
+ *
+ * @param uri The Namespace URI or the empty string.
+ * @param localName The local name.
+ * @return The attributes index, or -1 if none was found.
+ * @see org.xml.sax.Attributes#getIndex(java.lang.String,java.lang.String)
+ */
+ public int getIndex (String uri, String localName)
+ {
+ return -1;
+ }
+
+
+ /**
+ * Look up an attribute index by qualified (prefixed) name.
+ *
+ * @param qName The qualified name.
+ * @return The attributes index, or -1 if none was found.
+ * @see org.xml.sax.Attributes#getIndex(java.lang.String)
+ */
+ public int getIndex (String qName)
+ {
+ int max = atts.getLength();
+ for (int i = 0; i < max; i++) {
+ if (qAtts.getName(i).equals(qName)) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+
+ /**
+ * Look up the type of an attribute by Namespace name.
+ *
+ * @param uri The Namespace URI
+ * @param localName The local name.
+ * @return The attribute's type as an internalized string.
+ */
+ public String getType (String uri, String localName)
+ {
+ return null;
+ }
+
+
+ /**
+ * Look up the type of an attribute by qualified (prefixed) name.
+ *
+ * @param qName The qualified name.
+ * @return The attribute's type as an internalized string.
+ */
+ public String getType (String qName)
+ {
+ return qAtts.getType(qName).intern();
+ }
+
+
+ /**
+ * Look up the value of an attribute by Namespace name.
+ *
+ * @param uri The Namespace URI
+ * @param localName The local name.
+ * @return The attribute's value.
+ */
+ public String getValue (String uri, String localName)
+ {
+ return null;
+ }
+
+
+ /**
+ * Look up the value of an attribute by qualified (prefixed) name.
+ *
+ * @param qName The qualified name.
+ * @return The attribute's value.
+ */
+ public String getValue (String qName)
+ {
+ return qAtts.getValue(qName);
+ }
+
+ private AttributeList qAtts;
+ }
+}
+
+// end of ParserAdapter.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/ParserFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/ParserFactory.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/ParserFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/ParserFactory.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,129 @@
+// SAX parser factory.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: ParserFactory.java,v 1.11 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax.helpers;
+
+import java.lang.ClassNotFoundException;
+import java.lang.IllegalAccessException;
+import java.lang.InstantiationException;
+import java.lang.SecurityException;
+import java.lang.ClassCastException;
+
+import org.xml.sax.Parser;
+
+
+/**
+ * Java-specific class for dynamically loading SAX parsers.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p><strong>Note:</strong> This class is designed to work with the now-deprecated
+ * SAX1 {@link org.xml.sax.Parser Parser} class. SAX2 applications should use
+ * {@link org.xml.sax.helpers.XMLReaderFactory XMLReaderFactory} instead.</p>
+ *
+ * <p>ParserFactory is not part of the platform-independent definition
+ * of SAX; it is an additional convenience class designed
+ * specifically for Java XML application writers. SAX applications
+ * can use the static methods in this class to allocate a SAX parser
+ * dynamically at run-time based either on the value of the
+ * `org.xml.sax.parser' system property or on a string containing the class
+ * name.</p>
+ *
+ * <p>Note that the application still requires an XML parser that
+ * implements SAX1.</p>
+ *
+ * @deprecated This class works with the deprecated
+ * {@link org.xml.sax.Parser Parser}
+ * interface.
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ */
+public class ParserFactory {
+
+
+ /**
+ * Private null constructor.
+ */
+ private ParserFactory ()
+ {
+ }
+
+
+ /**
+ * Create a new SAX parser using the `org.xml.sax.parser' system property.
+ *
+ * <p>The named class must exist and must implement the
+ * {@link org.xml.sax.Parser Parser} interface.</p>
+ *
+ * @exception java.lang.NullPointerException There is no value
+ * for the `org.xml.sax.parser' system property.
+ * @exception java.lang.ClassNotFoundException The SAX parser
+ * class was not found (check your CLASSPATH).
+ * @exception IllegalAccessException The SAX parser class was
+ * found, but you do not have permission to load
+ * it.
+ * @exception InstantiationException The SAX parser class was
+ * found but could not be instantiated.
+ * @exception java.lang.ClassCastException The SAX parser class
+ * was found and instantiated, but does not implement
+ * org.xml.sax.Parser.
+ * @see #makeParser(java.lang.String)
+ * @see org.xml.sax.Parser
+ */
+ public static Parser makeParser ()
+ throws ClassNotFoundException,
+ IllegalAccessException,
+ InstantiationException,
+ NullPointerException,
+ ClassCastException
+ {
+ String className = System.getProperty("org.xml.sax.parser");
+ if (className == null) {
+ throw new NullPointerException("No value for sax.parser property");
+ } else {
+ return makeParser(className);
+ }
+ }
+
+
+ /**
+ * Create a new SAX parser object using the class name provided.
+ *
+ * <p>The named class must exist and must implement the
+ * {@link org.xml.sax.Parser Parser} interface.</p>
+ *
+ * @param className A string containing the name of the
+ * SAX parser class.
+ * @exception java.lang.ClassNotFoundException The SAX parser
+ * class was not found (check your CLASSPATH).
+ * @exception IllegalAccessException The SAX parser class was
+ * found, but you do not have permission to load
+ * it.
+ * @exception InstantiationException The SAX parser class was
+ * found but could not be instantiated.
+ * @exception java.lang.ClassCastException The SAX parser class
+ * was found and instantiated, but does not implement
+ * org.xml.sax.Parser.
+ * @see #makeParser()
+ * @see org.xml.sax.Parser
+ */
+ public static Parser makeParser (String className)
+ throws ClassNotFoundException,
+ IllegalAccessException,
+ InstantiationException,
+ ClassCastException
+ {
+ return (Parser) NewInstance.newInstance (
+ NewInstance.getClassLoader (), className);
+ }
+
+}
+
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/XMLFilterImpl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/XMLFilterImpl.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/XMLFilterImpl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/XMLFilterImpl.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,713 @@
+// XMLFilterImpl.java - base SAX2 filter implementation.
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the Public Domain.
+// $Id: XMLFilterImpl.java,v 1.12 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax.helpers;
+
+import java.io.IOException;
+
+import org.xml.sax.XMLReader;
+import org.xml.sax.XMLFilter;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.Attributes;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.SAXNotRecognizedException;
+
+
+/**
+ * Base class for deriving an XML filter.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class is designed to sit between an {@link org.xml.sax.XMLReader
+ * XMLReader} and the client application's event handlers. By default, it
+ * does nothing but pass requests up to the reader and events
+ * on to the handlers unmodified, but subclasses can override
+ * specific methods to modify the event stream or the configuration
+ * requests as they pass through.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.XMLFilter
+ * @see org.xml.sax.XMLReader
+ * @see org.xml.sax.EntityResolver
+ * @see org.xml.sax.DTDHandler
+ * @see org.xml.sax.ContentHandler
+ * @see org.xml.sax.ErrorHandler
+ */
+public class XMLFilterImpl
+ implements XMLFilter, EntityResolver, DTDHandler, ContentHandler, ErrorHandler
+{
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Constructors.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Construct an empty XML filter, with no parent.
+ *
+ * <p>This filter will have no parent: you must assign a parent
+ * before you start a parse or do any configuration with
+ * setFeature or setProperty, unless you use this as a pure event
+ * consumer rather than as an {@link XMLReader}.</p>
+ *
+ * @see org.xml.sax.XMLReader#setFeature
+ * @see org.xml.sax.XMLReader#setProperty
+ * @see #setParent
+ */
+ public XMLFilterImpl ()
+ {
+ super();
+ }
+
+
+ /**
+ * Construct an XML filter with the specified parent.
+ *
+ * @see #setParent
+ * @see #getParent
+ */
+ public XMLFilterImpl (XMLReader parent)
+ {
+ super();
+ setParent(parent);
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.XMLFilter.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Set the parent reader.
+ *
+ * <p>This is the {@link org.xml.sax.XMLReader XMLReader} from which
+ * this filter will obtain its events and to which it will pass its
+ * configuration requests. The parent may itself be another filter.</p>
+ *
+ * <p>If there is no parent reader set, any attempt to parse
+ * or to set or get a feature or property will fail.</p>
+ *
+ * @param parent The parent XML reader.
+ * @see #getParent
+ */
+ public void setParent (XMLReader parent)
+ {
+ this.parent = parent;
+ }
+
+
+ /**
+ * Get the parent reader.
+ *
+ * @return The parent XML reader, or null if none is set.
+ * @see #setParent
+ */
+ public XMLReader getParent ()
+ {
+ return parent;
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.XMLReader.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Set the value of a feature.
+ *
+ * <p>This will always fail if the parent is null.</p>
+ *
+ * @param name The feature name.
+ * @param value The requested feature value.
+ * @exception org.xml.sax.SAXNotRecognizedException If the feature
+ * value can't be assigned or retrieved from the parent.
+ * @exception org.xml.sax.SAXNotSupportedException When the
+ * parent recognizes the feature name but
+ * cannot set the requested value.
+ */
+ public void setFeature (String name, boolean value)
+ throws SAXNotRecognizedException, SAXNotSupportedException
+ {
+ if (parent != null) {
+ parent.setFeature(name, value);
+ } else {
+ throw new SAXNotRecognizedException("Feature: " + name);
+ }
+ }
+
+
+ /**
+ * Look up the value of a feature.
+ *
+ * <p>This will always fail if the parent is null.</p>
+ *
+ * @param name The feature name.
+ * @return The current value of the feature.
+ * @exception org.xml.sax.SAXNotRecognizedException If the feature
+ * value can't be assigned or retrieved from the parent.
+ * @exception org.xml.sax.SAXNotSupportedException When the
+ * parent recognizes the feature name but
+ * cannot determine its value at this time.
+ */
+ public boolean getFeature (String name)
+ throws SAXNotRecognizedException, SAXNotSupportedException
+ {
+ if (parent != null) {
+ return parent.getFeature(name);
+ } else {
+ throw new SAXNotRecognizedException("Feature: " + name);
+ }
+ }
+
+
+ /**
+ * Set the value of a property.
+ *
+ * <p>This will always fail if the parent is null.</p>
+ *
+ * @param name The property name.
+ * @param value The requested property value.
+ * @exception org.xml.sax.SAXNotRecognizedException If the property
+ * value can't be assigned or retrieved from the parent.
+ * @exception org.xml.sax.SAXNotSupportedException When the
+ * parent recognizes the property name but
+ * cannot set the requested value.
+ */
+ public void setProperty (String name, Object value)
+ throws SAXNotRecognizedException, SAXNotSupportedException
+ {
+ if (parent != null) {
+ parent.setProperty(name, value);
+ } else {
+ throw new SAXNotRecognizedException("Property: " + name);
+ }
+ }
+
+
+ /**
+ * Look up the value of a property.
+ *
+ * @param name The property name.
+ * @return The current value of the property.
+ * @exception org.xml.sax.SAXNotRecognizedException If the property
+ * value can't be assigned or retrieved from the parent.
+ * @exception org.xml.sax.SAXNotSupportedException When the
+ * parent recognizes the property name but
+ * cannot determine its value at this time.
+ */
+ public Object getProperty (String name)
+ throws SAXNotRecognizedException, SAXNotSupportedException
+ {
+ if (parent != null) {
+ return parent.getProperty(name);
+ } else {
+ throw new SAXNotRecognizedException("Property: " + name);
+ }
+ }
+
+
+ /**
+ * Set the entity resolver.
+ *
+ * @param resolver The new entity resolver.
+ */
+ public void setEntityResolver (EntityResolver resolver)
+ {
+ entityResolver = resolver;
+ }
+
+
+ /**
+ * Get the current entity resolver.
+ *
+ * @return The current entity resolver, or null if none was set.
+ */
+ public EntityResolver getEntityResolver ()
+ {
+ return entityResolver;
+ }
+
+
+ /**
+ * Set the DTD event handler.
+ *
+ * @param handler the new DTD handler
+ */
+ public void setDTDHandler (DTDHandler handler)
+ {
+ dtdHandler = handler;
+ }
+
+
+ /**
+ * Get the current DTD event handler.
+ *
+ * @return The current DTD handler, or null if none was set.
+ */
+ public DTDHandler getDTDHandler ()
+ {
+ return dtdHandler;
+ }
+
+
+ /**
+ * Set the content event handler.
+ *
+ * @param handler the new content handler
+ */
+ public void setContentHandler (ContentHandler handler)
+ {
+ contentHandler = handler;
+ }
+
+
+ /**
+ * Get the content event handler.
+ *
+ * @return The current content handler, or null if none was set.
+ */
+ public ContentHandler getContentHandler ()
+ {
+ return contentHandler;
+ }
+
+
+ /**
+ * Set the error event handler.
+ *
+ * @param handler the new error handler
+ */
+ public void setErrorHandler (ErrorHandler handler)
+ {
+ errorHandler = handler;
+ }
+
+
+ /**
+ * Get the current error event handler.
+ *
+ * @return The current error handler, or null if none was set.
+ */
+ public ErrorHandler getErrorHandler ()
+ {
+ return errorHandler;
+ }
+
+
+ /**
+ * Parse a document.
+ *
+ * @param input The input source for the document entity.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @exception java.io.IOException An IO exception from the parser,
+ * possibly from a byte stream or character stream
+ * supplied by the application.
+ */
+ public void parse (InputSource input)
+ throws SAXException, IOException
+ {
+ setupParse();
+ parent.parse(input);
+ }
+
+
+ /**
+ * Parse a document.
+ *
+ * @param systemId The system identifier as a fully-qualified URI.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @exception java.io.IOException An IO exception from the parser,
+ * possibly from a byte stream or character stream
+ * supplied by the application.
+ */
+ public void parse (String systemId)
+ throws SAXException, IOException
+ {
+ parse(new InputSource(systemId));
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.EntityResolver.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Filter an external entity resolution.
+ *
+ * @param publicId The entity's public identifier, or null.
+ * @param systemId The entity's system identifier.
+ * @return A new InputSource or null for the default.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ * @exception java.io.IOException The client may throw an
+ * I/O-related exception while obtaining the
+ * new InputSource.
+ */
+ public InputSource resolveEntity (String publicId, String systemId)
+ throws SAXException, IOException
+ {
+ if (entityResolver != null) {
+ return entityResolver.resolveEntity(publicId, systemId);
+ } else {
+ return null;
+ }
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.DTDHandler.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Filter a notation declaration event.
+ *
+ * @param name The notation name.
+ * @param publicId The notation's public identifier, or null.
+ * @param systemId The notation's system identifier, or null.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void notationDecl (String name, String publicId, String systemId)
+ throws SAXException
+ {
+ if (dtdHandler != null) {
+ dtdHandler.notationDecl(name, publicId, systemId);
+ }
+ }
+
+
+ /**
+ * Filter an unparsed entity declaration event.
+ *
+ * @param name The entity name.
+ * @param publicId The entity's public identifier, or null.
+ * @param systemId The entity's system identifier, or null.
+ * @param notationName The name of the associated notation.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void unparsedEntityDecl (String name, String publicId,
+ String systemId, String notationName)
+ throws SAXException
+ {
+ if (dtdHandler != null) {
+ dtdHandler.unparsedEntityDecl(name, publicId, systemId,
+ notationName);
+ }
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.ContentHandler.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Filter a new document locator event.
+ *
+ * @param locator The document locator.
+ */
+ public void setDocumentLocator (Locator locator)
+ {
+ this.locator = locator;
+ if (contentHandler != null) {
+ contentHandler.setDocumentLocator(locator);
+ }
+ }
+
+
+ /**
+ * Filter a start document event.
+ *
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void startDocument ()
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.startDocument();
+ }
+ }
+
+
+ /**
+ * Filter an end document event.
+ *
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void endDocument ()
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.endDocument();
+ }
+ }
+
+
+ /**
+ * Filter a start Namespace prefix mapping event.
+ *
+ * @param prefix The Namespace prefix.
+ * @param uri The Namespace URI.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void startPrefixMapping (String prefix, String uri)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.startPrefixMapping(prefix, uri);
+ }
+ }
+
+
+ /**
+ * Filter an end Namespace prefix mapping event.
+ *
+ * @param prefix The Namespace prefix.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void endPrefixMapping (String prefix)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.endPrefixMapping(prefix);
+ }
+ }
+
+
+ /**
+ * Filter a start element event.
+ *
+ * @param uri The element's Namespace URI, or the empty string.
+ * @param localName The element's local name, or the empty string.
+ * @param qName The element's qualified (prefixed) name, or the empty
+ * string.
+ * @param atts The element's attributes.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void startElement (String uri, String localName, String qName,
+ Attributes atts)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.startElement(uri, localName, qName, atts);
+ }
+ }
+
+
+ /**
+ * Filter an end element event.
+ *
+ * @param uri The element's Namespace URI, or the empty string.
+ * @param localName The element's local name, or the empty string.
+ * @param qName The element's qualified (prefixed) name, or the empty
+ * string.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void endElement (String uri, String localName, String qName)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.endElement(uri, localName, qName);
+ }
+ }
+
+
+ /**
+ * Filter a character data event.
+ *
+ * @param ch An array of characters.
+ * @param start The starting position in the array.
+ * @param length The number of characters to use from the array.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void characters (char ch[], int start, int length)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.characters(ch, start, length);
+ }
+ }
+
+
+ /**
+ * Filter an ignorable whitespace event.
+ *
+ * @param ch An array of characters.
+ * @param start The starting position in the array.
+ * @param length The number of characters to use from the array.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void ignorableWhitespace (char ch[], int start, int length)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.ignorableWhitespace(ch, start, length);
+ }
+ }
+
+
+ /**
+ * Filter a processing instruction event.
+ *
+ * @param target The processing instruction target.
+ * @param data The text following the target.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void processingInstruction (String target, String data)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.processingInstruction(target, data);
+ }
+ }
+
+
+ /**
+ * Filter a skipped entity event.
+ *
+ * @param name The name of the skipped entity.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void skippedEntity (String name)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.skippedEntity(name);
+ }
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.ErrorHandler.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Filter a warning event.
+ *
+ * @param e The warning as an exception.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void warning (SAXParseException e)
+ throws SAXException
+ {
+ if (errorHandler != null) {
+ errorHandler.warning(e);
+ }
+ }
+
+
+ /**
+ * Filter an error event.
+ *
+ * @param e The error as an exception.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void error (SAXParseException e)
+ throws SAXException
+ {
+ if (errorHandler != null) {
+ errorHandler.error(e);
+ }
+ }
+
+
+ /**
+ * Filter a fatal error event.
+ *
+ * @param e The error as an exception.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void fatalError (SAXParseException e)
+ throws SAXException
+ {
+ if (errorHandler != null) {
+ errorHandler.fatalError(e);
+ }
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal methods.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Set up before a parse.
+ *
+ * <p>Before every parse, check whether the parent is
+ * non-null, and re-register the filter for all of the
+ * events.</p>
+ */
+ private void setupParse ()
+ {
+ if (parent == null) {
+ throw new NullPointerException("No parent for filter");
+ }
+ parent.setEntityResolver(this);
+ parent.setDTDHandler(this);
+ parent.setContentHandler(this);
+ parent.setErrorHandler(this);
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////////
+
+ private XMLReader parent = null;
+ private Locator locator = null;
+ private EntityResolver entityResolver = null;
+ private DTDHandler dtdHandler = null;
+ private ContentHandler contentHandler = null;
+ private ErrorHandler errorHandler = null;
+
+}
+
+// end of XMLFilterImpl.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/XMLReaderAdapter.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/XMLReaderAdapter.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/XMLReaderAdapter.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/XMLReaderAdapter.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,538 @@
+// XMLReaderAdapter.java - adapt an SAX2 XMLReader to a SAX1 Parser
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the public domain.
+// $Id: XMLReaderAdapter.java,v 1.1 2004/12/23 22:38:42 mark Exp $
+
+package org.xml.sax.helpers;
+
+import java.io.IOException;
+import java.util.Locale;
+
+import org.xml.sax.Parser; // deprecated
+import org.xml.sax.Locator;
+import org.xml.sax.InputSource;
+import org.xml.sax.AttributeList; // deprecated
+import org.xml.sax.EntityResolver;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.DocumentHandler; // deprecated
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+
+import org.xml.sax.XMLReader;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXNotSupportedException;
+
+
+/**
+ * Adapt a SAX2 XMLReader as a SAX1 Parser.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class wraps a SAX2 {@link org.xml.sax.XMLReader XMLReader}
+ * and makes it act as a SAX1 {@link org.xml.sax.Parser Parser}. The XMLReader
+ * must support a true value for the
+ * http://xml.org/sax/features/namespace-prefixes property or parsing will fail
+ * with a {@link org.xml.sax.SAXException SAXException}; if the XMLReader
+ * supports a false value for the http://xml.org/sax/features/namespaces
+ * property, that will also be used to improve efficiency.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.Parser
+ * @see org.xml.sax.XMLReader
+ */
+public class XMLReaderAdapter implements Parser, ContentHandler
+{
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Constructor.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Create a new adapter.
+ *
+ * <p>Use the "org.xml.sax.driver" property to locate the SAX2
+ * driver to embed.</p>
+ *
+ * @exception org.xml.sax.SAXException If the embedded driver
+ * cannot be instantiated or if the
+ * org.xml.sax.driver property is not specified.
+ */
+ public XMLReaderAdapter ()
+ throws SAXException
+ {
+ setup(XMLReaderFactory.createXMLReader());
+ }
+
+
+ /**
+ * Create a new adapter.
+ *
+ * <p>Create a new adapter, wrapped around a SAX2 XMLReader.
+ * The adapter will make the XMLReader act like a SAX1
+ * Parser.</p>
+ *
+ * @param xmlReader The SAX2 XMLReader to wrap.
+ * @exception java.lang.NullPointerException If the argument is null.
+ */
+ public XMLReaderAdapter (XMLReader xmlReader)
+ {
+ setup(xmlReader);
+ }
+
+
+
+ /**
+ * Internal setup.
+ *
+ * @param xmlReader The embedded XMLReader.
+ */
+ private void setup (XMLReader xmlReader)
+ {
+ if (xmlReader == null) {
+ throw new NullPointerException("XMLReader must not be null");
+ }
+ this.xmlReader = xmlReader;
+ qAtts = new AttributesAdapter();
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.Parser.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Set the locale for error reporting.
+ *
+ * <p>This is not supported in SAX2, and will always throw
+ * an exception.</p>
+ *
+ * @param locale the locale for error reporting.
+ * @see org.xml.sax.Parser#setLocale
+ * @exception org.xml.sax.SAXException Thrown unless overridden.
+ */
+ public void setLocale (Locale locale)
+ throws SAXException
+ {
+ throw new SAXNotSupportedException("setLocale not supported");
+ }
+
+
+ /**
+ * Register the entity resolver.
+ *
+ * @param resolver The new resolver.
+ * @see org.xml.sax.Parser#setEntityResolver
+ */
+ public void setEntityResolver (EntityResolver resolver)
+ {
+ xmlReader.setEntityResolver(resolver);
+ }
+
+
+ /**
+ * Register the DTD event handler.
+ *
+ * @param handler The new DTD event handler.
+ * @see org.xml.sax.Parser#setDTDHandler
+ */
+ public void setDTDHandler (DTDHandler handler)
+ {
+ xmlReader.setDTDHandler(handler);
+ }
+
+
+ /**
+ * Register the SAX1 document event handler.
+ *
+ * <p>Note that the SAX1 document handler has no Namespace
+ * support.</p>
+ *
+ * @param handler The new SAX1 document event handler.
+ * @see org.xml.sax.Parser#setDocumentHandler
+ */
+ public void setDocumentHandler (DocumentHandler handler)
+ {
+ documentHandler = handler;
+ }
+
+
+ /**
+ * Register the error event handler.
+ *
+ * @param handler The new error event handler.
+ * @see org.xml.sax.Parser#setErrorHandler
+ */
+ public void setErrorHandler (ErrorHandler handler)
+ {
+ xmlReader.setErrorHandler(handler);
+ }
+
+
+ /**
+ * Parse the document.
+ *
+ * <p>This method will throw an exception if the embedded
+ * XMLReader does not support the
+ * http://xml.org/sax/features/namespace-prefixes property.</p>
+ *
+ * @param systemId The absolute URL of the document.
+ * @exception java.io.IOException If there is a problem reading
+ * the raw content of the document.
+ * @exception org.xml.sax.SAXException If there is a problem
+ * processing the document.
+ * @see #parse(org.xml.sax.InputSource)
+ * @see org.xml.sax.Parser#parse(java.lang.String)
+ */
+ public void parse (String systemId)
+ throws IOException, SAXException
+ {
+ parse(new InputSource(systemId));
+ }
+
+
+ /**
+ * Parse the document.
+ *
+ * <p>This method will throw an exception if the embedded
+ * XMLReader does not support the
+ * http://xml.org/sax/features/namespace-prefixes property.</p>
+ *
+ * @param input An input source for the document.
+ * @exception java.io.IOException If there is a problem reading
+ * the raw content of the document.
+ * @exception org.xml.sax.SAXException If there is a problem
+ * processing the document.
+ * @see #parse(java.lang.String)
+ * @see org.xml.sax.Parser#parse(org.xml.sax.InputSource)
+ */
+ public void parse (InputSource input)
+ throws IOException, SAXException
+ {
+ setupXMLReader();
+ xmlReader.parse(input);
+ }
+
+
+ /**
+ * Set up the XML reader.
+ */
+ private void setupXMLReader ()
+ throws SAXException
+ {
+ xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
+ try {
+ xmlReader.setFeature("http://xml.org/sax/features/namespaces",
+ false);
+ } catch (SAXException e) {
+ // NO OP: it's just extra information, and we can ignore it
+ }
+ xmlReader.setContentHandler(this);
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.ContentHandler.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Set a document locator.
+ *
+ * @param locator The document locator.
+ * @see org.xml.sax.ContentHandler#setDocumentLocator
+ */
+ public void setDocumentLocator (Locator locator)
+ {
+ if (documentHandler != null)
+ documentHandler.setDocumentLocator(locator);
+ }
+
+
+ /**
+ * Start document event.
+ *
+ * @exception org.xml.sax.SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.ContentHandler#startDocument
+ */
+ public void startDocument ()
+ throws SAXException
+ {
+ if (documentHandler != null)
+ documentHandler.startDocument();
+ }
+
+
+ /**
+ * End document event.
+ *
+ * @exception org.xml.sax.SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.ContentHandler#endDocument
+ */
+ public void endDocument ()
+ throws SAXException
+ {
+ if (documentHandler != null)
+ documentHandler.endDocument();
+ }
+
+
+ /**
+ * Adapt a SAX2 start prefix mapping event.
+ *
+ * @param prefix The prefix being mapped.
+ * @param uri The Namespace URI being mapped to.
+ * @see org.xml.sax.ContentHandler#startPrefixMapping
+ */
+ public void startPrefixMapping (String prefix, String uri)
+ {
+ }
+
+
+ /**
+ * Adapt a SAX2 end prefix mapping event.
+ *
+ * @param prefix The prefix being mapped.
+ * @see org.xml.sax.ContentHandler#endPrefixMapping
+ */
+ public void endPrefixMapping (String prefix)
+ {
+ }
+
+
+ /**
+ * Adapt a SAX2 start element event.
+ *
+ * @param uri The Namespace URI.
+ * @param localName The Namespace local name.
+ * @param qName The qualified (prefixed) name.
+ * @param atts The SAX2 attributes.
+ * @exception org.xml.sax.SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.ContentHandler#endDocument
+ */
+ public void startElement (String uri, String localName,
+ String qName, Attributes atts)
+ throws SAXException
+ {
+ if (documentHandler != null) {
+ qAtts.setAttributes(atts);
+ documentHandler.startElement(qName, qAtts);
+ }
+ }
+
+
+ /**
+ * Adapt a SAX2 end element event.
+ *
+ * @param uri The Namespace URI.
+ * @param localName The Namespace local name.
+ * @param qName The qualified (prefixed) name.
+ * @exception org.xml.sax.SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.ContentHandler#endElement
+ */
+ public void endElement (String uri, String localName,
+ String qName)
+ throws SAXException
+ {
+ if (documentHandler != null)
+ documentHandler.endElement(qName);
+ }
+
+
+ /**
+ * Adapt a SAX2 characters event.
+ *
+ * @param ch An array of characters.
+ * @param start The starting position in the array.
+ * @param length The number of characters to use.
+ * @exception org.xml.sax.SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.ContentHandler#characters
+ */
+ public void characters (char ch[], int start, int length)
+ throws SAXException
+ {
+ if (documentHandler != null)
+ documentHandler.characters(ch, start, length);
+ }
+
+
+ /**
+ * Adapt a SAX2 ignorable whitespace event.
+ *
+ * @param ch An array of characters.
+ * @param start The starting position in the array.
+ * @param length The number of characters to use.
+ * @exception org.xml.sax.SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.ContentHandler#ignorableWhitespace
+ */
+ public void ignorableWhitespace (char ch[], int start, int length)
+ throws SAXException
+ {
+ if (documentHandler != null)
+ documentHandler.ignorableWhitespace(ch, start, length);
+ }
+
+
+ /**
+ * Adapt a SAX2 processing instruction event.
+ *
+ * @param target The processing instruction target.
+ * @param data The remainder of the processing instruction
+ * @exception org.xml.sax.SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.ContentHandler#processingInstruction
+ */
+ public void processingInstruction (String target, String data)
+ throws SAXException
+ {
+ if (documentHandler != null)
+ documentHandler.processingInstruction(target, data);
+ }
+
+
+ /**
+ * Adapt a SAX2 skipped entity event.
+ *
+ * @param name The name of the skipped entity.
+ * @see org.xml.sax.ContentHandler#skippedEntity
+ * @exception org.xml.sax.SAXException Throwable by subclasses.
+ */
+ public void skippedEntity (String name)
+ throws SAXException
+ {
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////////
+
+ XMLReader xmlReader;
+ DocumentHandler documentHandler;
+ AttributesAdapter qAtts;
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal class.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Internal class to wrap a SAX2 Attributes object for SAX1.
+ */
+ final class AttributesAdapter implements AttributeList
+ {
+ AttributesAdapter ()
+ {
+ }
+
+
+ /**
+ * Set the embedded Attributes object.
+ *
+ * @param The embedded SAX2 Attributes.
+ */
+ void setAttributes (Attributes attributes)
+ {
+ this.attributes = attributes;
+ }
+
+
+ /**
+ * Return the number of attributes.
+ *
+ * @return The length of the attribute list.
+ * @see org.xml.sax.AttributeList#getLength
+ */
+ public int getLength ()
+ {
+ return attributes.getLength();
+ }
+
+
+ /**
+ * Return the qualified (prefixed) name of an attribute by position.
+ *
+ * @return The qualified name.
+ * @see org.xml.sax.AttributeList#getName
+ */
+ public String getName (int i)
+ {
+ return attributes.getQName(i);
+ }
+
+
+ /**
+ * Return the type of an attribute by position.
+ *
+ * @return The type.
+ * @see org.xml.sax.AttributeList#getType(int)
+ */
+ public String getType (int i)
+ {
+ return attributes.getType(i);
+ }
+
+
+ /**
+ * Return the value of an attribute by position.
+ *
+ * @return The value.
+ * @see org.xml.sax.AttributeList#getValue(int)
+ */
+ public String getValue (int i)
+ {
+ return attributes.getValue(i);
+ }
+
+
+ /**
+ * Return the type of an attribute by qualified (prefixed) name.
+ *
+ * @return The type.
+ * @see org.xml.sax.AttributeList#getType(java.lang.String)
+ */
+ public String getType (String qName)
+ {
+ return attributes.getType(qName);
+ }
+
+
+ /**
+ * Return the value of an attribute by qualified (prefixed) name.
+ *
+ * @return The value.
+ * @see org.xml.sax.AttributeList#getValue(java.lang.String)
+ */
+ public String getValue (String qName)
+ {
+ return attributes.getValue(qName);
+ }
+
+ private Attributes attributes;
+ }
+
+}
+
+// end of XMLReaderAdapter.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/XMLReaderFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/XMLReaderFactory.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/XMLReaderFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/XMLReaderFactory.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,202 @@
+// XMLReaderFactory.java - factory for creating a new reader.
+// http://www.saxproject.org
+// Written by David Megginson
+// and by David Brownell
+// NO WARRANTY! This class is in the Public Domain.
+// $Id: XMLReaderFactory.java,v 1.14 2004/12/11 15:41:10 dog Exp $
+
+package org.xml.sax.helpers;
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import org.xml.sax.XMLReader;
+import org.xml.sax.SAXException;
+
+
+/**
+ * Factory for creating an XML reader.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class contains static methods for creating an XML reader
+ * from an explicit class name, or based on runtime defaults:</p>
+ *
+ * <pre>
+ * try {
+ * XMLReader myReader = XMLReaderFactory.createXMLReader();
+ * } catch (SAXException e) {
+ * System.err.println(e.getMessage());
+ * }
+ * </pre>
+ *
+ * <p><strong>Note to Distributions bundled with parsers:</strong>
+ * You should modify the implementation of the no-arguments
+ * <em>createXMLReader</em> to handle cases where the external
+ * configuration mechanisms aren't set up. That method should do its
+ * best to return a parser when one is in the class path, even when
+ * nothing bound its class name to <code>org.xml.sax.driver</code> so
+ * those configuration mechanisms would see it.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson, David Brownell
+ * @version 2.0.1 (sax2r2)
+ */
+final public class XMLReaderFactory
+{
+ /**
+ * Private constructor.
+ *
+ * <p>This constructor prevents the class from being instantiated.</p>
+ */
+ private XMLReaderFactory ()
+ {
+ }
+
+ private static final String property = "org.xml.sax.driver";
+
+ /**
+ * Attempt to create an XMLReader from system defaults.
+ * In environments which can support it, the name of the XMLReader
+ * class is determined by trying each these options in order, and
+ * using the first one which succeeds:</p> <ul>
+ *
+ * <li>If the system property <code>org.xml.sax.driver</code>
+ * has a value, that is used as an XMLReader class name. </li>
+ *
+ * <li>The JAR "Services API" is used to look for a class name
+ * in the <em>META-INF/services/org.xml.sax.driver</em> file in
+ * jarfiles available to the runtime.</li>
+ *
+ * <li> SAX parser distributions are strongly encouraged to provide
+ * a default XMLReader class name that will take effect only when
+ * previous options (on this list) are not successful.</li>
+ *
+ * <li>Finally, if {@link ParserFactory#makeParser()} can
+ * return a system default SAX1 parser, that parser is wrapped in
+ * a {@link ParserAdapter}. (This is a migration aid for SAX1
+ * environments, where the <code>org.xml.sax.parser</code> system
+ * property will often be usable.) </li>
+ *
+ * </ul>
+ *
+ * <p> In environments such as small embedded systems, which can not
+ * support that flexibility, other mechanisms to determine the default
+ * may be used. </p>
+ *
+ * <p>Note that many Java environments allow system properties to be
+ * initialized on a command line. This means that <em>in most cases</em>
+ * setting a good value for that property ensures that calls to this
+ * method will succeed, except when security policies intervene.
+ * This will also maximize application portability to older SAX
+ * environments, with less robust implementations of this method.
+ * </p>
+ *
+ * @return A new XMLReader.
+ * @exception org.xml.sax.SAXException If no default XMLReader class
+ * can be identified and instantiated.
+ * @see #createXMLReader(java.lang.String)
+ */
+ public static XMLReader createXMLReader ()
+ throws SAXException
+ {
+ String className = null;
+ ClassLoader loader = NewInstance.getClassLoader ();
+
+ // 1. try the JVM-instance-wide system property
+ try { className = System.getProperty (property); }
+ catch (RuntimeException e) { /* normally fails for applets */ }
+
+ // 2. if that fails, try META-INF/services/
+ if (className == null) {
+ try {
+ String service = "META-INF/services/" + property;
+ InputStream in;
+ BufferedReader reader;
+
+ if (loader == null)
+ in = ClassLoader.getSystemResourceAsStream (service);
+ else
+ in = loader.getResourceAsStream (service);
+
+ if (in != null) {
+ reader = new BufferedReader (
+ new InputStreamReader (in, "UTF8"));
+ className = reader.readLine ();
+ in.close ();
+ }
+ } catch (Exception e) {
+ }
+ }
+
+ // 3. Distro-specific fallback
+ if (className == null) {
+// BEGIN DISTRIBUTION-SPECIFIC
+
+ // EXAMPLE:
+ // className = "com.example.sax.XmlReader";
+ // or a $JAVA_HOME/jre/lib/*properties setting...
+
+// END DISTRIBUTION-SPECIFIC
+ }
+
+ // do we know the XMLReader implementation class yet?
+ if (className != null)
+ return loadClass (loader, className);
+
+ // 4. panic -- adapt any SAX1 parser
+ try {
+ return new ParserAdapter (ParserFactory.makeParser ());
+ } catch (Exception e) {
+ throw new SAXException ("Can't create default XMLReader; "
+ + "is system property org.xml.sax.driver set?");
+ }
+ }
+
+
+ /**
+ * Attempt to create an XML reader from a class name.
+ *
+ * <p>Given a class name, this method attempts to load
+ * and instantiate the class as an XML reader.</p>
+ *
+ * <p>Note that this method will not be usable in environments where
+ * the caller (perhaps an applet) is not permitted to load classes
+ * dynamically.</p>
+ *
+ * @return A new XML reader.
+ * @exception org.xml.sax.SAXException If the class cannot be
+ * loaded, instantiated, and cast to XMLReader.
+ * @see #createXMLReader()
+ */
+ public static XMLReader createXMLReader (String className)
+ throws SAXException
+ {
+ return loadClass (NewInstance.getClassLoader (), className);
+ }
+
+ private static XMLReader loadClass (ClassLoader loader, String className)
+ throws SAXException
+ {
+ try {
+ return (XMLReader) NewInstance.newInstance (loader, className);
+ } catch (ClassNotFoundException e1) {
+ throw new SAXException("SAX2 driver class " + className +
+ " not found", e1);
+ } catch (IllegalAccessException e2) {
+ throw new SAXException("SAX2 driver class " + className +
+ " found but cannot be loaded", e2);
+ } catch (InstantiationException e3) {
+ throw new SAXException("SAX2 driver class " + className +
+ " loaded but cannot be instantiated (no empty public constructor?)",
+ e3);
+ } catch (ClassCastException e4) {
+ throw new SAXException("SAX2 driver class " + className +
+ " does not implement XMLReader", e4);
+ }
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/package.html
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/package.html?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/package.html (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/helpers/package.html Thu Nov 8 16:56:19 2007
@@ -0,0 +1,11 @@
+<HTML><HEAD>
+<!-- $Id: package.html,v 1.12 2004/12/11 15:41:10 dog Exp $ -->
+</HEAD><BODY>
+
+<p>This package contains "helper" classes, including
+support for bootstrapping SAX-based applications.
+
+<p>See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+for more information about SAX.</p>
+
+</BODY></HTML>
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/package.html
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/package.html?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/package.html (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/sax/org/xml/sax/package.html Thu Nov 8 16:56:19 2007
@@ -0,0 +1,297 @@
+<html><head>
+<!-- $Id: package.html,v 1.14 2004/12/11 15:41:10 dog Exp $ -->
+</head><body>
+
+<p> This package provides the core SAX APIs.
+Some SAX1 APIs are deprecated to encourage integration of
+namespace-awareness into designs of new applications
+and into maintenance of existing infrastructure. </p>
+
+<p>See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+for more information about SAX.</p>
+
+
+<h2> SAX2 Standard Feature Flags </h2>
+
+<p> One of the essential characteristics of SAX2 is that it added
+feature flags which can be used to examine and perhaps modify
+parser modes, in particular modes such as validation.
+Since features are identified by (absolute) URIs, anyone
+can define such features.
+Currently defined standard feature URIs have the prefix
+<code>http://xml.org/sax/features/</code> before an identifier such as
+<code>validation</code>. Turn features on or off using
+<em>setFeature</em>. Those standard identifiers are: </p>
+
+
+<table border="1" cellpadding="3" cellspacing="0" width="100%">
+ <tr align="center" bgcolor="#ccccff">
+ <th>Feature ID</th>
+ <th>Access</th>
+ <th>Default</th>
+ <th>Description</th>
+ </tr>
+
+ <tr>
+ <td>external-general-entities</td>
+ <td><em>read/write</em></td>
+ <td><em>unspecified</em></td>
+ <td> Reports whether this parser processes external
+ general entities; always true if validating.
+ </td>
+ </tr>
+
+ <tr>
+ <td>external-parameter-entities</td>
+ <td><em>read/write</em></td>
+ <td><em>unspecified</em></td>
+ <td> Reports whether this parser processes external
+ parameter entities; always true if validating.
+ </td>
+ </tr>
+
+ <tr>
+ <td>is-standalone</td>
+ <td>(parsing) <em>read-only</em>, (not parsing) <em>none</em></td>
+ <td>not applicable</td>
+ <td> May be examined only during a parse, after the
+ <em>startDocument()</em> callback has been completed; read-only.
+ The value is true if the document specified standalone="yes" in
+ its XML declaration, and otherwise is false.
+ </td>
+ </tr>
+
+ <tr>
+ <td>lexical-handler/parameter-entities</td>
+ <td><em>read/write</em></td>
+ <td><em>unspecified</em></td>
+ <td> A value of "true" indicates that the LexicalHandler will report
+ the beginning and end of parameter entities.
+ </td>
+ </tr>
+
+ <tr>
+ <td>namespaces</td>
+ <td><em>read/write</em></td>
+ <td>true</td>
+ <td> A value of "true" indicates namespace URIs and unprefixed local names
+ for element and attribute names will be available.
+ </td>
+ </tr>
+
+ <tr>
+ <td>namespace-prefixes</td>
+ <td><em>read/write</em></td>
+ <td>false</td>
+ <td> A value of "true" indicates that XML qualified names (with prefixes) and
+ attributes (including <em>xmlns*</em> attributes) will be available.
+ </td>
+ </tr>
+
+ <tr>
+ <td>resolve-dtd-uris</td>
+ <td><em>read/write</em></td>
+ <td><em>true</em></td>
+ <td> A value of "true" indicates that system IDs in declarations will
+ be absolutized (relative to their base URIs) before reporting.
+ (That is the default behavior for all SAX2 XML parsers.)
+ A value of "false" indicates those IDs will not be absolutized;
+ parsers will provide the base URI from
+ <em>Locator.getSystemId()</em>.
+ This applies to system IDs passed in <ul>
+ <li><em>DTDHandler.notationDecl()</em>,
+ <li><em>DTDHandler.unparsedEntityDecl()</em>, and
+ <li><em>DeclHandler.externalEntityDecl()</em>.
+ </ul>
+ It does not apply to <em>EntityResolver.resolveEntity()</em>,
+ which is not used to report declarations, or to
+ <em>LexicalHandler.startDTD()</em>, which already provides
+ the non-absolutized URI.
+ </td>
+ </tr>
+
+ <tr>
+ <td>string-interning</td>
+ <td><em>read/write</em></td>
+ <td><em>unspecified</em></td>
+ <td> Has a value of "true" if all XML names (for elements, prefixes,
+ attributes, entities, notations, and local names),
+ as well as Namespace URIs, will have been interned
+ using <em>java.lang.String.intern</em>. This supports fast
+ testing of equality/inequality against string constants,
+ rather than forcing slower calls to <em>String.equals()</em>.
+ </td>
+ </tr>
+
+ <tr>
+ <td>unicode-normalization-checking</td>
+ <td><em>read/write</em></td>
+ <td><em>false</em></td>
+ <td> Controls whether the parser reports Unicode normalization
+ errors as described in section 2.13 and Appendix B of the
+ XML 1.1 Recommendation. If true, Unicode normalization
+ errors are reported using the ErrorHandler.error() callback.
+ Such errors are not fatal in themselves (though, obviously,
+ other Unicode-related encoding errors may be).
+ </td>
+ </tr>
+
+ <tr>
+ <td>use-attributes2</td>
+ <td><em>read-only</em></td>
+ <td>not applicable</td>
+ <td> Returns "true" if the <em>Attributes</em> objects passed by
+ this parser in <em>ContentHandler.startElement()</em>
+ implement the <a href="ext/Attributes2.html"
+ ><em>org.xml.sax.ext.Attributes2</em></a> interface.
+ That interface exposes additional DTD-related information,
+ such as whether the attribute was specified in the
+ source text rather than defaulted.
+ </td>
+ </tr>
+
+ <tr>
+ <td>use-locator2</td>
+ <td><em>read-only</em></td>
+ <td>not applicable</td>
+ <td> Returns "true" if the <em>Locator</em> objects passed by
+ this parser in <em>ContentHandler.setDocumentLocator()</em>
+ implement the <a href="ext/Locator2.html"
+ ><em>org.xml.sax.ext.Locator2</em></a> interface.
+ That interface exposes additional entity information,
+ such as the character encoding and XML version used.
+ </td>
+ </tr>
+
+ <tr>
+ <td>use-entity-resolver2</td>
+ <td><em>read/write</em></td>
+ <td><em>true</em></td>
+ <td> Returns "true" if, when <em>setEntityResolver</em> is given
+ an object implementing the <a href="ext/EntityResolver2.html"
+ ><em>org.xml.sax.ext.EntityResolver2</em></a> interface,
+ those new methods will be used.
+ Returns "false" to indicate that those methods will not be used.
+ </td>
+ </tr>
+
+ <tr>
+ <td>validation</td>
+ <td><em>read/write</em></td>
+ <td><em>unspecified</em></td>
+ <td> Controls whether the parser is reporting all validity
+ errors; if true, all external entities will be read.
+ </td>
+ </tr>
+
+ <tr>
+ <td>xmlns-uris</td>
+ <td><em>read/write</em></td>
+ <td><em>false</em></td>
+ <td> Controls whether, when the <em>namespace-prefixes</em> feature
+ is set, the parser treats namespace declaration attributes as
+ being in the <em>http://www.w3.org/2000/xmlns/</em> namespace.
+ By default, SAX2 conforms to the original "Namespaces in XML"
+ Recommendation, which explicitly states that such attributes are
+ not in any namespace.
+ Setting this optional flag to "true" makes the SAX2 events conform to
+ a later backwards-incompatible revision of that recommendation,
+ placing those attributes in a namespace.
+ </td>
+ </tr>
+
+ <tr>
+ <td>xml-1.1</td>
+ <td><em>read-only</em></td>
+ <td>not applicable</td>
+ <td> Returns "true" if the parser supports both XML 1.1 and XML 1.0.
+ Returns "false" if the parser supports only XML 1.0.
+ </td>
+ </tr>
+
+</table>
+
+<p> Support for the default values of the
+<em>namespaces</em> and <em>namespace-prefixes</em>
+properties is required.
+Support for any other feature flags is entirely optional.
+</p>
+
+<p> For default values not specified by SAX2,
+each XMLReader implementation specifies its default,
+or may choose not to expose the feature flag.
+Unless otherwise specified here,
+implementations may support changing current values
+of these standard feature flags, but not while parsing.
+</p>
+
+<h2> SAX2 Standard Handler and Property IDs </h2>
+
+<p> For parser interface characteristics that are described
+as objects, a separate namespace is defined. The
+objects in this namespace are again identified by URI, and
+the standard property URIs have the prefix
+<code>http://xml.org/sax/properties/</code> before an identifier such as
+<code>lexical-handler</code> or
+<code>dom-node</code>. Manage those properties using
+<em>setProperty()</em>. Those identifiers are: </p>
+
+<table border="1" cellpadding="3" cellspacing="0" width="100%">
+ <tr align="center" bgcolor="#ccccff">
+ <th>Property ID</th>
+ <th>Description</th>
+ </tr>
+
+ <tr>
+ <td>declaration-handler</td>
+ <td> Used to see most DTD declarations except those treated
+ as lexical ("document element name is ...") or which are
+ mandatory for all SAX parsers (<em>DTDHandler</em>).
+ The Object must implement <a href="ext/DeclHandler.html"
+ ><em>org.xml.sax.ext.DeclHandler</em></a>.
+ </td>
+ </tr>
+
+ <tr>
+ <td>document-xml-version</td>
+ <td> May be examined only during a parse, after the startDocument()
+ callback has been completed; read-only. This property is a
+ literal string describing the actual XML version of the document,
+ such as "1.0" or "1.1".
+ </td>
+ </tr>
+
+ <tr>
+ <td>dom-node</td>
+ <td> For "DOM Walker" style parsers, which ignore their
+ <em>parser.parse()</em> parameters, this is used to
+ specify the DOM (sub)tree being walked by the parser.
+ The Object must implement the
+ <em>org.w3c.dom.Node</em> interface.
+ </td>
+ </tr>
+
+ <tr>
+ <td>lexical-handler</td>
+ <td> Used to see some syntax events that are essential in some
+ applications: comments, CDATA delimiters, selected general
+ entity inclusions, and the start and end of the DTD
+ (and declaration of document element name).
+ The Object must implement <a href="ext/LexicalHandler.html"
+ ><em>org.xml.sax.ext.LexicalHandler</em></a>.
+ </td>
+ </tr>
+
+ <tr>
+ <td>xml-string</td>
+ <td> Readable only during a parser callback, this exposes a <b>TBS</b>
+ chunk of characters responsible for the current event. </td>
+ </tr>
+
+</table>
+
+<p> All of these standard properties are optional;
+XMLReader implementations need not support them.
+</p>
+
+</body></html>
\ No newline at end of file
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/Makefile.am?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/Makefile.am Thu Nov 8 16:56:19 2007
@@ -0,0 +1,149 @@
+## Input file for automake to generate the Makefile.in used by configure
+
+EXTRA_DIST = README \
+org/w3c/dom/Attr.java \
+org/w3c/dom/CDATASection.java \
+org/w3c/dom/CharacterData.java \
+org/w3c/dom/Comment.java \
+org/w3c/dom/DOMConfiguration.java \
+org/w3c/dom/DOMError.java \
+org/w3c/dom/DOMErrorHandler.java \
+org/w3c/dom/DOMException.java \
+org/w3c/dom/DOMImplementation.java \
+org/w3c/dom/DOMImplementationList.java \
+org/w3c/dom/DOMImplementationSource.java \
+org/w3c/dom/DOMLocator.java \
+org/w3c/dom/DOMStringList.java \
+org/w3c/dom/Document.java \
+org/w3c/dom/DocumentFragment.java \
+org/w3c/dom/DocumentType.java \
+org/w3c/dom/Element.java \
+org/w3c/dom/Entity.java \
+org/w3c/dom/EntityReference.java \
+org/w3c/dom/NameList.java \
+org/w3c/dom/NamedNodeMap.java \
+org/w3c/dom/Node.java \
+org/w3c/dom/NodeList.java \
+org/w3c/dom/Notation.java \
+org/w3c/dom/ProcessingInstruction.java \
+org/w3c/dom/Text.java \
+org/w3c/dom/TypeInfo.java \
+org/w3c/dom/UserDataHandler.java \
+org/w3c/dom/bootstrap/DOMImplementationRegistry.java \
+org/w3c/dom/css/CSS2Properties.java \
+org/w3c/dom/css/CSSCharsetRule.java \
+org/w3c/dom/css/CSSFontFaceRule.java \
+org/w3c/dom/css/CSSImportRule.java \
+org/w3c/dom/css/CSSMediaRule.java \
+org/w3c/dom/css/CSSPageRule.java \
+org/w3c/dom/css/CSSPrimitiveValue.java \
+org/w3c/dom/css/CSSRule.java \
+org/w3c/dom/css/CSSRuleList.java \
+org/w3c/dom/css/CSSStyleDeclaration.java \
+org/w3c/dom/css/CSSStyleRule.java \
+org/w3c/dom/css/CSSStyleSheet.java \
+org/w3c/dom/css/CSSUnknownRule.java \
+org/w3c/dom/css/CSSValue.java \
+org/w3c/dom/css/CSSValueList.java \
+org/w3c/dom/css/Counter.java \
+org/w3c/dom/css/DOMImplementationCSS.java \
+org/w3c/dom/css/DocumentCSS.java \
+org/w3c/dom/css/ElementCSSInlineStyle.java \
+org/w3c/dom/css/RGBColor.java \
+org/w3c/dom/css/Rect.java \
+org/w3c/dom/css/ViewCSS.java \
+org/w3c/dom/events/DocumentEvent.java \
+org/w3c/dom/events/Event.java \
+org/w3c/dom/events/EventException.java \
+org/w3c/dom/events/EventListener.java \
+org/w3c/dom/events/EventTarget.java \
+org/w3c/dom/events/MouseEvent.java \
+org/w3c/dom/events/MutationEvent.java \
+org/w3c/dom/events/UIEvent.java \
+org/w3c/dom/html2/HTMLAnchorElement.java \
+org/w3c/dom/html2/HTMLAppletElement.java \
+org/w3c/dom/html2/HTMLAreaElement.java \
+org/w3c/dom/html2/HTMLBRElement.java \
+org/w3c/dom/html2/HTMLBaseElement.java \
+org/w3c/dom/html2/HTMLBaseFontElement.java \
+org/w3c/dom/html2/HTMLBodyElement.java \
+org/w3c/dom/html2/HTMLButtonElement.java \
+org/w3c/dom/html2/HTMLCollection.java \
+org/w3c/dom/html2/HTMLDListElement.java \
+org/w3c/dom/html2/HTMLDirectoryElement.java \
+org/w3c/dom/html2/HTMLDivElement.java \
+org/w3c/dom/html2/HTMLDocument.java \
+org/w3c/dom/html2/HTMLElement.java \
+org/w3c/dom/html2/HTMLFieldSetElement.java \
+org/w3c/dom/html2/HTMLFontElement.java \
+org/w3c/dom/html2/HTMLFormElement.java \
+org/w3c/dom/html2/HTMLFrameElement.java \
+org/w3c/dom/html2/HTMLFrameSetElement.java \
+org/w3c/dom/html2/HTMLHRElement.java \
+org/w3c/dom/html2/HTMLHeadElement.java \
+org/w3c/dom/html2/HTMLHeadingElement.java \
+org/w3c/dom/html2/HTMLHtmlElement.java \
+org/w3c/dom/html2/HTMLIFrameElement.java \
+org/w3c/dom/html2/HTMLImageElement.java \
+org/w3c/dom/html2/HTMLInputElement.java \
+org/w3c/dom/html2/HTMLIsIndexElement.java \
+org/w3c/dom/html2/HTMLLIElement.java \
+org/w3c/dom/html2/HTMLLabelElement.java \
+org/w3c/dom/html2/HTMLLegendElement.java \
+org/w3c/dom/html2/HTMLLinkElement.java \
+org/w3c/dom/html2/HTMLMapElement.java \
+org/w3c/dom/html2/HTMLMenuElement.java \
+org/w3c/dom/html2/HTMLMetaElement.java \
+org/w3c/dom/html2/HTMLModElement.java \
+org/w3c/dom/html2/HTMLOListElement.java \
+org/w3c/dom/html2/HTMLObjectElement.java \
+org/w3c/dom/html2/HTMLOptGroupElement.java \
+org/w3c/dom/html2/HTMLOptionElement.java \
+org/w3c/dom/html2/HTMLOptionsCollection.java \
+org/w3c/dom/html2/HTMLParagraphElement.java \
+org/w3c/dom/html2/HTMLParamElement.java \
+org/w3c/dom/html2/HTMLPreElement.java \
+org/w3c/dom/html2/HTMLQuoteElement.java \
+org/w3c/dom/html2/HTMLScriptElement.java \
+org/w3c/dom/html2/HTMLSelectElement.java \
+org/w3c/dom/html2/HTMLStyleElement.java \
+org/w3c/dom/html2/HTMLTableCaptionElement.java \
+org/w3c/dom/html2/HTMLTableCellElement.java \
+org/w3c/dom/html2/HTMLTableColElement.java \
+org/w3c/dom/html2/HTMLTableElement.java \
+org/w3c/dom/html2/HTMLTableRowElement.java \
+org/w3c/dom/html2/HTMLTableSectionElement.java \
+org/w3c/dom/html2/HTMLTextAreaElement.java \
+org/w3c/dom/html2/HTMLTitleElement.java \
+org/w3c/dom/html2/HTMLUListElement.java \
+org/w3c/dom/ls/DOMImplementationLS.java \
+org/w3c/dom/ls/LSException.java \
+org/w3c/dom/ls/LSInput.java \
+org/w3c/dom/ls/LSLoadEvent.java \
+org/w3c/dom/ls/LSOutput.java \
+org/w3c/dom/ls/LSParser.java \
+org/w3c/dom/ls/LSParserFilter.java \
+org/w3c/dom/ls/LSProgressEvent.java \
+org/w3c/dom/ls/LSResourceResolver.java \
+org/w3c/dom/ls/LSSerializer.java \
+org/w3c/dom/ls/LSSerializerFilter.java \
+org/w3c/dom/ranges/DocumentRange.java \
+org/w3c/dom/ranges/Range.java \
+org/w3c/dom/ranges/RangeException.java \
+org/w3c/dom/stylesheets/DocumentStyle.java \
+org/w3c/dom/stylesheets/LinkStyle.java \
+org/w3c/dom/stylesheets/MediaList.java \
+org/w3c/dom/stylesheets/StyleSheet.java \
+org/w3c/dom/stylesheets/StyleSheetList.java \
+org/w3c/dom/traversal/DocumentTraversal.java \
+org/w3c/dom/traversal/NodeFilter.java \
+org/w3c/dom/traversal/NodeIterator.java \
+org/w3c/dom/traversal/TreeWalker.java \
+org/w3c/dom/views/AbstractView.java \
+org/w3c/dom/views/DocumentView.java \
+org/w3c/dom/xpath/XPathEvaluator.java \
+org/w3c/dom/xpath/XPathException.java \
+org/w3c/dom/xpath/XPathExpression.java \
+org/w3c/dom/xpath/XPathNSResolver.java \
+org/w3c/dom/xpath/XPathNamespace.java \
+org/w3c/dom/xpath/XPathResult.java
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/Makefile.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/Makefile.in?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/Makefile.in Thu Nov 8 16:56:19 2007
@@ -0,0 +1,596 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = external/w3c_dom
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
+ $(top_srcdir)/../../config/lead-dot.m4 \
+ $(top_srcdir)/../../config/multi.m4 \
+ $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
+ $(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
+ $(top_srcdir)/m4/ax_create_stdint_h.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
+CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
+CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_PLUGIN_FALSE = @CREATE_PLUGIN_FALSE@
+CREATE_PLUGIN_TRUE = @CREATE_PLUGIN_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_WRAPPERS_FALSE = @CREATE_WRAPPERS_FALSE@
+CREATE_WRAPPERS_TRUE = @CREATE_WRAPPERS_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@
+ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FASTJAR = @FASTJAR@
+FIND = @FIND@
+FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
+FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+GDK_CFLAGS = @GDK_CFLAGS@
+GDK_LIBS = @GDK_LIBS@
+GJDOC = @GJDOC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+JIKESWARNINGS = @JIKESWARNINGS@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBMAGIC = @LIBMAGIC@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
+MOZILLA_LIBS = @MOZILLA_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_ESCHER = @PATH_TO_ESCHER@
+PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGIN_DIR = @PLUGIN_DIR@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
+USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
+USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
+USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@
+VERSION = @VERSION@
+VM_BINARY = @VM_BINARY@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+XTEST_LIBS = @XTEST_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+nativeexeclibdir = @nativeexeclibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexeclibdir = @toolexeclibdir@
+vm_classes = @vm_classes@
+EXTRA_DIST = README \
+org/w3c/dom/Attr.java \
+org/w3c/dom/CDATASection.java \
+org/w3c/dom/CharacterData.java \
+org/w3c/dom/Comment.java \
+org/w3c/dom/DOMConfiguration.java \
+org/w3c/dom/DOMError.java \
+org/w3c/dom/DOMErrorHandler.java \
+org/w3c/dom/DOMException.java \
+org/w3c/dom/DOMImplementation.java \
+org/w3c/dom/DOMImplementationList.java \
+org/w3c/dom/DOMImplementationSource.java \
+org/w3c/dom/DOMLocator.java \
+org/w3c/dom/DOMStringList.java \
+org/w3c/dom/Document.java \
+org/w3c/dom/DocumentFragment.java \
+org/w3c/dom/DocumentType.java \
+org/w3c/dom/Element.java \
+org/w3c/dom/Entity.java \
+org/w3c/dom/EntityReference.java \
+org/w3c/dom/NameList.java \
+org/w3c/dom/NamedNodeMap.java \
+org/w3c/dom/Node.java \
+org/w3c/dom/NodeList.java \
+org/w3c/dom/Notation.java \
+org/w3c/dom/ProcessingInstruction.java \
+org/w3c/dom/Text.java \
+org/w3c/dom/TypeInfo.java \
+org/w3c/dom/UserDataHandler.java \
+org/w3c/dom/bootstrap/DOMImplementationRegistry.java \
+org/w3c/dom/css/CSS2Properties.java \
+org/w3c/dom/css/CSSCharsetRule.java \
+org/w3c/dom/css/CSSFontFaceRule.java \
+org/w3c/dom/css/CSSImportRule.java \
+org/w3c/dom/css/CSSMediaRule.java \
+org/w3c/dom/css/CSSPageRule.java \
+org/w3c/dom/css/CSSPrimitiveValue.java \
+org/w3c/dom/css/CSSRule.java \
+org/w3c/dom/css/CSSRuleList.java \
+org/w3c/dom/css/CSSStyleDeclaration.java \
+org/w3c/dom/css/CSSStyleRule.java \
+org/w3c/dom/css/CSSStyleSheet.java \
+org/w3c/dom/css/CSSUnknownRule.java \
+org/w3c/dom/css/CSSValue.java \
+org/w3c/dom/css/CSSValueList.java \
+org/w3c/dom/css/Counter.java \
+org/w3c/dom/css/DOMImplementationCSS.java \
+org/w3c/dom/css/DocumentCSS.java \
+org/w3c/dom/css/ElementCSSInlineStyle.java \
+org/w3c/dom/css/RGBColor.java \
+org/w3c/dom/css/Rect.java \
+org/w3c/dom/css/ViewCSS.java \
+org/w3c/dom/events/DocumentEvent.java \
+org/w3c/dom/events/Event.java \
+org/w3c/dom/events/EventException.java \
+org/w3c/dom/events/EventListener.java \
+org/w3c/dom/events/EventTarget.java \
+org/w3c/dom/events/MouseEvent.java \
+org/w3c/dom/events/MutationEvent.java \
+org/w3c/dom/events/UIEvent.java \
+org/w3c/dom/html2/HTMLAnchorElement.java \
+org/w3c/dom/html2/HTMLAppletElement.java \
+org/w3c/dom/html2/HTMLAreaElement.java \
+org/w3c/dom/html2/HTMLBRElement.java \
+org/w3c/dom/html2/HTMLBaseElement.java \
+org/w3c/dom/html2/HTMLBaseFontElement.java \
+org/w3c/dom/html2/HTMLBodyElement.java \
+org/w3c/dom/html2/HTMLButtonElement.java \
+org/w3c/dom/html2/HTMLCollection.java \
+org/w3c/dom/html2/HTMLDListElement.java \
+org/w3c/dom/html2/HTMLDirectoryElement.java \
+org/w3c/dom/html2/HTMLDivElement.java \
+org/w3c/dom/html2/HTMLDocument.java \
+org/w3c/dom/html2/HTMLElement.java \
+org/w3c/dom/html2/HTMLFieldSetElement.java \
+org/w3c/dom/html2/HTMLFontElement.java \
+org/w3c/dom/html2/HTMLFormElement.java \
+org/w3c/dom/html2/HTMLFrameElement.java \
+org/w3c/dom/html2/HTMLFrameSetElement.java \
+org/w3c/dom/html2/HTMLHRElement.java \
+org/w3c/dom/html2/HTMLHeadElement.java \
+org/w3c/dom/html2/HTMLHeadingElement.java \
+org/w3c/dom/html2/HTMLHtmlElement.java \
+org/w3c/dom/html2/HTMLIFrameElement.java \
+org/w3c/dom/html2/HTMLImageElement.java \
+org/w3c/dom/html2/HTMLInputElement.java \
+org/w3c/dom/html2/HTMLIsIndexElement.java \
+org/w3c/dom/html2/HTMLLIElement.java \
+org/w3c/dom/html2/HTMLLabelElement.java \
+org/w3c/dom/html2/HTMLLegendElement.java \
+org/w3c/dom/html2/HTMLLinkElement.java \
+org/w3c/dom/html2/HTMLMapElement.java \
+org/w3c/dom/html2/HTMLMenuElement.java \
+org/w3c/dom/html2/HTMLMetaElement.java \
+org/w3c/dom/html2/HTMLModElement.java \
+org/w3c/dom/html2/HTMLOListElement.java \
+org/w3c/dom/html2/HTMLObjectElement.java \
+org/w3c/dom/html2/HTMLOptGroupElement.java \
+org/w3c/dom/html2/HTMLOptionElement.java \
+org/w3c/dom/html2/HTMLOptionsCollection.java \
+org/w3c/dom/html2/HTMLParagraphElement.java \
+org/w3c/dom/html2/HTMLParamElement.java \
+org/w3c/dom/html2/HTMLPreElement.java \
+org/w3c/dom/html2/HTMLQuoteElement.java \
+org/w3c/dom/html2/HTMLScriptElement.java \
+org/w3c/dom/html2/HTMLSelectElement.java \
+org/w3c/dom/html2/HTMLStyleElement.java \
+org/w3c/dom/html2/HTMLTableCaptionElement.java \
+org/w3c/dom/html2/HTMLTableCellElement.java \
+org/w3c/dom/html2/HTMLTableColElement.java \
+org/w3c/dom/html2/HTMLTableElement.java \
+org/w3c/dom/html2/HTMLTableRowElement.java \
+org/w3c/dom/html2/HTMLTableSectionElement.java \
+org/w3c/dom/html2/HTMLTextAreaElement.java \
+org/w3c/dom/html2/HTMLTitleElement.java \
+org/w3c/dom/html2/HTMLUListElement.java \
+org/w3c/dom/ls/DOMImplementationLS.java \
+org/w3c/dom/ls/LSException.java \
+org/w3c/dom/ls/LSInput.java \
+org/w3c/dom/ls/LSLoadEvent.java \
+org/w3c/dom/ls/LSOutput.java \
+org/w3c/dom/ls/LSParser.java \
+org/w3c/dom/ls/LSParserFilter.java \
+org/w3c/dom/ls/LSProgressEvent.java \
+org/w3c/dom/ls/LSResourceResolver.java \
+org/w3c/dom/ls/LSSerializer.java \
+org/w3c/dom/ls/LSSerializerFilter.java \
+org/w3c/dom/ranges/DocumentRange.java \
+org/w3c/dom/ranges/Range.java \
+org/w3c/dom/ranges/RangeException.java \
+org/w3c/dom/stylesheets/DocumentStyle.java \
+org/w3c/dom/stylesheets/LinkStyle.java \
+org/w3c/dom/stylesheets/MediaList.java \
+org/w3c/dom/stylesheets/StyleSheet.java \
+org/w3c/dom/stylesheets/StyleSheetList.java \
+org/w3c/dom/traversal/DocumentTraversal.java \
+org/w3c/dom/traversal/NodeFilter.java \
+org/w3c/dom/traversal/NodeIterator.java \
+org/w3c/dom/traversal/TreeWalker.java \
+org/w3c/dom/views/AbstractView.java \
+org/w3c/dom/views/DocumentView.java \
+org/w3c/dom/xpath/XPathEvaluator.java \
+org/w3c/dom/xpath/XPathException.java \
+org/w3c/dom/xpath/XPathExpression.java \
+org/w3c/dom/xpath/XPathNSResolver.java \
+org/w3c/dom/xpath/XPathNamespace.java \
+org/w3c/dom/xpath/XPathResult.java
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu external/w3c_dom/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu external/w3c_dom/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ $(mkdir_p) $(distdir)/org/w3c/dom $(distdir)/org/w3c/dom/bootstrap $(distdir)/org/w3c/dom/css $(distdir)/org/w3c/dom/events $(distdir)/org/w3c/dom/html2 $(distdir)/org/w3c/dom/ls $(distdir)/org/w3c/dom/ranges $(distdir)/org/w3c/dom/stylesheets $(distdir)/org/w3c/dom/traversal $(distdir)/org/w3c/dom/views $(distdir)/org/w3c/dom/xpath
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/README
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/README?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/README (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/README Thu Nov 8 16:56:19 2007
@@ -0,0 +1,97 @@
+Bindings for the Document Object Model (DOM).
+DOM is not maintained as part of GNU Classpath, but is used with GNU Classpath.
+
+The packages includes are:
+
+Document Object Model (DOM) Level 3 Core Specification
+http://www.w3.org/TR/DOM-Level-3-Core/
+(07 April 2004)
+
+Document Object Model (DOM) Level 3 Load and Save Specification
+http://www.w3.org/TR/DOM-Level-3-LS/
+(07 April 2004)
+
+Document Object Model (DOM) Level 2 Events Specification
+http://www.w3.org/TR/DOM-Level-2-Events/
+(13 November 2000)
+Latest errata: 20021016
+
+Document Object Model (DOM) Level 2 Views Specification
+http://www.w3.org/TR/DOM-Level-2-Views/
+(13 November 2000)
+Latest errata: 20021016
+
+Document Object Model (DOM) Level 2 Style Specification
+http://www.w3.org/TR/DOM-Level-2-Style/
+(13 November 2000)
+Latest errata: 20021016
+
+Document Object Model (DOM) Level 2 Traversal and Range Specification
+http://www.w3.org/TR/DOM-Level-2-Traversal-Range/
+(13 November 2000)
+Latest errata: 20021016
+
+Document Object Model (DOM) Level 2 HTML Specification
+http://www.w3.org/TR/DOM-Level-2-HTML/
+(09 January 2003)
+
+Document Object Model (DOM) Level 3 XPath Specification
+http://www.w3.org/TR/DOM-Level-3-XPath/
+(26 February 2004)
+
+Errata can be found at:
+http://www.w3.org/2000/11/DOM-Level-2-errata
+http://www.w3.org/2004/01/DOM-Level-3-errata
+
+The only change to the sources is setting the additional fallback for
+org.w3c.dom.bootstrap.DOMImplementationRegistry.newInstance() to
+gnu.xml.dom.ImplementationSource.
+
+When importing new versions don't forget to update the Makefile.am
+to list any new files (or to remove old ones).
+
+All files are distributed under the following
+W3C Software Short Notice:
+
+ Copyright (c) 2004 World Wide Web Consortium,
+
+ (Massachusetts Institute of Technology, European Research Consortium for
+ Informatics and Mathematics, Keio University). All Rights Reserved. This
+ work is distributed under the W3C(r) Software License [1] in the hope that
+ it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+ Permission to copy, modify, and distribute this software and its
+ documentation, with or without modification, for any purpose and
+ without fee or royalty is hereby granted, provided that you include
+ the following on ALL copies of the software and documentation or
+ portions thereof, including modifications:
+
+ 1. The full text of this NOTICE in a location viewable to users of
+ the redistributed or derivative work.
+ 2. Any pre-existing intellectual property disclaimers, notices, or
+ terms and conditions. If none exist, the W3C Software Short Notice
+ should be included (hypertext is preferred, text is permitted) within
+ the body of any redistributed or derivative code.
+ 3. Notice of any changes or modifications to the files, including
+ the date changes were made. (We recommend you provide URIs to the
+ location from which the code is derived.)
+
+ THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT
+ HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,
+ INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR
+ DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
+ TRADEMARKS OR OTHER RIGHTS.
+
+ COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL
+ OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
+ DOCUMENTATION.
+
+ The name and trademarks of copyright holders may NOT be used in
+ advertising or publicity pertaining to the software without specific,
+ written prior permission. Title to copyright in this software and any
+ associated documentation will at all times remain with copyright
+ holders.
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/Attr.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/Attr.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/Attr.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/Attr.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,275 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * The <code>Attr</code> interface represents an attribute in an
+ * <code>Element</code> object. Typically the allowable values for the
+ * attribute are defined in a schema associated with the document.
+ * <p><code>Attr</code> objects inherit the <code>Node</code> interface, but
+ * since they are not actually child nodes of the element they describe, the
+ * DOM does not consider them part of the document tree. Thus, the
+ * <code>Node</code> attributes <code>parentNode</code>,
+ * <code>previousSibling</code>, and <code>nextSibling</code> have a
+ * <code>null</code> value for <code>Attr</code> objects. The DOM takes the
+ * view that attributes are properties of elements rather than having a
+ * separate identity from the elements they are associated with; this should
+ * make it more efficient to implement such features as default attributes
+ * associated with all elements of a given type. Furthermore,
+ * <code>Attr</code> nodes may not be immediate children of a
+ * <code>DocumentFragment</code>. However, they can be associated with
+ * <code>Element</code> nodes contained within a
+ * <code>DocumentFragment</code>. In short, users and implementors of the
+ * DOM need to be aware that <code>Attr</code> nodes have some things in
+ * common with other objects inheriting the <code>Node</code> interface, but
+ * they also are quite distinct.
+ * <p>The attribute's effective value is determined as follows: if this
+ * attribute has been explicitly assigned any value, that value is the
+ * attribute's effective value; otherwise, if there is a declaration for
+ * this attribute, and that declaration includes a default value, then that
+ * default value is the attribute's effective value; otherwise, the
+ * attribute does not exist on this element in the structure model until it
+ * has been explicitly added. Note that the <code>Node.nodeValue</code>
+ * attribute on the <code>Attr</code> instance can also be used to retrieve
+ * the string version of the attribute's value(s).
+ * <p> If the attribute was not explicitly given a value in the instance
+ * document but has a default value provided by the schema associated with
+ * the document, an attribute node will be created with
+ * <code>specified</code> set to <code>false</code>. Removing attribute
+ * nodes for which a default value is defined in the schema generates a new
+ * attribute node with the default value and <code>specified</code> set to
+ * <code>false</code>. If validation occurred while invoking
+ * <code>Document.normalizeDocument()</code>, attribute nodes with
+ * <code>specified</code> equals to <code>false</code> are recomputed
+ * according to the default attribute values provided by the schema. If no
+ * default value is associate with this attribute in the schema, the
+ * attribute node is discarded.
+ * <p>In XML, where the value of an attribute can contain entity references,
+ * the child nodes of the <code>Attr</code> node may be either
+ * <code>Text</code> or <code>EntityReference</code> nodes (when these are
+ * in use; see the description of <code>EntityReference</code> for
+ * discussion).
+ * <p>The DOM Core represents all attribute values as simple strings, even if
+ * the DTD or schema associated with the document declares them of some
+ * specific type such as tokenized.
+ * <p>The way attribute value normalization is performed by the DOM
+ * implementation depends on how much the implementation knows about the
+ * schema in use. Typically, the <code>value</code> and
+ * <code>nodeValue</code> attributes of an <code>Attr</code> node initially
+ * returns the normalized value given by the parser. It is also the case
+ * after <code>Document.normalizeDocument()</code> is called (assuming the
+ * right options have been set). But this may not be the case after
+ * mutation, independently of whether the mutation is performed by setting
+ * the string value directly or by changing the <code>Attr</code> child
+ * nodes. In particular, this is true when <a href='http://www.w3.org/TR/2004/REC-xml-20040204#dt-charref'>character
+ * references</a> are involved, given that they are not represented in the DOM and they
+ * impact attribute value normalization. On the other hand, if the
+ * implementation knows about the schema in use when the attribute value is
+ * changed, and it is of a different type than CDATA, it may normalize it
+ * again at that time. This is especially true of specialized DOM
+ * implementations, such as SVG DOM implementations, which store attribute
+ * values in an internal form different from a string.
+ * <p>The following table gives some examples of the relations between the
+ * attribute value in the original document (parsed attribute), the value as
+ * exposed in the DOM, and the serialization of the value:
+ * <table border='1' cellpadding='3'>
+ * <tr>
+ * <th>Examples</th>
+ * <th>Parsed
+ * attribute value</th>
+ * <th>Initial <code>Attr.value</code></th>
+ * <th>Serialized attribute value</th>
+ * </tr>
+ * <tr>
+ * <td valign='top' rowspan='1' colspan='1'>
+ * Character reference</td>
+ * <td valign='top' rowspan='1' colspan='1'>
+ * <pre>"x²=5"</pre>
+ * </td>
+ * <td valign='top' rowspan='1' colspan='1'>
+ * <pre>"x\u00b2=5"</pre>
+ * </td>
+ * <td valign='top' rowspan='1' colspan='1'>
+ * <pre>"x²=5"</pre>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign='top' rowspan='1' colspan='1'>Built-in
+ * character entity</td>
+ * <td valign='top' rowspan='1' colspan='1'>
+ * <pre>"y<6"</pre>
+ * </td>
+ * <td valign='top' rowspan='1' colspan='1'>
+ * <pre>"y<6"</pre>
+ * </td>
+ * <td valign='top' rowspan='1' colspan='1'>
+ * <pre>"y<6"</pre>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign='top' rowspan='1' colspan='1'>Literal newline between</td>
+ * <td valign='top' rowspan='1' colspan='1'>
+ * <pre>
+ * "x=5 y=6"</pre>
+ * </td>
+ * <td valign='top' rowspan='1' colspan='1'>
+ * <pre>"x=5 y=6"</pre>
+ * </td>
+ * <td valign='top' rowspan='1' colspan='1'>
+ * <pre>"x=5 y=6"</pre>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign='top' rowspan='1' colspan='1'>Normalized newline between</td>
+ * <td valign='top' rowspan='1' colspan='1'>
+ * <pre>"x=5
+ * y=6"</pre>
+ * </td>
+ * <td valign='top' rowspan='1' colspan='1'>
+ * <pre>"x=5 y=6"</pre>
+ * </td>
+ * <td valign='top' rowspan='1' colspan='1'>
+ * <pre>"x=5 y=6"</pre>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign='top' rowspan='1' colspan='1'>Entity <code>e</code> with literal newline</td>
+ * <td valign='top' rowspan='1' colspan='1'>
+ * <pre>
+ * <!ENTITY e '... ...'> [...]> "x=5&e;y=6"</pre>
+ * </td>
+ * <td valign='top' rowspan='1' colspan='1'><em>Dependent on Implementation and Load Options</em></td>
+ * <td valign='top' rowspan='1' colspan='1'><em>Dependent on Implementation and Load/Save Options</em></td>
+ * </tr>
+ * </table>
+ * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
+ */
+public interface Attr extends Node {
+ /**
+ * Returns the name of this attribute. If <code>Node.localName</code> is
+ * different from <code>null</code>, this attribute is a qualified name.
+ */
+ public String getName();
+
+ /**
+ * <code>True</code> if this attribute was explicitly given a value in
+ * the instance document, <code>false</code> otherwise. If the
+ * application changed the value of this attribute node (even if it ends
+ * up having the same value as the default value) then it is set to
+ * <code>true</code>. The implementation may handle attributes with
+ * default values from other schemas similarly but applications should
+ * use <code>Document.normalizeDocument()</code> to guarantee this
+ * information is up-to-date.
+ */
+ public boolean getSpecified();
+
+ /**
+ * On retrieval, the value of the attribute is returned as a string.
+ * Character and general entity references are replaced with their
+ * values. See also the method <code>getAttribute</code> on the
+ * <code>Element</code> interface.
+ * <br>On setting, this creates a <code>Text</code> node with the unparsed
+ * contents of the string, i.e. any characters that an XML processor
+ * would recognize as markup are instead treated as literal text. See
+ * also the method <code>Element.setAttribute()</code>.
+ * <br> Some specialized implementations, such as some [<a href='http://www.w3.org/TR/2003/REC-SVG11-20030114/'>SVG 1.1</a>]
+ * implementations, may do normalization automatically, even after
+ * mutation; in such case, the value on retrieval may differ from the
+ * value on setting.
+ */
+ public String getValue();
+ /**
+ * On retrieval, the value of the attribute is returned as a string.
+ * Character and general entity references are replaced with their
+ * values. See also the method <code>getAttribute</code> on the
+ * <code>Element</code> interface.
+ * <br>On setting, this creates a <code>Text</code> node with the unparsed
+ * contents of the string, i.e. any characters that an XML processor
+ * would recognize as markup are instead treated as literal text. See
+ * also the method <code>Element.setAttribute()</code>.
+ * <br> Some specialized implementations, such as some [<a href='http://www.w3.org/TR/2003/REC-SVG11-20030114/'>SVG 1.1</a>]
+ * implementations, may do normalization automatically, even after
+ * mutation; in such case, the value on retrieval may differ from the
+ * value on setting.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
+ */
+ public void setValue(String value)
+ throws DOMException;
+
+ /**
+ * The <code>Element</code> node this attribute is attached to or
+ * <code>null</code> if this attribute is not in use.
+ * @since DOM Level 2
+ */
+ public Element getOwnerElement();
+
+ /**
+ * The type information associated with this attribute. While the type
+ * information contained in this attribute is guarantee to be correct
+ * after loading the document or invoking
+ * <code>Document.normalizeDocument()</code>, <code>schemaTypeInfo</code>
+ * may not be reliable if the node was moved.
+ * @since DOM Level 3
+ */
+ public TypeInfo getSchemaTypeInfo();
+
+ /**
+ * Returns whether this attribute is known to be of type ID (i.e. to
+ * contain an identifier for its owner element) or not. When it is and
+ * its value is unique, the <code>ownerElement</code> of this attribute
+ * can be retrieved using the method <code>Document.getElementById</code>
+ * . The implementation could use several ways to determine if an
+ * attribute node is known to contain an identifier:
+ * <ul>
+ * <li> If validation
+ * occurred using an XML Schema [<a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/'>XML Schema Part 1</a>]
+ * while loading the document or while invoking
+ * <code>Document.normalizeDocument()</code>, the post-schema-validation
+ * infoset contributions (PSVI contributions) values are used to
+ * determine if this attribute is a schema-determined ID attribute using
+ * the <a href='http://www.w3.org/TR/2003/REC-xptr-framework-20030325/#term-sdi'>
+ * schema-determined ID</a> definition in [<a href='http://www.w3.org/TR/2003/REC-xptr-framework-20030325/'>XPointer</a>]
+ * .
+ * </li>
+ * <li> If validation occurred using a DTD while loading the document or
+ * while invoking <code>Document.normalizeDocument()</code>, the infoset <b>[type definition]</b> value is used to determine if this attribute is a DTD-determined ID
+ * attribute using the <a href='http://www.w3.org/TR/2003/REC-xptr-framework-20030325/#term-ddi'>
+ * DTD-determined ID</a> definition in [<a href='http://www.w3.org/TR/2003/REC-xptr-framework-20030325/'>XPointer</a>]
+ * .
+ * </li>
+ * <li> from the use of the methods <code>Element.setIdAttribute()</code>,
+ * <code>Element.setIdAttributeNS()</code>, or
+ * <code>Element.setIdAttributeNode()</code>, i.e. it is an
+ * user-determined ID attribute;
+ * <p ><b>Note:</b> XPointer framework (see section 3.2 in [<a href='http://www.w3.org/TR/2003/REC-xptr-framework-20030325/'>XPointer</a>]
+ * ) consider the DOM user-determined ID attribute as being part of the
+ * XPointer externally-determined ID definition.
+ * </li>
+ * <li> using mechanisms that
+ * are outside the scope of this specification, it is then an
+ * externally-determined ID attribute. This includes using schema
+ * languages different from XML schema and DTD.
+ * </li>
+ * </ul>
+ * <br> If validation occurred while invoking
+ * <code>Document.normalizeDocument()</code>, all user-determined ID
+ * attributes are reset and all attribute nodes ID information are then
+ * reevaluated in accordance to the schema used. As a consequence, if
+ * the <code>Attr.schemaTypeInfo</code> attribute contains an ID type,
+ * <code>isId</code> will always return true.
+ * @since DOM Level 3
+ */
+ public boolean isId();
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/CDATASection.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/CDATASection.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/CDATASection.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/CDATASection.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * CDATA sections are used to escape blocks of text containing characters that
+ * would otherwise be regarded as markup. The only delimiter that is
+ * recognized in a CDATA section is the "]]>" string that ends the CDATA
+ * section. CDATA sections cannot be nested. Their primary purpose is for
+ * including material such as XML fragments, without needing to escape all
+ * the delimiters.
+ * <p>The <code>CharacterData.data</code> attribute holds the text that is
+ * contained by the CDATA section. Note that this <em>may</em> contain characters that need to be escaped outside of CDATA sections and
+ * that, depending on the character encoding ("charset") chosen for
+ * serialization, it may be impossible to write out some characters as part
+ * of a CDATA section.
+ * <p>The <code>CDATASection</code> interface inherits from the
+ * <code>CharacterData</code> interface through the <code>Text</code>
+ * interface. Adjacent <code>CDATASection</code> nodes are not merged by use
+ * of the <code>normalize</code> method of the <code>Node</code> interface.
+ * <p> No lexical check is done on the content of a CDATA section and it is
+ * therefore possible to have the character sequence <code>"]]>"</code>
+ * in the content, which is illegal in a CDATA section per section 2.7 of [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. The
+ * presence of this character sequence must generate a fatal error during
+ * serialization or the cdata section must be splitted before the
+ * serialization (see also the parameter <code>"split-cdata-sections"</code>
+ * in the <code>DOMConfiguration</code> interface).
+ * <p ><b>Note:</b> Because no markup is recognized within a
+ * <code>CDATASection</code>, character numeric references cannot be used as
+ * an escape mechanism when serializing. Therefore, action needs to be taken
+ * when serializing a <code>CDATASection</code> with a character encoding
+ * where some of the contained characters cannot be represented. Failure to
+ * do so would not produce well-formed XML.
+ * <p ><b>Note:</b> One potential solution in the serialization process is to
+ * end the CDATA section before the character, output the character using a
+ * character reference or entity reference, and open a new CDATA section for
+ * any further characters in the text node. Note, however, that some code
+ * conversion libraries at the time of writing do not return an error or
+ * exception when a character is missing from the encoding, making the task
+ * of ensuring that data is not corrupted on serialization more difficult.
+ * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
+ */
+public interface CDATASection extends Text {
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/CharacterData.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/CharacterData.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/CharacterData.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/CharacterData.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * The <code>CharacterData</code> interface extends Node with a set of
+ * attributes and methods for accessing character data in the DOM. For
+ * clarity this set is defined here rather than on each object that uses
+ * these attributes and methods. No DOM objects correspond directly to
+ * <code>CharacterData</code>, though <code>Text</code> and others do
+ * inherit the interface from it. All <code>offsets</code> in this interface
+ * start from <code>0</code>.
+ * <p>As explained in the <code>DOMString</code> interface, text strings in
+ * the DOM are represented in UTF-16, i.e. as a sequence of 16-bit units. In
+ * the following, the term 16-bit units is used whenever necessary to
+ * indicate that indexing on CharacterData is done in 16-bit units.
+ * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
+ */
+public interface CharacterData extends Node {
+ /**
+ * The character data of the node that implements this interface. The DOM
+ * implementation may not put arbitrary limits on the amount of data
+ * that may be stored in a <code>CharacterData</code> node. However,
+ * implementation limits may mean that the entirety of a node's data may
+ * not fit into a single <code>DOMString</code>. In such cases, the user
+ * may call <code>substringData</code> to retrieve the data in
+ * appropriately sized pieces.
+ * @exception DOMException
+ * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
+ * fit in a <code>DOMString</code> variable on the implementation
+ * platform.
+ */
+ public String getData()
+ throws DOMException;
+ /**
+ * The character data of the node that implements this interface. The DOM
+ * implementation may not put arbitrary limits on the amount of data
+ * that may be stored in a <code>CharacterData</code> node. However,
+ * implementation limits may mean that the entirety of a node's data may
+ * not fit into a single <code>DOMString</code>. In such cases, the user
+ * may call <code>substringData</code> to retrieve the data in
+ * appropriately sized pieces.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
+ */
+ public void setData(String data)
+ throws DOMException;
+
+ /**
+ * The number of 16-bit units that are available through <code>data</code>
+ * and the <code>substringData</code> method below. This may have the
+ * value zero, i.e., <code>CharacterData</code> nodes may be empty.
+ */
+ public int getLength();
+
+ /**
+ * Extracts a range of data from the node.
+ * @param offset Start offset of substring to extract.
+ * @param count The number of 16-bit units to extract.
+ * @return The specified substring. If the sum of <code>offset</code> and
+ * <code>count</code> exceeds the <code>length</code>, then all 16-bit
+ * units to the end of the data are returned.
+ * @exception DOMException
+ * INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is
+ * negative or greater than the number of 16-bit units in
+ * <code>data</code>, or if the specified <code>count</code> is
+ * negative.
+ * <br>DOMSTRING_SIZE_ERR: Raised if the specified range of text does
+ * not fit into a <code>DOMString</code>.
+ */
+ public String substringData(int offset,
+ int count)
+ throws DOMException;
+
+ /**
+ * Append the string to the end of the character data of the node. Upon
+ * success, <code>data</code> provides access to the concatenation of
+ * <code>data</code> and the <code>DOMString</code> specified.
+ * @param arg The <code>DOMString</code> to append.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ */
+ public void appendData(String arg)
+ throws DOMException;
+
+ /**
+ * Insert a string at the specified 16-bit unit offset.
+ * @param offset The character offset at which to insert.
+ * @param arg The <code>DOMString</code> to insert.
+ * @exception DOMException
+ * INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is
+ * negative or greater than the number of 16-bit units in
+ * <code>data</code>.
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ */
+ public void insertData(int offset,
+ String arg)
+ throws DOMException;
+
+ /**
+ * Remove a range of 16-bit units from the node. Upon success,
+ * <code>data</code> and <code>length</code> reflect the change.
+ * @param offset The offset from which to start removing.
+ * @param count The number of 16-bit units to delete. If the sum of
+ * <code>offset</code> and <code>count</code> exceeds
+ * <code>length</code> then all 16-bit units from <code>offset</code>
+ * to the end of the data are deleted.
+ * @exception DOMException
+ * INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is
+ * negative or greater than the number of 16-bit units in
+ * <code>data</code>, or if the specified <code>count</code> is
+ * negative.
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ */
+ public void deleteData(int offset,
+ int count)
+ throws DOMException;
+
+ /**
+ * Replace the characters starting at the specified 16-bit unit offset
+ * with the specified string.
+ * @param offset The offset from which to start replacing.
+ * @param count The number of 16-bit units to replace. If the sum of
+ * <code>offset</code> and <code>count</code> exceeds
+ * <code>length</code>, then all 16-bit units to the end of the data
+ * are replaced; (i.e., the effect is the same as a <code>remove</code>
+ * method call with the same range, followed by an <code>append</code>
+ * method invocation).
+ * @param arg The <code>DOMString</code> with which the range must be
+ * replaced.
+ * @exception DOMException
+ * INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is
+ * negative or greater than the number of 16-bit units in
+ * <code>data</code>, or if the specified <code>count</code> is
+ * negative.
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ */
+ public void replaceData(int offset,
+ int count,
+ String arg)
+ throws DOMException;
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/Comment.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/Comment.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/Comment.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/Comment.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * This interface inherits from <code>CharacterData</code> and represents the
+ * content of a comment, i.e., all the characters between the starting '
+ * <code><!--</code>' and ending '<code>--></code>'. Note that this is
+ * the definition of a comment in XML, and, in practice, HTML, although some
+ * HTML tools may implement the full SGML comment structure.
+ * <p> No lexical check is done on the content of a comment and it is
+ * therefore possible to have the character sequence <code>"--"</code>
+ * (double-hyphen) in the content, which is illegal in a comment per section
+ * 2.5 of [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. The
+ * presence of this character sequence must generate a fatal error during
+ * serialization.
+ * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
+ */
+public interface Comment extends CharacterData {
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMConfiguration.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMConfiguration.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMConfiguration.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMConfiguration.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,413 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * The <code>DOMConfiguration</code> interface represents the configuration
+ * of a document and maintains a table of recognized parameters. Using the
+ * configuration, it is possible to change
+ * <code>Document.normalizeDocument()</code> behavior, such as replacing the
+ * <code>CDATASection</code> nodes with <code>Text</code> nodes or
+ * specifying the type of the schema that must be used when the validation
+ * of the <code>Document</code> is requested. <code>DOMConfiguration</code>
+ * objects are also used in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407'>DOM Level 3 Load and Save</a>]
+ * in the <code>DOMParser</code> and <code>DOMSerializer</code> interfaces.
+ * <p> The parameter names used by the <code>DOMConfiguration</code> object
+ * are defined throughout the DOM Level 3 specifications. Names are
+ * case-insensitive. To avoid possible conflicts, as a convention, names
+ * referring to parameters defined outside the DOM specification should be
+ * made unique. Because parameters are exposed as properties in the , names
+ * are recommended to follow the section 5.16 Identifiers of [Unicode] with the addition of the character '-' (HYPHEN-MINUS) but it is not
+ * enforced by the DOM implementation. DOM Level 3 Core Implementations are
+ * required to recognize all parameters defined in this specification. Some
+ * parameter values may also be required to be supported by the
+ * implementation. Refer to the definition of the parameter to know if a
+ * value must be supported or not.
+ * <p ><b>Note:</b> Parameters are similar to features and properties used in
+ * SAX2 [<a href='http://www.saxproject.org/'>SAX</a>].
+ * <p> The following list of parameters defined in the DOM:
+ * <dl>
+ * <dt>
+ * <code>"canonical-form"</code></dt>
+ * <dd>
+ * <dl>
+ * <dt><code>true</code></dt>
+ * <dd>[<em>optional</em>] Canonicalize the document according to the rules specified in [<a href='http://www.w3.org/TR/2001/REC-xml-c14n-20010315'>Canonical XML</a>],
+ * such as removing the <code>DocumentType</code> node (if any) from the
+ * tree, or removing superfluous namespace declarations from each element.
+ * Note that this is limited to what can be represented in the DOM; in
+ * particular, there is no way to specify the order of the attributes in the
+ * DOM. In addition, Setting this parameter to <code>true</code> will also
+ * set the state of the parameters listed below. Later changes to the state
+ * of one of those parameters will revert "canonical-form" back to
+ * <code>false</code>. Parameters set to <code>false</code>: "entities", "
+ * normalize-characters", "cdata-sections". Parameters set to
+ * <code>true</code>: "namespaces", "namespace-declarations", "well-formed",
+ * "element-content-whitespace". Other parameters are not changed unless
+ * explicitly specified in the description of the parameters.</dd>
+ * <dt>
+ * <code>false</code></dt>
+ * <dd>[<em>required</em>] (<em>default</em>)Do not canonicalize the document.</dd>
+ * </dl></dd>
+ * <dt><code>"cdata-sections"</code></dt>
+ * <dd>
+ * <dl>
+ * <dt>
+ * <code>true</code></dt>
+ * <dd>[<em>required</em>] (<em>default</em>)Keep <code>CDATASection</code> nodes in the document.</dd>
+ * <dt><code>false</code></dt>
+ * <dd>[<em>required</em>]Transform <code>CDATASection</code> nodes in the document into
+ * <code>Text</code> nodes. The new <code>Text</code> node is then combined
+ * with any adjacent <code>Text</code> node.</dd>
+ * </dl></dd>
+ * <dt>
+ * <code>"check-character-normalization"</code></dt>
+ * <dd>
+ * <dl>
+ * <dt><code>true</code></dt>
+ * <dd>[<em>optional</em>] Check if the characters in the document are <a href='http://www.w3.org/TR/2004/REC-xml11-20040204/#dt-fullnorm'>fully
+ * normalized</a>, as defined in appendix B of [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>]. When a
+ * sequence of characters is encountered that fails normalization checking,
+ * an error with the <code>DOMError.type</code> equals to
+ * "check-character-normalization-failure" is issued. </dd>
+ * <dt><code>false</code></dt>
+ * <dd>[<em>required</em>] (<em>default</em>)Do not check if characters are normalized.</dd>
+ * </dl></dd>
+ * <dt><code>"comments"</code></dt>
+ * <dd>
+ * <dl>
+ * <dt>
+ * <code>true</code></dt>
+ * <dd>[<em>required</em>] (<em>default</em>)Keep <code>Comment</code> nodes in the document.</dd>
+ * <dt><code>false</code></dt>
+ * <dd>[<em>required</em>]Discard <code>Comment</code> nodes in the document.</dd>
+ * </dl></dd>
+ * <dt>
+ * <code>"datatype-normalization"</code></dt>
+ * <dd>
+ * <dl>
+ * <dt><code>true</code></dt>
+ * <dd>[<em>optional</em>] Expose schema normalized values in the tree, such as <a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#key-nv'>XML
+ * Schema normalized values</a> in the case of XML Schema. Since this parameter requires to have schema
+ * information, the "validate" parameter will also be set to
+ * <code>true</code>. Having this parameter activated when "validate" is
+ * <code>false</code> has no effect and no schema-normalization will happen.
+ * <p ><b>Note:</b> Since the document contains the result of the XML 1.0
+ * processing, this parameter does not apply to attribute value
+ * normalization as defined in section 3.3.3 of [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>] and is only
+ * meant for schema languages other than Document Type Definition (DTD). </dd>
+ * <dt>
+ * <code>false</code></dt>
+ * <dd>[<em>required</em>] (<em>default</em>) Do not perform schema normalization on the tree. </dd>
+ * </dl></dd>
+ * <dt>
+ * <code>"element-content-whitespace"</code></dt>
+ * <dd>
+ * <dl>
+ * <dt><code>true</code></dt>
+ * <dd>[<em>required</em>] (<em>default</em>)Keep all whitespaces in the document.</dd>
+ * <dt><code>false</code></dt>
+ * <dd>[<em>optional</em>] Discard all <code>Text</code> nodes that contain whitespaces in element
+ * content, as described in <a href='http://www.w3.org/TR/2004/REC-xml-infoset-20040204#infoitem.character'>
+ * [element content whitespace]</a>. The implementation is expected to use the attribute
+ * <code>Text.isElementContentWhitespace</code> to determine if a
+ * <code>Text</code> node should be discarded or not.</dd>
+ * </dl></dd>
+ * <dt><code>"entities"</code></dt>
+ * <dd>
+ * <dl>
+ * <dt>
+ * <code>true</code></dt>
+ * <dd>[<em>required</em>] (<em>default</em>)Keep <code>EntityReference</code> nodes in the document.</dd>
+ * <dt>
+ * <code>false</code></dt>
+ * <dd>[<em>required</em>] Remove all <code>EntityReference</code> nodes from the document,
+ * putting the entity expansions directly in their place. <code>Text</code>
+ * nodes are normalized, as defined in <code>Node.normalize</code>. Only <a href='http://www.w3.org/TR/2004/REC-xml-infoset-20040204/#infoitem.rse'>
+ * unexpanded entity references</a> are kept in the document. </dd>
+ * </dl>
+ * <p ><b>Note:</b> This parameter does not affect <code>Entity</code> nodes. </dd>
+ * <dt>
+ * <code>"error-handler"</code></dt>
+ * <dd>[<em>required</em>] Contains a <code>DOMErrorHandler</code> object. If an error is
+ * encountered in the document, the implementation will call back the
+ * <code>DOMErrorHandler</code> registered using this parameter. The
+ * implementation may provide a default <code>DOMErrorHandler</code> object.
+ * When called, <code>DOMError.relatedData</code> will contain the closest
+ * node to where the error occurred. If the implementation is unable to
+ * determine the node where the error occurs,
+ * <code>DOMError.relatedData</code> will contain the <code>Document</code>
+ * node. Mutations to the document from within an error handler will result
+ * in implementation dependent behavior. </dd>
+ * <dt><code>"infoset"</code></dt>
+ * <dd>
+ * <dl>
+ * <dt>
+ * <code>true</code></dt>
+ * <dd>[<em>required</em>]Keep in the document the information defined in the XML Information Set [<a href='http://www.w3.org/TR/2004/REC-xml-infoset-20040204/'>XML Information Set</a>]
+ * .This forces the following parameters to <code>false</code>: "
+ * validate-if-schema", "entities", "datatype-normalization", "cdata-sections
+ * ".This forces the following parameters to <code>true</code>: "
+ * namespace-declarations", "well-formed", "element-content-whitespace", "
+ * comments", "namespaces".Other parameters are not changed unless
+ * explicitly specified in the description of the parameters. Note that
+ * querying this parameter with <code>getParameter</code> returns
+ * <code>true</code> only if the individual parameters specified above are
+ * appropriately set.</dd>
+ * <dt><code>false</code></dt>
+ * <dd>Setting <code>infoset</code> to
+ * <code>false</code> has no effect.</dd>
+ * </dl></dd>
+ * <dt><code>"namespaces"</code></dt>
+ * <dd>
+ * <dl>
+ * <dt>
+ * <code>true</code></dt>
+ * <dd>[<em>required</em>] (<em>default</em>) Perform the namespace processing as defined in . </dd>
+ * <dt><code>false</code></dt>
+ * <dd>[<em>optional</em>] Do not perform the namespace processing. </dd>
+ * </dl></dd>
+ * <dt>
+ * <code>"namespace-declarations"</code></dt>
+ * <dd> This parameter has no effect if the
+ * parameter "namespaces" is set to <code>false</code>.
+ * <dl>
+ * <dt><code>true</code></dt>
+ * <dd>[<em>required</em>] (<em>default</em>) Include namespace declaration attributes, specified or defaulted from
+ * the schema, in the document. See also the sections "Declaring Namespaces"
+ * in [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
+ * and [<a href='http://www.w3.org/TR/2004/REC-xml-names11-20040204/'>XML Namespaces 1.1</a>]
+ * .</dd>
+ * <dt><code>false</code></dt>
+ * <dd>[<em>required</em>]Discard all namespace declaration attributes. The namespace prefixes (
+ * <code>Node.prefix</code>) are retained even if this parameter is set to
+ * <code>false</code>.</dd>
+ * </dl></dd>
+ * <dt><code>"normalize-characters"</code></dt>
+ * <dd>
+ * <dl>
+ * <dt><code>true</code></dt>
+ * <dd>[<em>optional</em>] <a href='http://www.w3.org/TR/2004/REC-xml11-20040204/#dt-fullnorm'>Fully
+ * normalized</a> the characters in the document as defined in appendix B of [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>]. </dd>
+ * <dt>
+ * <code>false</code></dt>
+ * <dd>[<em>required</em>] (<em>default</em>)Do not perform character normalization.</dd>
+ * </dl></dd>
+ * <dt><code>"schema-location"</code></dt>
+ * <dd>[<em>optional</em>] Represent a <code>DOMString</code> object containing a list of URIs,
+ * separated by whitespaces (characters matching the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-S'>nonterminal
+ * production S</a> defined in section 2.3 [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]), that
+ * represents the schemas against which validation should occur, i.e. the
+ * current schema. The types of schemas referenced in this list must match
+ * the type specified with <code>schema-type</code>, otherwise the behavior
+ * of an implementation is undefined. The schemas specified using this
+ * property take precedence to the schema information specified in the
+ * document itself. For namespace aware schema, if a schema specified using
+ * this property and a schema specified in the document instance (i.e. using
+ * the <code>schemaLocation</code> attribute) in a schema document (i.e.
+ * using schema <code>import</code> mechanisms) share the same
+ * <code>targetNamespace</code>, the schema specified by the user using this
+ * property will be used. If two schemas specified using this property share
+ * the same <code>targetNamespace</code> or have no namespace, the behavior
+ * is implementation dependent. If no location has been provided, this
+ * parameter is <code>null</code>.
+ * <p ><b>Note:</b> The <code>"schema-location"</code> parameter is ignored
+ * unless the "schema-type" parameter value is set. It is strongly
+ * recommended that <code>Document.documentURI</code> will be set so that an
+ * implementation can successfully resolve any external entities referenced. </dd>
+ * <dt>
+ * <code>"schema-type"</code></dt>
+ * <dd>[<em>optional</em>] Represent a <code>DOMString</code> object containing an absolute URI
+ * and representing the type of the schema language used to validate a
+ * document against. Note that no lexical checking is done on the absolute
+ * URI. If this parameter is not set, a default value may be provided by
+ * the implementation, based on the schema languages supported and on the
+ * schema language used at load time. If no value is provided, this
+ * parameter is <code>null</code>.
+ * <p ><b>Note:</b> For XML Schema [<a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/'>XML Schema Part 1</a>]
+ * , applications must use the value
+ * <code>"http://www.w3.org/2001/XMLSchema"</code>. For XML DTD [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>],
+ * applications must use the value
+ * <code>"http://www.w3.org/TR/REC-xml"</code>. Other schema languages are
+ * outside the scope of the W3C and therefore should recommend an absolute
+ * URI in order to use this method. </dd>
+ * <dt><code>"split-cdata-sections"</code></dt>
+ * <dd>
+ * <dl>
+ * <dt>
+ * <code>true</code></dt>
+ * <dd>[<em>required</em>] (<em>default</em>)Split CDATA sections containing the CDATA section termination marker
+ * ']]>'. When a CDATA section is split a warning is issued with a
+ * <code>DOMError.type</code> equals to
+ * <code>"cdata-sections-splitted"</code> and
+ * <code>DOMError.relatedData</code> equals to the first
+ * <code>CDATASection</code> node in document order resulting from the split.</dd>
+ * <dt>
+ * <code>false</code></dt>
+ * <dd>[<em>required</em>]Signal an error if a <code>CDATASection</code> contains an
+ * unrepresentable character.</dd>
+ * </dl></dd>
+ * <dt><code>"validate"</code></dt>
+ * <dd>
+ * <dl>
+ * <dt><code>true</code></dt>
+ * <dd>[<em>optional</em>] Require the validation against a schema (i.e. XML schema, DTD, any
+ * other type or representation of schema) of the document as it is being
+ * normalized as defined by [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. If
+ * validation errors are found, or no schema was found, the error handler is
+ * notified. Schema-normalized values will not be exposed according to the
+ * schema in used unless the parameter "datatype-normalization" is
+ * <code>true</code>. This parameter will reevaluate:
+ * <ul>
+ * <li> Attribute nodes with
+ * <code>Attr.specified</code> equals to <code>false</code>, as specified in
+ * the description of the <code>Attr</code> interface;
+ * </li>
+ * <li> The value of the
+ * attribute <code>Text.isElementContentWhitespace</code> for all
+ * <code>Text</code> nodes;
+ * </li>
+ * <li> The value of the attribute
+ * <code>Attr.isId</code> for all <code>Attr</code> nodes;
+ * </li>
+ * <li> The attributes
+ * <code>Element.schemaTypeInfo</code> and <code>Attr.schemaTypeInfo</code>.
+ * </li>
+ * </ul>
+ * <p ><b>Note:</b> "validate-if-schema" and "validate" are mutually
+ * exclusive, setting one of them to <code>true</code> will set the other
+ * one to <code>false</code>. Applications should also consider setting the
+ * parameter "well-formed" to <code>true</code>, which is the default for
+ * that option, when validating the document. </dd>
+ * <dt><code>false</code></dt>
+ * <dd>[<em>required</em>] (<em>default</em>) Do not accomplish schema processing, including the internal subset
+ * processing. Default attribute values information are kept. Note that
+ * validation might still happen if "validate-if-schema" is <code>true</code>
+ * . </dd>
+ * </dl></dd>
+ * <dt><code>"validate-if-schema"</code></dt>
+ * <dd>
+ * <dl>
+ * <dt><code>true</code></dt>
+ * <dd>[<em>optional</em>]Enable validation only if a declaration for the document element can be
+ * found in a schema (independently of where it is found, i.e. XML schema,
+ * DTD, or any other type or representation of schema). If validation is
+ * enabled, this parameter has the same behavior as the parameter "validate"
+ * set to <code>true</code>.
+ * <p ><b>Note:</b> "validate-if-schema" and "validate" are mutually
+ * exclusive, setting one of them to <code>true</code> will set the other
+ * one to <code>false</code>. </dd>
+ * <dt><code>false</code></dt>
+ * <dd>[<em>required</em>] (<em>default</em>) No schema processing should be performed if the document has a schema,
+ * including internal subset processing. Default attribute values
+ * information are kept. Note that validation must still happen if "validate
+ * " is <code>true</code>. </dd>
+ * </dl></dd>
+ * <dt><code>"well-formed"</code></dt>
+ * <dd>
+ * <dl>
+ * <dt><code>true</code></dt>
+ * <dd>[<em>required</em>] (<em>default</em>) Check if all nodes are XML well formed according to the XML version in
+ * use in <code>Document.xmlVersion</code>:
+ * <ul>
+ * <li> check if the attribute
+ * <code>Node.nodeName</code> contains invalid characters according to its
+ * node type and generate a <code>DOMError</code> of type
+ * <code>"wf-invalid-character-in-node-name"</code>, with a
+ * <code>DOMError.SEVERITY_ERROR</code> severity, if necessary;
+ * </li>
+ * <li> check if
+ * the text content inside <code>Attr</code>, <code>Element</code>,
+ * <code>Comment</code>, <code>Text</code>, <code>CDATASection</code> nodes
+ * for invalid characters and generate a <code>DOMError</code> of type
+ * <code>"wf-invalid-character"</code>, with a
+ * <code>DOMError.SEVERITY_ERROR</code> severity, if necessary;
+ * </li>
+ * <li> check if
+ * the data inside <code>ProcessingInstruction</code> nodes for invalid
+ * characters and generate a <code>DOMError</code> of type
+ * <code>"wf-invalid-character"</code>, with a
+ * <code>DOMError.SEVERITY_ERROR</code> severity, if necessary;
+ * </li>
+ * </ul></dd>
+ * <dt>
+ * <code>false</code></dt>
+ * <dd>[<em>optional</em>] Do not check for XML well-formedness. </dd>
+ * </dl></dd>
+ * </dl>
+ * <p> The resolution of the system identifiers associated with entities is
+ * done using <code>Document.documentURI</code>. However, when the feature
+ * "LS" defined in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407'>DOM Level 3 Load and Save</a>]
+ * is supported by the DOM implementation, the parameter
+ * "resource-resolver" can also be used on <code>DOMConfiguration</code>
+ * objects attached to <code>Document</code> nodes. If this parameter is
+ * set, <code>Document.normalizeDocument()</code> will invoke the resource
+ * resolver instead of using <code>Document.documentURI</code>.
+ * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
+ * @since DOM Level 3
+ */
+public interface DOMConfiguration {
+ /**
+ * Set the value of a parameter.
+ * @param name The name of the parameter to set.
+ * @param value The new value or <code>null</code> if the user wishes to
+ * unset the parameter. While the type of the value parameter is
+ * defined as <code>DOMUserData</code>, the object type must match the
+ * type defined by the definition of the parameter. For example, if
+ * the parameter is "error-handler", the value must be of type
+ * <code>DOMErrorHandler</code>.
+ * @exception DOMException
+ * NOT_FOUND_ERR: Raised when the parameter name is not recognized.
+ * <br> NOT_SUPPORTED_ERR: Raised when the parameter name is recognized
+ * but the requested value cannot be set.
+ * <br> TYPE_MISMATCH_ERR: Raised if the value type for this parameter
+ * name is incompatible with the expected value type.
+ */
+ public void setParameter(String name,
+ Object value)
+ throws DOMException;
+
+ /**
+ * Return the value of a parameter if known.
+ * @param name The name of the parameter.
+ * @return The current object associated with the specified parameter or
+ * <code>null</code> if no object has been associated or if the
+ * parameter is not supported.
+ * @exception DOMException
+ * NOT_FOUND_ERR: Raised when the parameter name is not recognized.
+ */
+ public Object getParameter(String name)
+ throws DOMException;
+
+ /**
+ * Check if setting a parameter to a specific value is supported.
+ * @param name The name of the parameter to check.
+ * @param value An object. if <code>null</code>, the returned value is
+ * <code>true</code>.
+ * @return <code>true</code> if the parameter could be successfully set
+ * to the specified value, or <code>false</code> if the parameter is
+ * not recognized or the requested value is not supported. This does
+ * not change the current value of the parameter itself.
+ */
+ public boolean canSetParameter(String name,
+ Object value);
+
+ /**
+ * The list of the parameters supported by this
+ * <code>DOMConfiguration</code> object and for which at least one value
+ * can be set by the application. Note that this list can also contain
+ * parameter names defined outside this specification.
+ */
+ public DOMStringList getParameterNames();
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMError.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMError.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMError.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMError.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * <code>DOMError</code> is an interface that describes an error.
+ * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
+ * @since DOM Level 3
+ */
+public interface DOMError {
+ // ErrorSeverity
+ /**
+ * The severity of the error described by the <code>DOMError</code> is
+ * warning. A <code>SEVERITY_WARNING</code> will not cause the
+ * processing to stop, unless <code>DOMErrorHandler.handleError()</code>
+ * returns <code>false</code>.
+ */
+ public static final short SEVERITY_WARNING = 1;
+ /**
+ * The severity of the error described by the <code>DOMError</code> is
+ * error. A <code>SEVERITY_ERROR</code> may not cause the processing to
+ * stop if the error can be recovered, unless
+ * <code>DOMErrorHandler.handleError()</code> returns <code>false</code>.
+ */
+ public static final short SEVERITY_ERROR = 2;
+ /**
+ * The severity of the error described by the <code>DOMError</code> is
+ * fatal error. A <code>SEVERITY_FATAL_ERROR</code> will cause the
+ * normal processing to stop. The return value of
+ * <code>DOMErrorHandler.handleError()</code> is ignored unless the
+ * implementation chooses to continue, in which case the behavior
+ * becomes undefined.
+ */
+ public static final short SEVERITY_FATAL_ERROR = 3;
+
+ /**
+ * The severity of the error, either <code>SEVERITY_WARNING</code>,
+ * <code>SEVERITY_ERROR</code>, or <code>SEVERITY_FATAL_ERROR</code>.
+ */
+ public short getSeverity();
+
+ /**
+ * An implementation specific string describing the error that occurred.
+ */
+ public String getMessage();
+
+ /**
+ * A <code>DOMString</code> indicating which related data is expected in
+ * <code>relatedData</code>. Users should refer to the specification of
+ * the error in order to find its <code>DOMString</code> type and
+ * <code>relatedData</code> definitions if any.
+ * <p ><b>Note:</b> As an example,
+ * <code>Document.normalizeDocument()</code> does generate warnings when
+ * the "split-cdata-sections" parameter is in use. Therefore, the method
+ * generates a <code>SEVERITY_WARNING</code> with <code>type</code>
+ * <code>"cdata-sections-splitted"</code> and the first
+ * <code>CDATASection</code> node in document order resulting from the
+ * split is returned by the <code>relatedData</code> attribute.
+ */
+ public String getType();
+
+ /**
+ * The related platform dependent exception if any.
+ */
+ public Object getRelatedException();
+
+ /**
+ * The related <code>DOMError.type</code> dependent data if any.
+ */
+ public Object getRelatedData();
+
+ /**
+ * The location of the error.
+ */
+ public DOMLocator getLocation();
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMErrorHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMErrorHandler.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMErrorHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMErrorHandler.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * <code>DOMErrorHandler</code> is a callback interface that the DOM
+ * implementation can call when reporting errors that happens while
+ * processing XML data, or when doing some other processing (e.g. validating
+ * a document). A <code>DOMErrorHandler</code> object can be attached to a
+ * <code>Document</code> using the "error-handler" on the
+ * <code>DOMConfiguration</code> interface. If more than one error needs to
+ * be reported during an operation, the sequence and numbers of the errors
+ * passed to the error handler are implementation dependent.
+ * <p> The application that is using the DOM implementation is expected to
+ * implement this interface.
+ * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
+ * @since DOM Level 3
+ */
+public interface DOMErrorHandler {
+ /**
+ * This method is called on the error handler when an error occurs.
+ * <br> If an exception is thrown from this method, it is considered to be
+ * equivalent of returning <code>true</code>.
+ * @param error The error object that describes the error. This object
+ * may be reused by the DOM implementation across multiple calls to
+ * the <code>handleError</code> method.
+ * @return If the <code>handleError</code> method returns
+ * <code>false</code>, the DOM implementation should stop the current
+ * processing when possible. If the method returns <code>true</code>,
+ * the processing may continue depending on
+ * <code>DOMError.severity</code>.
+ */
+ public boolean handleError(DOMError error);
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * DOM operations only raise exceptions in "exceptional" circumstances, i.e.,
+ * when an operation is impossible to perform (either for logical reasons,
+ * because data is lost, or because the implementation has become unstable).
+ * In general, DOM methods return specific error values in ordinary
+ * processing situations, such as out-of-bound errors when using
+ * <code>NodeList</code>.
+ * <p>Implementations should raise other exceptions under other circumstances.
+ * For example, implementations should raise an implementation-dependent
+ * exception if a <code>null</code> argument is passed when <code>null</code>
+ * was not expected.
+ * <p>Some languages and object systems do not support the concept of
+ * exceptions. For such systems, error conditions may be indicated using
+ * native error reporting mechanisms. For some bindings, for example,
+ * methods may return error codes similar to those listed in the
+ * corresponding method descriptions.
+ * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
+ */
+public class DOMException extends RuntimeException {
+ public DOMException(short code, String message) {
+ super(message);
+ this.code = code;
+ }
+ public short code;
+ // ExceptionCode
+ /**
+ * If index or size is negative, or greater than the allowed value.
+ */
+ public static final short INDEX_SIZE_ERR = 1;
+ /**
+ * If the specified range of text does not fit into a
+ * <code>DOMString</code>.
+ */
+ public static final short DOMSTRING_SIZE_ERR = 2;
+ /**
+ * If any <code>Node</code> is inserted somewhere it doesn't belong.
+ */
+ public static final short HIERARCHY_REQUEST_ERR = 3;
+ /**
+ * If a <code>Node</code> is used in a different document than the one
+ * that created it (that doesn't support it).
+ */
+ public static final short WRONG_DOCUMENT_ERR = 4;
+ /**
+ * If an invalid or illegal character is specified, such as in an XML name.
+ */
+ public static final short INVALID_CHARACTER_ERR = 5;
+ /**
+ * If data is specified for a <code>Node</code> which does not support
+ * data.
+ */
+ public static final short NO_DATA_ALLOWED_ERR = 6;
+ /**
+ * If an attempt is made to modify an object where modifications are not
+ * allowed.
+ */
+ public static final short NO_MODIFICATION_ALLOWED_ERR = 7;
+ /**
+ * If an attempt is made to reference a <code>Node</code> in a context
+ * where it does not exist.
+ */
+ public static final short NOT_FOUND_ERR = 8;
+ /**
+ * If the implementation does not support the requested type of object or
+ * operation.
+ */
+ public static final short NOT_SUPPORTED_ERR = 9;
+ /**
+ * If an attempt is made to add an attribute that is already in use
+ * elsewhere.
+ */
+ public static final short INUSE_ATTRIBUTE_ERR = 10;
+ /**
+ * If an attempt is made to use an object that is not, or is no longer,
+ * usable.
+ * @since DOM Level 2
+ */
+ public static final short INVALID_STATE_ERR = 11;
+ /**
+ * If an invalid or illegal string is specified.
+ * @since DOM Level 2
+ */
+ public static final short SYNTAX_ERR = 12;
+ /**
+ * If an attempt is made to modify the type of the underlying object.
+ * @since DOM Level 2
+ */
+ public static final short INVALID_MODIFICATION_ERR = 13;
+ /**
+ * If an attempt is made to create or change an object in a way which is
+ * incorrect with regard to namespaces.
+ * @since DOM Level 2
+ */
+ public static final short NAMESPACE_ERR = 14;
+ /**
+ * If a parameter or an operation is not supported by the underlying
+ * object.
+ * @since DOM Level 2
+ */
+ public static final short INVALID_ACCESS_ERR = 15;
+ /**
+ * If a call to a method such as <code>insertBefore</code> or
+ * <code>removeChild</code> would make the <code>Node</code> invalid
+ * with respect to "partial validity", this exception would be raised
+ * and the operation would not be done. This code is used in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Val-20040127/'>DOM Level 3 Validation</a>]
+ * . Refer to this specification for further information.
+ * @since DOM Level 3
+ */
+ public static final short VALIDATION_ERR = 16;
+ /**
+ * If the type of an object is incompatible with the expected type of the
+ * parameter associated to the object.
+ * @since DOM Level 3
+ */
+ public static final short TYPE_MISMATCH_ERR = 17;
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMImplementation.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMImplementation.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMImplementation.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMImplementation.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * The <code>DOMImplementation</code> interface provides a number of methods
+ * for performing operations that are independent of any particular instance
+ * of the document object model.
+ * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
+ */
+public interface DOMImplementation {
+ /**
+ * Test if the DOM implementation implements a specific feature and
+ * version, as specified in .
+ * @param feature The name of the feature to test.
+ * @param version This is the version number of the feature to test.
+ * @return <code>true</code> if the feature is implemented in the
+ * specified version, <code>false</code> otherwise.
+ */
+ public boolean hasFeature(String feature,
+ String version);
+
+ /**
+ * Creates an empty <code>DocumentType</code> node. Entity declarations
+ * and notations are not made available. Entity reference expansions and
+ * default attribute additions do not occur..
+ * @param qualifiedName The qualified name of the document type to be
+ * created.
+ * @param publicId The external subset public identifier.
+ * @param systemId The external subset system identifier.
+ * @return A new <code>DocumentType</code> node with
+ * <code>Node.ownerDocument</code> set to <code>null</code>.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified qualified name is not
+ * an XML name according to [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>].
+ * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
+ * malformed.
+ * <br>NOT_SUPPORTED_ERR: May be raised if the implementation does not
+ * support the feature "XML" and the language exposed through the
+ * Document does not support XML Namespaces (such as [<a href='http://www.w3.org/TR/1999/REC-html401-19991224/'>HTML 4.01</a>]).
+ * @since DOM Level 2
+ */
+ public DocumentType createDocumentType(String qualifiedName,
+ String publicId,
+ String systemId)
+ throws DOMException;
+
+ /**
+ * Creates a DOM Document object of the specified type with its document
+ * element.
+ * <br>Note that based on the <code>DocumentType</code> given to create
+ * the document, the implementation may instantiate specialized
+ * <code>Document</code> objects that support additional features than
+ * the "Core", such as "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
+ * . On the other hand, setting the <code>DocumentType</code> after the
+ * document was created makes this very unlikely to happen.
+ * Alternatively, specialized <code>Document</code> creation methods,
+ * such as <code>createHTMLDocument</code> [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
+ * , can be used to obtain specific types of <code>Document</code>
+ * objects.
+ * @param namespaceURI The namespace URI of the document element to
+ * create or <code>null</code>.
+ * @param qualifiedName The qualified name of the document element to be
+ * created or <code>null</code>.
+ * @param doctype The type of document to be created or <code>null</code>.
+ * When <code>doctype</code> is not <code>null</code>, its
+ * <code>Node.ownerDocument</code> attribute is set to the document
+ * being created.
+ * @return A new <code>Document</code> object with its document element.
+ * If the <code>NamespaceURI</code>, <code>qualifiedName</code>, and
+ * <code>doctype</code> are <code>null</code>, the returned
+ * <code>Document</code> is empty with no document element.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified qualified name is not
+ * an XML name according to [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>].
+ * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
+ * malformed, if the <code>qualifiedName</code> has a prefix and the
+ * <code>namespaceURI</code> is <code>null</code>, or if the
+ * <code>qualifiedName</code> is <code>null</code> and the
+ * <code>namespaceURI</code> is different from <code>null</code>, or
+ * if the <code>qualifiedName</code> has a prefix that is "xml" and
+ * the <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'>
+ * http://www.w3.org/XML/1998/namespace</a>" [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
+ * , or if the DOM implementation does not support the
+ * <code>"XML"</code> feature but a non-null namespace URI was
+ * provided, since namespaces were defined by XML.
+ * <br>WRONG_DOCUMENT_ERR: Raised if <code>doctype</code> has already
+ * been used with a different document or was created from a different
+ * implementation.
+ * <br>NOT_SUPPORTED_ERR: May be raised if the implementation does not
+ * support the feature "XML" and the language exposed through the
+ * Document does not support XML Namespaces (such as [<a href='http://www.w3.org/TR/1999/REC-html401-19991224/'>HTML 4.01</a>]).
+ * @since DOM Level 2
+ */
+ public Document createDocument(String namespaceURI,
+ String qualifiedName,
+ DocumentType doctype)
+ throws DOMException;
+
+ /**
+ * This method returns a specialized object which implements the
+ * specialized APIs of the specified feature and version, as specified
+ * in . The specialized object may also be obtained by using
+ * binding-specific casting methods but is not necessarily expected to,
+ * as discussed in . This method also allow the implementation to
+ * provide specialized objects which do not support the
+ * <code>DOMImplementation</code> interface.
+ * @param feature The name of the feature requested. Note that any plus
+ * sign "+" prepended to the name of the feature will be ignored since
+ * it is not significant in the context of this method.
+ * @param version This is the version number of the feature to test.
+ * @return Returns an object which implements the specialized APIs of
+ * the specified feature and version, if any, or <code>null</code> if
+ * there is no object which implements interfaces associated with that
+ * feature. If the <code>DOMObject</code> returned by this method
+ * implements the <code>DOMImplementation</code> interface, it must
+ * delegate to the primary core <code>DOMImplementation</code> and not
+ * return results inconsistent with the primary core
+ * <code>DOMImplementation</code> such as <code>hasFeature</code>,
+ * <code>getFeature</code>, etc.
+ * @since DOM Level 3
+ */
+ public Object getFeature(String feature,
+ String version);
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMImplementationList.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMImplementationList.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMImplementationList.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMImplementationList.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * The <code>DOMImplementationList</code> interface provides the abstraction
+ * of an ordered collection of DOM implementations, without defining or
+ * constraining how this collection is implemented. The items in the
+ * <code>DOMImplementationList</code> are accessible via an integral index,
+ * starting from 0.
+ * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
+ * @since DOM Level 3
+ */
+public interface DOMImplementationList {
+ /**
+ * Returns the <code>index</code>th item in the collection. If
+ * <code>index</code> is greater than or equal to the number of
+ * <code>DOMImplementation</code>s in the list, this returns
+ * <code>null</code>.
+ * @param index Index into the collection.
+ * @return The <code>DOMImplementation</code> at the <code>index</code>
+ * th position in the <code>DOMImplementationList</code>, or
+ * <code>null</code> if that is not a valid index.
+ */
+ public DOMImplementation item(int index);
+
+ /**
+ * The number of <code>DOMImplementation</code>s in the list. The range
+ * of valid child node indices is 0 to <code>length-1</code> inclusive.
+ */
+ public int getLength();
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMImplementationSource.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMImplementationSource.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMImplementationSource.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMImplementationSource.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * This interface permits a DOM implementer to supply one or more
+ * implementations, based upon requested features and versions, as specified
+ * in . Each implemented <code>DOMImplementationSource</code> object is
+ * listed in the binding-specific list of available sources so that its
+ * <code>DOMImplementation</code> objects are made available.
+ * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
+ * @since DOM Level 3
+ */
+public interface DOMImplementationSource {
+ /**
+ * A method to request the first DOM implementation that supports the
+ * specified features.
+ * @param features A string that specifies which features and versions
+ * are required. This is a space separated list in which each feature
+ * is specified by its name optionally followed by a space and a
+ * version number. This method returns the first item of the list
+ * returned by <code>getDOMImplementationList</code>. As an example,
+ * the string <code>"XML 3.0 Traversal +Events 2.0"</code> will
+ * request a DOM implementation that supports the module "XML" for its
+ * 3.0 version, a module that support of the "Traversal" module for
+ * any version, and the module "Events" for its 2.0 version. The
+ * module "Events" must be accessible using the method
+ * <code>Node.getFeature()</code> and
+ * <code>DOMImplementation.getFeature()</code>.
+ * @return The first DOM implementation that support the desired
+ * features, or <code>null</code> if this source has none.
+ */
+ public DOMImplementation getDOMImplementation(String features);
+
+ /**
+ * A method to request a list of DOM implementations that support the
+ * specified features and versions, as specified in .
+ * @param features A string that specifies which features and versions
+ * are required. This is a space separated list in which each feature
+ * is specified by its name optionally followed by a space and a
+ * version number. This is something like: "XML 3.0 Traversal +Events
+ * 2.0"
+ * @return A list of DOM implementations that support the desired
+ * features.
+ */
+ public DOMImplementationList getDOMImplementationList(String features);
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMLocator.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMLocator.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMLocator.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMLocator.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * <code>DOMLocator</code> is an interface that describes a location (e.g.
+ * where an error occurred).
+ * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
+ * @since DOM Level 3
+ */
+public interface DOMLocator {
+ /**
+ * The line number this locator is pointing to, or <code>-1</code> if
+ * there is no column number available.
+ */
+ public int getLineNumber();
+
+ /**
+ * The column number this locator is pointing to, or <code>-1</code> if
+ * there is no column number available.
+ */
+ public int getColumnNumber();
+
+ /**
+ * The byte offset into the input source this locator is pointing to or
+ * <code>-1</code> if there is no byte offset available.
+ */
+ public int getByteOffset();
+
+ /**
+ * The UTF-16, as defined in [Unicode] and Amendment 1 of [ISO/IEC 10646], offset into the input source this locator is pointing to or
+ * <code>-1</code> if there is no UTF-16 offset available.
+ */
+ public int getUtf16Offset();
+
+ /**
+ * The node this locator is pointing to, or <code>null</code> if no node
+ * is available.
+ */
+ public Node getRelatedNode();
+
+ /**
+ * The URI this locator is pointing to, or <code>null</code> if no URI is
+ * available.
+ */
+ public String getUri();
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMStringList.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMStringList.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMStringList.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DOMStringList.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * The <code>DOMStringList</code> interface provides the abstraction of an
+ * ordered collection of <code>DOMString</code> values, without defining or
+ * constraining how this collection is implemented. The items in the
+ * <code>DOMStringList</code> are accessible via an integral index, starting
+ * from 0.
+ * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
+ * @since DOM Level 3
+ */
+public interface DOMStringList {
+ /**
+ * Returns the <code>index</code>th item in the collection. If
+ * <code>index</code> is greater than or equal to the number of
+ * <code>DOMString</code>s in the list, this returns <code>null</code>.
+ * @param index Index into the collection.
+ * @return The <code>DOMString</code> at the <code>index</code>th
+ * position in the <code>DOMStringList</code>, or <code>null</code> if
+ * that is not a valid index.
+ */
+ public String item(int index);
+
+ /**
+ * The number of <code>DOMString</code>s in the list. The range of valid
+ * child node indices is 0 to <code>length-1</code> inclusive.
+ */
+ public int getLength();
+
+ /**
+ * Test if a string is part of this <code>DOMStringList</code>.
+ * @param str The string to look for.
+ * @return <code>true</code> if the string has been found,
+ * <code>false</code> otherwise.
+ */
+ public boolean contains(String str);
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/Document.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/Document.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/Document.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/Document.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,814 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * The <code>Document</code> interface represents the entire HTML or XML
+ * document. Conceptually, it is the root of the document tree, and provides
+ * the primary access to the document's data.
+ * <p>Since elements, text nodes, comments, processing instructions, etc.
+ * cannot exist outside the context of a <code>Document</code>, the
+ * <code>Document</code> interface also contains the factory methods needed
+ * to create these objects. The <code>Node</code> objects created have a
+ * <code>ownerDocument</code> attribute which associates them with the
+ * <code>Document</code> within whose context they were created.
+ * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
+ */
+public interface Document extends Node {
+ /**
+ * The Document Type Declaration (see <code>DocumentType</code>)
+ * associated with this document. For XML documents without a document
+ * type declaration this returns <code>null</code>. For HTML documents,
+ * a <code>DocumentType</code> object may be returned, independently of
+ * the presence or absence of document type declaration in the HTML
+ * document.
+ * <br>This provides direct access to the <code>DocumentType</code> node,
+ * child node of this <code>Document</code>. This node can be set at
+ * document creation time and later changed through the use of child
+ * nodes manipulation methods, such as <code>Node.insertBefore</code>,
+ * or <code>Node.replaceChild</code>. Note, however, that while some
+ * implementations may instantiate different types of
+ * <code>Document</code> objects supporting additional features than the
+ * "Core", such as "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
+ * , based on the <code>DocumentType</code> specified at creation time,
+ * changing it afterwards is very unlikely to result in a change of the
+ * features supported.
+ * @version DOM Level 3
+ */
+ public DocumentType getDoctype();
+
+ /**
+ * The <code>DOMImplementation</code> object that handles this document. A
+ * DOM application may use objects from multiple implementations.
+ */
+ public DOMImplementation getImplementation();
+
+ /**
+ * This is a convenience attribute that allows direct access to the child
+ * node that is the document element of the document.
+ */
+ public Element getDocumentElement();
+
+ /**
+ * Creates an element of the type specified. Note that the instance
+ * returned implements the <code>Element</code> interface, so attributes
+ * can be specified directly on the returned object.
+ * <br>In addition, if there are known attributes with default values,
+ * <code>Attr</code> nodes representing them are automatically created
+ * and attached to the element.
+ * <br>To create an element with a qualified name and namespace URI, use
+ * the <code>createElementNS</code> method.
+ * @param tagName The name of the element type to instantiate. For XML,
+ * this is case-sensitive, otherwise it depends on the
+ * case-sensitivity of the markup language in use. In that case, the
+ * name is mapped to the canonical form of that markup by the DOM
+ * implementation.
+ * @return A new <code>Element</code> object with the
+ * <code>nodeName</code> attribute set to <code>tagName</code>, and
+ * <code>localName</code>, <code>prefix</code>, and
+ * <code>namespaceURI</code> set to <code>null</code>.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified name is not an XML
+ * name according to the XML version in use specified in the
+ * <code>Document.xmlVersion</code> attribute.
+ */
+ public Element createElement(String tagName)
+ throws DOMException;
+
+ /**
+ * Creates an empty <code>DocumentFragment</code> object.
+ * @return A new <code>DocumentFragment</code>.
+ */
+ public DocumentFragment createDocumentFragment();
+
+ /**
+ * Creates a <code>Text</code> node given the specified string.
+ * @param data The data for the node.
+ * @return The new <code>Text</code> object.
+ */
+ public Text createTextNode(String data);
+
+ /**
+ * Creates a <code>Comment</code> node given the specified string.
+ * @param data The data for the node.
+ * @return The new <code>Comment</code> object.
+ */
+ public Comment createComment(String data);
+
+ /**
+ * Creates a <code>CDATASection</code> node whose value is the specified
+ * string.
+ * @param data The data for the <code>CDATASection</code> contents.
+ * @return The new <code>CDATASection</code> object.
+ * @exception DOMException
+ * NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
+ */
+ public CDATASection createCDATASection(String data)
+ throws DOMException;
+
+ /**
+ * Creates a <code>ProcessingInstruction</code> node given the specified
+ * name and data strings.
+ * @param target The target part of the processing instruction.Unlike
+ * <code>Document.createElementNS</code> or
+ * <code>Document.createAttributeNS</code>, no namespace well-formed
+ * checking is done on the target name. Applications should invoke
+ * <code>Document.normalizeDocument()</code> with the parameter "
+ * namespaces" set to <code>true</code> in order to ensure that the
+ * target name is namespace well-formed.
+ * @param data The data for the node.
+ * @return The new <code>ProcessingInstruction</code> object.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified target is not an XML
+ * name according to the XML version in use specified in the
+ * <code>Document.xmlVersion</code> attribute.
+ * <br>NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
+ */
+ public ProcessingInstruction createProcessingInstruction(String target,
+ String data)
+ throws DOMException;
+
+ /**
+ * Creates an <code>Attr</code> of the given name. Note that the
+ * <code>Attr</code> instance can then be set on an <code>Element</code>
+ * using the <code>setAttributeNode</code> method.
+ * <br>To create an attribute with a qualified name and namespace URI, use
+ * the <code>createAttributeNS</code> method.
+ * @param name The name of the attribute.
+ * @return A new <code>Attr</code> object with the <code>nodeName</code>
+ * attribute set to <code>name</code>, and <code>localName</code>,
+ * <code>prefix</code>, and <code>namespaceURI</code> set to
+ * <code>null</code>. The value of the attribute is the empty string.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified name is not an XML
+ * name according to the XML version in use specified in the
+ * <code>Document.xmlVersion</code> attribute.
+ */
+ public Attr createAttribute(String name)
+ throws DOMException;
+
+ /**
+ * Creates an <code>EntityReference</code> object. In addition, if the
+ * referenced entity is known, the child list of the
+ * <code>EntityReference</code> node is made the same as that of the
+ * corresponding <code>Entity</code> node.
+ * <p ><b>Note:</b> If any descendant of the <code>Entity</code> node has
+ * an unbound namespace prefix, the corresponding descendant of the
+ * created <code>EntityReference</code> node is also unbound; (its
+ * <code>namespaceURI</code> is <code>null</code>). The DOM Level 2 and
+ * 3 do not support any mechanism to resolve namespace prefixes in this
+ * case.
+ * @param name The name of the entity to reference.Unlike
+ * <code>Document.createElementNS</code> or
+ * <code>Document.createAttributeNS</code>, no namespace well-formed
+ * checking is done on the entity name. Applications should invoke
+ * <code>Document.normalizeDocument()</code> with the parameter "
+ * namespaces" set to <code>true</code> in order to ensure that the
+ * entity name is namespace well-formed.
+ * @return The new <code>EntityReference</code> object.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified name is not an XML
+ * name according to the XML version in use specified in the
+ * <code>Document.xmlVersion</code> attribute.
+ * <br>NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
+ */
+ public EntityReference createEntityReference(String name)
+ throws DOMException;
+
+ /**
+ * Returns a <code>NodeList</code> of all the <code>Elements</code> in
+ * document order with a given tag name and are contained in the
+ * document.
+ * @param tagname The name of the tag to match on. The special value "*"
+ * matches all tags. For XML, the <code>tagname</code> parameter is
+ * case-sensitive, otherwise it depends on the case-sensitivity of the
+ * markup language in use.
+ * @return A new <code>NodeList</code> object containing all the matched
+ * <code>Elements</code>.
+ */
+ public NodeList getElementsByTagName(String tagname);
+
+ /**
+ * Imports a node from another document to this document, without altering
+ * or removing the source node from the original document; this method
+ * creates a new copy of the source node. The returned node has no
+ * parent; (<code>parentNode</code> is <code>null</code>).
+ * <br>For all nodes, importing a node creates a node object owned by the
+ * importing document, with attribute values identical to the source
+ * node's <code>nodeName</code> and <code>nodeType</code>, plus the
+ * attributes related to namespaces (<code>prefix</code>,
+ * <code>localName</code>, and <code>namespaceURI</code>). As in the
+ * <code>cloneNode</code> operation, the source node is not altered.
+ * User data associated to the imported node is not carried over.
+ * However, if any <code>UserDataHandlers</code> has been specified
+ * along with the associated data these handlers will be called with the
+ * appropriate parameters before this method returns.
+ * <br>Additional information is copied as appropriate to the
+ * <code>nodeType</code>, attempting to mirror the behavior expected if
+ * a fragment of XML or HTML source was copied from one document to
+ * another, recognizing that the two documents may have different DTDs
+ * in the XML case. The following list describes the specifics for each
+ * type of node.
+ * <dl>
+ * <dt>ATTRIBUTE_NODE</dt>
+ * <dd>The <code>ownerElement</code> attribute
+ * is set to <code>null</code> and the <code>specified</code> flag is
+ * set to <code>true</code> on the generated <code>Attr</code>. The
+ * descendants of the source <code>Attr</code> are recursively imported
+ * and the resulting nodes reassembled to form the corresponding subtree.
+ * Note that the <code>deep</code> parameter has no effect on
+ * <code>Attr</code> nodes; they always carry their children with them
+ * when imported.</dd>
+ * <dt>DOCUMENT_FRAGMENT_NODE</dt>
+ * <dd>If the <code>deep</code> option
+ * was set to <code>true</code>, the descendants of the source
+ * <code>DocumentFragment</code> are recursively imported and the
+ * resulting nodes reassembled under the imported
+ * <code>DocumentFragment</code> to form the corresponding subtree.
+ * Otherwise, this simply generates an empty
+ * <code>DocumentFragment</code>.</dd>
+ * <dt>DOCUMENT_NODE</dt>
+ * <dd><code>Document</code>
+ * nodes cannot be imported.</dd>
+ * <dt>DOCUMENT_TYPE_NODE</dt>
+ * <dd><code>DocumentType</code>
+ * nodes cannot be imported.</dd>
+ * <dt>ELEMENT_NODE</dt>
+ * <dd><em>Specified</em> attribute nodes of the source element are imported, and the generated
+ * <code>Attr</code> nodes are attached to the generated
+ * <code>Element</code>. Default attributes are <em>not</em> copied, though if the document being imported into defines default
+ * attributes for this element name, those are assigned. If the
+ * <code>importNode</code> <code>deep</code> parameter was set to
+ * <code>true</code>, the descendants of the source element are
+ * recursively imported and the resulting nodes reassembled to form the
+ * corresponding subtree.</dd>
+ * <dt>ENTITY_NODE</dt>
+ * <dd><code>Entity</code> nodes can be
+ * imported, however in the current release of the DOM the
+ * <code>DocumentType</code> is readonly. Ability to add these imported
+ * nodes to a <code>DocumentType</code> will be considered for addition
+ * to a future release of the DOM.On import, the <code>publicId</code>,
+ * <code>systemId</code>, and <code>notationName</code> attributes are
+ * copied. If a <code>deep</code> import is requested, the descendants
+ * of the the source <code>Entity</code> are recursively imported and
+ * the resulting nodes reassembled to form the corresponding subtree.</dd>
+ * <dt>
+ * ENTITY_REFERENCE_NODE</dt>
+ * <dd>Only the <code>EntityReference</code> itself is
+ * copied, even if a <code>deep</code> import is requested, since the
+ * source and destination documents might have defined the entity
+ * differently. If the document being imported into provides a
+ * definition for this entity name, its value is assigned.</dd>
+ * <dt>NOTATION_NODE</dt>
+ * <dd>
+ * <code>Notation</code> nodes can be imported, however in the current
+ * release of the DOM the <code>DocumentType</code> is readonly. Ability
+ * to add these imported nodes to a <code>DocumentType</code> will be
+ * considered for addition to a future release of the DOM.On import, the
+ * <code>publicId</code> and <code>systemId</code> attributes are copied.
+ * Note that the <code>deep</code> parameter has no effect on this type
+ * of nodes since they cannot have any children.</dd>
+ * <dt>
+ * PROCESSING_INSTRUCTION_NODE</dt>
+ * <dd>The imported node copies its
+ * <code>target</code> and <code>data</code> values from those of the
+ * source node.Note that the <code>deep</code> parameter has no effect
+ * on this type of nodes since they cannot have any children.</dd>
+ * <dt>TEXT_NODE,
+ * CDATA_SECTION_NODE, COMMENT_NODE</dt>
+ * <dd>These three types of nodes inheriting
+ * from <code>CharacterData</code> copy their <code>data</code> and
+ * <code>length</code> attributes from those of the source node.Note
+ * that the <code>deep</code> parameter has no effect on these types of
+ * nodes since they cannot have any children.</dd>
+ * </dl>
+ * @param importedNode The node to import.
+ * @param deep If <code>true</code>, recursively import the subtree under
+ * the specified node; if <code>false</code>, import only the node
+ * itself, as explained above. This has no effect on nodes that cannot
+ * have any children, and on <code>Attr</code>, and
+ * <code>EntityReference</code> nodes.
+ * @return The imported node that belongs to this <code>Document</code>.
+ * @exception DOMException
+ * NOT_SUPPORTED_ERR: Raised if the type of node being imported is not
+ * supported.
+ * <br>INVALID_CHARACTER_ERR: Raised if one of the imported names is not
+ * an XML name according to the XML version in use specified in the
+ * <code>Document.xmlVersion</code> attribute. This may happen when
+ * importing an XML 1.1 [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>] element
+ * into an XML 1.0 document, for instance.
+ * @since DOM Level 2
+ */
+ public Node importNode(Node importedNode,
+ boolean deep)
+ throws DOMException;
+
+ /**
+ * Creates an element of the given qualified name and namespace URI.
+ * <br>Per [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
+ * , applications must use the value <code>null</code> as the
+ * namespaceURI parameter for methods if they wish to have no namespace.
+ * @param namespaceURI The namespace URI of the element to create.
+ * @param qualifiedName The qualified name of the element type to
+ * instantiate.
+ * @return A new <code>Element</code> object with the following
+ * attributes:
+ * <table border='1' cellpadding='3'>
+ * <tr>
+ * <th>Attribute</th>
+ * <th>Value</th>
+ * </tr>
+ * <tr>
+ * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeName</code></td>
+ * <td valign='top' rowspan='1' colspan='1'>
+ * <code>qualifiedName</code></td>
+ * </tr>
+ * <tr>
+ * <td valign='top' rowspan='1' colspan='1'><code>Node.namespaceURI</code></td>
+ * <td valign='top' rowspan='1' colspan='1'>
+ * <code>namespaceURI</code></td>
+ * </tr>
+ * <tr>
+ * <td valign='top' rowspan='1' colspan='1'><code>Node.prefix</code></td>
+ * <td valign='top' rowspan='1' colspan='1'>prefix, extracted
+ * from <code>qualifiedName</code>, or <code>null</code> if there is
+ * no prefix</td>
+ * </tr>
+ * <tr>
+ * <td valign='top' rowspan='1' colspan='1'><code>Node.localName</code></td>
+ * <td valign='top' rowspan='1' colspan='1'>local name, extracted from
+ * <code>qualifiedName</code></td>
+ * </tr>
+ * <tr>
+ * <td valign='top' rowspan='1' colspan='1'><code>Element.tagName</code></td>
+ * <td valign='top' rowspan='1' colspan='1'>
+ * <code>qualifiedName</code></td>
+ * </tr>
+ * </table>
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified
+ * <code>qualifiedName</code> is not an XML name according to the XML
+ * version in use specified in the <code>Document.xmlVersion</code>
+ * attribute.
+ * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is a
+ * malformed qualified name, if the <code>qualifiedName</code> has a
+ * prefix and the <code>namespaceURI</code> is <code>null</code>, or
+ * if the <code>qualifiedName</code> has a prefix that is "xml" and
+ * the <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'>
+ * http://www.w3.org/XML/1998/namespace</a>" [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
+ * , or if the <code>qualifiedName</code> or its prefix is "xmlns" and
+ * the <code>namespaceURI</code> is different from "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>", or if the <code>namespaceURI</code> is "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>" and neither the <code>qualifiedName</code> nor its prefix is "xmlns".
+ * <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not
+ * support the <code>"XML"</code> feature, since namespaces were
+ * defined by XML.
+ * @since DOM Level 2
+ */
+ public Element createElementNS(String namespaceURI,
+ String qualifiedName)
+ throws DOMException;
+
+ /**
+ * Creates an attribute of the given qualified name and namespace URI.
+ * <br>Per [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
+ * , applications must use the value <code>null</code> as the
+ * <code>namespaceURI</code> parameter for methods if they wish to have
+ * no namespace.
+ * @param namespaceURI The namespace URI of the attribute to create.
+ * @param qualifiedName The qualified name of the attribute to
+ * instantiate.
+ * @return A new <code>Attr</code> object with the following attributes:
+ * <table border='1' cellpadding='3'>
+ * <tr>
+ * <th>
+ * Attribute</th>
+ * <th>Value</th>
+ * </tr>
+ * <tr>
+ * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeName</code></td>
+ * <td valign='top' rowspan='1' colspan='1'>qualifiedName</td>
+ * </tr>
+ * <tr>
+ * <td valign='top' rowspan='1' colspan='1'>
+ * <code>Node.namespaceURI</code></td>
+ * <td valign='top' rowspan='1' colspan='1'><code>namespaceURI</code></td>
+ * </tr>
+ * <tr>
+ * <td valign='top' rowspan='1' colspan='1'>
+ * <code>Node.prefix</code></td>
+ * <td valign='top' rowspan='1' colspan='1'>prefix, extracted from
+ * <code>qualifiedName</code>, or <code>null</code> if there is no
+ * prefix</td>
+ * </tr>
+ * <tr>
+ * <td valign='top' rowspan='1' colspan='1'><code>Node.localName</code></td>
+ * <td valign='top' rowspan='1' colspan='1'>local name, extracted from
+ * <code>qualifiedName</code></td>
+ * </tr>
+ * <tr>
+ * <td valign='top' rowspan='1' colspan='1'><code>Attr.name</code></td>
+ * <td valign='top' rowspan='1' colspan='1'>
+ * <code>qualifiedName</code></td>
+ * </tr>
+ * <tr>
+ * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeValue</code></td>
+ * <td valign='top' rowspan='1' colspan='1'>the empty
+ * string</td>
+ * </tr>
+ * </table>
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified
+ * <code>qualifiedName</code> is not an XML name according to the XML
+ * version in use specified in the <code>Document.xmlVersion</code>
+ * attribute.
+ * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is a
+ * malformed qualified name, if the <code>qualifiedName</code> has a
+ * prefix and the <code>namespaceURI</code> is <code>null</code>, if
+ * the <code>qualifiedName</code> has a prefix that is "xml" and the
+ * <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'>
+ * http://www.w3.org/XML/1998/namespace</a>", if the <code>qualifiedName</code> or its prefix is "xmlns" and the
+ * <code>namespaceURI</code> is different from "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>", or if the <code>namespaceURI</code> is "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>" and neither the <code>qualifiedName</code> nor its prefix is "xmlns".
+ * <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not
+ * support the <code>"XML"</code> feature, since namespaces were
+ * defined by XML.
+ * @since DOM Level 2
+ */
+ public Attr createAttributeNS(String namespaceURI,
+ String qualifiedName)
+ throws DOMException;
+
+ /**
+ * Returns a <code>NodeList</code> of all the <code>Elements</code> with a
+ * given local name and namespace URI in document order.
+ * @param namespaceURI The namespace URI of the elements to match on. The
+ * special value <code>"*"</code> matches all namespaces.
+ * @param localName The local name of the elements to match on. The
+ * special value "*" matches all local names.
+ * @return A new <code>NodeList</code> object containing all the matched
+ * <code>Elements</code>.
+ * @since DOM Level 2
+ */
+ public NodeList getElementsByTagNameNS(String namespaceURI,
+ String localName);
+
+ /**
+ * Returns the <code>Element</code> that has an ID attribute with the
+ * given value. If no such element exists, this returns <code>null</code>
+ * . If more than one element has an ID attribute with that value, what
+ * is returned is undefined.
+ * <br> The DOM implementation is expected to use the attribute
+ * <code>Attr.isId</code> to determine if an attribute is of type ID.
+ * <p ><b>Note:</b> Attributes with the name "ID" or "id" are not of type
+ * ID unless so defined.
+ * @param elementId The unique <code>id</code> value for an element.
+ * @return The matching element or <code>null</code> if there is none.
+ * @since DOM Level 2
+ */
+ public Element getElementById(String elementId);
+
+ /**
+ * An attribute specifying the encoding used for this document at the time
+ * of the parsing. This is <code>null</code> when it is not known, such
+ * as when the <code>Document</code> was created in memory.
+ * @since DOM Level 3
+ */
+ public String getInputEncoding();
+
+ /**
+ * An attribute specifying, as part of the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'>XML declaration</a>, the encoding of this document. This is <code>null</code> when
+ * unspecified or when it is not known, such as when the
+ * <code>Document</code> was created in memory.
+ * @since DOM Level 3
+ */
+ public String getXmlEncoding();
+
+ /**
+ * An attribute specifying, as part of the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'>XML declaration</a>, whether this document is standalone. This is <code>false</code> when
+ * unspecified.
+ * <p ><b>Note:</b> No verification is done on the value when setting
+ * this attribute. Applications should use
+ * <code>Document.normalizeDocument()</code> with the "validate"
+ * parameter to verify if the value matches the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#sec-rmd'>validity
+ * constraint for standalone document declaration</a> as defined in [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>].
+ * @since DOM Level 3
+ */
+ public boolean getXmlStandalone();
+ /**
+ * An attribute specifying, as part of the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'>XML declaration</a>, whether this document is standalone. This is <code>false</code> when
+ * unspecified.
+ * <p ><b>Note:</b> No verification is done on the value when setting
+ * this attribute. Applications should use
+ * <code>Document.normalizeDocument()</code> with the "validate"
+ * parameter to verify if the value matches the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#sec-rmd'>validity
+ * constraint for standalone document declaration</a> as defined in [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>].
+ * @exception DOMException
+ * NOT_SUPPORTED_ERR: Raised if this document does not support the
+ * "XML" feature.
+ * @since DOM Level 3
+ */
+ public void setXmlStandalone(boolean xmlStandalone)
+ throws DOMException;
+
+ /**
+ * An attribute specifying, as part of the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'>XML declaration</a>, the version number of this document. If there is no declaration and if
+ * this document supports the "XML" feature, the value is
+ * <code>"1.0"</code>. If this document does not support the "XML"
+ * feature, the value is always <code>null</code>. Changing this
+ * attribute will affect methods that check for invalid characters in
+ * XML names. Application should invoke
+ * <code>Document.normalizeDocument()</code> in order to check for
+ * invalid characters in the <code>Node</code>s that are already part of
+ * this <code>Document</code>.
+ * <br> DOM applications may use the
+ * <code>DOMImplementation.hasFeature(feature, version)</code> method
+ * with parameter values "XMLVersion" and "1.0" (respectively) to
+ * determine if an implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. DOM
+ * applications may use the same method with parameter values
+ * "XMLVersion" and "1.1" (respectively) to determine if an
+ * implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>]. In both
+ * cases, in order to support XML, an implementation must also support
+ * the "XML" feature defined in this specification. <code>Document</code>
+ * objects supporting a version of the "XMLVersion" feature must not
+ * raise a <code>NOT_SUPPORTED_ERR</code> exception for the same version
+ * number when using <code>Document.xmlVersion</code>.
+ * @since DOM Level 3
+ */
+ public String getXmlVersion();
+ /**
+ * An attribute specifying, as part of the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'>XML declaration</a>, the version number of this document. If there is no declaration and if
+ * this document supports the "XML" feature, the value is
+ * <code>"1.0"</code>. If this document does not support the "XML"
+ * feature, the value is always <code>null</code>. Changing this
+ * attribute will affect methods that check for invalid characters in
+ * XML names. Application should invoke
+ * <code>Document.normalizeDocument()</code> in order to check for
+ * invalid characters in the <code>Node</code>s that are already part of
+ * this <code>Document</code>.
+ * <br> DOM applications may use the
+ * <code>DOMImplementation.hasFeature(feature, version)</code> method
+ * with parameter values "XMLVersion" and "1.0" (respectively) to
+ * determine if an implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. DOM
+ * applications may use the same method with parameter values
+ * "XMLVersion" and "1.1" (respectively) to determine if an
+ * implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>]. In both
+ * cases, in order to support XML, an implementation must also support
+ * the "XML" feature defined in this specification. <code>Document</code>
+ * objects supporting a version of the "XMLVersion" feature must not
+ * raise a <code>NOT_SUPPORTED_ERR</code> exception for the same version
+ * number when using <code>Document.xmlVersion</code>.
+ * @exception DOMException
+ * NOT_SUPPORTED_ERR: Raised if the version is set to a value that is
+ * not supported by this <code>Document</code> or if this document
+ * does not support the "XML" feature.
+ * @since DOM Level 3
+ */
+ public void setXmlVersion(String xmlVersion)
+ throws DOMException;
+
+ /**
+ * An attribute specifying whether error checking is enforced or not. When
+ * set to <code>false</code>, the implementation is free to not test
+ * every possible error case normally defined on DOM operations, and not
+ * raise any <code>DOMException</code> on DOM operations or report
+ * errors while using <code>Document.normalizeDocument()</code>. In case
+ * of error, the behavior is undefined. This attribute is
+ * <code>true</code> by default.
+ * @since DOM Level 3
+ */
+ public boolean getStrictErrorChecking();
+ /**
+ * An attribute specifying whether error checking is enforced or not. When
+ * set to <code>false</code>, the implementation is free to not test
+ * every possible error case normally defined on DOM operations, and not
+ * raise any <code>DOMException</code> on DOM operations or report
+ * errors while using <code>Document.normalizeDocument()</code>. In case
+ * of error, the behavior is undefined. This attribute is
+ * <code>true</code> by default.
+ * @since DOM Level 3
+ */
+ public void setStrictErrorChecking(boolean strictErrorChecking);
+
+ /**
+ * The location of the document or <code>null</code> if undefined or if
+ * the <code>Document</code> was created using
+ * <code>DOMImplementation.createDocument</code>. No lexical checking is
+ * performed when setting this attribute; this could result in a
+ * <code>null</code> value returned when using <code>Node.baseURI</code>
+ * .
+ * <br> Beware that when the <code>Document</code> supports the feature
+ * "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
+ * , the href attribute of the HTML BASE element takes precedence over
+ * this attribute when computing <code>Node.baseURI</code>.
+ * @since DOM Level 3
+ */
+ public String getDocumentURI();
+ /**
+ * The location of the document or <code>null</code> if undefined or if
+ * the <code>Document</code> was created using
+ * <code>DOMImplementation.createDocument</code>. No lexical checking is
+ * performed when setting this attribute; this could result in a
+ * <code>null</code> value returned when using <code>Node.baseURI</code>
+ * .
+ * <br> Beware that when the <code>Document</code> supports the feature
+ * "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
+ * , the href attribute of the HTML BASE element takes precedence over
+ * this attribute when computing <code>Node.baseURI</code>.
+ * @since DOM Level 3
+ */
+ public void setDocumentURI(String documentURI);
+
+ /**
+ * Attempts to adopt a node from another document to this document. If
+ * supported, it changes the <code>ownerDocument</code> of the source
+ * node, its children, as well as the attached attribute nodes if there
+ * are any. If the source node has a parent it is first removed from the
+ * child list of its parent. This effectively allows moving a subtree
+ * from one document to another (unlike <code>importNode()</code> which
+ * create a copy of the source node instead of moving it). When it
+ * fails, applications should use <code>Document.importNode()</code>
+ * instead. Note that if the adopted node is already part of this
+ * document (i.e. the source and target document are the same), this
+ * method still has the effect of removing the source node from the
+ * child list of its parent, if any. The following list describes the
+ * specifics for each type of node.
+ * <dl>
+ * <dt>ATTRIBUTE_NODE</dt>
+ * <dd>The
+ * <code>ownerElement</code> attribute is set to <code>null</code> and
+ * the <code>specified</code> flag is set to <code>true</code> on the
+ * adopted <code>Attr</code>. The descendants of the source
+ * <code>Attr</code> are recursively adopted.</dd>
+ * <dt>DOCUMENT_FRAGMENT_NODE</dt>
+ * <dd>The
+ * descendants of the source node are recursively adopted.</dd>
+ * <dt>DOCUMENT_NODE</dt>
+ * <dd>
+ * <code>Document</code> nodes cannot be adopted.</dd>
+ * <dt>DOCUMENT_TYPE_NODE</dt>
+ * <dd>
+ * <code>DocumentType</code> nodes cannot be adopted.</dd>
+ * <dt>ELEMENT_NODE</dt>
+ * <dd><em>Specified</em> attribute nodes of the source element are adopted. Default attributes
+ * are discarded, though if the document being adopted into defines
+ * default attributes for this element name, those are assigned. The
+ * descendants of the source element are recursively adopted.</dd>
+ * <dt>ENTITY_NODE</dt>
+ * <dd>
+ * <code>Entity</code> nodes cannot be adopted.</dd>
+ * <dt>ENTITY_REFERENCE_NODE</dt>
+ * <dd>Only
+ * the <code>EntityReference</code> node itself is adopted, the
+ * descendants are discarded, since the source and destination documents
+ * might have defined the entity differently. If the document being
+ * imported into provides a definition for this entity name, its value
+ * is assigned.</dd>
+ * <dt>NOTATION_NODE</dt>
+ * <dd><code>Notation</code> nodes cannot be
+ * adopted.</dd>
+ * <dt>PROCESSING_INSTRUCTION_NODE, TEXT_NODE, CDATA_SECTION_NODE,
+ * COMMENT_NODE</dt>
+ * <dd>These nodes can all be adopted. No specifics.</dd>
+ * </dl>
+ * <p ><b>Note:</b> Since it does not create new nodes unlike the
+ * <code>Document.importNode()</code> method, this method does not raise
+ * an <code>INVALID_CHARACTER_ERR</code> exception, and applications
+ * should use the <code>Document.normalizeDocument()</code> method to
+ * check if an imported name is not an XML name according to the XML
+ * version in use.
+ * @param source The node to move into this document.
+ * @return The adopted node, or <code>null</code> if this operation
+ * fails, such as when the source node comes from a different
+ * implementation.
+ * @exception DOMException
+ * NOT_SUPPORTED_ERR: Raised if the source node is of type
+ * <code>DOCUMENT</code>, <code>DOCUMENT_TYPE</code>.
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised when the source node is
+ * readonly.
+ * @since DOM Level 3
+ */
+ public Node adoptNode(Node source)
+ throws DOMException;
+
+ /**
+ * The configuration used when <code>Document.normalizeDocument()</code>
+ * is invoked.
+ * @since DOM Level 3
+ */
+ public DOMConfiguration getDomConfig();
+
+ /**
+ * This method acts as if the document was going through a save and load
+ * cycle, putting the document in a "normal" form. As a consequence,
+ * this method updates the replacement tree of
+ * <code>EntityReference</code> nodes and normalizes <code>Text</code>
+ * nodes, as defined in the method <code>Node.normalize()</code>.
+ * <br> Otherwise, the actual result depends on the features being set on
+ * the <code>Document.domConfig</code> object and governing what
+ * operations actually take place. Noticeably this method could also
+ * make the document namespace well-formed according to the algorithm
+ * described in , check the character normalization, remove the
+ * <code>CDATASection</code> nodes, etc. See
+ * <code>DOMConfiguration</code> for details.
+ * <pre>// Keep in the document
+ * the information defined // in the XML Information Set (Java example)
+ * DOMConfiguration docConfig = myDocument.getDomConfig();
+ * docConfig.setParameter("infoset", Boolean.TRUE);
+ * myDocument.normalizeDocument();</pre>
+ *
+ * <br>Mutation events, when supported, are generated to reflect the
+ * changes occurring on the document.
+ * <br> If errors occur during the invocation of this method, such as an
+ * attempt to update a read-only node or a <code>Node.nodeName</code>
+ * contains an invalid character according to the XML version in use,
+ * errors or warnings (<code>DOMError.SEVERITY_ERROR</code> or
+ * <code>DOMError.SEVERITY_WARNING</code>) will be reported using the
+ * <code>DOMErrorHandler</code> object associated with the "error-handler
+ * " parameter. Note this method might also report fatal errors (
+ * <code>DOMError.SEVERITY_FATAL_ERROR</code>) if an implementation
+ * cannot recover from an error.
+ * @since DOM Level 3
+ */
+ public void normalizeDocument();
+
+ /**
+ * Rename an existing node of type <code>ELEMENT_NODE</code> or
+ * <code>ATTRIBUTE_NODE</code>.
+ * <br>When possible this simply changes the name of the given node,
+ * otherwise this creates a new node with the specified name and
+ * replaces the existing node with the new node as described below.
+ * <br>If simply changing the name of the given node is not possible, the
+ * following operations are performed: a new node is created, any
+ * registered event listener is registered on the new node, any user
+ * data attached to the old node is removed from that node, the old node
+ * is removed from its parent if it has one, the children are moved to
+ * the new node, if the renamed node is an <code>Element</code> its
+ * attributes are moved to the new node, the new node is inserted at the
+ * position the old node used to have in its parent's child nodes list
+ * if it has one, the user data that was attached to the old node is
+ * attached to the new node.
+ * <br>When the node being renamed is an <code>Element</code> only the
+ * specified attributes are moved, default attributes originated from
+ * the DTD are updated according to the new element name. In addition,
+ * the implementation may update default attributes from other schemas.
+ * Applications should use <code>Document.normalizeDocument()</code> to
+ * guarantee these attributes are up-to-date.
+ * <br>When the node being renamed is an <code>Attr</code> that is
+ * attached to an <code>Element</code>, the node is first removed from
+ * the <code>Element</code> attributes map. Then, once renamed, either
+ * by modifying the existing node or creating a new one as described
+ * above, it is put back.
+ * <br>In addition,
+ * <ul>
+ * <li> a user data event <code>NODE_RENAMED</code> is fired,
+ * </li>
+ * <li>
+ * when the implementation supports the feature "MutationNameEvents",
+ * each mutation operation involved in this method fires the appropriate
+ * event, and in the end the event {
+ * <code>http://www.w3.org/2001/xml-events</code>,
+ * <code>DOMElementNameChanged</code>} or {
+ * <code>http://www.w3.org/2001/xml-events</code>,
+ * <code>DOMAttributeNameChanged</code>} is fired.
+ * </li>
+ * </ul>
+ * @param n The node to rename.
+ * @param namespaceURI The new namespace URI.
+ * @param qualifiedName The new qualified name.
+ * @return The renamed node. This is either the specified node or the new
+ * node that was created to replace the specified node.
+ * @exception DOMException
+ * NOT_SUPPORTED_ERR: Raised when the type of the specified node is
+ * neither <code>ELEMENT_NODE</code> nor <code>ATTRIBUTE_NODE</code>,
+ * or if the implementation does not support the renaming of the
+ * document element.
+ * <br>INVALID_CHARACTER_ERR: Raised if the new qualified name is not an
+ * XML name according to the XML version in use specified in the
+ * <code>Document.xmlVersion</code> attribute.
+ * <br>WRONG_DOCUMENT_ERR: Raised when the specified node was created
+ * from a different document than this document.
+ * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is a
+ * malformed qualified name, if the <code>qualifiedName</code> has a
+ * prefix and the <code>namespaceURI</code> is <code>null</code>, or
+ * if the <code>qualifiedName</code> has a prefix that is "xml" and
+ * the <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'>
+ * http://www.w3.org/XML/1998/namespace</a>" [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
+ * . Also raised, when the node being renamed is an attribute, if the
+ * <code>qualifiedName</code>, or its prefix, is "xmlns" and the
+ * <code>namespaceURI</code> is different from "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>".
+ * @since DOM Level 3
+ */
+ public Node renameNode(Node n,
+ String namespaceURI,
+ String qualifiedName)
+ throws DOMException;
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DocumentFragment.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DocumentFragment.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DocumentFragment.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DocumentFragment.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * <code>DocumentFragment</code> is a "lightweight" or "minimal"
+ * <code>Document</code> object. It is very common to want to be able to
+ * extract a portion of a document's tree or to create a new fragment of a
+ * document. Imagine implementing a user command like cut or rearranging a
+ * document by moving fragments around. It is desirable to have an object
+ * which can hold such fragments and it is quite natural to use a Node for
+ * this purpose. While it is true that a <code>Document</code> object could
+ * fulfill this role, a <code>Document</code> object can potentially be a
+ * heavyweight object, depending on the underlying implementation. What is
+ * really needed for this is a very lightweight object.
+ * <code>DocumentFragment</code> is such an object.
+ * <p>Furthermore, various operations -- such as inserting nodes as children
+ * of another <code>Node</code> -- may take <code>DocumentFragment</code>
+ * objects as arguments; this results in all the child nodes of the
+ * <code>DocumentFragment</code> being moved to the child list of this node.
+ * <p>The children of a <code>DocumentFragment</code> node are zero or more
+ * nodes representing the tops of any sub-trees defining the structure of
+ * the document. <code>DocumentFragment</code> nodes do not need to be
+ * well-formed XML documents (although they do need to follow the rules
+ * imposed upon well-formed XML parsed entities, which can have multiple top
+ * nodes). For example, a <code>DocumentFragment</code> might have only one
+ * child and that child node could be a <code>Text</code> node. Such a
+ * structure model represents neither an HTML document nor a well-formed XML
+ * document.
+ * <p>When a <code>DocumentFragment</code> is inserted into a
+ * <code>Document</code> (or indeed any other <code>Node</code> that may
+ * take children) the children of the <code>DocumentFragment</code> and not
+ * the <code>DocumentFragment</code> itself are inserted into the
+ * <code>Node</code>. This makes the <code>DocumentFragment</code> very
+ * useful when the user wishes to create nodes that are siblings; the
+ * <code>DocumentFragment</code> acts as the parent of these nodes so that
+ * the user can use the standard methods from the <code>Node</code>
+ * interface, such as <code>Node.insertBefore</code> and
+ * <code>Node.appendChild</code>.
+ * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
+ */
+public interface DocumentFragment extends Node {
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DocumentType.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DocumentType.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DocumentType.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/DocumentType.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * Each <code>Document</code> has a <code>doctype</code> attribute whose value
+ * is either <code>null</code> or a <code>DocumentType</code> object. The
+ * <code>DocumentType</code> interface in the DOM Core provides an interface
+ * to the list of entities that are defined for the document, and little
+ * else because the effect of namespaces and the various XML schema efforts
+ * on DTD representation are not clearly understood as of this writing.
+ * <p>DOM Level 3 doesn't support editing <code>DocumentType</code> nodes.
+ * <code>DocumentType</code> nodes are read-only.
+ * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
+ */
+public interface DocumentType extends Node {
+ /**
+ * The name of DTD; i.e., the name immediately following the
+ * <code>DOCTYPE</code> keyword.
+ */
+ public String getName();
+
+ /**
+ * A <code>NamedNodeMap</code> containing the general entities, both
+ * external and internal, declared in the DTD. Parameter entities are
+ * not contained. Duplicates are discarded. For example in:
+ * <pre><!DOCTYPE
+ * ex SYSTEM "ex.dtd" [ <!ENTITY foo "foo"> <!ENTITY bar
+ * "bar"> <!ENTITY bar "bar2"> <!ENTITY % baz "baz">
+ * ]> <ex/></pre>
+ * the interface provides access to <code>foo</code>
+ * and the first declaration of <code>bar</code> but not the second
+ * declaration of <code>bar</code> or <code>baz</code>. Every node in
+ * this map also implements the <code>Entity</code> interface.
+ * <br>The DOM Level 2 does not support editing entities, therefore
+ * <code>entities</code> cannot be altered in any way.
+ */
+ public NamedNodeMap getEntities();
+
+ /**
+ * A <code>NamedNodeMap</code> containing the notations declared in the
+ * DTD. Duplicates are discarded. Every node in this map also implements
+ * the <code>Notation</code> interface.
+ * <br>The DOM Level 2 does not support editing notations, therefore
+ * <code>notations</code> cannot be altered in any way.
+ */
+ public NamedNodeMap getNotations();
+
+ /**
+ * The public identifier of the external subset.
+ * @since DOM Level 2
+ */
+ public String getPublicId();
+
+ /**
+ * The system identifier of the external subset. This may be an absolute
+ * URI or not.
+ * @since DOM Level 2
+ */
+ public String getSystemId();
+
+ /**
+ * The internal subset as a string, or <code>null</code> if there is none.
+ * This is does not contain the delimiting square brackets.
+ * <p ><b>Note:</b> The actual content returned depends on how much
+ * information is available to the implementation. This may vary
+ * depending on various parameters, including the XML processor used to
+ * build the document.
+ * @since DOM Level 2
+ */
+ public String getInternalSubset();
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/Element.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/Element.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/Element.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/external/w3c_dom/org/w3c/dom/Element.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,439 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * The <code>Element</code> interface represents an element in an HTML or XML
+ * document. Elements may have attributes associated with them; since the
+ * <code>Element</code> interface inherits from <code>Node</code>, the
+ * generic <code>Node</code> interface attribute <code>attributes</code> may
+ * be used to retrieve the set of all attributes for an element. There are
+ * methods on the <code>Element</code> interface to retrieve either an
+ * <code>Attr</code> object by name or an attribute value by name. In XML,
+ * where an attribute value may contain entity references, an
+ * <code>Attr</code> object should be retrieved to examine the possibly
+ * fairly complex sub-tree representing the attribute value. On the other
+ * hand, in HTML, where all attributes have simple string values, methods to
+ * directly access an attribute value can safely be used as a convenience.
+ * <p ><b>Note:</b> In DOM Level 2, the method <code>normalize</code> is
+ * inherited from the <code>Node</code> interface where it was moved.
+ * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
+ */
+public interface Element extends Node {
+ /**
+ * The name of the element. If <code>Node.localName</code> is different
+ * from <code>null</code>, this attribute is a qualified name. For
+ * example, in:
+ * <pre> <elementExample id="demo"> ...
+ * </elementExample> , </pre>
+ * <code>tagName</code> has the value
+ * <code>"elementExample"</code>. Note that this is case-preserving in
+ * XML, as are all of the operations of the DOM. The HTML DOM returns
+ * the <code>tagName</code> of an HTML element in the canonical
+ * uppercase form, regardless of the case in the source HTML document.
+ */
+ public String getTagName();
+
+ /**
+ * Retrieves an attribute value by name.
+ * @param name The name of the attribute to retrieve.
+ * @return The <code>Attr</code> value as a string, or the empty string
+ * if that attribute does not have a specified or default value.
+ */
+ public String getAttribute(String name);
+
+ /**
+ * Adds a new attribute. If an attribute with that name is already present
+ * in the element, its value is changed to be that of the value
+ * parameter. This value is a simple string; it is not parsed as it is
+ * being set. So any markup (such as syntax to be recognized as an
+ * entity reference) is treated as literal text, and needs to be
+ * appropriately escaped by the implementation when it is written out.
+ * In order to assign an attribute value that contains entity
+ * references, the user must create an <code>Attr</code> node plus any
+ * <code>Text</code> and <code>EntityReference</code> nodes, build the
+ * appropriate subtree, and use <code>setAttributeNode</code> to assign
+ * it as the value of an attribute.
+ * <br>To set an attribute with a qualified name and namespace URI, use
+ * the <code>setAttributeNS</code> method.
+ * @param name The name of the attribute to create or alter.
+ * @param value Value to set in string form.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified name is not an XML
+ * name according to the XML version in use specified in the
+ * <code>Document.xmlVersion</code> attribute.
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ */
+ public void setAttribute(String name,
+ String value)
+ throws DOMException;
+
+ /**
+ * Removes an attribute by name. If a default value for the removed
+ * attribute is defined in the DTD, a new attribute immediately appears
+ * with the default value as well as the corresponding namespace URI,
+ * local name, and prefix when applicable. The implementation may handle
+ * default values from other schemas similarly but applications should
+ * use <code>Document.normalizeDocument()</code> to guarantee this
+ * information is up-to-date.
+ * <br>If no attribute with this name is found, this method has no effect.
+ * <br>To remove an attribute by local name and namespace URI, use the
+ * <code>removeAttributeNS</code> method.
+ * @param name The name of the attribute to remove.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ */
+ public void removeAttribute(String name)
+ throws DOMException;
+
+ /**
+ * Retrieves an attribute node by name.
+ * <br>To retrieve an attribute node by qualified name and namespace URI,
+ * use the <code>getAttributeNodeNS</code> method.
+ * @param name The name (<code>nodeName</code>) of the attribute to
+ * retrieve.
+ * @return The <code>Attr</code> node with the specified name (
+ * <code>nodeName</code>) or <code>null</code> if there is no such
+ * attribute.
+ */
+ public Attr getAttributeNode(String name);
+
+ /**
+ * Adds a new attribute node. If an attribute with that name (
+ * <code>nodeName</code>) is already present in the element, it is
+ * replaced by the new one. Replacing an attribute node by itself has no
+ * effect.
+ * <br>To add a new attribute node with a qualified name and namespace
+ * URI, use the <code>setAttributeNodeNS</code> method.
+ * @param newAttr The <code>Attr</code> node to add to the attribute list.
+ * @return If the <code>newAttr</code> attribute replaces an existing
+ * attribute, the replaced <code>Attr</code> node is returned,
+ * otherwise <code>null</code> is returned.
+ * @exception DOMException
+ * WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a
+ * different document than the one that created the element.
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an
+ * attribute of another <code>Element</code> object. The DOM user must
+ * explicitly clone <code>Attr</code> nodes to re-use them in other
+ * elements.
+ */
+ public Attr setAttributeNode(Attr newAttr)
+ throws DOMException;
+
+ /**
+ * Removes the specified attribute node. If a default value for the
+ * removed <code>Attr</code> node is defined in the DTD, a new node
+ * immediately appears with the default value as well as the
+ * corresponding namespace URI, local name, and prefix when applicable.
+ * The implementation may handle default values from other schemas
+ * similarly but applications should use
+ * <code>Document.normalizeDocument()</code> to guarantee this
+ * information is up-to-date.
+ * @param oldAttr The <code>Attr</code> node to remove from the attribute
+ * list.
+ * @return The <code>Attr</code> node that was removed.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * <br>NOT_FOUND_ERR: Raised if <code>oldAttr</code> is not an attribute
+ * of the element.
+ */
+ public Attr removeAttributeNode(Attr oldAttr)
+ throws DOMException;
+
+ /**
+ * Returns a <code>NodeList</code> of all descendant <code>Elements</code>
+ * with a given tag name, in document order.
+ * @param name The name of the tag to match on. The special value "*"
+ * matches all tags.
+ * @return A list of matching <code>Element</code> nodes.
+ */
+ public NodeList getElementsByTagName(String name);
+
+ /**
+ * Retrieves an attribute value by local name and namespace URI.
+ * <br>Per [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
+ * , applications must use the value <code>null</code> as the
+ * <code>namespaceURI</code> parameter for methods if they wish to have
+ * no namespace.
+ * @param namespaceURI The namespace URI of the attribute to retrieve.
+ * @param localName The local name of the attribute to retrieve.
+ * @return The <code>Attr</code> value as a string, or the empty string
+ * if that attribute does not have a specified or default value.
+ * @exception DOMException
+ * NOT_SUPPORTED_ERR: May be raised if the implementation does not
+ * support the feature <code>"XML"</code> and the language exposed
+ * through the Document does not support XML Namespaces (such as [<a href='http://www.w3.org/TR/1999/REC-html401-19991224/'>HTML 4.01</a>]).
+ * @since DOM Level 2
+ */
+ public String getAttributeNS(String namespaceURI,
+ String localName)
+ throws DOMException;
+
+ /**
+ * Adds a new attribute. If an attribute with the same local name and
+ * namespace URI is already present on the element, its prefix is
+ * changed to be the prefix part of the <code>qualifiedName</code>, and
+ * its value is changed to be the <code>value</code> parameter. This
+ * value is a simple string; it is not parsed as it is being set. So any
+ * markup (such as syntax to be recognized as an entity reference) is
+ * treated as literal text, and needs to be appropriately escaped by the
+ * implementation when it is written out. In order to assign an
+ * attribute value that contains entity references, the user must create
+ * an <code>Attr</code> node plus any <code>Text</code> and
+ * <code>EntityReference</code> nodes, build the appropriate subtree,
+ * and use <code>setAttributeNodeNS</code> or
+ * <code>setAttributeNode</code> to assign it as the value of an
+ * attribute.
+ * <br>Per [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
+ * , applications must use the value <code>null</code> as the
+ * <code>namespaceURI</code> parameter for methods if they wish to have
+ * no namespace.
+ * @param namespaceURI The namespace URI of the attribute to create or
+ * alter.
+ * @param qualifiedName The qualified name of the attribute to create or
+ * alter.
+ * @param value The value to set in string form.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified qualified name is not
+ * an XML name according to the XML version in use specified in the
+ * <code>Document.xmlVersion</code> attribute.
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
+ * malformed per the Namespaces in XML specification, if the
+ * <code>qualifiedName</code> has a prefix and the
+ * <code>namespaceURI</code> is <code>null</code>, if the
+ * <code>qualifiedName</code> has a prefix that is "xml" and the
+ * <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'>
+ * http://www.w3.org/XML/1998/namespace</a>", if the <code>qualifiedName</code> or its prefix is "xmlns" and the
+ * <code>namespaceURI</code> is different from "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>", or if the <code>namespaceURI</code> is "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>" and neither the <code>qualifiedName</code> nor its prefix is "xmlns".
+ * <br>NOT_SUPPORTED_ERR: May be raised if the implementation does not
+ * support the feature <code>"XML"</code> and the language exposed
+ * through the Document does not support XML Namespaces (such as [<a href='http://www.w3.org/TR/1999/REC-html401-19991224/'>HTML 4.01</a>]).
+ * @since DOM Level 2
+ */
+ public void setAttributeNS(String namespaceURI,
+ String qualifiedName,
+ String value)
+ throws DOMException;
+
+ /**
+ * Removes an attribute by local name and namespace URI. If a default
+ * value for the removed attribute is defined in the DTD, a new
+ * attribute immediately appears with the default value as well as the
+ * corresponding namespace URI, local name, and prefix when applicable.
+ * The implementation may handle default values from other schemas
+ * similarly but applications should use
+ * <code>Document.normalizeDocument()</code> to guarantee this
+ * information is up-to-date.
+ * <br>If no attribute with this local name and namespace URI is found,
+ * this method has no effect.
+ * <br>Per [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
+ * , applications must use the value <code>null</code> as the
+ * <code>namespaceURI</code> parameter for methods if they wish to have
+ * no namespace.
+ * @param namespaceURI The namespace URI of the attribute to remove.
+ * @param localName The local name of the attribute to remove.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * <br>NOT_SUPPORTED_ERR: May be raised if the implementation does not
+ * support the feature <code>"XML"</code> and the language exposed
+ * through the Document does not support XML Namespaces (such as [<a href='http://www.w3.org/TR/1999/REC-html401-19991224/'>HTML 4.01</a>]).
+ * @since DOM Level 2
+ */
+ public void removeAttributeNS(String namespaceURI,
+ String localName)
+ throws DOMException;
+
+ /**
+ * Retrieves an <code>Attr</code> node by local name and namespace URI.
+ * <br>Per [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
+ * , applications must use the value <code>null</code> as the
+ * <code>namespaceURI</code> parameter for methods if they wish to have
+ * no namespace.
+ * @param namespaceURI The namespace URI of the attribute to retrieve.
+ * @param localName The local name of the attribute to retrieve.
+ * @return The <code>Attr</code> node with the specified attribute local
+ * name and namespace URI or <code>null</code> if there is no such
+ * attribute.
+ * @exception DOMException
+ * NOT_SUPPORTED_ERR: May be raised if the implementation does not
+ * support the feature <code>"XML"</code> and the language exposed
+ * through the Document does not support XML Namespaces (such as [<a href='http://www.w3.org/TR/1999/REC-html401-19991224/'>HTML 4.01</a>]).
+ * @since DOM Level 2
+ */
+ public Attr getAttributeNodeNS(String namespaceURI,
+ String localName)
+ throws DOMException;
+
+ /**
+ * Adds a new attribute. If an attribute with that local name and that
+ * namespace URI is already present in the element, it is replaced by
+ * the new one. Replacing an attribute node by itself has no effect.
+ * <br>Per [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
+ * , applications must use the value <code>null</code> as the
+ * <code>namespaceURI</code> parameter for methods if they wish to have
+ * no namespace.
+ * @param newAttr The <code>Attr</code> node to add to the attribute list.
+ * @return If the <code>newAttr</code> attribute replaces an existing
+ * attribute with the same local name and namespace URI, the replaced
+ * <code>Attr</code> node is returned, otherwise <code>null</code> is
+ * returned.
+ * @exception DOMException
+ * WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a
+ * different document than the one that created the element.
+ * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an
+ * attribute of another <code>Element</code> object. The DOM user must
+ * explicitly clone <code>Attr</code> nodes to re-use them in other
+ * elements.
+ * <br>NOT_SUPPORTED_ERR: May be raised if the implementation does not
+ * support the feature <code>"XML"</code> and the language exposed
+ * through the Document does not support XML Namespaces (such as [<a href='http://www.w3.org/TR/1999/REC-html401-19991224/'>HTML 4.01</a>]).
+ * @since DOM Level 2
+ */
+ public Attr setAttributeNodeNS(Attr newAttr)
+ throws DOMException;
+
+ /**
+ * Returns a <code>NodeList</code> of all the descendant
+ * <code>Elements</code> with a given local name and namespace URI in
+ * document order.
+ * @param namespaceURI The namespace URI of the elements to match on. The
+ * special value "*" matches all namespaces.
+ * @param localName The local name of the elements to match on. The
+ * special value "*" matches all local names.
+ * @return A new <code>NodeList</code> object containing all the matched
+ * <code>Elements</code>.
+ * @exception DOMException
+ * NOT_SUPPORTED_ERR: May be raised if the implementation does not
+ * support the feature <code>"XML"</code> and the language exposed
+ * through the Document does not support XML Namespaces (such as [<a href='http://www.w3.org/TR/1999/REC-html401-19991224/'>HTML 4.01</a>]).
+ * @since DOM Level 2
+ */
+ public NodeList getElementsByTagNameNS(String namespaceURI,
+ String localName)
+ throws DOMException;
+
+ /**
+ * Returns <code>true</code> when an attribute with a given name is
+ * specified on this element or has a default value, <code>false</code>
+ * otherwise.
+ * @param name The name of the attribute to look for.
+ * @return <code>true</code> if an attribute with the given name is
+ * specified on this element or has a default value, <code>false</code>
+ * otherwise.
+ * @since DOM Level 2
+ */
+ public boolean hasAttribute(String name);
+
+ /**
+ * Returns <code>true</code> when an attribute with a given local name and
+ * namespace URI is specified on this element or has a default value,
+ * <code>false</code> otherwise.
+ * <br>Per [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
+ * , applications must use the value <code>null</code> as the
+ * <code>namespaceURI</code> parameter for methods if they wish to have
+ * no namespace.
+ * @param namespaceURI The namespace URI of the attribute to look for.
+ * @param localName The local name of the attribute to look for.
+ * @return <code>true</code> if an attribute with the given local name
+ * and namespace URI is specified or has a default value on this
+ * element, <code>false</code> otherwise.
+ * @exception DOMException
+ * NOT_SUPPORTED_ERR: May be raised if the implementation does not
+ * support the feature <code>"XML"</code> and the language exposed
+ * through the Document does not support XML Namespaces (such as [<a href='http://www.w3.org/TR/1999/REC-html401-19991224/'>HTML 4.01</a>]).
+ * @since DOM Level 2
+ */
+ public boolean hasAttributeNS(String namespaceURI,
+ String localName)
+ throws DOMException;
+
+ /**
+ * The type information associated with this element.
+ * @since DOM Level 3
+ */
+ public TypeInfo getSchemaTypeInfo();
+
+ /**
+ * If the parameter <code>isId</code> is <code>true</code>, this method
+ * declares the specified attribute to be a user-determined ID attribute
+ * . This affects the value of <code>Attr.isId</code> and the behavior
+ * of <code>Document.getElementById</code>, but does not change any
+ * schema that may be in use, in particular this does not affect the
+ * <code>Attr.schemaTypeInfo</code> of the specified <code>Attr</code>
+ * node. Use the value <code>false</code> for the parameter
+ * <code>isId</code> to undeclare an attribute for being a
+ * user-determined ID attribute.
+ * <br> To specify an attribute by local name and namespace URI, use the
+ * <code>setIdAttributeNS</code> method.
+ * @param name The name of the attribute.
+ * @param isId Whether the attribute is a of type ID.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * <br>NOT_FOUND_ERR: Raised if the specified node is not an attribute
+ * of this element.
+ * @since DOM Level 3
+ */
+ public void setIdAttribute(String name,
+ boolean isId)
+ throws DOMException;
+
+ /**
+ * If the parameter <code>isId</code> is <code>true</code>, this method
+ * declares the specified attribute to be a user-determined ID attribute
+ * . This affects the value of <code>Attr.isId</code> and the behavior
+ * of <code>Document.getElementById</code>, but does not change any
+ * schema that may be in use, in particular this does not affect the
+ * <code>Attr.schemaTypeInfo</code> of the specified <code>Attr</code>
+ * node. Use the value <code>false</code> for the parameter
+ * <code>isId</code> to undeclare an attribute for being a
+ * user-determined ID attribute.
+ * @param namespaceURI The namespace URI of the attribute.
+ * @param localName The local name of the attribute.
+ * @param isId Whether the attribute is a of type ID.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * <br>NOT_FOUND_ERR: Raised if the specified node is not an attribute
+ * of this element.
+ * @since DOM Level 3
+ */
+ public void setIdAttributeNS(String namespaceURI,
+ String localName,
+ boolean isId)
+ throws DOMException;
+
+ /**
+ * If the parameter <code>isId</code> is <code>true</code>, this method
+ * declares the specified attribute to be a user-determined ID attribute
+ * . This affects the value of <code>Attr.isId</code> and the behavior
+ * of <code>Document.getElementById</code>, but does not change any
+ * schema that may be in use, in particular this does not affect the
+ * <code>Attr.schemaTypeInfo</code> of the specified <code>Attr</code>
+ * node. Use the value <code>false</code> for the parameter
+ * <code>isId</code> to undeclare an attribute for being a
+ * user-determined ID attribute.
+ * @param idAttr The attribute node.
+ * @param isId Whether the attribute is a of type ID.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * <br>NOT_FOUND_ERR: Raised if the specified node is not an attribute
+ * of this element.
+ * @since DOM Level 3
+ */
+ public void setIdAttributeNode(Attr idAttr,
+ boolean isId)
+ throws DOMException;
+
+}
More information about the llvm-commits
mailing list