Index: ChangeLog =================================================================== RCS file: /cvsroot/classpath/classpath/ChangeLog,v retrieving revision 1.2386.2.81 diff -u -3 -p -u -r1.2386.2.81 ChangeLog --- ChangeLog 7 Feb 2005 02:45:43 -0000 1.2386.2.81 +++ ChangeLog 15 Feb 2005 20:55:10 -0000 @@ -1,3 +1,410 @@ +2005-02-14 Sven de Marothy + + * java/util/Calendar.java + (Calendar): Constructor should clear fields. + +2005-02-14 Sven de Marothy + + * javax/swing/SpinnerDateModel.java: Implemented. + +2005-02-14 Sven de Marothy + + * java/util/Calendar.java + (clear): Dates should clear to local time. + + * java/util/GregorianCalendar.java + (computeTime): Fix priority problem with DAY_OF_WEEK, + Handle non-sunday-startig weeks and minimumDaysInFirstWeek. + +2005-02-13 Mark Wielaard + + * java/awt/AWTKeyStroke.java (getAWTKeyStroke(String)): Throw + IllegalArgumentException when the given String is null. + + * javax/swing/KeyStroke.java (getKeyStroke(String)): Return null + when given keystoke sequence cannot be parsed. + + * javax/swing/JRootPane.java (setJMenuBar): Remove current menubar + if one is installed. Only install the given menubar is not null. + + * javax/swing/JViewport.java (getViewSize): Return an empty + Dimension when the view isn't set or preferred component size when + no viewSize is set. + + * javax/swing/ViewportLayout.java (preferredLayoutSize): Return an + empty Dimension when there is no view set. + (minimumLayoutSize): Likewise. + (layoutContainer): Don't try to layout when there is no view. + +2005-02-13 Mark Wielaard + + # Fixes bug #11957 + * java/io/ObjectInputStream.java (resolveClass): Don't check "void" + twice. + +2005-02-13 Tom Tromey + + * gnu/xml/aelfred2/SAXDriver.java: Ensure that null is returned when + attribute index is out of bounds. + +2005-02-12 Mark Wielaard + + Fixes bug #11949 + * java/awt/BasicStroke.java (hashCode): Check for null dash. + +2005-02-11 Andrew John Hughes + + * gnu/java/awt/color/ClutProfileConverter.java, + gnu/java/awt/peer/ClasspathTextLayoutPeer.java, + gnu/java/awt/peer/gtk/GdkFontPeer.java, + gnu/java/awt/peer/gtk/GdkGlyphVector.java, + gnu/java/awt/peer/gtk/GdkGraphics2D.java, + gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java, + gnu/java/awt/peer/gtk/GdkPixbufDecoder.java, + gnu/java/awt/peer/gtk/GdkRobotPeer.java, + gnu/java/awt/peer/gtk/GdkTextLayout.java, + gnu/java/awt/peer/gtk/GtkButtonPeer.java, + gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java, + gnu/java/awt/peer/gtk/GtkCheckboxPeer.java, + gnu/java/awt/peer/gtk/GtkChoicePeer.java, + gnu/java/awt/peer/gtk/GtkComponentPeer.java, + gnu/java/awt/peer/gtk/GtkContainerPeer.java, + gnu/java/awt/peer/gtk/GtkDialogPeer.java, + gnu/java/awt/peer/gtk/GtkFileDialogPeer.java, + gnu/java/awt/peer/gtk/GtkFontPeer.java, + gnu/java/awt/peer/gtk/GtkFramePeer.java, + gnu/java/awt/peer/gtk/GtkLabelPeer.java, + gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java, + gnu/java/awt/peer/gtk/GtkMenuItemPeer.java, + gnu/java/awt/peer/gtk/GtkScrollPanePeer.java, + gnu/java/awt/peer/gtk/GtkTextComponentPeer.java, + gnu/java/awt/peer/gtk/GtkToolkit.java, + gnu/java/awt/peer/gtk/GtkWindowPeer.java, + gnu/java/io/EncodingManager.java, + gnu/java/io/decode/DecoderUTF8.java, + gnu/java/net/protocol/file/Connection.java, + gnu/java/net/protocol/ftp/ActiveModeDTP.java, + gnu/java/net/protocol/ftp/BlockInputStream.java, + gnu/java/net/protocol/ftp/BlockOutputStream.java, + gnu/java/net/protocol/ftp/CompressedOutputStream.java, + gnu/java/net/protocol/ftp/StreamInputStream.java, + gnu/java/net/protocol/ftp/StreamOutputStream.java, + gnu/java/net/protocol/http/Cookie.java, + gnu/java/net/protocol/http/HTTPConnection.java, + gnu/java/net/protocol/http/HTTPDateFormat.java, + gnu/java/net/protocol/http/Request.java, + gnu/java/nio/SelectorImpl.java, + gnu/java/rmi/dgc/DGCImpl.java, + gnu/java/rmi/server/UnicastConnectionManager.java, + gnu/java/security/pkcs/SignerInfo.java, + gnu/java/security/provider/EncodedKeyFactory.java, + gnu/java/security/provider/GnuDHPublicKey.java, + gnu/java/security/provider/PKIXCertPathValidatorImpl.java, + gnu/java/security/x509/X500DistinguishedName.java, + gnu/java/security/x509/X509CRL.java, + gnu/java/security/x509/X509CRLEntry.java, + gnu/java/security/x509/X509Certificate.java, + gnu/java/security/x509/ext/AuthorityKeyIdentifier.java, + gnu/java/security/x509/ext/CertificatePolicies.java, + gnu/java/security/x509/ext/PolicyConstraint.java, + gnu/xml/aelfred2/SAXDriver.java, + gnu/xml/dom/Consumer.java, + gnu/xml/dom/DomCharacterData.java, + gnu/xml/dom/DomDocument.java, + gnu/xml/dom/DomDocumentBuilder.java, + gnu/xml/dom/DomIterator.java, + gnu/xml/dom/DomNode.java, + gnu/xml/dom/DomXPathExpression.java, + gnu/xml/dom/DomXPathResult.java, + gnu/xml/dom/JAXPFactory.java, + gnu/xml/dom/ls/DomLSException.java, + gnu/xml/libxmlj/dom/GnomeDocumentBuilder.java, + gnu/xml/libxmlj/dom/GnomeXPathNodeList.java, + gnu/xml/libxmlj/sax/GnomeXMLReader.java, + gnu/xml/libxmlj/transform/GnomeTransformer.java, + gnu/xml/libxmlj/transform/GnomeTransformerFactory.java, + gnu/xml/libxmlj/util/XMLJ.java, + gnu/xml/pipeline/CallFilter.java, + gnu/xml/pipeline/DomConsumer.java, + gnu/xml/pipeline/LinkFilter.java, + gnu/xml/pipeline/NSFilter.java, + gnu/xml/pipeline/TeeConsumer.java, + gnu/xml/pipeline/ValidationConsumer.java, + gnu/xml/pipeline/WellFormednessFilter.java, + gnu/xml/pipeline/XIncludeFilter.java, + gnu/xml/pipeline/XsltFilter.java, + gnu/xml/transform/ApplyImportsNode.java, + gnu/xml/transform/Bindings.java, + gnu/xml/transform/DocumentFunction.java, + gnu/xml/transform/FormatNumberFunction.java, + gnu/xml/transform/NodeNumberNode.java, + gnu/xml/transform/NumberNode.java, + gnu/xml/transform/Stylesheet.java, + gnu/xml/transform/SystemPropertyFunction.java, + gnu/xml/transform/Template.java, + gnu/xml/transform/TemplatesImpl.java, + gnu/xml/transform/TransformerImpl.java, + gnu/xml/transform/ValueOfNode.java, + gnu/xml/transform/XSLURIResolver.java, + gnu/xml/util/DoParse.java, + gnu/xml/util/Resolver.java, + gnu/xml/xpath/Expr.java, + gnu/xml/xpath/FunctionCall.java, + gnu/xml/xpath/RelationalExpr.java, + gnu/xml/xpath/Selector.java, + gnu/xml/xpath/XPathParser.java, + java/beans/XMLDecoder.java, + java/text/SimpleDateFormat.java, + javax/swing/JPopupMenu.java, + javax/swing/JSpinner.java, + javax/swing/SortingFocusTraversalPolicy.java, + javax/swing/SwingUtilities.java, + javax/swing/plaf/basic/BasicComboBoxEditor.java, + javax/swing/plaf/basic/BasicComboBoxRenderer.java, + javax/swing/tree/DefaultMutableTreeNode.java, + javax/xml/parsers/DocumentBuilder.java, + javax/xml/parsers/DocumentBuilderFactory.java, + javax/xml/transform/sax/SAXTransformerFactory.java, + vm/reference/java/lang/VMClassLoader.java, + vm/reference/java/lang/VMProcess.java, + vm/reference/java/lang/VMRuntime.java, + vm/reference/java/lang/VMSystem.java, + vm/reference/java/security/VMAccessController.java: + Removed unused imports and expanded starred + imports. + +2005-02-12 Michael Koch + + * include/gnu_java_awt_peer_gtk_GdkFontPeer.h, + include/gnu_java_awt_peer_gtk_GdkGraphics2D.h: + Regenerated. + +2005-02-12 Graydon Hoare + + * gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java: Add. + +2005-02-12 Graydon Hoare + + * gnu/java/awt/peer/gtk/GdkFontPeer.java + (getGlyphVector): + (getFontMetrics): + (getTextMetrics): New native methods. + * gnu/java/awt/peer/gtk/GdkFontMetrics.java: Remove native parts. + * gnu/java/awt/peer/gtk/GdkGlyphVector.java: Likewise. + * gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java: + Hold reference to GtkToolkit. + * gnu/java/awt/peer/gtk/GdkGraphics2D.java + (cairoSetFont): + (cairoDrawGdkTextLayout): + (cairoDrawString): + (getPeerTextMetrics): + (getPeerFontMetrics): Remove. + (setFont): Don't call cairoSetFont. + (cairoDrawGlyphVector): Accept font peer argument. + (drawGlyphVector): Pass font peer to cairoDrawGlyphVector. + * gnu/java/awt/peer/gtk/GdkPixbufDecoder.java: + (finalize): Call finish from here. + (produce): Not from here. + * gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java: + Hold reference to GdkGraphicsEnvironment. + * gnu/java/awt/peer/gtk/GtkToolkit.java: + (getFontMetrics): Change locking. + (getBounds): New method. + (getLocalGraphicsEnvironment): Pass reference to this. + + * include/Makefile.am: Remove entries for GdkFontMetrics, GdkGlyphVector. + * include/gnu_java_awt_peer_gtk_GdkFontMetrics.h: Remove. + * include/gnu_java_awt_peer_gtk_GdkFontPeer.h: Regenerate. + * include/gnu_java_awt_peer_gtk_GdkGlyphVector.h: Remove. + * include/gnu_java_awt_peer_gtk_GdkGraphics2D.h: Regenerate. + + * native/jni/gtk-peer/Makefile.am + Remove entries for GdkFontMetrics, GdkGlyphVector. + * native/jni/gtk-peer/gdkfont.h: Add #defines, remove struct glyphvec. + * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c + (ensure_metrics_cairo): + (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetFont): + (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawString): + (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getPeerFontMetrics): + (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getPeerTextMetrics): + (metrics_cairo): + (metrics_surface): Remove. + (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGlyphVector): + Pass and install font peer. + * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c: + Release GDK lock while performing upcalls. + * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c: Remove. + * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c + (Java_gnu_java_awt_peer_gtk_GdkFontPeer_getGlyphVector): + (Java_gnu_java_awt_peer_gtk_GdkFontPeer_getFontMetrics): + (Java_gnu_java_awt_peer_gtk_GdkFontPeer_getTextMetrics): New methods. + * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c: Remove. + +2005-02-11 Craig Black + + * gnu/java/awt/peer/gtk/GtkCheckboxMenuItem.java + (postMenuActionEvent): Implement to notify ItemListeners. + * java/awt/CheckboxMenuItem.java + (dispatchEventImpl): Update state on ItemEvent. + * java/awt/MenuItem.java + (processActionEvent): Retarget event source. + +2005-02-11 Thomas Fitzsimmons + + * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c (create): + Use GTK's built-in file system backend. Use GTK_RESPONSE_ACCEPT. + (handle_response): Use GTK_RESPONSE_ACCEPT. + +2005-02-10 Michael Koch + + * configure.ac: Define GTK_CAIRO in config.h + * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c + (gtkInit): Compile Graphics2D stuff conditionally. + +2005-02-10 Chris Burdess + + * gnu/xml/dom/DomAttr.java, + gnu/xml/dom/DomCDATA.java, + gnu/xml/dom/DomCDATASection.java, + gnu/xml/dom/DomCharacterData.java, + gnu/xml/dom/DomDOMException.java, + gnu/xml/dom/DomDoctype.java, + gnu/xml/dom/DomDocument.java, + gnu/xml/dom/DomDocumentConfiguration.java, + gnu/xml/dom/DomDocumentFragment.java, + gnu/xml/dom/DomElement.java, + gnu/xml/dom/DomEx.java, + gnu/xml/dom/DomFragment.java, + gnu/xml/dom/DomImpl.java, + gnu/xml/dom/DomIterator.java, + gnu/xml/dom/DomNamedNodeMap.java, + gnu/xml/dom/DomNode.java, + gnu/xml/dom/DomNsNode.java, + gnu/xml/dom/DomPI.java, + gnu/xml/dom/DomProcessingInstruction.java, + gnu/xml/dom/DomText.java, + gnu/xml/dom/DomLSEx.java, + gnu/xml/dom/DomLSException.java, + gnu/xml/dom/DomLSParser.java, + gnu/xml/dom/DomLSSerializer.java: Refactoring of exception and DOM + implementation class names to conform to Classpath guidelines. Make + DomLSException use JDK 1.4+ exception chaining. + * gnu/xml/util/SAXNullTransformerFactory.java, + gnu/xml/xpath/Predicate.java: Use constants relative to declaring + class or interface. + +2005-02-10 Michael Koch + + * javax/swing/JTabbedPane.java + (Page.setDisplayedMnemonicIndex): Handle empty menmonic. + +2005-02-10 Graydon Hoare + + * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c, + jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c, + jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c, + jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c: + Release GDK lock during upcalls. + +2005-02-10 Michael Koch + + * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c: + Merged file header from java-gui-20050128-branch. + +2005-02-10 Michael Koch + + * java/awt/Container.java (paramString): + If layoutMgr is null just return result of super.paramString(). + +2005-02-10 Jeroen Frijters + + * java/text/Collator.java (getInstance(Locale)): + Added default collation pattern to handle case when resource + is missing and throw InternalError instead of returning null + should parsing fail. + +2005-02-09 Mark Wielaard + + * gnu/java/net/protocol/jar/Connection.java (getJarFile): + Rename jar_file to jf. + +2005-02-09 Tom Tromey + + * gnu/java/net/protocol/jar/Connection.java (getJarFile): Open + jar file with OPEN_DELETE. + * java/util/zip/ZipFile.java (ZipFile): Call deleteOnExit when + OPEN_DELETE is used. + +2005-02-09 Michael Koch + + * java/awt/Scrollbar.java: Reformatted. + +2005-02-08 Tom Tromey + + * java/net/URI.java (AUTHORITY_REGEXP): Handle case where user + name or port is missing. + (AUTHORITY_USERINFO_GROUP, AUTHORITY_HOST_GROUP, + AUTHORITY_PORT_GROUP): Updated. + +2005-02-08 Craig Black + + * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c + (copyState): Pass a JNI global reference to signal handler. + (realize_cb): Use and free JNI global reference. + + * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c + (create): Pass a JNI global reference to signal handler. + (selection_changed): Match declaration. + + * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c + (dispose): Do not remove entries from state tables until after widget is + destroyed. + +2005-02-08 Michael Koch + + * native/jni/java-nio/java_nio_VMDirectByteBuffer.c + (NIOGetPointer): Handle case of pointer size != 32 bit. + (NIOGetRawData): Likewise. + (Java_java_nio_VMDirectByteBuffer_init): Likewise. + Fixed asking for primitive type 'long'. + +2005-02-08 Michael Koch + + * configure.ac: Define substition variable GTK_CAIRO_ENABLED. + Fix handling of GTK_CAIRO conditional. + * gnu/classpath/Configuration.java.in (GTK_CAIRO_ENABLED): + New constant. + * gnu/java/awt/peer/gtk/GdkGraphics2D.java (static): + Throw error when Cairo support was not enabled during configure time. + +2005-02-08 Michael Koch + + * javax/swing/tree/DefaultMutableTreeNode.java: + Reworked Javadocs all over. + (getPathToRoot): Fixed direction of result array initialization. + +2005-02-07 Mark Wielaard + + * java/util/ResourceBundle.java (getObject): Clarify + MissingResourceException detailed message. + (tryBundle(String,ClassLoader)): Likewise. + +2005-02-07 Craig Black + + * native/jni/classpath/native_state.c + (add_node): Update head pointer when moving node to front of list. + +2005-02-07 Andrew John Hughes + + * acinclude.m4: + (CLASSPATH_FIND_JAVAC): Add ECJ option. + (CLASSPATH_WITH_ECJ): New function. + (CLASSPATH_CHECK_ECJ): New function. + * examples/Makefile.am: + Allow examples to be built with ecj. + * lib/Makefile.am: + Allow Classpath to be built with ecj. + 2005-02-06 Mark Wielaard Reported by Timo Lindfors @@ -79,17 +486,17 @@ 2005-02-03 Dalibor Topic - * libraries/javalib/gnu/regexp/RE.java, - libraries/javalib/java/io/ObjectInputStream.java, - libraries/javalib/java/io/ObjectStreamClass.java, - libraries/javalib/java/lang/SecurityManager.java, - libraries/javalib/java/security/AllPermission.java, + * libraries/javalib/gnu/regexp/RE.java, + libraries/javalib/java/io/ObjectInputStream.java, + libraries/javalib/java/io/ObjectStreamClass.java, + libraries/javalib/java/lang/SecurityManager.java, + libraries/javalib/java/security/AllPermission.java, libraries/javalib/java/security/BasicPermission.java, - libraries/javalib/java/security/Permissions.java, - libraries/javalib/java/text/MessageFormat.java, - libraries/javalib/java/util/AbstractList.java: - Made 'inner' classes real public static inner classes, - and made them final where possible, or removed them + libraries/javalib/java/security/Permissions.java, + libraries/javalib/java/text/MessageFormat.java, + libraries/javalib/java/util/AbstractList.java: + Made 'inner' classes real public static inner classes, + and made them final where possible, or removed them where unused. 2005-02-03 Michael Koch @@ -107,7 +514,7 @@ * java/util/Calendar.java (set) Invalidate all fields on first call to set(). - + 2005-02-02 Mark Wielaard * vm/reference/java/lang/VMClassLoader.java: Remove SystemClassLoader @@ -138,34 +545,34 @@ 2005-02-02 Robert Schuster - * gnu/java/beans/decoder/GrowableArrayContext.java: Fixed - assignment behavior by using java.lang.reflect.Array.set() - directly. + * gnu/java/beans/decoder/GrowableArrayContext.java: Fixed + assignment behavior by using java.lang.reflect.Array.set() + directly. 2005-02-01 Dalibor Topic * gnu/java/beans/EmptyBeanInfo.java, gnu/java/beans/info/ComponentBeanInfo.java, - gnu/java/lang/SystemClassLoader.java: + gnu/java/lang/SystemClassLoader.java: Removed unused files. 2005-02-01 Sven de Marothy * java/util/GregorianCalendar.java - (computeTime): Fixed handling of time zones. + (computeTime): Fixed handling of time zones. 2005-02-01 Sven de Marothy * java/util/Calendar.java - (clear): Set values to Epoch instead of zero. - (set): Set isSet to the relevant field pattern instead of just the + (clear): Set values to Epoch instead of zero. + (set): Set isSet to the relevant field pattern instead of just the field. - * java/util/GregorianCalendar.java - (getBundle): Removed. - (getDayOfYear): Removed. - (getFirstDayOfMonth): New private method. - (nonLeniencyCheck): New private method. - (computeTime): Correct handling of insufficient data. + * java/util/GregorianCalendar.java + (getBundle): Removed. + (getDayOfYear): Removed. + (getFirstDayOfMonth): New private method. + (nonLeniencyCheck): New private method. + (computeTime): Correct handling of insufficient data. 2005-02-01 Andrew John Hughes Index: configure.ac =================================================================== RCS file: /cvsroot/classpath/classpath/configure.ac,v retrieving revision 1.43.2.5 diff -u -3 -p -u -r1.43.2.5 configure.ac --- configure.ac 16 Jan 2005 15:14:52 -0000 1.43.2.5 +++ configure.ac 15 Feb 2005 20:55:10 -0000 @@ -91,12 +91,16 @@ dnl ------------------------------------ AC_ARG_ENABLE([gtk-cairo], [AS_HELP_STRING(--enable-gtk-cairo,build the cairo Graphics2D implementation on GTK [default=no])], [case "${enableval}" in - yes) GTK_CAIRO=yes ;; - no) GTK_CAIRO=no ;; - *) GTK_CAIRO=yes ;; + yes) GTK_CAIRO_ENABLED=true ;; + no) GTK_CAIRO_ENABLED=false ;; + *) GTK_CAIRO_ENABLED=true ;; esac], - [GTK_CAIRO=no]) -AM_CONDITIONAL(GTK_CAIRO, test "x${enable_gtk_cairo}" = xyes) + [GTK_CAIRO_ENABLED=false]) +AC_SUBST(GTK_CAIRO_ENABLED) +if test "x${GTK_CAIRO_ENABLED}" = xtrue; then + AC_DEFINE(GTK_CAIRO, 1, [defined if cairo support was built in]) +fi +AM_CONDITIONAL(GTK_CAIRO, test "x${GTK_CAIRO_ENABLED}" = xtrue) dnl ----------------------------------------------------------- dnl Regenerate headers at build time (disabled by default) Index: examples/Makefile.am =================================================================== RCS file: /cvsroot/classpath/classpath/examples/Makefile.am,v retrieving revision 1.1.2.3 diff -u -3 -p -u -r1.1.2.3 Makefile.am --- examples/Makefile.am 2 Feb 2005 01:56:01 -0000 1.1.2.3 +++ examples/Makefile.am 15 Feb 2005 20:55:10 -0000 @@ -1,9 +1,6 @@ ## Input file for automake to generate the Makefile.in used by configure # Setup the compiler to use the GNU Classpath library we just build -if FOUND_ECJ -JCOMPILER = $(ECJ) -1.5 -bootclasspath '$(top_builddir)/lib' -classpath . -else if FOUND_GCJ JCOMPILER = $(GCJ) --bootclasspath '$(top_builddir)/lib' --classpath . -C else @@ -13,6 +10,9 @@ else if FOUND_GCJX JCOMPILER = $(GCJX) -bootclasspath '' -sourcepath '' -classpath $(top_builddir)/lib:. else +if FOUND_ECJ +JCOMPILER = $(ECJ) -1.5 -bootclasspath '$(top_builddir)/lib' -classpath . +else error dunno how to setup the JCOMPILER and compile endif endif Index: gnu/classpath/Configuration.java.in =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/classpath/Configuration.java.in,v retrieving revision 1.12.2.1 diff -u -3 -p -u -r1.12.2.1 Configuration.java.in --- gnu/classpath/Configuration.java.in 16 Jan 2005 02:14:45 -0000 1.12.2.1 +++ gnu/classpath/Configuration.java.in 15 Feb 2005 20:55:10 -0000 @@ -1,6 +1,5 @@ -/* -*-java-*- */ -/* gnu.classpath.Configuration - Copyright (C) 1998, 2001, 2003 Free Software Foundation, Inc. +/* Configuration.java -- + Copyright (C) 1998, 2001, 2003, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -123,4 +122,10 @@ public interface Configuration */ boolean JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@; + + /** + * Set to true if Cairo was found and enabled during configure, + * false otherwise. + */ + boolean GTK_CAIRO_ENABLED = @GTK_CAIRO_ENABLED@; } Index: gnu/java/awt/color/ClutProfileConverter.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/color/ClutProfileConverter.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 ClutProfileConverter.java --- gnu/java/awt/color/ClutProfileConverter.java 15 Jan 2005 17:01:39 -0000 1.1.2.1 +++ gnu/java/awt/color/ClutProfileConverter.java 15 Feb 2005 20:55:10 -0000 @@ -38,7 +38,6 @@ package gnu.java.awt.color; -import java.awt.color.ColorSpace; import java.awt.color.ICC_Profile; Index: gnu/java/awt/peer/ClasspathTextLayoutPeer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/ClasspathTextLayoutPeer.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 ClasspathTextLayoutPeer.java --- gnu/java/awt/peer/ClasspathTextLayoutPeer.java 15 Jan 2005 17:01:40 -0000 1.1.2.1 +++ gnu/java/awt/peer/ClasspathTextLayoutPeer.java 15 Feb 2005 20:55:10 -0000 @@ -38,19 +38,12 @@ exception statement from your version. * package gnu.java.awt.peer; -import java.awt.Font; import java.awt.Graphics2D; import java.awt.Shape; import java.awt.font.TextHitInfo; import java.awt.font.TextLayout; import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; -import java.text.CharacterIterator; -import java.text.AttributedCharacterIterator; -import java.text.AttributedString; -import java.util.Map; -import java.awt.font.TextAttribute; - /** * @author Graydon Hoare Index: gnu/java/awt/peer/gtk/GdkFontMetrics.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkFontMetrics.java,v retrieving revision 1.9.2.1 diff -u -3 -p -u -r1.9.2.1 GdkFontMetrics.java --- gnu/java/awt/peer/gtk/GdkFontMetrics.java 15 Jan 2005 17:01:40 -0000 1.9.2.1 +++ gnu/java/awt/peer/gtk/GdkFontMetrics.java 15 Feb 2005 20:55:11 -0000 @@ -63,8 +63,6 @@ public class GdkFontMetrics extends Font static final int TEXT_METRICS_X_ADVANCE = 4; static final int TEXT_METRICS_Y_ADVANCE = 5; - static native void getPeerFontMetrics(GdkFontPeer peer, double [] metrics); - static native void getPeerTextMetrics(GdkFontPeer peer, String str, double [] metrics); public GdkFontMetrics (Font font) { @@ -77,12 +75,7 @@ public class GdkFontMetrics extends Font font_metrics = new int[5]; double [] hires = new double[5]; - - if (GtkToolkit.useGraphics2D ()) - GdkGraphics2D.getPeerFontMetrics(peer, hires); - else - getPeerFontMetrics (peer, hires); - + peer.getFontMetrics (hires); for (int i = 0; i < 5; ++i) font_metrics[i] = (int) hires[i]; } @@ -90,10 +83,7 @@ public class GdkFontMetrics extends Font public int stringWidth (String str) { double [] hires = new double[6]; - if (GtkToolkit.useGraphics2D()) - GdkGraphics2D.getPeerTextMetrics(peer, str, hires); - else - getPeerTextMetrics(peer, str, hires); + peer.getTextMetrics(str, hires); return (int) hires [TEXT_METRICS_WIDTH]; } @@ -115,7 +105,6 @@ public class GdkFontMetrics extends Font public int getLeading () { return 1; -// return metrics[ASCENT] + metrics[DESCENT]; } public int getAscent () Index: gnu/java/awt/peer/gtk/GdkFontPeer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java,v retrieving revision 1.3.2.2 diff -u -3 -p -u -r1.3.2.2 GdkFontPeer.java --- gnu/java/awt/peer/gtk/GdkFontPeer.java 16 Jan 2005 02:14:45 -0000 1.3.2.2 +++ gnu/java/awt/peer/gtk/GdkFontPeer.java 15 Feb 2005 20:55:11 -0000 @@ -37,19 +37,21 @@ exception statement from your version. * package gnu.java.awt.peer.gtk; -import java.awt.peer.FontPeer; -import java.awt.*; -import java.awt.geom.*; -import java.awt.font.*; + +import gnu.classpath.Configuration; +import gnu.java.awt.peer.ClasspathFontPeer; + +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.font.FontRenderContext; +import java.awt.font.GlyphVector; +import java.awt.font.LineMetrics; +import java.awt.geom.Rectangle2D; import java.util.Locale; import java.util.Map; import java.util.ResourceBundle; -import java.util.MissingResourceException; import java.text.CharacterIterator; -import java.text.AttributedCharacterIterator; import java.text.StringCharacterIterator; -import gnu.classpath.Configuration; -import gnu.java.awt.peer.ClasspathFontPeer; public class GdkFontPeer extends ClasspathFontPeer { @@ -81,6 +83,9 @@ public class GdkFontPeer extends Classpa private native void dispose (); private native void setFont (String family, int style, int size, boolean useGraphics2D); + native void getFontMetrics(double [] metrics); + native void getTextMetrics(String str, double [] metrics); + protected void finalize () { if (GtkToolkit.useGraphics2D ()) @@ -158,26 +163,33 @@ public class GdkFontPeer extends Classpa public boolean canDisplay (Font font, char c) { - throw new UnsupportedOperationException (); + // FIXME: inquire with pango + return true; } public int canDisplayUpTo (Font font, CharacterIterator i, int start, int limit) { - throw new UnsupportedOperationException (); + // FIXME: inquire with pango + return -1; } + + private native GdkGlyphVector getGlyphVector(String txt, + Font f, + FontRenderContext ctx); public GlyphVector createGlyphVector (Font font, FontRenderContext ctx, CharacterIterator i) { - return new GdkGlyphVector(font, this, ctx, buildString (i)); + return getGlyphVector(buildString (i), font, ctx); } public GlyphVector createGlyphVector (Font font, FontRenderContext ctx, int[] glyphCodes) { - return new GdkGlyphVector (font, this, ctx, glyphCodes); + return null; + // return new GdkGlyphVector (font, this, ctx, glyphCodes); } public byte getBaselineFor (Font font, char c) @@ -259,7 +271,8 @@ public class GdkFontPeer extends Classpa public Rectangle2D getStringBounds (Font font, CharacterIterator ci, int begin, int limit, FontRenderContext frc) { - throw new UnsupportedOperationException (); + GdkGlyphVector gv = getGlyphVector(buildString (ci, begin, limit), font, frc); + return gv.getVisualBounds(); } public boolean hasUniformLineMetrics (Font font) Index: gnu/java/awt/peer/gtk/GdkGlyphVector.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkGlyphVector.java,v retrieving revision 1.2.2.1 diff -u -3 -p -u -r1.2.2.1 GdkGlyphVector.java --- gnu/java/awt/peer/gtk/GdkGlyphVector.java 15 Jan 2005 17:01:40 -0000 1.2.2.1 +++ gnu/java/awt/peer/gtk/GdkGlyphVector.java 15 Feb 2005 20:55:11 -0000 @@ -38,8 +38,6 @@ exception statement from your version. * package gnu.java.awt.peer.gtk; -import gnu.classpath.Configuration; - import java.awt.Font; import java.awt.Rectangle; import java.awt.Shape; @@ -54,36 +52,57 @@ import java.awt.geom.Rectangle2D; public class GdkGlyphVector extends GlyphVector { - static + /* We use a simple representation for glyph vectors here. Glyph i + * consumes 8 doubles: + * + * logical x: extents[ 10*i ] + * logical y: extents[ 10*i + 1 ] + * logical width: extents[ 10*i + 2 ] + * logical height: extents[ 10*i + 3 ] + * + * visual x: extents[ 10*i + 4 ] + * visual y: extents[ 10*i + 5 ] + * visual width: extents[ 10*i + 6 ] + * visual height: extents[ 10*i + 7 ] + * + * origin pos x: extents[ 10*i + 8 ] + * origin pos y: extents[ 10*i + 9 ] + * + * as well as one int, code[i], representing the glyph code in the font. + */ + + double [] extents; + int [] codes; + + Font font; + FontRenderContext fontRenderContext; + + Rectangle2D allLogical; + Rectangle2D allVisual; + + public GdkGlyphVector(double[] extents, int[] codes, Font font, FontRenderContext frc) { - if (Configuration.INIT_LOAD_LIBRARY) + this.extents = extents; + this.codes = codes; + this.font = font; + this.fontRenderContext = frc; + + allLogical = new Rectangle2D.Double(); + allVisual = new Rectangle2D.Double(); + + for (int i = 0; i < codes.length; ++i) { - System.loadLibrary("gtkpeer"); + allLogical.add (new Rectangle2D.Double(extents[10*i ] + extents[10*i + 8], + extents[10*i + 1] + extents[10*i + 9], + extents[10*i + 2], + extents[10*i + 3])); + + allVisual.add (new Rectangle2D.Double(extents[10*i + 4] + extents[10*i + 8], + extents[10*i + 5] + extents[10*i + 9], + extents[10*i + 6], + extents[10*i + 7])); } - - if (GtkToolkit.useGraphics2D ()) - initStaticState (); } - native static void initStaticState (); - private final int native_state = GtkGenericPeer.getUniqueInteger (); - - private Font font; - private FontRenderContext ctx; - - private native void initState (GdkFontPeer peer, FontRenderContext ctx); - private native void setChars (String s); - private native void setGlyphCodes (int codes[]); - private native void dispose (); - private native int glyphCode (int idx); - private native int numGlyphs (); - private native int glyphCharIndex (int idx); - private native double[] allLogicalExtents (); - private native double[] allInkExtents (); - private native double[] glyphLogicalExtents (int idx); - private native double[] glyphInkExtents (int idx); - private native boolean glyphIsHorizontal (int idx); - private native boolean isEqual (GdkGlyphVector ggv); - /* geometric notes: @@ -108,26 +127,14 @@ public class GdkGlyphVector extends Glyp */ - - public GdkGlyphVector (Font f, GdkFontPeer peer, FontRenderContext c, String s) + public double[] getExtents() { - font = f; - ctx = c; - initState (peer, ctx); - setChars (s); + return extents; } - public GdkGlyphVector (Font f, GdkFontPeer peer, FontRenderContext c, int codes[]) + public int[] getCodes() { - font = f; - ctx = c; - initState (peer, ctx); - setGlyphCodes (codes); - } - - protected void finalize () - { - dispose (); + return codes; } public Font getFont () @@ -137,12 +144,15 @@ public class GdkGlyphVector extends Glyp public FontRenderContext getFontRenderContext () { - return ctx; + return fontRenderContext; } public int getGlyphCharIndex (int glyphIndex) { - return glyphCharIndex (glyphIndex); + // FIXME: currently pango does not provide glyph-by-glyph + // reverse mapping information, so we assume a broken 1:1 + // glyph model here. This is plainly wrong. + return glyphIndex; } public int[] getGlyphCharIndices (int beginGlyphIndex, @@ -154,50 +164,44 @@ public class GdkGlyphVector extends Glyp ix = new int[numEntries]; for (int i = 0; i < numEntries; i++) - ix[i] = glyphCharIndex (beginGlyphIndex + i); + ix[i] = getGlyphCharIndex (beginGlyphIndex + i); return ix; } public int getGlyphCode (int glyphIndex) { - return glyphCode (glyphIndex); + return codes[glyphIndex]; } public int[] getGlyphCodes (int beginGlyphIndex, int numEntries, int[] codeReturn) { - int ix[] = codeReturn; - if (ix == null) - ix = new int[numEntries]; + if (codeReturn == null) + codeReturn = new int[numEntries]; - for (int i = 0; i < numEntries; i++) - ix[i] = glyphCode (beginGlyphIndex + i); - return ix; + System.arraycopy(codes, beginGlyphIndex, codeReturn, 0, numEntries); + return codeReturn; } - public Shape getGlyphLogicalBounds (int glyphIndex) + public Shape getGlyphLogicalBounds (int i) { - double extents[] = glyphLogicalExtents (glyphIndex); - return new Rectangle2D.Double (extents[0], extents[1], - extents[2], extents[3]); + return new Rectangle2D.Double (extents[8*i], extents[8*i + 1], + extents[8*i + 2], extents[8*i + 3]); } - public GlyphMetrics getGlyphMetrics (int glyphIndex) + public GlyphMetrics getGlyphMetrics (int i) { - double extents[] = glyphLogicalExtents (glyphIndex); - Rectangle2D log_bounds = new Rectangle2D.Double (extents[0], extents[1], - extents[2], extents[3]); - - extents = glyphInkExtents (glyphIndex); - Rectangle2D ink_bounds = new Rectangle2D.Double (extents[0], extents[1], - extents[2], extents[3]); - - boolean is_horizontal = glyphIsHorizontal (glyphIndex); - - return new GlyphMetrics (is_horizontal, - (float)(log_bounds.getWidth() + log_bounds.getX()), - (float)(log_bounds.getHeight() + log_bounds.getY()), - ink_bounds, GlyphMetrics.STANDARD); + // FIXME: pango does not yield vertical layout information at the + // moment. + + boolean is_horizontal = true; + double advanceX = extents[8*i + 2]; // "logical width" == advanceX + double advanceY = 0; + + return new GlyphMetrics (is_horizontal, + (float) advanceX, (float) advanceY, + (Rectangle2D) getGlyphVisualBounds(i), + GlyphMetrics.STANDARD); } public Shape getGlyphOutline (int glyphIndex) @@ -210,20 +214,18 @@ public class GdkGlyphVector extends Glyp throw new UnsupportedOperationException (); } - public Rectangle getGlyphPixelBounds (int glyphIndex, + public Rectangle getGlyphPixelBounds (int i, FontRenderContext renderFRC, float x, float y) { - double extents[] = glyphInkExtents(glyphIndex); - return new Rectangle ((int)x, (int)y, (int)extents[2], (int)extents[3]); + return new Rectangle((int) x, (int) y, + (int) extents[8*i + 6], (int) extents[8*i + 7]); } - public Point2D getGlyphPosition (int glyphIndex) + public Point2D getGlyphPosition (int i) { - float[] ret = new float[2 * (glyphIndex + 1)]; - getGlyphPositions (0, glyphIndex + 1, ret); - return new Point2D.Float (ret[2 * glyphIndex], - ret[2 * glyphIndex + 1]); + return new Point2D.Double (extents[10*i + 8], + extents[10*i + 9]); } public float[] getGlyphPositions (int beginGlyphIndex, @@ -234,35 +236,25 @@ public class GdkGlyphVector extends Glyp if (fx == null) fx = new float[numEntries * 2]; - - float x = 0.0f; - float y = 0.0f; for (int i = 0; i < numEntries; ++i) { - boolean is_horizontal = glyphIsHorizontal (beginGlyphIndex + i); - double log_extents[] = glyphLogicalExtents (beginGlyphIndex + i); - fx[2*i] = x + (float)log_extents[0]; // x offset - fx[2*i + 1] = y + (float)log_extents[1]; // y offset - if (is_horizontal) - x += (float)log_extents[2]; // x advance ("logical width") in pango-ese - else - y += (float)log_extents[3]; // y advance ("logical height") in pango-ese + fx[2*i ] = (float) extents[10*i + 8]; + fx[2*i + 1] = (float) extents[10*i + 9]; } return fx; } public AffineTransform getGlyphTransform (int glyphIndex) { - // glyphs don't have independent transforms in these simple glyph + // Glyphs don't have independent transforms in these simple glyph // vectors; docs specify null is an ok return here. return null; } - public Shape getGlyphVisualBounds (int glyphIndex) + public Shape getGlyphVisualBounds (int i) { - double extents[] = glyphInkExtents (glyphIndex); - return new Rectangle2D.Double (extents[0], extents[1], - extents[2], extents[3]); + return new Rectangle2D.Double(extents[8*i + 4], extents[8*i + 5], + extents[8*i + 6], extents[8*i + 7]); } public int getLayoutFlags () @@ -272,14 +264,12 @@ public class GdkGlyphVector extends Glyp public Rectangle2D getLogicalBounds () { - double extents[] = allLogicalExtents (); - return new Rectangle2D.Double (extents[0], extents[1], - extents[2], extents[3]); + return allLogical; } public int getNumGlyphs () { - return numGlyphs (); + return codes.length; } public Shape getOutline () @@ -290,26 +280,28 @@ public class GdkGlyphVector extends Glyp public Rectangle getPixelBounds (FontRenderContext renderFRC, float x, float y) { - double extents[] = allInkExtents(); - return new Rectangle ((int)x, (int)y, - (int)extents[2], (int)extents[3]); + return new Rectangle((int)x, + (int)y, + (int) allVisual.getWidth(), + (int) allVisual.getHeight()); } public Rectangle2D getVisualBounds () { - double extents[] = allInkExtents(); - return new Rectangle2D.Double (extents[0], extents[1], - extents[2], extents[3]); + return allVisual; } public void performDefaultLayout () { } - public void setGlyphPosition (int glyphIndex, Point2D newPos) + public void setGlyphPosition (int i, Point2D newPos) { - // should we be ok twiddling pango's structure here? - throw new UnsupportedOperationException (); + extents[8*i ] = newPos.getX(); + extents[8*i + 1] = newPos.getY(); + + extents[8*i + 4] = newPos.getX(); + extents[8*i + 5] = newPos.getY(); } public void setGlyphTransform (int glyphIndex, @@ -327,8 +319,31 @@ public class GdkGlyphVector extends Glyp if (! (gv instanceof GdkGlyphVector)) return false; - GdkGlyphVector ggv = (GdkGlyphVector)gv; - return isEqual(ggv); + GdkGlyphVector ggv = (GdkGlyphVector) gv; + + if ((ggv.codes.length != this.codes.length) + || (ggv.extents.length != this.extents.length)) + return false; + + if ((ggv.font == null && this.font != null) + || (ggv.font != null && this.font == null) + || (!ggv.font.equals(this.font))) + return false; + + if ((ggv.fontRenderContext == null && this.fontRenderContext != null) + || (ggv.fontRenderContext != null && this.fontRenderContext == null) + || (!ggv.fontRenderContext.equals(this.fontRenderContext))) + return false; + + for (int i = 0; i < ggv.codes.length; ++i) + if (ggv.codes[i] != this.codes[i]) + return false; + + for (int i = 0; i < ggv.extents.length; ++i) + if (ggv.extents[i] != this.extents[i]) + return false; + + return true; } public GlyphJustificationInfo getGlyphJustificationInfo(int idx) Index: gnu/java/awt/peer/gtk/GdkGraphics2D.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java,v retrieving revision 1.15.2.4 diff -u -3 -p -u -r1.15.2.4 GdkGraphics2D.java --- gnu/java/awt/peer/gtk/GdkGraphics2D.java 16 Jan 2005 15:15:01 -0000 1.15.2.4 +++ gnu/java/awt/peer/gtk/GdkGraphics2D.java 15 Feb 2005 20:55:11 -0000 @@ -1,5 +1,5 @@ -/* GdkGraphics2D.java - Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* GdkGraphics2D.java -- + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -40,7 +40,6 @@ package gnu.java.awt.peer.gtk; import gnu.classpath.Configuration; import gnu.java.awt.ClasspathToolkit; -import gnu.java.awt.peer.ClasspathFontPeer; import java.awt.AlphaComposite; import java.awt.BasicStroke; @@ -60,9 +59,7 @@ import java.awt.Shape; import java.awt.Stroke; import java.awt.TexturePaint; import java.awt.Toolkit; -import java.awt.color.ColorSpace; import java.awt.font.FontRenderContext; -import java.awt.font.GlyphJustificationInfo; import java.awt.font.GlyphVector; import java.awt.geom.AffineTransform; import java.awt.geom.Arc2D; @@ -80,7 +77,6 @@ import java.awt.image.DataBuffer; import java.awt.image.DataBufferInt; import java.awt.image.DirectColorModel; import java.awt.image.FilteredImageSource; -import java.awt.image.ImageConsumer; import java.awt.image.ImageObserver; import java.awt.image.ImagingOpException; import java.awt.image.MultiPixelPackedSampleModel; @@ -103,6 +99,10 @@ public class GdkGraphics2D extends Graph static { + if (! Configuration.GTK_CAIRO_ENABLED) + throw new Error("Grahics2D not implemented. " + + "Cairo was not found or disabled at configure time"); + if (Configuration.INIT_LOAD_LIBRARY) System.loadLibrary("gtkpeer"); @@ -211,9 +211,7 @@ public class GdkGraphics2D extends Graph GdkGraphics2D(GtkComponentPeer component) { this.component = component; - - setFont(new Font("SansSerif", Font.PLAIN, 12)); - + if (component.isRealized()) initComponentGraphics2D(); else @@ -230,6 +228,7 @@ public class GdkGraphics2D extends Graph setTransform(new AffineTransform()); setStroke(new BasicStroke()); setRenderingHints(getDefaultHints()); + setFont(new Font("SansSerif", Font.PLAIN, 12)); stateStack = new Stack(); } @@ -1322,58 +1321,54 @@ public class GdkGraphics2D extends Graph } // these are the most accelerated painting paths - native void cairoDrawGdkGlyphVector(GdkFontPeer f, GdkGlyphVector gv, - float x, float y); + native void cairoDrawGlyphVector(GdkFontPeer font, + float x, float y, int n, + int[] codes, float[] positions); - native void cairoDrawGdkTextLayout(GdkFontPeer f, GdkTextLayout gl, float x, - float y); - - native void cairoDrawString(GdkFontPeer f, String str, float x, float y); + native void cairoDrawGdkTextLayout(GdkTextLayout gl, + float x, float y); GdkFontPeer getFontPeer() { return (GdkFontPeer) getFont().getPeer(); } - public void drawGdkGlyphVector(GdkGlyphVector gv, float x, float y) - { - cairoDrawGdkGlyphVector(getFontPeer(), gv, x, y); - updateBufferedImage(); - } - public void drawGdkTextLayout(GdkTextLayout gl, float x, float y) { - cairoDrawGdkTextLayout(getFontPeer(), gl, x, y); - updateBufferedImage(); + cairoDrawGdkTextLayout (gl, x, y); + updateBufferedImage (); } public void drawString(String str, float x, float y) { - cairoDrawString(getFontPeer(), str, x, y); - updateBufferedImage(); + drawGlyphVector(getFont().createGlyphVector(null, str), x, y); + updateBufferedImage (); } public void drawString(String str, int x, int y) { - drawString(str, (float) x, (float) y); + drawString (str, (float) x, (float) y); } public void drawString(AttributedCharacterIterator ci, int x, int y) { - drawString(ci, (float) x, (float) y); + drawString (ci, (float) x, (float) y); } public void drawGlyphVector(GlyphVector gv, float x, float y) { - if (gv instanceof GdkGlyphVector) - drawGdkGlyphVector((GdkGlyphVector) gv, x, y); - else - throw new java.lang.UnsupportedOperationException(); + int n = gv.getNumGlyphs (); + int[] codes = gv.getGlyphCodes (0, n, null); + float[] positions = gv.getGlyphPositions (0, n, null); + + setFont (gv.getFont ()); + cairoDrawGlyphVector (getFontPeer(), x, y, n, codes, positions); + updateBufferedImage (); } public void drawString(AttributedCharacterIterator ci, float x, float y) { - GlyphVector gv = font.createGlyphVector(getFontRenderContext(), ci); + GlyphVector gv = getFont().createGlyphVector(getFontRenderContext(), ci); drawGlyphVector(gv, x, y); } @@ -1412,6 +1407,8 @@ public class GdkGraphics2D extends Graph public Font getFont() { + if (font == null) + return new Font("SansSerif", Font.PLAIN, 12); return font; } @@ -1421,16 +1418,9 @@ public class GdkGraphics2D extends Graph static native void releasePeerGraphicsResource(GdkFontPeer f); - static native void getPeerTextMetrics(GdkFontPeer f, String str, - double[] metrics); - - static native void getPeerFontMetrics(GdkFontPeer f, double[] metrics); - public FontMetrics getFontMetrics() { - // the reason we go via the toolkit here is to try to get - // a cached object. the toolkit keeps such a cache. - return Toolkit.getDefaultToolkit().getFontMetrics(font); + return getFontMetrics(getFont()); } public FontMetrics getFontMetrics(Font f) @@ -1453,7 +1443,7 @@ public class GdkGraphics2D extends Graph public String toString() { return (getClass().getName() - + "[font=" + font.toString() + + "[font=" + getFont().toString() + ",color=" + fg.toString() + "]"); } Index: gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java =================================================================== RCS file: gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java diff -N gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java 15 Feb 2005 20:55:11 -0000 @@ -0,0 +1,138 @@ +/* GdkGraphicsConfiguration.java -- describes characteristics of graphics + Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation + +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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.java.awt.peer.gtk; + +import java.awt.BufferCapabilities; +import java.awt.ImageCapabilities; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import java.awt.Rectangle; + +import java.awt.geom.AffineTransform; + +import java.awt.image.BufferedImage; +import java.awt.image.ColorModel; +import java.awt.image.VolatileImage; + +public class GdkGraphicsConfiguration + extends GraphicsConfiguration +{ + GdkScreenGraphicsDevice gdkScreenGraphicsDevice; + ColorModel cm; + Rectangle bounds; + + public GtkToolkit getToolkit() + { + return gdkScreenGraphicsDevice.getToolkit(); + } + + public GdkGraphicsConfiguration(GdkScreenGraphicsDevice dev) + { + this.gdkScreenGraphicsDevice = dev; + cm = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB).getColorModel(); + bounds = getToolkit().getBounds(); + } + + public GraphicsDevice getDevice() + { + return gdkScreenGraphicsDevice; + } + + public BufferedImage createCompatibleImage(int w, int h) + { + return new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); + } + + public BufferedImage createCompatibleImage(int w, int h, + int transparency) + { + return createCompatibleImage(w, h); + } + + public VolatileImage createCompatibleVolatileImage(int w, int h) + { + throw new java.lang.UnsupportedOperationException (); + } + + public VolatileImage createCompatibleVolatileImage(int w, int h, + ImageCapabilities caps) + throws java.awt.AWTException + { + throw new java.lang.UnsupportedOperationException (); + } + + public ColorModel getColorModel() + { + return cm; + } + + public ColorModel getColorModel(int transparency) + { + return getColorModel(); + } + + public AffineTransform getDefaultTransform() + { + // FIXME: extract the GDK DPI information here. + return new AffineTransform(); + } + + public AffineTransform getNormalizingTransform() + { + // FIXME: extract the GDK DPI information here. + return new AffineTransform(); + } + + public Rectangle getBounds() + { + return bounds; + } + + public BufferCapabilities getBufferCapabilities() + { + return new BufferCapabilities(getImageCapabilities(), + getImageCapabilities(), + BufferCapabilities.FlipContents.UNDEFINED); + } + + public ImageCapabilities getImageCapabilities() + { + return new ImageCapabilities(false); + } + +} Index: gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java,v retrieving revision 1.1.2.2 diff -u -3 -p -u -r1.1.2.2 GdkGraphicsEnvironment.java --- gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java 16 Jan 2005 15:15:01 -0000 1.1.2.2 +++ gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java 15 Feb 2005 20:55:11 -0000 @@ -43,21 +43,28 @@ import java.awt.Graphics2D; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.HeadlessException; -import java.awt.Rectangle; -import java.awt.Shape; import java.awt.image.BufferedImage; import java.util.Locale; public class GdkGraphicsEnvironment extends GraphicsEnvironment { - public GdkGraphicsEnvironment () + GtkToolkit gtkToolkit; + + public GtkToolkit getToolkit() + { + return gtkToolkit; + } + + public GdkGraphicsEnvironment (GtkToolkit tk) { super(); + gtkToolkit = tk; } public GraphicsDevice[] getScreenDevices () { - throw new java.lang.UnsupportedOperationException (); + // FIXME: Support multiple screens, since GDK can. + return new GraphicsDevice[] { new GdkScreenGraphicsDevice (this) }; } public GraphicsDevice getDefaultScreenDevice () @@ -65,7 +72,7 @@ public class GdkGraphicsEnvironment exte if (GraphicsEnvironment.isHeadless ()) throw new HeadlessException (); - return new GdkScreenGraphicsDevice (); + return new GdkScreenGraphicsDevice (this); } public Graphics2D createGraphics (BufferedImage image) Index: gnu/java/awt/peer/gtk/GdkPixbufDecoder.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java,v retrieving revision 1.6.2.2 diff -u -3 -p -u -r1.6.2.2 GdkPixbufDecoder.java --- gnu/java/awt/peer/gtk/GdkPixbufDecoder.java 16 Jan 2005 15:15:01 -0000 1.6.2.2 +++ gnu/java/awt/peer/gtk/GdkPixbufDecoder.java 15 Feb 2005 20:55:11 -0000 @@ -42,16 +42,12 @@ import gnu.classpath.Configuration; import java.awt.image.BufferedImage; import java.awt.image.ColorModel; -import java.awt.image.DataBufferInt; import java.awt.image.DirectColorModel; import java.awt.image.ImageConsumer; import java.awt.image.ImageProducer; import java.awt.image.Raster; import java.awt.image.RenderedImage; -import java.awt.image.WritableRaster; import java.io.DataOutput; -import java.io.FileDescriptor; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.net.URL; @@ -176,7 +172,11 @@ public class GdkPixbufDecoder extends gn } curr = null; - finish(); + } + + public void finalize() + { + finish(); } Index: gnu/java/awt/peer/gtk/GdkRobotPeer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkRobotPeer.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 GdkRobotPeer.java --- gnu/java/awt/peer/gtk/GdkRobotPeer.java 16 Jan 2005 15:15:01 -0000 1.1.2.1 +++ gnu/java/awt/peer/gtk/GdkRobotPeer.java 15 Feb 2005 20:55:11 -0000 @@ -38,7 +38,6 @@ exception statement from your version. * package gnu.java.awt.peer.gtk; import java.awt.AWTException; -import java.awt.Color; import java.awt.GraphicsDevice; import java.awt.image.ColorModel; import java.awt.image.DirectColorModel; Index: gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 GdkScreenGraphicsDevice.java --- gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java 16 Jan 2005 15:15:01 -0000 1.1.2.1 +++ gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java 15 Feb 2005 20:55:11 -0000 @@ -43,9 +43,17 @@ import java.awt.GraphicsConfiguration; public class GdkScreenGraphicsDevice extends GraphicsDevice { - public GdkScreenGraphicsDevice () + GdkGraphicsEnvironment env; + + public GtkToolkit getToolkit() { + return env.getToolkit(); + } + + public GdkScreenGraphicsDevice (GdkGraphicsEnvironment e) + { super (); + env = e; } public int getType () @@ -62,12 +70,13 @@ public class GdkScreenGraphicsDevice ext public GraphicsConfiguration[] getConfigurations () { // FIXME: query X for the list of possible configurations - return null; + return new GraphicsConfiguration [] { new GdkGraphicsConfiguration(this) }; } public GraphicsConfiguration getDefaultConfiguration () { + // FIXME: query X for default configuration - return null; + return new GdkGraphicsConfiguration(this); } } Index: gnu/java/awt/peer/gtk/GdkTextLayout.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 GdkTextLayout.java --- gnu/java/awt/peer/gtk/GdkTextLayout.java 15 Jan 2005 17:01:41 -0000 1.1.2.1 +++ gnu/java/awt/peer/gtk/GdkTextLayout.java 15 Feb 2005 20:55:12 -0000 @@ -52,7 +52,6 @@ import java.awt.geom.Rectangle2D; import java.text.CharacterIterator; import java.text.AttributedCharacterIterator; import java.text.AttributedString; -import java.util.Map; import java.awt.font.TextAttribute; import gnu.classpath.Configuration; Index: gnu/java/awt/peer/gtk/GtkButtonPeer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkButtonPeer.java,v retrieving revision 1.30.2.2 diff -u -3 -p -u -r1.30.2.2 GtkButtonPeer.java --- gnu/java/awt/peer/gtk/GtkButtonPeer.java 15 Jan 2005 17:01:41 -0000 1.30.2.2 +++ gnu/java/awt/peer/gtk/GtkButtonPeer.java 15 Feb 2005 20:55:12 -0000 @@ -41,7 +41,6 @@ package gnu.java.awt.peer.gtk; import java.awt.AWTEvent; import java.awt.Button; import java.awt.Component; -import java.awt.Font; import java.awt.Point; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; Index: gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java,v retrieving revision 1.5 diff -u -3 -p -u -r1.5 GtkCheckboxMenuItemPeer.java --- gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java 9 Jul 2003 10:25:34 -0000 1.5 +++ gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java 15 Feb 2005 20:55:12 -0000 @@ -38,9 +38,10 @@ exception statement from your version. * package gnu.java.awt.peer.gtk; +import java.awt.ItemSelectable; +import java.awt.event.ItemEvent; import java.awt.CheckboxMenuItem; import java.awt.peer.CheckboxMenuItemPeer; -import java.awt.peer.MenuItemPeer; public class GtkCheckboxMenuItemPeer extends GtkMenuItemPeer implements CheckboxMenuItemPeer @@ -54,4 +55,15 @@ public class GtkCheckboxMenuItemPeer ext } native public void setState (boolean t); + + protected void postMenuActionEvent () + { + CheckboxMenuItem item = (CheckboxMenuItem)awtWidget; + q().postEvent (new ItemEvent ((ItemSelectable)awtWidget, + ItemEvent.ITEM_STATE_CHANGED, + item.getActionCommand(), + item.getState() ? ItemEvent.DESELECTED : ItemEvent.SELECTED)); + + super.postMenuActionEvent(); + } } Index: gnu/java/awt/peer/gtk/GtkCheckboxPeer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java,v retrieving revision 1.18.2.1 diff -u -3 -p -u -r1.18.2.1 GtkCheckboxPeer.java --- gnu/java/awt/peer/gtk/GtkCheckboxPeer.java 14 Jan 2005 10:24:04 -0000 1.18.2.1 +++ gnu/java/awt/peer/gtk/GtkCheckboxPeer.java 15 Feb 2005 20:55:12 -0000 @@ -40,8 +40,6 @@ package gnu.java.awt.peer.gtk; import java.awt.Checkbox; import java.awt.CheckboxGroup; -import java.awt.Component; -import java.awt.Font; import java.awt.peer.CheckboxPeer; public class GtkCheckboxPeer extends GtkComponentPeer Index: gnu/java/awt/peer/gtk/GtkChoicePeer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java,v retrieving revision 1.17.2.1 diff -u -3 -p -u -r1.17.2.1 GtkChoicePeer.java --- gnu/java/awt/peer/gtk/GtkChoicePeer.java 15 Jan 2005 17:01:41 -0000 1.17.2.1 +++ gnu/java/awt/peer/gtk/GtkChoicePeer.java 15 Feb 2005 20:55:12 -0000 @@ -38,7 +38,6 @@ exception statement from your version. * package gnu.java.awt.peer.gtk; -import java.awt.AWTEvent; import java.awt.Choice; import java.awt.event.ItemEvent; import java.awt.peer.ChoicePeer; Index: gnu/java/awt/peer/gtk/GtkComponentPeer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java,v retrieving revision 1.70.2.4 diff -u -3 -p -u -r1.70.2.4 GtkComponentPeer.java --- gnu/java/awt/peer/gtk/GtkComponentPeer.java 16 Jan 2005 15:15:01 -0000 1.70.2.4 +++ gnu/java/awt/peer/gtk/GtkComponentPeer.java 15 Feb 2005 20:55:12 -0000 @@ -47,14 +47,12 @@ import java.awt.Cursor; import java.awt.Dimension; import java.awt.Font; import java.awt.FontMetrics; -import java.awt.Frame; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GraphicsConfiguration; import java.awt.Image; import java.awt.Insets; import java.awt.ItemSelectable; -import java.awt.KeyboardFocusManager; import java.awt.Point; import java.awt.Rectangle; import java.awt.Toolkit; Index: gnu/java/awt/peer/gtk/GtkContainerPeer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkContainerPeer.java,v retrieving revision 1.25.2.1 diff -u -3 -p -u -r1.25.2.1 GtkContainerPeer.java --- gnu/java/awt/peer/gtk/GtkContainerPeer.java 15 Jan 2005 17:01:41 -0000 1.25.2.1 +++ gnu/java/awt/peer/gtk/GtkContainerPeer.java 15 Feb 2005 20:55:12 -0000 @@ -38,7 +38,6 @@ exception statement from your version. * package gnu.java.awt.peer.gtk; -import java.awt.AWTEvent; import java.awt.Color; import java.awt.Component; import java.awt.Container; @@ -46,7 +45,6 @@ import java.awt.Font; import java.awt.Graphics; import java.awt.Insets; import java.awt.Window; -import java.awt.event.PaintEvent; import java.awt.peer.ComponentPeer; import java.awt.peer.ContainerPeer; Index: gnu/java/awt/peer/gtk/GtkDialogPeer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkDialogPeer.java,v retrieving revision 1.21.2.3 diff -u -3 -p -u -r1.21.2.3 GtkDialogPeer.java --- gnu/java/awt/peer/gtk/GtkDialogPeer.java 16 Jan 2005 15:15:01 -0000 1.21.2.3 +++ gnu/java/awt/peer/gtk/GtkDialogPeer.java 15 Feb 2005 20:55:12 -0000 @@ -38,8 +38,6 @@ exception statement from your version. * package gnu.java.awt.peer.gtk; -import java.awt.AWTEvent; -import java.awt.Component; import java.awt.Dialog; import java.awt.Graphics; import java.awt.Rectangle; Index: gnu/java/awt/peer/gtk/GtkFileDialogPeer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java,v retrieving revision 1.17.2.2 diff -u -3 -p -u -r1.17.2.2 GtkFileDialogPeer.java --- gnu/java/awt/peer/gtk/GtkFileDialogPeer.java 15 Jan 2005 17:01:41 -0000 1.17.2.2 +++ gnu/java/awt/peer/gtk/GtkFileDialogPeer.java 15 Feb 2005 20:55:12 -0000 @@ -38,12 +38,10 @@ exception statement from your version. * package gnu.java.awt.peer.gtk; -import java.awt.AWTEvent; import java.awt.Dialog; import java.awt.FileDialog; import java.awt.Graphics; import java.awt.Window; -import java.awt.event.WindowEvent; import java.awt.peer.FileDialogPeer; import java.io.File; import java.io.FilenameFilter; Index: gnu/java/awt/peer/gtk/GtkFontPeer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkFontPeer.java,v retrieving revision 1.10.2.1 diff -u -3 -p -u -r1.10.2.1 GtkFontPeer.java --- gnu/java/awt/peer/gtk/GtkFontPeer.java 15 Jan 2005 17:01:41 -0000 1.10.2.1 +++ gnu/java/awt/peer/gtk/GtkFontPeer.java 15 Feb 2005 20:55:12 -0000 @@ -46,7 +46,6 @@ import java.awt.font.FontRenderContext; import java.awt.font.GlyphVector; import java.awt.font.LineMetrics; import java.awt.geom.Rectangle2D; -import java.awt.peer.FontPeer; import java.text.CharacterIterator; import java.util.Locale; import java.util.MissingResourceException; Index: gnu/java/awt/peer/gtk/GtkFramePeer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java,v retrieving revision 1.25.2.4 diff -u -3 -p -u -r1.25.2.4 GtkFramePeer.java --- gnu/java/awt/peer/gtk/GtkFramePeer.java 16 Jan 2005 15:15:01 -0000 1.25.2.4 +++ gnu/java/awt/peer/gtk/GtkFramePeer.java 15 Feb 2005 20:55:12 -0000 @@ -38,11 +38,8 @@ exception statement from your version. * package gnu.java.awt.peer.gtk; -import java.awt.Component; -import java.awt.Container; import java.awt.Frame; import java.awt.Graphics; -import java.awt.Graphics2D; import java.awt.Image; import java.awt.MenuBar; import java.awt.Rectangle; Index: gnu/java/awt/peer/gtk/GtkLabelPeer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkLabelPeer.java,v retrieving revision 1.18.2.2 diff -u -3 -p -u -r1.18.2.2 GtkLabelPeer.java --- gnu/java/awt/peer/gtk/GtkLabelPeer.java 15 Jan 2005 17:01:41 -0000 1.18.2.2 +++ gnu/java/awt/peer/gtk/GtkLabelPeer.java 15 Feb 2005 20:55:12 -0000 @@ -38,8 +38,6 @@ exception statement from your version. * package gnu.java.awt.peer.gtk; -import java.awt.Component; -import java.awt.Font; import java.awt.Label; import java.awt.peer.LabelPeer; Index: gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java,v retrieving revision 1.6.2.1 diff -u -3 -p -u -r1.6.2.1 GtkMenuComponentPeer.java --- gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java 14 Jan 2005 10:24:04 -0000 1.6.2.1 +++ gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java 15 Feb 2005 20:55:12 -0000 @@ -38,8 +38,6 @@ exception statement from your version. * package gnu.java.awt.peer.gtk; -import java.awt.Font; -import java.awt.MenuComponent; import java.awt.peer.MenuComponentPeer; public class GtkMenuComponentPeer extends GtkGenericPeer Index: gnu/java/awt/peer/gtk/GtkMenuItemPeer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java,v retrieving revision 1.10.2.2 diff -u -3 -p -u -r1.10.2.2 GtkMenuItemPeer.java --- gnu/java/awt/peer/gtk/GtkMenuItemPeer.java 15 Jan 2005 17:01:41 -0000 1.10.2.2 +++ gnu/java/awt/peer/gtk/GtkMenuItemPeer.java 15 Feb 2005 20:55:12 -0000 @@ -43,8 +43,6 @@ import java.awt.Menu; import java.awt.MenuComponent; import java.awt.MenuBar; import java.awt.MenuItem; -import java.awt.peer.MenuBarPeer; -import java.awt.peer.MenuComponentPeer; import java.awt.peer.MenuItemPeer; import java.awt.peer.MenuPeer; Index: gnu/java/awt/peer/gtk/GtkScrollPanePeer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java,v retrieving revision 1.15.2.1 diff -u -3 -p -u -r1.15.2.1 GtkScrollPanePeer.java --- gnu/java/awt/peer/gtk/GtkScrollPanePeer.java 15 Jan 2005 17:01:42 -0000 1.15.2.1 +++ gnu/java/awt/peer/gtk/GtkScrollPanePeer.java 15 Feb 2005 20:55:12 -0000 @@ -41,7 +41,6 @@ package gnu.java.awt.peer.gtk; import java.awt.Adjustable; import java.awt.Dimension; import java.awt.ScrollPane; -import java.awt.peer.ComponentPeer; import java.awt.peer.ScrollPanePeer; public class GtkScrollPanePeer extends GtkContainerPeer Index: gnu/java/awt/peer/gtk/GtkTextComponentPeer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkTextComponentPeer.java,v retrieving revision 1.14.2.1 diff -u -3 -p -u -r1.14.2.1 GtkTextComponentPeer.java --- gnu/java/awt/peer/gtk/GtkTextComponentPeer.java 16 Jan 2005 15:15:01 -0000 1.14.2.1 +++ gnu/java/awt/peer/gtk/GtkTextComponentPeer.java 15 Feb 2005 20:55:12 -0000 @@ -38,11 +38,8 @@ exception statement from your version. * package gnu.java.awt.peer.gtk; -import java.awt.AWTEvent; -import java.awt.Component; import java.awt.Rectangle; import java.awt.TextComponent; -import java.awt.event.KeyEvent; import java.awt.event.TextEvent; import java.awt.peer.TextComponentPeer; Index: gnu/java/awt/peer/gtk/GtkToolkit.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java,v retrieving revision 1.54.2.4 diff -u -3 -p -u -r1.54.2.4 GtkToolkit.java --- gnu/java/awt/peer/gtk/GtkToolkit.java 18 Jan 2005 11:38:29 -0000 1.54.2.4 +++ gnu/java/awt/peer/gtk/GtkToolkit.java 15 Feb 2005 20:55:12 -0000 @@ -51,7 +51,6 @@ import java.awt.datatransfer.Clipboard; import java.awt.dnd.DragGestureEvent; import java.awt.dnd.peer.DragSourceContextPeer; import java.awt.font.FontRenderContext; -import java.awt.font.TextAttribute; import java.awt.im.InputMethodHighlight; import java.awt.image.BufferedImage; import java.awt.image.ColorModel; @@ -68,7 +67,6 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; -import java.util.MissingResourceException; import java.util.Properties; import javax.imageio.spi.IIORegistry; @@ -348,15 +346,18 @@ public class GtkToolkit extends gnu.java public FontMetrics getFontMetrics (Font font) { - if (metricsCache.containsKey(font)) - return (FontMetrics) metricsCache.get(font); - else + synchronized (metricsCache) + { + if (metricsCache.containsKey(font)) + return (FontMetrics) metricsCache.get(font); + } + + FontMetrics m = new GdkFontMetrics (font); + synchronized (metricsCache) { - FontMetrics m; - m = new GdkFontMetrics (font); metricsCache.put(font, m); - return m; - } + } + return m; } public Image getImage (String filename) @@ -632,11 +633,18 @@ public class GtkToolkit extends gnu.java throw new Error("not implemented"); } + public Rectangle getBounds() + { + int[] dims = new int[2]; + getScreenSizeDimensions(dims); + return new Rectangle(0, 0, dims[0], dims[1]); + } + // ClasspathToolkit methods public GraphicsEnvironment getLocalGraphicsEnvironment() { - return new GdkGraphicsEnvironment(); + return new GdkGraphicsEnvironment(this); } public Font createFont(int format, InputStream stream) Index: gnu/java/awt/peer/gtk/GtkWindowPeer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java,v retrieving revision 1.27.2.2 diff -u -3 -p -u -r1.27.2.2 GtkWindowPeer.java --- gnu/java/awt/peer/gtk/GtkWindowPeer.java 16 Jan 2005 15:15:01 -0000 1.27.2.2 +++ gnu/java/awt/peer/gtk/GtkWindowPeer.java 15 Feb 2005 20:55:12 -0000 @@ -39,7 +39,6 @@ exception statement from your version. * package gnu.java.awt.peer.gtk; import java.awt.Component; -import java.awt.Dimension; import java.awt.Frame; import java.awt.Window; import java.awt.event.WindowEvent; Index: gnu/java/io/EncodingManager.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/io/EncodingManager.java,v retrieving revision 1.7.2.3 diff -u -3 -p -u -r1.7.2.3 EncodingManager.java --- gnu/java/io/EncodingManager.java 16 Jan 2005 15:15:01 -0000 1.7.2.3 +++ gnu/java/io/EncodingManager.java 15 Feb 2005 20:55:12 -0000 @@ -46,7 +46,6 @@ import java.lang.reflect.Constructor; import java.io.InputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; -import java.security.AccessController; import java.util.Hashtable; import java.util.StringTokenizer; Index: gnu/java/io/decode/DecoderUTF8.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/io/decode/DecoderUTF8.java,v retrieving revision 1.5.2.1 diff -u -3 -p -u -r1.5.2.1 DecoderUTF8.java --- gnu/java/io/decode/DecoderUTF8.java 16 Jan 2005 02:14:45 -0000 1.5.2.1 +++ gnu/java/io/decode/DecoderUTF8.java 15 Feb 2005 20:55:12 -0000 @@ -39,7 +39,6 @@ exception statement from your version. * package gnu.java.io.decode; import java.io.InputStream; -import java.io.CharConversionException; import java.io.IOException; /** Index: gnu/java/net/protocol/file/Connection.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/file/Connection.java,v retrieving revision 1.8.2.2 diff -u -3 -p -u -r1.8.2.2 Connection.java --- gnu/java/net/protocol/file/Connection.java 16 Jan 2005 15:15:08 -0000 1.8.2.2 +++ gnu/java/net/protocol/file/Connection.java 15 Feb 2005 20:55:12 -0000 @@ -53,7 +53,6 @@ import java.net.ProtocolException; import java.net.URL; import java.net.URLConnection; import java.security.Permission; -import java.security.AccessController; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; Index: gnu/java/net/protocol/ftp/ActiveModeDTP.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/ftp/ActiveModeDTP.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 ActiveModeDTP.java --- gnu/java/net/protocol/ftp/ActiveModeDTP.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ gnu/java/net/protocol/ftp/ActiveModeDTP.java 15 Feb 2005 20:55:12 -0000 @@ -42,7 +42,6 @@ import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.net.InetAddress; -import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.Socket; Index: gnu/java/net/protocol/ftp/BlockInputStream.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/ftp/BlockInputStream.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 BlockInputStream.java --- gnu/java/net/protocol/ftp/BlockInputStream.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ gnu/java/net/protocol/ftp/BlockInputStream.java 15 Feb 2005 20:55:12 -0000 @@ -38,7 +38,6 @@ exception statement from your version. * package gnu.java.net.protocol.ftp; -import java.io.FilterInputStream; import java.io.InputStream; import java.io.IOException; Index: gnu/java/net/protocol/ftp/BlockOutputStream.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/ftp/BlockOutputStream.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 BlockOutputStream.java --- gnu/java/net/protocol/ftp/BlockOutputStream.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ gnu/java/net/protocol/ftp/BlockOutputStream.java 15 Feb 2005 20:55:12 -0000 @@ -38,7 +38,6 @@ exception statement from your version. * package gnu.java.net.protocol.ftp; -import java.io.FilterOutputStream; import java.io.IOException; import java.io.OutputStream; Index: gnu/java/net/protocol/ftp/CompressedOutputStream.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/ftp/CompressedOutputStream.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 CompressedOutputStream.java --- gnu/java/net/protocol/ftp/CompressedOutputStream.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ gnu/java/net/protocol/ftp/CompressedOutputStream.java 15 Feb 2005 20:55:12 -0000 @@ -38,7 +38,6 @@ exception statement from your version. * package gnu.java.net.protocol.ftp; -import java.io.FilterOutputStream; import java.io.IOException; import java.io.OutputStream; Index: gnu/java/net/protocol/ftp/StreamInputStream.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/ftp/StreamInputStream.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 StreamInputStream.java --- gnu/java/net/protocol/ftp/StreamInputStream.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ gnu/java/net/protocol/ftp/StreamInputStream.java 15 Feb 2005 20:55:12 -0000 @@ -38,7 +38,6 @@ exception statement from your version. * package gnu.java.net.protocol.ftp; -import java.io.FilterInputStream; import java.io.InputStream; import java.io.IOException; Index: gnu/java/net/protocol/ftp/StreamOutputStream.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/ftp/StreamOutputStream.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 StreamOutputStream.java --- gnu/java/net/protocol/ftp/StreamOutputStream.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ gnu/java/net/protocol/ftp/StreamOutputStream.java 15 Feb 2005 20:55:12 -0000 @@ -38,7 +38,6 @@ exception statement from your version. * package gnu.java.net.protocol.ftp; -import java.io.FilterOutputStream; import java.io.IOException; import java.io.OutputStream; Index: gnu/java/net/protocol/http/Cookie.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/http/Cookie.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 Cookie.java --- gnu/java/net/protocol/http/Cookie.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ gnu/java/net/protocol/http/Cookie.java 15 Feb 2005 20:55:12 -0000 @@ -38,7 +38,6 @@ exception statement from your version. * package gnu.java.net.protocol.http; -import java.text.ParseException; import java.util.Date; /** Index: gnu/java/net/protocol/http/HTTPConnection.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/http/HTTPConnection.java,v retrieving revision 1.4.2.1 diff -u -3 -p -u -r1.4.2.1 HTTPConnection.java --- gnu/java/net/protocol/http/HTTPConnection.java 16 Jan 2005 15:15:09 -0000 1.4.2.1 +++ gnu/java/net/protocol/http/HTTPConnection.java 15 Feb 2005 20:55:12 -0000 @@ -54,12 +54,10 @@ import java.net.InetSocketAddress; import java.net.Socket; import java.security.GeneralSecurityException; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import javax.net.SocketFactory; import javax.net.ssl.HandshakeCompletedListener; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocket; Index: gnu/java/net/protocol/http/HTTPDateFormat.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/http/HTTPDateFormat.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 HTTPDateFormat.java --- gnu/java/net/protocol/http/HTTPDateFormat.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ gnu/java/net/protocol/http/HTTPDateFormat.java 15 Feb 2005 20:55:12 -0000 @@ -38,9 +38,15 @@ exception statement from your version. * package gnu.java.net.protocol.http; -import java.io.PrintStream; -import java.text.*; -import java.util.*; +import java.text.DateFormat; +import java.text.DecimalFormat; +import java.text.FieldPosition; +import java.text.NumberFormat; +import java.text.ParsePosition; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.TimeZone; /** * HTTP date formatter and parser. Index: gnu/java/net/protocol/http/Request.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/http/Request.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 Request.java --- gnu/java/net/protocol/http/Request.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ gnu/java/net/protocol/http/Request.java 15 Feb 2005 20:55:13 -0000 @@ -46,7 +46,6 @@ import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.net.ProtocolException; -import java.net.Socket; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.text.DateFormat; Index: gnu/java/net/protocol/jar/Connection.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/jar/Connection.java,v retrieving revision 1.4.2.1 diff -u -3 -p -u -r1.4.2.1 Connection.java --- gnu/java/net/protocol/jar/Connection.java 3 Feb 2005 00:55:47 -0000 1.4.2.1 +++ gnu/java/net/protocol/jar/Connection.java 15 Feb 2005 20:55:13 -0000 @@ -97,9 +97,8 @@ public final class Connection extends Ja fos.close(); // Always verify the Manifest, open read only and delete when done. - // XXX ZipFile.OPEN_DELETE not yet implemented. - // jf = new JarFile (f, true, ZipFile.OPEN_READ | ZipFile.OPEN_DELETE); - jf = new JarFile (f, true, ZipFile.OPEN_READ); + jf = new JarFile (f, true, + ZipFile.OPEN_READ | ZipFile.OPEN_DELETE); } cache.put (url, jf); Index: gnu/java/nio/SelectorImpl.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/nio/SelectorImpl.java,v retrieving revision 1.16.2.1 diff -u -3 -p -u -r1.16.2.1 SelectorImpl.java --- gnu/java/nio/SelectorImpl.java 16 Jan 2005 15:15:09 -0000 1.16.2.1 +++ gnu/java/nio/SelectorImpl.java 15 Feb 2005 20:55:13 -0000 @@ -38,8 +38,6 @@ exception statement from your version. * package gnu.java.nio; -import gnu.classpath.Configuration; - import java.io.IOException; import java.nio.channels.ClosedSelectorException; import java.nio.channels.SelectableChannel; Index: gnu/java/rmi/dgc/DGCImpl.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/rmi/dgc/DGCImpl.java,v retrieving revision 1.4 diff -u -3 -p -u -r1.4 DGCImpl.java --- gnu/java/rmi/dgc/DGCImpl.java 31 Oct 2002 18:35:21 -0000 1.4 +++ gnu/java/rmi/dgc/DGCImpl.java 15 Feb 2005 20:55:13 -0000 @@ -42,7 +42,6 @@ import java.rmi.dgc.Lease; import java.rmi.dgc.VMID; import java.rmi.server.ObjID; import java.rmi.RemoteException; -import java.rmi.server.UnicastRemoteObject; import java.rmi.server.RMISocketFactory; import gnu.java.rmi.server.UnicastServerRef; Index: gnu/java/rmi/server/UnicastConnectionManager.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/rmi/server/UnicastConnectionManager.java,v retrieving revision 1.6.2.2 diff -u -3 -p -u -r1.6.2.2 UnicastConnectionManager.java --- gnu/java/rmi/server/UnicastConnectionManager.java 16 Jan 2005 02:14:45 -0000 1.6.2.2 +++ gnu/java/rmi/server/UnicastConnectionManager.java 15 Feb 2005 20:55:13 -0000 @@ -55,7 +55,6 @@ import java.rmi.server.RMIServerSocketFa import java.rmi.server.RMIClientSocketFactory; import java.util.ArrayList; import java.util.ConcurrentModificationException; -import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; Index: gnu/java/security/pkcs/SignerInfo.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/security/pkcs/SignerInfo.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 SignerInfo.java --- gnu/java/security/pkcs/SignerInfo.java 16 Jan 2005 02:14:45 -0000 1.1.2.1 +++ gnu/java/security/pkcs/SignerInfo.java 15 Feb 2005 20:55:13 -0000 @@ -41,11 +41,9 @@ import gnu.java.security.ber.BER; import gnu.java.security.ber.BEREncodingException; import gnu.java.security.ber.BERReader; import gnu.java.security.ber.BERValue; -import gnu.java.security.der.BitString; import gnu.java.security.der.DERValue; import java.io.IOException; -import java.io.InputStream; import java.math.BigInteger; Index: gnu/java/security/provider/EncodedKeyFactory.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/security/provider/EncodedKeyFactory.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 EncodedKeyFactory.java --- gnu/java/security/provider/EncodedKeyFactory.java 16 Jan 2005 02:14:45 -0000 1.1.2.1 +++ gnu/java/security/provider/EncodedKeyFactory.java 15 Feb 2005 20:55:13 -0000 @@ -38,6 +38,11 @@ exception statement from your version. * package gnu.java.security.provider; +import gnu.java.security.OID; +import gnu.java.security.der.BitString; +import gnu.java.security.der.DERReader; +import gnu.java.security.der.DERValue; + import java.io.IOException; import java.math.BigInteger; @@ -45,15 +50,12 @@ import java.math.BigInteger; import java.security.AlgorithmParameters; import java.security.InvalidKeyException; import java.security.Key; -import java.security.KeyFactory; import java.security.KeyFactorySpi; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.PublicKey; import java.security.spec.DSAParameterSpec; -import java.security.spec.DSAPrivateKeySpec; -import java.security.spec.DSAPublicKeySpec; import java.security.spec.InvalidParameterSpecException; import java.security.spec.InvalidKeySpecException; import java.security.spec.KeySpec; @@ -64,12 +66,6 @@ import java.security.spec.X509EncodedKey import javax.crypto.spec.DHParameterSpec; -import gnu.java.security.OID; -import gnu.java.security.der.BitString; -import gnu.java.security.der.DER; -import gnu.java.security.der.DERReader; -import gnu.java.security.der.DERValue; - /** * A factory for keys encoded in either the X.509 format (for public * keys) or the PKCS#8 format (for private keys). Index: gnu/java/security/provider/GnuDHPublicKey.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/security/provider/GnuDHPublicKey.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 GnuDHPublicKey.java --- gnu/java/security/provider/GnuDHPublicKey.java 16 Jan 2005 02:14:45 -0000 1.1.2.1 +++ gnu/java/security/provider/GnuDHPublicKey.java 15 Feb 2005 20:55:13 -0000 @@ -49,7 +49,6 @@ import gnu.java.security.OID; import gnu.java.security.der.BitString; import gnu.java.security.der.DER; import gnu.java.security.der.DERValue; -import gnu.java.security.der.DERWriter; public class GnuDHPublicKey implements DHPublicKey { Index: gnu/java/security/provider/PKIXCertPathValidatorImpl.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/security/provider/PKIXCertPathValidatorImpl.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 PKIXCertPathValidatorImpl.java --- gnu/java/security/provider/PKIXCertPathValidatorImpl.java 16 Jan 2005 02:14:45 -0000 1.1.2.1 +++ gnu/java/security/provider/PKIXCertPathValidatorImpl.java 15 Feb 2005 20:55:13 -0000 @@ -38,18 +38,40 @@ exception statement from your version. * package gnu.java.security.provider; +import gnu.java.security.OID; +import gnu.java.security.x509.GnuPKIExtension; +import gnu.java.security.x509.PolicyNodeImpl; +import gnu.java.security.x509.X509CertSelectorImpl; +import gnu.java.security.x509.X509CRLSelectorImpl; +import gnu.java.security.x509.ext.BasicConstraints; +import gnu.java.security.x509.ext.CertificatePolicies; +import gnu.java.security.x509.ext.Extension; +import gnu.java.security.x509.ext.KeyUsage; +import gnu.java.security.x509.ext.PolicyConstraint; + import java.io.IOException; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; -import java.security.Principal; import java.security.PublicKey; -import java.security.cert.*; - +import java.security.cert.CertificateException; +import java.security.cert.CertPath; +import java.security.cert.CertPathParameters; +import java.security.cert.CertPathValidatorException; +import java.security.cert.CertPathValidatorResult; +import java.security.cert.CertPathValidatorSpi; +import java.security.cert.CertStore; +import java.security.cert.CertStoreException; +import java.security.cert.CRL; +import java.security.cert.PKIXCertPathChecker; +import java.security.cert.PKIXCertPathValidatorResult; +import java.security.cert.PKIXParameters; +import java.security.cert.TrustAnchor; +import java.security.cert.X509Certificate; +import java.security.cert.X509CRL; import java.security.interfaces.DSAParams; import java.security.interfaces.DSAPublicKey; -import java.security.spec.DSAParameterSpec; import java.util.Arrays; import java.util.Collection; @@ -61,13 +83,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; -import gnu.java.security.x509.GnuPKIExtension; -import gnu.java.security.x509.PolicyNodeImpl; -import gnu.java.security.x509.X509CertSelectorImpl; -import gnu.java.security.x509.X509CRLSelectorImpl; -import gnu.java.security.x509.ext.*; -import gnu.java.security.OID; - /** * An implementation of the Public Key Infrastructure's X.509 * certificate path validation algorithm. Index: gnu/java/security/x509/X500DistinguishedName.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/security/x509/X500DistinguishedName.java,v retrieving revision 1.1.2.2 diff -u -3 -p -u -r1.1.2.2 X500DistinguishedName.java --- gnu/java/security/x509/X500DistinguishedName.java 16 Jan 2005 02:14:46 -0000 1.1.2.2 +++ gnu/java/security/x509/X500DistinguishedName.java 15 Feb 2005 20:55:13 -0000 @@ -55,7 +55,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.TreeMap; import gnu.java.security.der.DER; import gnu.java.security.der.DERReader; Index: gnu/java/security/x509/X509CRL.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/security/x509/X509CRL.java,v retrieving revision 1.1.2.2 diff -u -3 -p -u -r1.1.2.2 X509CRL.java --- gnu/java/security/x509/X509CRL.java 16 Jan 2005 02:14:46 -0000 1.1.2.2 +++ gnu/java/security/x509/X509CRL.java 15 Feb 2005 20:55:13 -0000 @@ -38,7 +38,6 @@ exception statement from your version. * package gnu.java.security.x509; -import gnu.java.io.ASN1ParsingException; import gnu.java.security.OID; import gnu.java.security.der.BitString; import gnu.java.security.der.DER; Index: gnu/java/security/x509/X509CRLEntry.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/security/x509/X509CRLEntry.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 X509CRLEntry.java --- gnu/java/security/x509/X509CRLEntry.java 16 Jan 2005 02:14:46 -0000 1.1.2.1 +++ gnu/java/security/x509/X509CRLEntry.java 15 Feb 2005 20:55:13 -0000 @@ -38,7 +38,6 @@ exception statement from your version. * package gnu.java.security.x509; -import java.io.InputStream; import java.io.IOException; import java.math.BigInteger; Index: gnu/java/security/x509/X509Certificate.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/security/x509/X509Certificate.java,v retrieving revision 1.3.2.2 diff -u -3 -p -u -r1.3.2.2 X509Certificate.java --- gnu/java/security/x509/X509Certificate.java 16 Jan 2005 15:15:09 -0000 1.3.2.2 +++ gnu/java/security/x509/X509Certificate.java 15 Feb 2005 20:55:15 -0000 @@ -38,18 +38,14 @@ exception statement from your version. * package gnu.java.security.x509; -import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.IOException; -import java.io.ObjectStreamException; import java.io.PrintWriter; import java.io.Serializable; import java.io.StringWriter; import java.math.BigInteger; -import java.net.InetAddress; - import java.security.AlgorithmParameters; import java.security.InvalidKeyException; import java.security.KeyFactory; @@ -79,7 +75,6 @@ import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; Index: gnu/java/security/x509/ext/AuthorityKeyIdentifier.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/security/x509/ext/AuthorityKeyIdentifier.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 AuthorityKeyIdentifier.java --- gnu/java/security/x509/ext/AuthorityKeyIdentifier.java 16 Jan 2005 02:14:46 -0000 1.1.2.1 +++ gnu/java/security/x509/ext/AuthorityKeyIdentifier.java 15 Feb 2005 20:55:15 -0000 @@ -40,7 +40,6 @@ package gnu.java.security.x509.ext; import java.io.IOException; import java.math.BigInteger; -import java.util.List; import gnu.java.security.OID; import gnu.java.security.der.DER; Index: gnu/java/security/x509/ext/CertificatePolicies.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/security/x509/ext/CertificatePolicies.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 CertificatePolicies.java --- gnu/java/security/x509/ext/CertificatePolicies.java 16 Jan 2005 02:14:46 -0000 1.1.2.1 +++ gnu/java/security/x509/ext/CertificatePolicies.java 15 Feb 2005 20:55:15 -0000 @@ -39,7 +39,6 @@ exception statement from your version. * package gnu.java.security.x509.ext; import java.io.IOException; -import java.math.BigInteger; import java.security.cert.PolicyQualifierInfo; import java.util.ArrayList; Index: gnu/java/security/x509/ext/PolicyConstraint.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/security/x509/ext/PolicyConstraint.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 PolicyConstraint.java --- gnu/java/security/x509/ext/PolicyConstraint.java 16 Jan 2005 02:14:46 -0000 1.1.2.1 +++ gnu/java/security/x509/ext/PolicyConstraint.java 15 Feb 2005 20:55:15 -0000 @@ -42,10 +42,8 @@ import java.io.IOException; import java.math.BigInteger; import gnu.java.security.OID; -import gnu.java.security.der.DER; import gnu.java.security.der.DERReader; import gnu.java.security.der.DERValue; -import gnu.java.security.x509.Util; public class PolicyConstraint extends Extension.Value { Index: gnu/xml/aelfred2/SAXDriver.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/aelfred2/SAXDriver.java,v retrieving revision 1.1.2.2 diff -u -3 -p -u -r1.1.2.2 SAXDriver.java --- gnu/xml/aelfred2/SAXDriver.java 6 Feb 2005 02:24:18 -0000 1.1.2.2 +++ gnu/xml/aelfred2/SAXDriver.java 15 Feb 2005 20:55:15 -0000 @@ -65,10 +65,8 @@ import java.util.Stack; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; -import java.util.Hashtable; import java.util.Iterator; import java.util.List; -import java.util.Vector; import org.xml.sax.*; import org.xml.sax.ext.*; @@ -1031,7 +1029,7 @@ final public class SAXDriver */ public int getLength () { - return attributesList.size (); + return attributesList.size(); } /** @@ -1039,7 +1037,11 @@ final public class SAXDriver */ public String getURI (int index) { - return ((Attribute) attributesList.get (index)).nameSpace; + if (index < 0 || index >= attributesList.size()) + { + return null; + } + return ((Attribute) attributesList.get(index)).nameSpace; } /** @@ -1047,7 +1049,11 @@ final public class SAXDriver */ public String getLocalName (int index) { - Attribute attr = (Attribute) attributesList.get (index); + if (index < 0 || index >= attributesList.size()) + { + return null; + } + Attribute attr = (Attribute) attributesList.get(index); // FIXME attr.localName is sometimes null, why? if (namespaces && attr.localName == null) { @@ -1056,38 +1062,51 @@ final public class SAXDriver attr.localName = (ci == -1) ? attr.name : attr.name.substring(ci + 1); } - return attr.localName; + return (attr.localName == null) ? "" : attr.localName; } /** * SAX2 Attributes method (don't invoke on parser); */ - public String getQName (int i) + public String getQName (int index) { - return ((Attribute) attributesList.get (i)).name; + if (index < 0 || index >= attributesList.size()) + { + return null; + } + Attribute attr = (Attribute) attributesList.get(index); + return (attr.name == null) ? "" : attr.name; } /** * SAX1 AttributeList method (don't invoke on parser); */ - public String getName (int i) + public String getName (int index) { - return ((Attribute) attributesList.get (i)).name; + return getQName(index); } /** * SAX1 AttributeList, SAX2 Attributes method * (don't invoke on parser); */ - public String getType (int i) + public String getType (int index) { - String type = parser.getAttributeType (elementName, getQName (i)); + if (index < 0 || index >= attributesList.size()) + { + return null; + } + String type = parser.getAttributeType(elementName, getQName(index)); if (type == null) + { return "CDATA"; + } // ... use DeclHandler.attributeDecl to see enumerations - if (type == "ENUMERATION") - return "NMTOKEN"; - return type; + if (type == "ENUMERATION") + { + return "NMTOKEN"; + } + return type; } @@ -1095,9 +1114,13 @@ final public class SAXDriver * SAX1 AttributeList, SAX2 Attributes method * (don't invoke on parser); */ - public String getValue (int i) + public String getValue (int index) { - return ((Attribute) attributesList.get (i)).value; + if (index < 0 || index >= attributesList.size()) + { + return null; + } + return ((Attribute) attributesList.get(index)).value; } @@ -1106,14 +1129,19 @@ final public class SAXDriver */ public int getIndex (String uri, String local) { - int length = getLength (); + int length = getLength(); - for (int i = 0; i < length; i++) { - if (!getURI (i).equals (uri)) + for (int i = 0; i < length; i++) + { + if (!getURI(i).equals(uri)) + { continue; - if (getLocalName (i).equals (local)) + } + if (getLocalName(i).equals(local)) + { return i; - } + } + } return -1; } @@ -1123,12 +1151,15 @@ final public class SAXDriver */ public int getIndex (String xmlName) { - int length = getLength (); + int length = getLength(); - for (int i = 0; i < length; i++) { - if (getQName (i).equals (xmlName)) + for (int i = 0; i < length; i++) + { + if (getQName(i).equals(xmlName)) + { return i; - } + } + } return -1; } @@ -1138,11 +1169,13 @@ final public class SAXDriver */ public String getType (String uri, String local) { - int index = getIndex (uri, local); + int index = getIndex(uri, local); if (index < 0) + { return null; - return getType (index); + } + return getType(index); } @@ -1152,11 +1185,13 @@ final public class SAXDriver */ public String getType (String xmlName) { - int index = getIndex (xmlName); + int index = getIndex(xmlName); if (index < 0) + { return null; - return getType (index); + } + return getType(index); } @@ -1165,11 +1200,13 @@ final public class SAXDriver */ public String getValue (String uri, String local) { - int index = getIndex (uri, local); + int index = getIndex(uri, local); if (index < 0) + { return null; - return getValue (index); + } + return getValue(index); } @@ -1179,11 +1216,13 @@ final public class SAXDriver */ public String getValue (String xmlName) { - int index = getIndex (xmlName); + int index = getIndex(xmlName); if (index < 0) + { return null; - return getValue (index); + } + return getValue(index); } Index: gnu/xml/dom/Consumer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/Consumer.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 Consumer.java --- gnu/xml/dom/Consumer.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ gnu/xml/dom/Consumer.java 15 Feb 2005 20:55:15 -0000 @@ -38,16 +38,11 @@ exception statement from your version. * package gnu.xml.dom; -import java.io.IOException; - -import org.w3c.dom.Document; import org.w3c.dom.DocumentType; -import org.w3c.dom.DOMImplementation; import org.w3c.dom.Node; import org.w3c.dom.Text; import org.xml.sax.Attributes; -import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.ext.Attributes2; Index: gnu/xml/dom/DomAttr.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomAttr.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 DomAttr.java --- gnu/xml/dom/DomAttr.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ gnu/xml/dom/DomAttr.java 15 Feb 2005 20:55:15 -0000 @@ -38,6 +38,7 @@ exception statement from your version. * package gnu.xml.dom; import org.w3c.dom.Attr; +import org.w3c.dom.DOMException; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.TypeInfo; @@ -194,7 +195,7 @@ public class DomAttr { if (readonly) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } if (value == null) { @@ -284,11 +285,11 @@ public class DomAttr { if (parent != null) { - throw new DomEx (DomEx.HIERARCHY_REQUEST_ERR); + throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR); } if (!(e instanceof DomElement)) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR); } parent = (DomElement) e; depth = parent.depth + 1; Index: gnu/xml/dom/DomCDATA.java =================================================================== RCS file: gnu/xml/dom/DomCDATA.java diff -N gnu/xml/dom/DomCDATA.java --- gnu/xml/dom/DomCDATA.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,91 +0,0 @@ -/* DomCDATA.java -- - Copyright (C) 1999,2000,2001,2004 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., 59 Temple Place, Suite 330, Boston, MA -02111-1307 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.xml.dom; - -import org.w3c.dom.CDATASection; - -/** - *

"CDATASection" implementation. - * This is a non-core DOM class, supporting the "XML" feature. - * CDATA sections are just ways to represent text using different - * delimeters.

- * - *

You are strongly advised not to use CDATASection nodes. - * The advantage of having slightly prettier ways to print text that may - * have lots of embedded XML delimiters, such as "&" and "<", - * can be dwarfed by the cost of dealing with multiple kinds of text - * nodes in all your algorithms.

- * - * @author David Brownell - * @author Chris Burdess - */ -public class DomCDATA - extends DomText - implements CDATASection -{ - - /** - * Constructs a CDATA section node associated with the specified - * document and holding the specified data. - * - *

This constructor should only be invoked by a Document as part of - * its createCDATASection functionality, or through a subclass which is - * similarly used in a "Sub-DOM" style layer. - * - */ - protected DomCDATA(DomDocument owner, String value) - { - super(CDATA_SECTION_NODE, owner, value); - } - - protected DomCDATA(DomDocument owner, char buf [], int off, int len) - { - super(CDATA_SECTION_NODE, owner, buf, off, len); - } - - /** - * DOM L1 - * Returns the string "#cdata-section". - */ - final public String getNodeName() - { - return "#cdata-section"; - } - -} - Index: gnu/xml/dom/DomCDATASection.java =================================================================== RCS file: gnu/xml/dom/DomCDATASection.java diff -N gnu/xml/dom/DomCDATASection.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/xml/dom/DomCDATASection.java 15 Feb 2005 20:55:15 -0000 @@ -0,0 +1,91 @@ +/* DomCDATASection.java -- + Copyright (C) 1999,2000,2001,2004 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.xml.dom; + +import org.w3c.dom.CDATASection; + +/** + *

"CDATASection" implementation. + * This is a non-core DOM class, supporting the "XML" feature. + * CDATA sections are just ways to represent text using different + * delimeters.

+ * + *

You are strongly advised not to use CDATASection nodes. + * The advantage of having slightly prettier ways to print text that may + * have lots of embedded XML delimiters, such as "&" and "<", + * can be dwarfed by the cost of dealing with multiple kinds of text + * nodes in all your algorithms.

+ * + * @author David Brownell + * @author Chris Burdess + */ +public class DomCDATASection + extends DomText + implements CDATASection +{ + + /** + * Constructs a CDATA section node associated with the specified + * document and holding the specified data. + * + *

This constructor should only be invoked by a Document as part of + * its createCDATASection functionality, or through a subclass which is + * similarly used in a "Sub-DOM" style layer. + * + */ + protected DomCDATASection(DomDocument owner, String value) + { + super(CDATA_SECTION_NODE, owner, value); + } + + protected DomCDATASection(DomDocument owner, char buf [], int off, int len) + { + super(CDATA_SECTION_NODE, owner, buf, off, len); + } + + /** + * DOM L1 + * Returns the string "#cdata-section". + */ + final public String getNodeName() + { + return "#cdata-section"; + } + +} + Index: gnu/xml/dom/DomCharacterData.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomCharacterData.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 DomCharacterData.java --- gnu/xml/dom/DomCharacterData.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ gnu/xml/dom/DomCharacterData.java 15 Feb 2005 20:55:15 -0000 @@ -38,8 +38,7 @@ exception statement from your version. * package gnu.xml.dom; import org.w3c.dom.CharacterData; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; +import org.w3c.dom.DOMException; import org.w3c.dom.events.MutationEvent; @@ -82,7 +81,7 @@ public abstract class DomCharacterData { if (isReadonly()) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } String value = text + arg; mutating(value); @@ -98,12 +97,12 @@ public abstract class DomCharacterData { if (isReadonly()) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } char[] raw = text.toCharArray(); if (offset < 0 || count < 0 || offset > raw.length) { - throw new DomEx(DomEx.INDEX_SIZE_ERR); + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } if ((offset + count) > raw.length) { @@ -125,7 +124,7 @@ public abstract class DomCharacterData } catch (IndexOutOfBoundsException x) { - throw new DomEx(DomEx.INDEX_SIZE_ERR); + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } } @@ -164,7 +163,7 @@ public abstract class DomCharacterData { if (isReadonly()) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } char[] raw = text.toCharArray(); char[] tmp = arg.toCharArray (); @@ -182,7 +181,7 @@ public abstract class DomCharacterData } catch (IndexOutOfBoundsException x) { - throw new DomEx(DomEx.INDEX_SIZE_ERR); + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } } @@ -195,14 +194,14 @@ public abstract class DomCharacterData { if (readonly) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } char[] raw = text.toCharArray(); // deleteData if (offset < 0 || count < 0 || offset > raw.length) { - throw new DomEx(DomEx.INDEX_SIZE_ERR); + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } if ((offset + count) > raw.length) { @@ -228,7 +227,7 @@ public abstract class DomCharacterData } catch (IndexOutOfBoundsException x) { - throw new DomEx(DomEx.INDEX_SIZE_ERR); + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } } @@ -241,7 +240,7 @@ public abstract class DomCharacterData { if (isReadonly()) { - throw new DomEx (DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } if (value == null) { @@ -276,7 +275,7 @@ public abstract class DomCharacterData { return text.substring(offset); } - throw new DomEx(DomEx.INDEX_SIZE_ERR); + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } } Index: gnu/xml/dom/DomDOMException.java =================================================================== RCS file: gnu/xml/dom/DomDOMException.java diff -N gnu/xml/dom/DomDOMException.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/xml/dom/DomDOMException.java 15 Feb 2005 20:55:15 -0000 @@ -0,0 +1,175 @@ +/* DomDOMException.java -- + Copyright (C) 1999,2000,2001,2004 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.xml.dom; + +import org.w3c.dom.DOMException; +import org.w3c.dom.Node; + +/** + *

DOMException implementation. The version that + * is provided by the W3C is abstract, so it can't be instantiated. + * + *

This also provides a bit more information about the error + * that is being reported, in terms of the relevant DOM structures + * and data. + * + * @author David Brownell + */ +public class DomDOMException + extends DOMException +{ + + /** @serial Data that caused an error to be reported */ + private String data; + + /** @serial Node associated with the error. */ + private Node node; + + /** @serial Data associated with the error. */ + private int value; + + /** + * Constructs an exception, with the diagnostic message + * corresponding to the specified code. + */ + public DomDOMException(short code) + { + super(code, diagnostic(code)); + } + + /** + * Constructs an exception, with the diagnostic message + * corresponding to the specified code and additional + * information as provided. + */ + public DomDOMException(short code, String data, Node node, int value) + { + super(code, diagnostic(code)); + this.data = data; + this.node = node; + this.value = value; + } + + /** Returns the node to which the diagnotic applies, or null. */ + final public Node getNode() + { + return node; + } + + /** Returns data to which the diagnotic applies, or null. */ + final public String getData() + { + return data; + } + + /** Returns data to which the diagnotic applies, or null. */ + final public int getValue() + { + return value; + } + + /** + * Returns a diagnostic message that may be slightly more useful + * than the generic one, where possible. + */ + public String getMessage() + { + String retval = super.getMessage(); + + if (data != null) + { + retval += "\nMore Information: " + data; + } + if (value != 0) + { + retval += "\nNumber: " + value; + } + if (node != null) + { + retval += "\nNode Name: " + node.getNodeName(); + } + return retval; + } + + // these strings should be localizable. + + private static String diagnostic(short code) + { + switch (code) + { + // DOM L1: + case INDEX_SIZE_ERR: + return "An index or size is out of range."; + case DOMSTRING_SIZE_ERR: + return "A string is too big."; + case HIERARCHY_REQUEST_ERR: + return "The node doesn't belong here."; + case WRONG_DOCUMENT_ERR: + return "The node belongs in another document."; + case INVALID_CHARACTER_ERR: + return "That character is not permitted."; + case NO_DATA_ALLOWED_ERR: + return "This node does not permit data."; + case NO_MODIFICATION_ALLOWED_ERR: + return "No changes are allowed."; + case NOT_FOUND_ERR: + return "The node was not found in that context."; + case NOT_SUPPORTED_ERR: + return "That object is not supported."; + case INUSE_ATTRIBUTE_ERR: + return "The attribute belongs to a different element."; + + // DOM L2: + case INVALID_STATE_ERR: + return "The object is not usable."; + case SYNTAX_ERR: + return "An illegal string was provided."; + case INVALID_MODIFICATION_ERR: + return "An object's type may not be changed."; + case NAMESPACE_ERR: + return "The operation violates XML Namespaces."; + case INVALID_ACCESS_ERR: + return "Parameter or operation isn't supported by this node."; + case TYPE_MISMATCH_ERR: + return "The type of the argument is incompatible with the expected type."; + } + return "Reserved exception number: " + code; + } + +} + Index: gnu/xml/dom/DomDoctype.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomDoctype.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 DomDoctype.java --- gnu/xml/dom/DomDoctype.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ gnu/xml/dom/DomDoctype.java 15 Feb 2005 20:55:15 -0000 @@ -39,6 +39,7 @@ package gnu.xml.dom; import java.util.HashMap; import org.w3c.dom.DocumentType; +import org.w3c.dom.DOMException; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Entity; import org.w3c.dom.NamedNodeMap; @@ -194,7 +195,7 @@ public class DomDoctype } if (isReadonly()) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } getEntities(); @@ -250,7 +251,7 @@ public class DomDoctype if (isReadonly()) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } getNotations(); Index: gnu/xml/dom/DomDocument.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomDocument.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 DomDocument.java --- gnu/xml/dom/DomDocument.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ gnu/xml/dom/DomDocument.java 15 Feb 2005 20:55:15 -0000 @@ -54,7 +54,6 @@ import org.w3c.dom.Entity; import org.w3c.dom.EntityReference; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; -import org.w3c.dom.NodeList; import org.w3c.dom.Notation; import org.w3c.dom.ProcessingInstruction; import org.w3c.dom.Text; @@ -292,16 +291,16 @@ public class DomDocument if (newChild.getNodeType() == ELEMENT_NODE && getDocumentElement() != null) { - throw new DomEx (DomEx.HIERARCHY_REQUEST_ERR, - "document element already present: " + - getDocumentElement(), newChild, 0); + throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR, + "document element already present: " + + getDocumentElement(), newChild, 0); } if (newChild.getNodeType() == DOCUMENT_TYPE_NODE && getDoctype() != null) { - throw new DomEx (DomEx.HIERARCHY_REQUEST_ERR, - "document type already present: " + - getDoctype(), newChild, 0); + throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR, + "document type already present: " + + getDoctype(), newChild, 0); } } @@ -376,12 +375,12 @@ public class DomDocument { if (name == null) { - throw new DomEx (DomEx.NAMESPACE_ERR, name, null, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, name, null, 0); } int len = name.length(); if (len == 0) { - throw new DomEx (DomEx.NAMESPACE_ERR, name, null, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, name, null, 0); } // dog: rewritten to use the rules for XML 1.0 and 1.1 @@ -407,7 +406,8 @@ public class DomDocument (c < 0xfdf0 || c > 0xfffd) && (c < 0x10000 || c > 0xeffff)) { - throw new DomEx(DomEx.INVALID_CHARACTER_ERR, name, null, c); + throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, + name, null, c); } } else @@ -425,14 +425,16 @@ public class DomDocument (c >= 0x20dd && c <= 0x20e0)) { // Compatibility area and Unicode 2.0 exclusions - throw new DomEx(DomEx.INVALID_CHARACTER_ERR, name, null, c); + throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, + name, null, c); } break; default: if (c != ':' && c != '_' && (c < 0x02bb || c > 0x02c1) && c != 0x0559 && c != 0x06e5 && c != 0x06e6) { - throw new DomEx(DomEx.INVALID_CHARACTER_ERR, name, null, c); + throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, + name, null, c); } } } @@ -464,7 +466,8 @@ public class DomDocument (c < 0x0300 || c > 0x036f) && (c < 0x203f || c > 0x2040)) { - throw new DomEx(DomEx.INVALID_CHARACTER_ERR, name, null, c); + throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, name, + null, c); } } else @@ -487,7 +490,8 @@ public class DomDocument (c >= 0x20dd && c <= 0x20e0)) { // Compatibility area and Unicode 2.0 exclusions - throw new DomEx(DomEx.INVALID_CHARACTER_ERR, name, null, c); + throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, + name, null, c); } break; default: @@ -495,7 +499,8 @@ public class DomDocument c != 0x0387 && (c < 0x02bb || c > 0x02c1) && c != 0x0559 && c != 0x06e5 && c != 0x06e6 && c != 0x00b7) { - throw new DomEx(DomEx.INVALID_CHARACTER_ERR, name, null, c); + throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, + name, null, c); } } } @@ -517,7 +522,8 @@ public class DomDocument if (index == 0 || index == (len - 1) || name.lastIndexOf(':') != index) { - throw new DomEx(DomEx.NAMESPACE_ERR, name, null, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + name, null, 0); } } } @@ -552,8 +558,8 @@ public class DomDocument continue; } } - throw new DomEx(DomEx.INVALID_CHARACTER_ERR, - new String(buf, off, len), null, c); + throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, + new String(buf, off, len), null, c); } } @@ -602,22 +608,23 @@ public class DomDocument if (namespaceURI != null && !XMLConstants.XML_NS_URI.equals(namespaceURI)) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "xml namespace is always " + - XMLConstants.XML_NS_URI, this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "xml namespace is always " + + XMLConstants.XML_NS_URI, this, 0); } namespaceURI = XMLConstants.XML_NS_URI; } else if (XMLConstants.XMLNS_ATTRIBUTE.equals(name) || name.startsWith("xmlns:")) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "xmlns is reserved", this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "xmlns is reserved", this, 0); } else if (namespaceURI == null && name.indexOf(':') != -1) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "prefixed name '" + name + "' needs a URI", this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "prefixed name '" + name + + "' needs a URI", this, 0); } Element element = new DomElement(this, namespaceURI, name); @@ -660,7 +667,7 @@ public class DomDocument */ public DocumentFragment createDocumentFragment() { - return new DomFragment(this); + return new DomDocumentFragment(this); } /** @@ -711,7 +718,7 @@ public class DomDocument { checkChar(value, "1.1".equals(version)); } - return new DomCDATA(this, value); + return new DomCDATASection(this, value); } /** @@ -723,7 +730,7 @@ public class DomDocument { checkChar(buf, off, len, "1.1".equals(version)); } - return new DomCDATA(this, buf, off, len); + return new DomCDATASection(this, buf, off, len); } /** @@ -739,12 +746,13 @@ public class DomDocument checkName(target, xml11); if ("xml".equalsIgnoreCase(target)) { - throw new DomEx(DomEx.SYNTAX_ERR, - "illegal PI target name", this, 0); + throw new DomDOMException(DOMException.SYNTAX_ERR, + "illegal PI target name", + this, 0); } checkChar(data, xml11); } - return new DomPI(this, target, data); + return new DomProcessingInstruction(this, target, data); } /** @@ -796,9 +804,10 @@ public class DomDocument } else if (!XMLConstants.XML_NS_URI.equals(namespaceURI)) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "xml namespace is always " + - XMLConstants.XML_NS_URI, this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "xml namespace is always " + + XMLConstants.XML_NS_URI, + this, 0); } } else if (XMLConstants.XMLNS_ATTRIBUTE.equals(name) || @@ -810,14 +819,15 @@ public class DomDocument } else if (!XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "xmlns namespace must be " + - XMLConstants.XMLNS_ATTRIBUTE_NS_URI, this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "xmlns namespace must be " + + XMLConstants.XMLNS_ATTRIBUTE_NS_URI, + this, 0); } } else if (namespaceURI == null && name.indexOf(':') != -1) { - throw new DomEx(DomEx.NAMESPACE_ERR, + throw new DomDOMException(DOMException.NAMESPACE_ERR, "prefixed name needs a URI: " + name, this, 0); } return new DomAttr(this, namespaceURI, name); @@ -913,7 +923,7 @@ public class DomDocument dst = createEntityReference(src.getNodeName()); break; case DOCUMENT_FRAGMENT_NODE: - dst = new DomFragment(this); + dst = new DomDocumentFragment(this); if (deep) { for (Node ctx = src.getFirstChild(); ctx != null; @@ -988,7 +998,7 @@ public class DomDocument // FALLTHROUGH // can't import unrecognized or nonstandard nodes default: - throw new DomEx(DomEx.NOT_SUPPORTED_ERR, null, src, 0); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, null, src, 0); } // FIXME cleanup a bit -- for deep copies, copy those @@ -1083,7 +1093,7 @@ public class DomDocument } else { - throw new DomEx(DomEx.NOT_SUPPORTED_ERR); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); } } @@ -1149,10 +1159,10 @@ public class DomDocument { case DOCUMENT_NODE: case DOCUMENT_TYPE_NODE: - throw new DomEx(DomEx.NOT_SUPPORTED_ERR); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); case ENTITY_NODE: case NOTATION_NODE: - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } if (source instanceof DomNode) { @@ -1284,11 +1294,12 @@ public class DomDocument DomNsNode src = (DomNsNode) n; if (src == null) { - throw new DomEx(DomEx.NOT_FOUND_ERR); + throw new DomDOMException(DOMException.NOT_FOUND_ERR); } if (src.owner != this) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR, null, src, 0); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR, + null, src, 0); } boolean xml11 = "1.1".equals(version); checkName(qualifiedName, xml11); @@ -1305,7 +1316,7 @@ public class DomDocument if (XMLConstants.XML_NS_PREFIX.equals(prefix) && !XMLConstants.XML_NS_URI.equals(namespaceURI)) { - throw new DomEx(DomEx.NAMESPACE_ERR, + throw new DomDOMException(DOMException.NAMESPACE_ERR, "xml namespace must be " + XMLConstants.XML_NS_URI, src, 0); } @@ -1314,14 +1325,14 @@ public class DomDocument XMLConstants.XMLNS_ATTRIBUTE.equals(qualifiedName)) && !XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) { - throw new DomEx(DomEx.NAMESPACE_ERR, + throw new DomDOMException(DOMException.NAMESPACE_ERR, "xmlns namespace must be " + XMLConstants.XMLNS_ATTRIBUTE_NS_URI, src, 0); } if (XMLConstants.XML_NS_URI.equals(namespaceURI) && !XMLConstants.XML_NS_PREFIX.equals(prefix)) { - throw new DomEx(DomEx.NAMESPACE_ERR, + throw new DomDOMException(DOMException.NAMESPACE_ERR, "xml namespace must be " + XMLConstants.XML_NS_URI, src, 0); } @@ -1330,7 +1341,7 @@ public class DomDocument !(XMLConstants.XMLNS_ATTRIBUTE.equals(prefix) || XMLConstants.XMLNS_ATTRIBUTE.equals(qualifiedName))) { - throw new DomEx(DomEx.NAMESPACE_ERR, + throw new DomDOMException(DOMException.NAMESPACE_ERR, "xmlns namespace must be " + XMLConstants.XMLNS_ATTRIBUTE_NS_URI, src, 0); } @@ -1343,7 +1354,7 @@ public class DomDocument // DOMElementNameChanged or DOMAttributeNameChanged return src; } - throw new DomEx(DomEx.NOT_SUPPORTED_ERR, null, n, 0); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, null, n, 0); } // -- XPathEvaluator -- Index: gnu/xml/dom/DomDocumentBuilder.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomDocumentBuilder.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 DomDocumentBuilder.java --- gnu/xml/dom/DomDocumentBuilder.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ gnu/xml/dom/DomDocumentBuilder.java 15 Feb 2005 20:55:15 -0000 @@ -40,7 +40,6 @@ package gnu.xml.dom; import java.io.InputStream; import java.io.IOException; import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMImplementation; Index: gnu/xml/dom/DomDocumentConfiguration.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomDocumentConfiguration.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 DomDocumentConfiguration.java --- gnu/xml/dom/DomDocumentConfiguration.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ gnu/xml/dom/DomDocumentConfiguration.java 15 Feb 2005 20:55:15 -0000 @@ -99,8 +99,8 @@ class DomDocumentConfiguration } catch (ClassCastException e) { - throw new DomEx(DomEx.TYPE_MISMATCH_ERR, - value.getClass().getName(), null, 0); + throw new DomDOMException(DOMException.TYPE_MISMATCH_ERR, + value.getClass().getName(), null, 0); } } else if ("namespace-declarations".equals(name)) @@ -140,7 +140,8 @@ class DomDocumentConfiguration } else { - throw new DomEx(DomEx.NOT_SUPPORTED_ERR, name, null, 0); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, + name, null, 0); } } @@ -197,7 +198,7 @@ class DomDocumentConfiguration namespaceDeclarations == true && comments == true) ? Boolean.TRUE : Boolean.FALSE; } - throw new DomEx(DomEx.NOT_SUPPORTED_ERR, name, null, 0); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, name, null, 0); } public boolean canSetParameter(String name, Object value) Index: gnu/xml/dom/DomDocumentFragment.java =================================================================== RCS file: gnu/xml/dom/DomDocumentFragment.java diff -N gnu/xml/dom/DomDocumentFragment.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/xml/dom/DomDocumentFragment.java 15 Feb 2005 20:55:15 -0000 @@ -0,0 +1,76 @@ +/* DomDocumentFragment.java -- + Copyright (C) 1999,2000,2001,2004 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.xml.dom; + +import org.w3c.dom.DocumentFragment; + +/** + *

"DocumentFragment" implementation.

+ * + * @author David Brownell + * @author Chris Burdess + */ +public class DomDocumentFragment + extends DomNode + implements DocumentFragment +{ + + /** + * Constructs a DocumentFragment node associated with the + * specified document. + * + *

This constructor should only be invoked by a Document as part of + * its createDocumentFragment functionality, or through a subclass which + * is similarly used in a "Sub-DOM" style layer. + */ + protected DomDocumentFragment(DomDocument owner) + { + super(DOCUMENT_FRAGMENT_NODE, owner); + } + + /** + * DOM L1 + * Returns the string "#document-fragment". + */ + final public String getNodeName() + { + return "#document-fragment"; + } + +} + Index: gnu/xml/dom/DomElement.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomElement.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 DomElement.java --- gnu/xml/dom/DomElement.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ gnu/xml/dom/DomElement.java 15 Feb 2005 20:55:15 -0000 @@ -42,6 +42,7 @@ import java.util.Set; import javax.xml.XMLConstants; import org.w3c.dom.Attr; +import org.w3c.dom.DOMException; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; @@ -262,7 +263,7 @@ public class DomElement if (("xmlns".equals (aname) || aname.startsWith ("xmlns:")) && !XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals (uri)) { - throw new DomEx(DomEx.NAMESPACE_ERR, + throw new DomDOMException(DOMException.NAMESPACE_ERR, "setting xmlns attribute to illegal value", this, 0); } @@ -318,9 +319,9 @@ public class DomElement { attributes.removeNamedItem(name); } - catch (DomEx e) + catch (DomDOMException e) { - if (e.code != DomEx.NOT_FOUND_ERR) + if (e.code != DOMException.NOT_FOUND_ERR) { throw e; } @@ -340,7 +341,7 @@ public class DomElement { if (attributes == null) { - throw new DomEx(DomEx.NOT_FOUND_ERR, null, node, 0); + throw new DomDOMException(DOMException.NOT_FOUND_ERR, null, node, 0); } return (Attr) attributes.removeNamedItem(node.getNodeName()); } @@ -358,7 +359,7 @@ public class DomElement { if (attributes == null) { - throw new DomEx(DomEx.NOT_FOUND_ERR, localPart, null, 0); + throw new DomDOMException(DOMException.NOT_FOUND_ERR, localPart, null, 0); } attributes.removeNamedItemNS (namespace, localPart); } @@ -487,11 +488,11 @@ public class DomElement { if (readonly) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } if (attr == null || attr.getOwnerElement() != this) { - throw new DomEx(DomEx.NOT_FOUND_ERR); + throw new DomDOMException(DOMException.NOT_FOUND_ERR); } if (isId) { Index: gnu/xml/dom/DomEx.java =================================================================== RCS file: gnu/xml/dom/DomEx.java diff -N gnu/xml/dom/DomEx.java --- gnu/xml/dom/DomEx.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,175 +0,0 @@ -/* DomEx.java -- - Copyright (C) 1999,2000,2001,2004 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., 59 Temple Place, Suite 330, Boston, MA -02111-1307 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.xml.dom; - -import org.w3c.dom.DOMException; -import org.w3c.dom.Node; - -/** - *

DOMException implementation. The version that - * is provided by the W3C is abstract, so it can't be instantiated. - * - *

This also provides a bit more information about the error - * that is being reported, in terms of the relevant DOM structures - * and data. - * - * @author David Brownell - */ -public class DomEx - extends DOMException -{ - - /** @serial Data that caused an error to be reported */ - private String data; - - /** @serial Node associated with the error. */ - private Node node; - - /** @serial Data associated with the error. */ - private int value; - - /** - * Constructs an exception, with the diagnostic message - * corresponding to the specified code. - */ - public DomEx(short code) - { - super(code, diagnostic(code)); - } - - /** - * Constructs an exception, with the diagnostic message - * corresponding to the specified code and additional - * information as provided. - */ - public DomEx(short code, String data, Node node, int value) - { - super(code, diagnostic(code)); - this.data = data; - this.node = node; - this.value = value; - } - - /** Returns the node to which the diagnotic applies, or null. */ - final public Node getNode() - { - return node; - } - - /** Returns data to which the diagnotic applies, or null. */ - final public String getData() - { - return data; - } - - /** Returns data to which the diagnotic applies, or null. */ - final public int getValue() - { - return value; - } - - /** - * Returns a diagnostic message that may be slightly more useful - * than the generic one, where possible. - */ - public String getMessage() - { - String retval = super.getMessage(); - - if (data != null) - { - retval += "\nMore Information: " + data; - } - if (value != 0) - { - retval += "\nNumber: " + value; - } - if (node != null) - { - retval += "\nNode Name: " + node.getNodeName(); - } - return retval; - } - - // these strings should be localizable. - - private static String diagnostic(short code) - { - switch (code) - { - // DOM L1: - case INDEX_SIZE_ERR: - return "An index or size is out of range."; - case DOMSTRING_SIZE_ERR: - return "A string is too big."; - case HIERARCHY_REQUEST_ERR: - return "The node doesn't belong here."; - case WRONG_DOCUMENT_ERR: - return "The node belongs in another document."; - case INVALID_CHARACTER_ERR: - return "That character is not permitted."; - case NO_DATA_ALLOWED_ERR: - return "This node does not permit data."; - case NO_MODIFICATION_ALLOWED_ERR: - return "No changes are allowed."; - case NOT_FOUND_ERR: - return "The node was not found in that context."; - case NOT_SUPPORTED_ERR: - return "That object is not supported."; - case INUSE_ATTRIBUTE_ERR: - return "The attribute belongs to a different element."; - - // DOM L2: - case INVALID_STATE_ERR: - return "The object is not usable."; - case SYNTAX_ERR: - return "An illegal string was provided."; - case INVALID_MODIFICATION_ERR: - return "An object's type may not be changed."; - case NAMESPACE_ERR: - return "The operation violates XML Namespaces."; - case INVALID_ACCESS_ERR: - return "Parameter or operation isn't supported by this node."; - case TYPE_MISMATCH_ERR: - return "The type of the argument is incompatible with the expected type."; - } - return "Reserved exception number: " + code; - } - -} - Index: gnu/xml/dom/DomFragment.java =================================================================== RCS file: gnu/xml/dom/DomFragment.java diff -N gnu/xml/dom/DomFragment.java --- gnu/xml/dom/DomFragment.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,76 +0,0 @@ -/* DomFragment.java -- - Copyright (C) 1999,2000,2001,2004 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., 59 Temple Place, Suite 330, Boston, MA -02111-1307 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.xml.dom; - -import org.w3c.dom.DocumentFragment; - -/** - *

"DocumentFragment" implementation.

- * - * @author David Brownell - * @author Chris Burdess - */ -public class DomFragment - extends DomNode - implements DocumentFragment -{ - - /** - * Constructs a DocumentFragment node associated with the - * specified document. - * - *

This constructor should only be invoked by a Document as part of - * its createDocumentFragment functionality, or through a subclass which - * is similarly used in a "Sub-DOM" style layer. - */ - protected DomFragment(DomDocument owner) - { - super(DOCUMENT_FRAGMENT_NODE, owner); - } - - /** - * DOM L1 - * Returns the string "#document-fragment". - */ - final public String getNodeName() - { - return "#document-fragment"; - } - -} - Index: gnu/xml/dom/DomImpl.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomImpl.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 DomImpl.java --- gnu/xml/dom/DomImpl.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ gnu/xml/dom/DomImpl.java 15 Feb 2005 20:55:15 -0000 @@ -207,7 +207,8 @@ public class DomImpl root = doc.createElementNS(namespaceURI, rootName); if (rootName.startsWith("xmlns:")) { - throw new DomEx(DomEx.NAMESPACE_ERR, "xmlns is reserved", null, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "xmlns is reserved", null, 0); } } // Bleech -- L2 seemingly _requires_ omission of xmlns attributes. Index: gnu/xml/dom/DomIterator.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomIterator.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 DomIterator.java --- gnu/xml/dom/DomIterator.java 16 Jan 2005 15:15:09 -0000 1.1.2.1 +++ gnu/xml/dom/DomIterator.java 15 Feb 2005 20:55:15 -0000 @@ -37,8 +37,7 @@ exception statement from your version. * package gnu.xml.dom; -import java.util.Vector; - +import org.w3c.dom.DOMException; import org.w3c.dom.Node; import org.w3c.dom.events.Event; import org.w3c.dom.events.EventListener; @@ -76,7 +75,7 @@ public final class DomIterator { if (!root.isSupported("MutationEvents", "2.0")) { - throw new DomEx(DomEx.NOT_SUPPORTED_ERR, + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, "Iterator needs mutation events", root, 0); } @@ -154,7 +153,7 @@ public final class DomIterator { if (done) { - throw new DomEx(DomEx.INVALID_STATE_ERR); + throw new DomDOMException(DOMException.INVALID_STATE_ERR); } right = true; return walk(true); @@ -171,7 +170,7 @@ public final class DomIterator { if (done) { - throw new DomEx(DomEx.INVALID_STATE_ERR); + throw new DomDOMException(DOMException.INVALID_STATE_ERR); } Node previous = reference; right = false; Index: gnu/xml/dom/DomNamedNodeMap.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomNamedNodeMap.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 DomNamedNodeMap.java --- gnu/xml/dom/DomNamedNodeMap.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/dom/DomNamedNodeMap.java 15 Feb 2005 20:55:15 -0000 @@ -37,6 +37,7 @@ exception statement from your version. * package gnu.xml.dom; +import org.w3c.dom.DOMException; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; @@ -166,24 +167,24 @@ public class DomNamedNodeMap { if (readonly) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } DomNode node = (DomNode) arg; if (node.owner != owner.owner) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR); } if (node.nodeType != type) { - throw new DomEx(DomEx.HIERARCHY_REQUEST_ERR); + throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR); } if (node.nodeType == Node.ATTRIBUTE_NODE) { DomNode element = node.parent; if (element != null && element != owner) { - throw new DomEx(DomEx.INUSE_ATTRIBUTE_ERR); + throw new DomDOMException(DOMException.INUSE_ATTRIBUTE_ERR); } node.parent = owner; node.depth = owner.depth + 1; @@ -302,7 +303,7 @@ public class DomNamedNodeMap { if (readonly) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } // report attribute REMOVAL event? @@ -369,7 +370,7 @@ public class DomNamedNodeMap return ctx; } } - throw new DomEx(DomEx.NOT_FOUND_ERR); + throw new DomDOMException(DOMException.NOT_FOUND_ERR); } String getDefaultValue(String name) Index: gnu/xml/dom/DomNode.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomNode.java,v retrieving revision 1.1.2.2 diff -u -3 -p -u -r1.1.2.2 DomNode.java --- gnu/xml/dom/DomNode.java 29 Jan 2005 02:45:23 -0000 1.1.2.2 +++ gnu/xml/dom/DomNode.java 15 Feb 2005 20:55:16 -0000 @@ -40,7 +40,6 @@ package gnu.xml.dom; import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import javax.xml.XMLConstants; import org.w3c.dom.Document; import org.w3c.dom.DOMException; @@ -58,7 +57,6 @@ import org.w3c.dom.events.EventTarget; import org.w3c.dom.events.MutationEvent; import org.w3c.dom.traversal.NodeFilter; import org.w3c.dom.traversal.NodeIterator; -import org.w3c.dom.traversal.TreeWalker; /** *

"Node", "EventTarget", and "DocumentEvent" implementation. @@ -308,15 +306,16 @@ public abstract class DomNode { if (readonly && !owner.building) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR, - null, this, 0); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, + null, this, 0); } for (DomNode ctx = this; ctx != null; ctx = ctx.parent) { if (child == ctx) { - throw new DomEx(DomEx.HIERARCHY_REQUEST_ERR, - "can't make ancestor into a child", this, 0); + throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR, + "can't make ancestor into a child", + this, 0); } } @@ -330,8 +329,8 @@ public abstract class DomNode // new in DOM L2, this case -- patch it up later, in reparent() if (!(childNodeType == DOCUMENT_TYPE_NODE && childOwner == null)) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR, - null, child, 0); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR, + null, child, 0); } } @@ -376,10 +375,12 @@ public abstract class DomNode } if (owner.checkingWellformedness) { - throw new DomEx(DomEx.HIERARCHY_REQUEST_ERR, - "can't append " + nodeTypeToString(childNodeType) + - " to node of type " + nodeTypeToString(nodeType), - this, 0); + throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR, + "can't append " + + nodeTypeToString(childNodeType) + + " to node of type " + + nodeTypeToString(nodeType), + this, 0); } } @@ -578,8 +579,8 @@ public abstract class DomNode } catch (ClassCastException e) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR, - null, newChild, 0); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR, + null, newChild, 0); } } @@ -630,12 +631,14 @@ public abstract class DomNode checkMisc(child); if (ref == null || ref.parent != this) { - throw new DomEx(DomEx.NOT_FOUND_ERR, null, ref, 0); + throw new DomDOMException(DOMException.NOT_FOUND_ERR, + null, ref, 0); } if (ref == child) { - throw new DomEx(DomEx.HIERARCHY_REQUEST_ERR, - "can't insert node before itself", ref, 0); + throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR, + "can't insert node before itself", + ref, 0); } if (child.parent != null) @@ -672,8 +675,8 @@ public abstract class DomNode } catch (ClassCastException e) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR, - null, newChild, 0); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR, + null, newChild, 0); } } @@ -721,7 +724,8 @@ public abstract class DomNode } if (ref == null || ref.parent != this) { - throw new DomEx(DomEx.NOT_FOUND_ERR, null, ref, 0); + throw new DomDOMException(DOMException.NOT_FOUND_ERR, + null, ref, 0); } if (reportMutations) @@ -784,7 +788,8 @@ public abstract class DomNode checkMisc(child); if (ref == null || ref.parent != this) { - throw new DomEx(DomEx.NOT_FOUND_ERR, null, ref, 0); + throw new DomDOMException(DOMException.NOT_FOUND_ERR, + null, ref, 0); } if (reportMutations) @@ -837,8 +842,8 @@ public abstract class DomNode } catch (ClassCastException e) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR, - null, newChild, 0); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR, + null, newChild, 0); } } @@ -860,12 +865,13 @@ public abstract class DomNode if (ref == null || ref.parent != this) { - throw new DomEx(DomEx.NOT_FOUND_ERR, null, ref, 0); + throw new DomDOMException(DOMException.NOT_FOUND_ERR, + null, ref, 0); } if (readonly && !owner.building) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR, - null, this, 0); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, + null, this, 0); } for (DomNode child = first; child != null; child = child.next) @@ -909,13 +915,13 @@ public abstract class DomNode return ref; } } - throw new DomEx(DomEx.NOT_FOUND_ERR, - "that's no child of mine", refChild, 0); + throw new DomDOMException(DOMException.NOT_FOUND_ERR, + "that's no child of mine", refChild, 0); } catch (ClassCastException e) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR, - null, refChild, 0); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR, + null, refChild, 0); } } @@ -1446,8 +1452,8 @@ public abstract class DomNode // mouse events - throw new DomEx(DomEx.NOT_SUPPORTED_ERR, - eventType, null, 0); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, + eventType, null, 0); } /** Index: gnu/xml/dom/DomNsNode.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomNsNode.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 DomNsNode.java --- gnu/xml/dom/DomNsNode.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/dom/DomNsNode.java 15 Feb 2005 20:55:16 -0000 @@ -38,6 +38,7 @@ exception statement from your version. * package gnu.xml.dom; import javax.xml.XMLConstants; +import org.w3c.dom.DOMException; /** *

Abstract implemention of namespace support. This facilitates @@ -135,7 +136,7 @@ public abstract class DomNsNode { if (readonly) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } if (prefix == null) @@ -145,40 +146,42 @@ public abstract class DomNsNode } else if (namespace == null) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "can't set prefix, node has no namespace URI", - this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "can't set prefix, node has no namespace URI", + this, 0); } DomDocument.checkName(prefix, "1.1".equals(owner.getXmlVersion())); if (prefix.indexOf (':') != -1) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "illegal prefix " + prefix, this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "illegal prefix " + prefix, this, 0); } if (XMLConstants.XML_NS_PREFIX.equals(prefix) && !XMLConstants.XML_NS_URI.equals(namespace)) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "xml namespace is always " + - XMLConstants.XML_NS_URI, this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "xml namespace is always " + + XMLConstants.XML_NS_URI, this, 0); } if (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix)) { if (namespace != null || getNodeType() != ATTRIBUTE_NODE) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "xmlns attribute prefix is reserved", this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "xmlns attribute prefix is reserved", + this, 0); } } else if (getNodeType () == ATTRIBUTE_NODE && (XMLConstants.XMLNS_ATTRIBUTE.equals(name) || name.startsWith("xmlns:"))) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "namespace declarations can't change names", this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "namespace declarations can't change names", + this, 0); } this.prefix = prefix.intern(); Index: gnu/xml/dom/DomPI.java =================================================================== RCS file: gnu/xml/dom/DomPI.java diff -N gnu/xml/dom/DomPI.java --- gnu/xml/dom/DomPI.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,145 +0,0 @@ -/* DomPI.java -- - Copyright (C) 1999,2000,2001,2004 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., 59 Temple Place, Suite 330, Boston, MA -02111-1307 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.xml.dom; - -import org.w3c.dom.ProcessingInstruction; - -/** - *

"ProcessingInstruction" (PI) implementation. - * This is a non-core DOM class, supporting the "XML" feature.

- * - *

Unlike other DOM APIs in the "XML" feature, this one fully - * exposes the functionality it describes. So there is no reason - * inherent in DOM to avoid using this API, unless you want to rely - * on NOTATION declarations to associate meaning with your PIs; - * there is no vendor-neutal way to record those notations in DOM.

- * - *

Also of note is that PI support is part of SAX, so that XML - * systems using PIs can choose among multiple APIs.

- * - * @see DomNotation - * - * @author David Brownell - * @author Chris Burdess - */ -public class DomPI - extends DomNode - implements ProcessingInstruction -{ - - private String target; - private String data; - - /** - * Constructs a ProcessingInstruction node associated with the - * specified document, with the specified data. - * - *

This constructor should only be invoked by a Document object as - * part of its createProcessingInstruction functionality, or through - * a subclass which is similarly used in a "Sub-DOM" style layer. - */ - protected DomPI(DomDocument owner, String target, String data) - { - super(PROCESSING_INSTRUCTION_NODE, owner); - this.target = target; - this.data = data; - } - - /** - * DOM L1 - * Returns the target of the processing instruction. - */ - public final String getTarget() - { - return target; - } - - /** - * DOM L1 - * Returns the target of the processing instruction - * (same as getTarget). - */ - public final String getNodeName() - { - return target; - } - - /** - * DOM L1 - * Returns the data associated with the processing instruction. - */ - public final String getData() - { - return data; - } - - /** - * DOM L1 - * Returns the data associated with the processing instruction - * (same as getData). - */ - public final String getNodeValue() - { - return data; - } - - /** - * DOM L1 - * Assigns the data associated with the processing instruction; - * same as setNodeValue. - */ - public final void setData(String data) - { - setNodeValue(data); - } - - /** - * DOM L1 - * Assigns the data associated with the processing instruction. - */ - public final void setNodeValue(String data) - { - if (isReadonly()) - { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); - } - this.data = data; - } - -} - Index: gnu/xml/dom/DomProcessingInstruction.java =================================================================== RCS file: gnu/xml/dom/DomProcessingInstruction.java diff -N gnu/xml/dom/DomProcessingInstruction.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/xml/dom/DomProcessingInstruction.java 15 Feb 2005 20:55:16 -0000 @@ -0,0 +1,147 @@ +/* DomProcessingInstruction.java -- + Copyright (C) 1999,2000,2001,2004 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.xml.dom; + +import org.w3c.dom.DOMException; +import org.w3c.dom.ProcessingInstruction; + +/** + *

"ProcessingInstruction" (PI) implementation. + * This is a non-core DOM class, supporting the "XML" feature.

+ * + *

Unlike other DOM APIs in the "XML" feature, this one fully + * exposes the functionality it describes. So there is no reason + * inherent in DOM to avoid using this API, unless you want to rely + * on NOTATION declarations to associate meaning with your PIs; + * there is no vendor-neutal way to record those notations in DOM.

+ * + *

Also of note is that PI support is part of SAX, so that XML + * systems using PIs can choose among multiple APIs.

+ * + * @see DomNotation + * + * @author David Brownell + * @author Chris Burdess + */ +public class DomProcessingInstruction + extends DomNode + implements ProcessingInstruction +{ + + private String target; + private String data; + + /** + * Constructs a ProcessingInstruction node associated with the + * specified document, with the specified data. + * + *

This constructor should only be invoked by a Document object as + * part of its createProcessingInstruction functionality, or through + * a subclass which is similarly used in a "Sub-DOM" style layer. + */ + protected DomProcessingInstruction(DomDocument owner, + String target, String data) + { + super(PROCESSING_INSTRUCTION_NODE, owner); + this.target = target; + this.data = data; + } + + /** + * DOM L1 + * Returns the target of the processing instruction. + */ + public final String getTarget() + { + return target; + } + + /** + * DOM L1 + * Returns the target of the processing instruction + * (same as getTarget). + */ + public final String getNodeName() + { + return target; + } + + /** + * DOM L1 + * Returns the data associated with the processing instruction. + */ + public final String getData() + { + return data; + } + + /** + * DOM L1 + * Returns the data associated with the processing instruction + * (same as getData). + */ + public final String getNodeValue() + { + return data; + } + + /** + * DOM L1 + * Assigns the data associated with the processing instruction; + * same as setNodeValue. + */ + public final void setData(String data) + { + setNodeValue(data); + } + + /** + * DOM L1 + * Assigns the data associated with the processing instruction. + */ + public final void setNodeValue(String data) + { + if (isReadonly()) + { + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); + } + this.data = data; + } + +} + Index: gnu/xml/dom/DomText.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomText.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 DomText.java --- gnu/xml/dom/DomText.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/dom/DomText.java 15 Feb 2005 20:55:16 -0000 @@ -102,7 +102,7 @@ public class DomText { if (isReadonly()) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } try { @@ -134,7 +134,7 @@ public class DomText } catch (IndexOutOfBoundsException x) { - throw new DomEx(DomEx.INDEX_SIZE_ERR); + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } } Index: gnu/xml/dom/DomXPathExpression.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomXPathExpression.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 DomXPathExpression.java --- gnu/xml/dom/DomXPathExpression.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/dom/DomXPathExpression.java 15 Feb 2005 20:55:16 -0000 @@ -37,7 +37,6 @@ exception statement from your version. * package gnu.xml.dom; -import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; Index: gnu/xml/dom/DomXPathResult.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomXPathResult.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 DomXPathResult.java --- gnu/xml/dom/DomXPathResult.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/dom/DomXPathResult.java 15 Feb 2005 20:55:16 -0000 @@ -39,10 +39,8 @@ package gnu.xml.dom; import java.util.Collection; import java.util.Iterator; -import org.w3c.dom.DOMException; import org.w3c.dom.Node; import org.w3c.dom.xpath.XPathException; -import org.w3c.dom.xpath.XPathNSResolver; import org.w3c.dom.xpath.XPathResult; /** Index: gnu/xml/dom/JAXPFactory.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/JAXPFactory.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 JAXPFactory.java --- gnu/xml/dom/JAXPFactory.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/dom/JAXPFactory.java 15 Feb 2005 20:55:16 -0000 @@ -40,7 +40,6 @@ package gnu.xml.dom; import java.io.IOException; import org.w3c.dom.Document; -import org.w3c.dom.DocumentType; import org.w3c.dom.DOMImplementation; import org.xml.sax.EntityResolver; Index: gnu/xml/dom/ls/DomLSEx.java =================================================================== RCS file: gnu/xml/dom/ls/DomLSEx.java diff -N gnu/xml/dom/ls/DomLSEx.java --- gnu/xml/dom/ls/DomLSEx.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,75 +0,0 @@ -/* DomLSEx.java -- - Copyright (C) 2004 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., 59 Temple Place, Suite 330, Boston, MA -02111-1307 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.xml.dom.ls; - -import java.io.PrintStream; -import java.io.PrintWriter; -import org.w3c.dom.ls.LSException; - -/** - * A DOM LS exception incorporating a cause. - * - * @author Chris Burdess - */ -public class DomLSEx - extends LSException -{ - - private final Exception cause2; - - public DomLSEx(short type, Exception cause) - { - super(type, cause.getMessage()); - cause2 = cause; - } - - public void printStackTrace(PrintStream out) - { - super.printStackTrace(out); - out.print("caused by "); - cause2.printStackTrace(out); - } - - public void printStackTrace(PrintWriter out) - { - super.printStackTrace(out); - out.print("caused by "); - cause2.printStackTrace(out); - } - -} Index: gnu/xml/dom/ls/DomLSException.java =================================================================== RCS file: gnu/xml/dom/ls/DomLSException.java diff -N gnu/xml/dom/ls/DomLSException.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/xml/dom/ls/DomLSException.java 15 Feb 2005 20:55:16 -0000 @@ -0,0 +1,57 @@ +/* DomLSException.java -- + Copyright (C) 2004 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.xml.dom.ls; + +import org.w3c.dom.ls.LSException; + +/** + * A DOM LS exception incorporating a cause. + * + * @author Chris Burdess + */ +public class DomLSException + extends LSException +{ + + public DomLSException(short type, Exception cause) + { + super(type, (cause == null) ? null : cause.getMessage()); + initCause(cause); + } + +} Index: gnu/xml/dom/ls/DomLSParser.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/ls/DomLSParser.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 DomLSParser.java --- gnu/xml/dom/ls/DomLSParser.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/dom/ls/DomLSParser.java 15 Feb 2005 20:55:16 -0000 @@ -65,7 +65,7 @@ import org.xml.sax.SAXNotRecognizedExcep import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; import gnu.xml.dom.DomDocument; -import gnu.xml.dom.DomEx; +import gnu.xml.dom.DomDOMException; /** * Parser implementation for GNU DOM. @@ -117,7 +117,7 @@ public class DomLSParser async = false; break; default: - throw new DomEx(DOMException.NOT_SUPPORTED_ERR); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); } // TODO schemaType this.schemaType = schemaType; @@ -307,13 +307,13 @@ public class DomLSParser { reader = null; eventSink = null; - throw new DomLSEx(LSException.PARSE_ERR, e); + throw new DomLSException(LSException.PARSE_ERR, e); } catch (IOException e) { reader = null; eventSink = null; - throw new DomLSEx(LSException.PARSE_ERR, e); + throw new DomLSException(LSException.PARSE_ERR, e); } // return document Document ret = eventSink.doc; @@ -341,11 +341,11 @@ public class DomLSParser } catch (ParserConfigurationException e) { - throw new DomLSEx(LSException.PARSE_ERR, e); + throw new DomLSException(LSException.PARSE_ERR, e); } catch (SAXException e) { - throw new DomLSEx(LSException.PARSE_ERR, e); + throw new DomLSException(LSException.PARSE_ERR, e); } } return reader; @@ -371,11 +371,11 @@ public class DomLSParser } catch (SAXException e) { - throw new DomLSEx(LSException.PARSE_ERR, e); + throw new DomLSException(LSException.PARSE_ERR, e); } catch (IOException e) { - throw new DomLSEx(LSException.PARSE_ERR, e); + throw new DomLSException(LSException.PARSE_ERR, e); } } if (source == null) @@ -403,7 +403,7 @@ public class DomLSParser } catch (IOException e) { - throw new DomLSEx(LSException.PARSE_ERR, e); + throw new DomLSException(LSException.PARSE_ERR, e); } } return source; @@ -457,7 +457,7 @@ public class DomLSParser } else { - throw new DomEx(DomEx.NOT_SUPPORTED_ERR); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); } // invalidate reader, a new one will be created reader = null; @@ -509,7 +509,7 @@ public class DomLSParser } else { - throw new DomEx(DomEx.NOT_SUPPORTED_ERR); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); } } Index: gnu/xml/dom/ls/DomLSSerializer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/ls/DomLSSerializer.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 DomLSSerializer.java --- gnu/xml/dom/ls/DomLSSerializer.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/dom/ls/DomLSSerializer.java 15 Feb 2005 20:55:16 -0000 @@ -58,7 +58,7 @@ import org.w3c.dom.ls.LSOutput; import org.w3c.dom.ls.LSSerializer; import org.w3c.dom.ls.LSSerializerFilter; import org.w3c.dom.traversal.NodeFilter; -import gnu.xml.dom.DomEx; +import gnu.xml.dom.DomDOMException; import gnu.xml.transform.StreamSerializer; /** @@ -147,7 +147,7 @@ public class DomLSSerializer } catch (IOException e) { - throw new DomLSEx(LSException.SERIALIZE_ERR, e); + throw new DomLSException(LSException.SERIALIZE_ERR, e); } } @@ -302,7 +302,7 @@ public class DomLSSerializer } else { - throw new DomEx(DomEx.NOT_SUPPORTED_ERR); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); } } @@ -319,7 +319,7 @@ public class DomLSSerializer } else { - throw new DomEx(DomEx.NOT_SUPPORTED_ERR); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); } } Index: gnu/xml/libxmlj/dom/GnomeDocumentBuilder.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/libxmlj/dom/GnomeDocumentBuilder.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 GnomeDocumentBuilder.java --- gnu/xml/libxmlj/dom/GnomeDocumentBuilder.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/libxmlj/dom/GnomeDocumentBuilder.java 15 Feb 2005 20:55:16 -0000 @@ -37,12 +37,8 @@ exception statement from your version. * package gnu.xml.libxmlj.dom; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.IOException; -import java.io.PushbackInputStream; -import java.net.MalformedURLException; import java.net.URL; import javax.xml.parsers.DocumentBuilder; Index: gnu/xml/libxmlj/dom/GnomeXPathNodeList.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/libxmlj/dom/GnomeXPathNodeList.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 GnomeXPathNodeList.java --- gnu/xml/libxmlj/dom/GnomeXPathNodeList.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/libxmlj/dom/GnomeXPathNodeList.java 15 Feb 2005 20:55:16 -0000 @@ -37,7 +37,6 @@ exception statement from your version. * package gnu.xml.libxmlj.dom; -import org.w3c.dom.DOMException; import org.w3c.dom.Node; import org.w3c.dom.NodeList; Index: gnu/xml/libxmlj/sax/GnomeXMLReader.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/libxmlj/sax/GnomeXMLReader.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 GnomeXMLReader.java --- gnu/xml/libxmlj/sax/GnomeXMLReader.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/libxmlj/sax/GnomeXMLReader.java 15 Feb 2005 20:55:16 -0000 @@ -38,19 +38,15 @@ exception statement from your version. * package gnu.xml.libxmlj.sax; import java.io.File; -import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.io.IOException; -import java.io.PushbackInputStream; import java.net.MalformedURLException; import java.net.URL; import java.util.Arrays; import java.util.ArrayList; -import java.util.HashMap; import java.util.Iterator; import java.util.List; -import java.util.Map; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; Index: gnu/xml/libxmlj/transform/GnomeTransformer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/libxmlj/transform/GnomeTransformer.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 GnomeTransformer.java --- gnu/xml/libxmlj/transform/GnomeTransformer.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/libxmlj/transform/GnomeTransformer.java 15 Feb 2005 20:55:16 -0000 @@ -37,14 +37,9 @@ exception statement from your version. * package gnu.xml.libxmlj.transform; -import java.io.ByteArrayOutputStream; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; -import java.io.PushbackInputStream; import java.net.URL; @@ -65,7 +60,6 @@ import javax.xml.transform.URIResolver; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.sax.SAXSource; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.stream.StreamSource; import javax.xml.transform.stream.StreamResult; Index: gnu/xml/libxmlj/transform/GnomeTransformerFactory.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/libxmlj/transform/GnomeTransformerFactory.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 GnomeTransformerFactory.java --- gnu/xml/libxmlj/transform/GnomeTransformerFactory.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/libxmlj/transform/GnomeTransformerFactory.java 15 Feb 2005 20:55:16 -0000 @@ -51,7 +51,6 @@ import javax.xml.transform.ErrorListener import javax.xml.transform.Source; import javax.xml.transform.Templates; import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.URIResolver; Index: gnu/xml/libxmlj/util/XMLJ.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/libxmlj/util/XMLJ.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 XMLJ.java --- gnu/xml/libxmlj/util/XMLJ.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/libxmlj/util/XMLJ.java 15 Feb 2005 20:55:16 -0000 @@ -42,7 +42,6 @@ import java.io.FileOutputStream; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; -import java.io.PushbackInputStream; import java.io.Reader; import java.io.Writer; import java.net.MalformedURLException; Index: gnu/xml/pipeline/CallFilter.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/pipeline/CallFilter.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 CallFilter.java --- gnu/xml/pipeline/CallFilter.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/pipeline/CallFilter.java 15 Feb 2005 20:55:16 -0000 @@ -37,11 +37,18 @@ exception statement from your version. * package gnu.xml.pipeline; -import java.io.*; -import java.net.*; - -import org.xml.sax.*; -import org.xml.sax.ext.*; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.net.URL; +import java.net.URLConnection; +import java.io.Writer; + +import org.xml.sax.DTDHandler; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; import gnu.xml.util.Resolver; Index: gnu/xml/pipeline/DomConsumer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/pipeline/DomConsumer.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 DomConsumer.java --- gnu/xml/pipeline/DomConsumer.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/pipeline/DomConsumer.java 15 Feb 2005 20:55:19 -0000 @@ -37,17 +37,30 @@ exception statement from your version. * package gnu.xml.pipeline; -import java.util.Hashtable; +import gnu.xml.aelfred2.ContentHandler2; +import gnu.xml.util.DomParser; -import org.w3c.dom.*; -import org.xml.sax.*; +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.DTDHandler; +import org.xml.sax.ErrorHandler; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXParseException; import org.xml.sax.ext.DeclHandler; import org.xml.sax.ext.LexicalHandler; import org.xml.sax.helpers.AttributesImpl; - -import gnu.xml.aelfred2.ContentHandler2; -import gnu.xml.util.DomParser; - +import org.w3c.dom.Attr; +import org.w3c.dom.CDATASection; +import org.w3c.dom.CharacterData; +import org.w3c.dom.Document; +import org.w3c.dom.DOMImplementation; +import org.w3c.dom.Element; +import org.w3c.dom.EntityReference; +import org.w3c.dom.Node; +import org.w3c.dom.ProcessingInstruction; +import org.w3c.dom.Text; /** * This consumer builds a DOM Document from its input, acting either as a Index: gnu/xml/pipeline/LinkFilter.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/pipeline/LinkFilter.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 LinkFilter.java --- gnu/xml/pipeline/LinkFilter.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/pipeline/LinkFilter.java 15 Feb 2005 20:55:19 -0000 @@ -43,7 +43,6 @@ import java.util.Enumeration; import java.util.Vector; import org.xml.sax.Attributes; -import org.xml.sax.Locator; import org.xml.sax.SAXException; Index: gnu/xml/pipeline/NSFilter.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/pipeline/NSFilter.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 NSFilter.java --- gnu/xml/pipeline/NSFilter.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/pipeline/NSFilter.java 15 Feb 2005 20:55:19 -0000 @@ -37,16 +37,17 @@ exception statement from your version. * package gnu.xml.pipeline; -import java.util.EmptyStackException; import java.util.Enumeration; import java.util.Stack; -import org.xml.sax.*; -import org.xml.sax.ext.*; +import org.xml.sax.Attributes; +import org.xml.sax.ErrorHandler; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; import org.xml.sax.helpers.AttributesImpl; import org.xml.sax.helpers.NamespaceSupport; - /** * This filter ensures that element and attribute names are properly prefixed, * and that such prefixes are declared. Such data is critical for operations Index: gnu/xml/pipeline/TeeConsumer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/pipeline/TeeConsumer.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 TeeConsumer.java --- gnu/xml/pipeline/TeeConsumer.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/pipeline/TeeConsumer.java 15 Feb 2005 20:55:19 -0000 @@ -37,11 +37,15 @@ exception statement from your version. * package gnu.xml.pipeline; -import java.io.IOException; -import org.xml.sax.*; -import org.xml.sax.ext.*; -//import gnu.xml.util; - +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.DTDHandler; +import org.xml.sax.ErrorHandler; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.ext.DeclHandler; +import org.xml.sax.ext.LexicalHandler; /** * Fans its events out to two other consumers, a "tee" filter stage in an Index: gnu/xml/pipeline/ValidationConsumer.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/pipeline/ValidationConsumer.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 ValidationConsumer.java --- gnu/xml/pipeline/ValidationConsumer.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/pipeline/ValidationConsumer.java 15 Feb 2005 20:55:19 -0000 @@ -37,8 +37,9 @@ exception statement from your version. * package gnu.xml.pipeline; -import java.io.*; - +import java.io.IOException; +import java.io.StringReader; +import java.io.StringWriter; import java.util.EmptyStackException; import java.util.Enumeration; import java.util.Hashtable; @@ -46,11 +47,16 @@ import java.util.Stack; import java.util.StringTokenizer; import java.util.Vector; -import org.xml.sax.*; -import org.xml.sax.ext.*; +import org.xml.sax.Attributes; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; - /** * This class checks SAX2 events to report validity errors; it works as * both a filter and a terminus on an event pipeline. It relies on the Index: gnu/xml/pipeline/WellFormednessFilter.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/pipeline/WellFormednessFilter.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 WellFormednessFilter.java --- gnu/xml/pipeline/WellFormednessFilter.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/pipeline/WellFormednessFilter.java 15 Feb 2005 20:55:19 -0000 @@ -40,10 +40,11 @@ package gnu.xml.pipeline; import java.util.EmptyStackException; import java.util.Stack; -import gnu.xml.aelfred2.SAXDriver; -import org.xml.sax.*; -import org.xml.sax.ext.*; - +import org.xml.sax.Attributes; +import org.xml.sax.ErrorHandler; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; /** * This filter reports fatal exceptions in the case of event streams that Index: gnu/xml/pipeline/XIncludeFilter.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/pipeline/XIncludeFilter.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 XIncludeFilter.java --- gnu/xml/pipeline/XIncludeFilter.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/pipeline/XIncludeFilter.java 15 Feb 2005 20:55:19 -0000 @@ -42,7 +42,6 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; -import java.util.Enumeration; import java.util.Hashtable; import java.util.Stack; import java.util.Vector; Index: gnu/xml/pipeline/XsltFilter.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/pipeline/XsltFilter.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 XsltFilter.java --- gnu/xml/pipeline/XsltFilter.java 16 Jan 2005 15:15:10 -0000 1.1.2.1 +++ gnu/xml/pipeline/XsltFilter.java 15 Feb 2005 20:55:19 -0000 @@ -44,7 +44,6 @@ import javax.xml.transform.TransformerCo import javax.xml.transform.sax.*; import javax.xml.transform.stream.StreamSource; -import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; import org.xml.sax.ext.LexicalHandler; Index: gnu/xml/transform/ApplyImportsNode.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/transform/ApplyImportsNode.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 ApplyImportsNode.java --- gnu/xml/transform/ApplyImportsNode.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/transform/ApplyImportsNode.java 15 Feb 2005 20:55:19 -0000 @@ -37,15 +37,9 @@ exception statement from your version. * package gnu.xml.transform; -import java.util.Collection; -import java.util.Iterator; -import java.text.DecimalFormat; import javax.xml.namespace.QName; import javax.xml.transform.TransformerException; -import org.w3c.dom.Document; import org.w3c.dom.Node; -import org.w3c.dom.Text; -import gnu.xml.xpath.Expr; /** * A template node representing an XSLT apply-imports instruction. Index: gnu/xml/transform/Bindings.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/transform/Bindings.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 Bindings.java --- gnu/xml/transform/Bindings.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/transform/Bindings.java 15 Feb 2005 20:55:19 -0000 @@ -45,12 +45,8 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.Map; import javax.xml.namespace.QName; -import javax.xml.transform.TransformerException; import javax.xml.xpath.XPathVariableResolver; -import org.w3c.dom.Document; -import org.w3c.dom.DocumentFragment; import org.w3c.dom.Node; -import gnu.xml.xpath.Expr; /** * The set of variable bindings in effect for a stylesheet. Index: gnu/xml/transform/DocumentFunction.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/transform/DocumentFunction.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 DocumentFunction.java --- gnu/xml/transform/DocumentFunction.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/transform/DocumentFunction.java 15 Feb 2005 20:55:19 -0000 @@ -37,22 +37,16 @@ exception statement from your version. * package gnu.xml.transform; -import java.io.InputStream; -import java.io.IOException; -import java.net.URL; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.TreeSet; -import javax.xml.transform.ErrorListener; import javax.xml.transform.TransformerException; -import javax.xml.transform.URIResolver; import javax.xml.transform.dom.DOMSource; import javax.xml.xpath.XPathFunction; import javax.xml.xpath.XPathFunctionException; -import org.w3c.dom.Document; import org.w3c.dom.Node; import gnu.xml.xpath.Constant; import gnu.xml.xpath.Expr; Index: gnu/xml/transform/FormatNumberFunction.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/transform/FormatNumberFunction.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 FormatNumberFunction.java --- gnu/xml/transform/FormatNumberFunction.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/transform/FormatNumberFunction.java 15 Feb 2005 20:55:19 -0000 @@ -38,7 +38,6 @@ exception statement from your version. * package gnu.xml.transform; import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; import java.util.ArrayList; import java.util.Collections; import java.util.List; Index: gnu/xml/transform/NodeNumberNode.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/transform/NodeNumberNode.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 NodeNumberNode.java --- gnu/xml/transform/NodeNumberNode.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/transform/NodeNumberNode.java 15 Feb 2005 20:55:19 -0000 @@ -43,13 +43,10 @@ import java.util.Collections; import java.util.Iterator; import java.util.List; import javax.xml.transform.TransformerException; -import org.w3c.dom.Document; import org.w3c.dom.Node; import gnu.xml.xpath.Expr; -import gnu.xml.xpath.NodeTypeTest; import gnu.xml.xpath.Pattern; import gnu.xml.xpath.Selector; -import gnu.xml.xpath.Test; import gnu.xml.xpath.UnionExpr; /** Index: gnu/xml/transform/NumberNode.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/transform/NumberNode.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 NumberNode.java --- gnu/xml/transform/NumberNode.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/transform/NumberNode.java 15 Feb 2005 20:55:19 -0000 @@ -38,7 +38,6 @@ exception statement from your version. * package gnu.xml.transform; import javax.xml.transform.TransformerException; -import org.w3c.dom.Document; import org.w3c.dom.Node; import gnu.xml.xpath.Expr; Index: gnu/xml/transform/Stylesheet.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/transform/Stylesheet.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 Stylesheet.java --- gnu/xml/transform/Stylesheet.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/transform/Stylesheet.java 15 Feb 2005 20:55:19 -0000 @@ -58,7 +58,6 @@ import javax.xml.namespace.QName; import javax.xml.transform.Source; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; -import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathFunction; import javax.xml.xpath.XPathFunctionResolver; import javax.xml.xpath.XPathExpressionException; @@ -68,7 +67,6 @@ import org.w3c.dom.DOMException; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; -import org.w3c.dom.NodeList; import org.w3c.dom.Text; import org.w3c.dom.UserDataHandler; import gnu.xml.xpath.Expr; Index: gnu/xml/transform/SystemPropertyFunction.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/transform/SystemPropertyFunction.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 SystemPropertyFunction.java --- gnu/xml/transform/SystemPropertyFunction.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/transform/SystemPropertyFunction.java 15 Feb 2005 20:55:19 -0000 @@ -38,7 +38,6 @@ exception statement from your version. * package gnu.xml.transform; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import javax.xml.namespace.QName; import javax.xml.xpath.XPathFunction; Index: gnu/xml/transform/Template.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/transform/Template.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 Template.java --- gnu/xml/transform/Template.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/transform/Template.java 15 Feb 2005 20:55:19 -0000 @@ -39,9 +39,7 @@ package gnu.xml.transform; import java.io.PrintStream; import javax.xml.namespace.QName; -import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; -import javax.xml.xpath.XPathExpressionException; import org.w3c.dom.Node; import gnu.xml.xpath.Expr; import gnu.xml.xpath.NameTest; Index: gnu/xml/transform/TemplatesImpl.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/transform/TemplatesImpl.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 TemplatesImpl.java --- gnu/xml/transform/TemplatesImpl.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/transform/TemplatesImpl.java 15 Feb 2005 20:55:19 -0000 @@ -38,12 +38,9 @@ exception statement from your version. * package gnu.xml.transform; import java.util.Properties; -import javax.xml.transform.ErrorListener; -import javax.xml.transform.Source; import javax.xml.transform.Templates; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.URIResolver; /** * GNU precompiled stylesheet implementation. Index: gnu/xml/transform/TransformerImpl.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/transform/TransformerImpl.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 TransformerImpl.java --- gnu/xml/transform/TransformerImpl.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/transform/TransformerImpl.java 15 Feb 2005 20:55:19 -0000 @@ -48,9 +48,6 @@ import java.net.UnknownServiceException; import java.net.URL; import java.net.URLConnection; import java.util.Collection; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; import java.util.Properties; import javax.xml.transform.ErrorListener; import javax.xml.transform.OutputKeys; @@ -67,7 +64,6 @@ import javax.xml.transform.stream.Stream import org.w3c.dom.Document; import org.w3c.dom.DocumentType; import org.w3c.dom.DOMImplementation; -import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.Text; import org.xml.sax.ContentHandler; @@ -76,8 +72,6 @@ import org.xml.sax.ext.LexicalHandler; import gnu.xml.dom.DomDoctype; import gnu.xml.dom.DomDocument; import gnu.xml.dom.ls.WriterOutputStream; -import gnu.xml.xpath.Expr; -import gnu.xml.xpath.Root; /** * The transformation process for a given stylesheet. Index: gnu/xml/transform/ValueOfNode.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/transform/ValueOfNode.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 ValueOfNode.java --- gnu/xml/transform/ValueOfNode.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/transform/ValueOfNode.java 15 Feb 2005 20:55:19 -0000 @@ -37,9 +37,6 @@ exception statement from your version. * package gnu.xml.transform; -import java.util.Collection; -import java.util.Iterator; -import java.text.DecimalFormat; import javax.xml.namespace.QName; import javax.xml.transform.TransformerException; import org.w3c.dom.Document; Index: gnu/xml/transform/XSLURIResolver.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/transform/XSLURIResolver.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 XSLURIResolver.java --- gnu/xml/transform/XSLURIResolver.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/transform/XSLURIResolver.java 15 Feb 2005 20:55:19 -0000 @@ -41,7 +41,6 @@ import java.io.File; import java.io.InputStream; import java.io.IOException; import java.io.Reader; -import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; Index: gnu/xml/util/DoParse.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/util/DoParse.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 DoParse.java --- gnu/xml/util/DoParse.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/util/DoParse.java 15 Feb 2005 20:55:19 -0000 @@ -37,28 +37,22 @@ exception statement from your version. * package gnu.xml.util; -import java.io.*; +import java.io.IOException; -import org.xml.sax.*; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; -import org.xml.sax.ext.*; -// import gnu.xml.pipeline.*; -// Added imports directly to fix a GCJ problem. -import gnu.xml.pipeline.CallFilter; -import gnu.xml.pipeline.DomConsumer; import gnu.xml.pipeline.EventConsumer; import gnu.xml.pipeline.EventFilter; -import gnu.xml.pipeline.LinkFilter; import gnu.xml.pipeline.NSFilter; import gnu.xml.pipeline.PipelineFactory; import gnu.xml.pipeline.TeeConsumer; -import gnu.xml.pipeline.TextConsumer; import gnu.xml.pipeline.ValidationConsumer; import gnu.xml.pipeline.WellFormednessFilter; -import gnu.xml.pipeline.XIncludeFilter; -import gnu.xml.pipeline.XsltFilter; - /** * This class provides a driver which may be invoked from the command line Index: gnu/xml/util/Resolver.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/util/Resolver.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 Resolver.java --- gnu/xml/util/Resolver.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/util/Resolver.java 15 Feb 2005 20:55:19 -0000 @@ -37,13 +37,13 @@ exception statement from your version. * package gnu.xml.util; -import java.io.*; - +import java.io.File; +import java.io.IOException; import java.util.Dictionary; -import java.util.Hashtable; - -import org.xml.sax.*; +import org.xml.sax.EntityResolver; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; /** * Utility implementation of a SAX resolver, which can be used to improve Index: gnu/xml/util/SAXNullTransformerFactory.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/util/SAXNullTransformerFactory.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 SAXNullTransformerFactory.java --- gnu/xml/util/SAXNullTransformerFactory.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/util/SAXNullTransformerFactory.java 15 Feb 2005 20:55:19 -0000 @@ -635,7 +635,8 @@ public class SAXNullTransformerFactory e // preserve original namespace prefixes try { - producer.setFeature(handler.FEATURE_URI + "namespace-prefixes", + producer.setFeature(EventFilter.FEATURE_URI + + "namespace-prefixes", true); } catch (Exception e) @@ -646,7 +647,7 @@ public class SAXNullTransformerFactory e // arrange the output handler.setResult (out); - handler.bind (producer, handler); + EventFilter.bind (producer, handler); // then parse ... single element pipeline producer.parse (input); Index: gnu/xml/xpath/Expr.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/xpath/Expr.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 Expr.java --- gnu/xml/xpath/Expr.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/xpath/Expr.java 15 Feb 2005 20:55:19 -0000 @@ -58,9 +58,7 @@ import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import org.w3c.dom.Document; -import org.w3c.dom.Element; import org.w3c.dom.Node; -import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import org.xml.sax.SAXException; Index: gnu/xml/xpath/FunctionCall.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/xpath/FunctionCall.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 FunctionCall.java --- gnu/xml/xpath/FunctionCall.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/xpath/FunctionCall.java 15 Feb 2005 20:55:19 -0000 @@ -38,7 +38,6 @@ exception statement from your version. * package gnu.xml.xpath; import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; import java.util.List; import javax.xml.namespace.QName; Index: gnu/xml/xpath/Predicate.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/xpath/Predicate.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 Predicate.java --- gnu/xml/xpath/Predicate.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/xpath/Predicate.java 15 Feb 2005 20:55:19 -0000 @@ -63,7 +63,7 @@ class Predicate // Same as [position() = x] return ((Double) ret).intValue() == pos; } - return expr._boolean(node, expr.evaluate(node, pos, len)); + return Expr._boolean(node, expr.evaluate(node, pos, len)); } public Test clone(Object context) Index: gnu/xml/xpath/RelationalExpr.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/xpath/RelationalExpr.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 RelationalExpr.java --- gnu/xml/xpath/RelationalExpr.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/xpath/RelationalExpr.java 15 Feb 2005 20:55:19 -0000 @@ -37,7 +37,6 @@ exception statement from your version. * package gnu.xml.xpath; -import java.util.Collection; import org.w3c.dom.Node; /** Index: gnu/xml/xpath/Selector.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/xpath/Selector.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 Selector.java --- gnu/xml/xpath/Selector.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/xpath/Selector.java 15 Feb 2005 20:55:19 -0000 @@ -39,7 +39,6 @@ package gnu.xml.xpath; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; @@ -48,7 +47,6 @@ import javax.xml.XMLConstants; import org.w3c.dom.Attr; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; -import org.w3c.dom.NodeList; /** * A single component of a location path. Index: gnu/xml/xpath/XPathParser.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/xpath/XPathParser.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 XPathParser.java --- gnu/xml/xpath/XPathParser.java 16 Jan 2005 15:15:11 -0000 1.1.2.1 +++ gnu/xml/xpath/XPathParser.java 15 Feb 2005 20:55:19 -0000 @@ -43,7 +43,6 @@ package gnu.xml.xpath; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.Map; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.xpath.XPathFunctionResolver; Index: include/Makefile.am =================================================================== RCS file: /cvsroot/classpath/classpath/include/Makefile.am,v retrieving revision 1.27.2.5 diff -u -3 -p -u -r1.27.2.5 Makefile.am --- include/Makefile.am 16 Jan 2005 15:15:11 -0000 1.27.2.5 +++ include/Makefile.am 15 Feb 2005 20:55:20 -0000 @@ -27,9 +27,7 @@ $(top_srcdir)/include/gnu_xml_libxmlj_tr $(top_srcdir)/include/gnu_xml_libxmlj_transform_GnomeTransformerFactory.h GTKPEER_H_FILES = \ -$(top_srcdir)/include/gnu_java_awt_peer_gtk_GdkFontMetrics.h \ $(top_srcdir)/include/gnu_java_awt_peer_gtk_GdkFontPeer.h \ -$(top_srcdir)/include/gnu_java_awt_peer_gtk_GdkGlyphVector.h \ $(top_srcdir)/include/gnu_java_awt_peer_gtk_GdkGraphics.h \ $(top_srcdir)/include/gnu_java_awt_peer_gtk_GdkGraphics2D.h \ $(top_srcdir)/include/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.h \ Index: include/gnu_java_awt_peer_gtk_GdkFontMetrics.h =================================================================== RCS file: include/gnu_java_awt_peer_gtk_GdkFontMetrics.h diff -N include/gnu_java_awt_peer_gtk_GdkFontMetrics.h --- include/gnu_java_awt_peer_gtk_GdkFontMetrics.h 16 Jan 2005 02:14:46 -0000 1.6.2.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,42 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ - -#ifndef __gnu_java_awt_peer_gtk_GdkFontMetrics__ -#define __gnu_java_awt_peer_gtk_GdkFontMetrics__ - -#include - -#ifdef __cplusplus -extern "C" -{ -#endif - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkFontMetrics_getPeerFontMetrics (JNIEnv *env, jclass, jobject, jdoubleArray); -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkFontMetrics_getPeerTextMetrics (JNIEnv *env, jclass, jobject, jstring, jdoubleArray); -#undef gnu_java_awt_peer_gtk_GdkFontMetrics_FONT_METRICS_ASCENT -#define gnu_java_awt_peer_gtk_GdkFontMetrics_FONT_METRICS_ASCENT 0L -#undef gnu_java_awt_peer_gtk_GdkFontMetrics_FONT_METRICS_MAX_ASCENT -#define gnu_java_awt_peer_gtk_GdkFontMetrics_FONT_METRICS_MAX_ASCENT 1L -#undef gnu_java_awt_peer_gtk_GdkFontMetrics_FONT_METRICS_DESCENT -#define gnu_java_awt_peer_gtk_GdkFontMetrics_FONT_METRICS_DESCENT 2L -#undef gnu_java_awt_peer_gtk_GdkFontMetrics_FONT_METRICS_MAX_DESCENT -#define gnu_java_awt_peer_gtk_GdkFontMetrics_FONT_METRICS_MAX_DESCENT 3L -#undef gnu_java_awt_peer_gtk_GdkFontMetrics_FONT_METRICS_MAX_ADVANCE -#define gnu_java_awt_peer_gtk_GdkFontMetrics_FONT_METRICS_MAX_ADVANCE 4L -#undef gnu_java_awt_peer_gtk_GdkFontMetrics_TEXT_METRICS_X_BEARING -#define gnu_java_awt_peer_gtk_GdkFontMetrics_TEXT_METRICS_X_BEARING 0L -#undef gnu_java_awt_peer_gtk_GdkFontMetrics_TEXT_METRICS_Y_BEARING -#define gnu_java_awt_peer_gtk_GdkFontMetrics_TEXT_METRICS_Y_BEARING 1L -#undef gnu_java_awt_peer_gtk_GdkFontMetrics_TEXT_METRICS_WIDTH -#define gnu_java_awt_peer_gtk_GdkFontMetrics_TEXT_METRICS_WIDTH 2L -#undef gnu_java_awt_peer_gtk_GdkFontMetrics_TEXT_METRICS_HEIGHT -#define gnu_java_awt_peer_gtk_GdkFontMetrics_TEXT_METRICS_HEIGHT 3L -#undef gnu_java_awt_peer_gtk_GdkFontMetrics_TEXT_METRICS_X_ADVANCE -#define gnu_java_awt_peer_gtk_GdkFontMetrics_TEXT_METRICS_X_ADVANCE 4L -#undef gnu_java_awt_peer_gtk_GdkFontMetrics_TEXT_METRICS_Y_ADVANCE -#define gnu_java_awt_peer_gtk_GdkFontMetrics_TEXT_METRICS_Y_ADVANCE 5L - -#ifdef __cplusplus -} -#endif - -#endif /* __gnu_java_awt_peer_gtk_GdkFontMetrics__ */ Index: include/gnu_java_awt_peer_gtk_GdkFontPeer.h =================================================================== RCS file: /cvsroot/classpath/classpath/include/gnu_java_awt_peer_gtk_GdkFontPeer.h,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 gnu_java_awt_peer_gtk_GdkFontPeer.h --- include/gnu_java_awt_peer_gtk_GdkFontPeer.h 15 Jan 2005 17:01:46 -0000 1.1.2.1 +++ include/gnu_java_awt_peer_gtk_GdkFontPeer.h 15 Feb 2005 20:55:20 -0000 @@ -14,6 +14,9 @@ JNIEXPORT void JNICALL Java_gnu_java_awt JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkFontPeer_initState (JNIEnv *env, jobject); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkFontPeer_dispose (JNIEnv *env, jobject); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkFontPeer_setFont (JNIEnv *env, jobject, jstring, jint, jint, jboolean); +JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkFontPeer_getFontMetrics (JNIEnv *env, jobject, jdoubleArray); +JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkFontPeer_getTextMetrics (JNIEnv *env, jobject, jstring, jdoubleArray); +JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_gtk_GdkFontPeer_getGlyphVector (JNIEnv *env, jobject, jstring, jobject, jobject); #ifdef __cplusplus } Index: include/gnu_java_awt_peer_gtk_GdkGlyphVector.h =================================================================== RCS file: include/gnu_java_awt_peer_gtk_GdkGlyphVector.h diff -N include/gnu_java_awt_peer_gtk_GdkGlyphVector.h --- include/gnu_java_awt_peer_gtk_GdkGlyphVector.h 14 Jan 2005 10:24:05 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,32 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ - -#ifndef __gnu_java_awt_peer_gtk_GdkGlyphVector__ -#define __gnu_java_awt_peer_gtk_GdkGlyphVector__ - -#include - -#ifdef __cplusplus -extern "C" -{ -#endif - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_initStaticState (JNIEnv *env, jclass); -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_initState (JNIEnv *env, jobject, jobject, jobject); -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_setChars (JNIEnv *env, jobject, jstring); -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_setGlyphCodes (JNIEnv *env, jobject, jintArray); -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_dispose (JNIEnv *env, jobject); -JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphCode (JNIEnv *env, jobject, jint); -JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_numGlyphs (JNIEnv *env, jobject); -JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphCharIndex (JNIEnv *env, jobject, jint); -JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_allLogicalExtents (JNIEnv *env, jobject); -JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_allInkExtents (JNIEnv *env, jobject); -JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphLogicalExtents (JNIEnv *env, jobject, jint); -JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphInkExtents (JNIEnv *env, jobject, jint); -JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphIsHorizontal (JNIEnv *env, jobject, jint); -JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_isEqual (JNIEnv *env, jobject, jobject); - -#ifdef __cplusplus -} -#endif - -#endif /* __gnu_java_awt_peer_gtk_GdkGlyphVector__ */ Index: include/gnu_java_awt_peer_gtk_GdkGraphics2D.h =================================================================== RCS file: /cvsroot/classpath/classpath/include/gnu_java_awt_peer_gtk_GdkGraphics2D.h,v retrieving revision 1.5.2.3 diff -u -3 -p -u -r1.5.2.3 gnu_java_awt_peer_gtk_GdkGraphics2D.h --- include/gnu_java_awt_peer_gtk_GdkGraphics2D.h 16 Jan 2005 15:15:11 -0000 1.5.2.3 +++ include/gnu_java_awt_peer_gtk_GdkGraphics2D.h 15 Feb 2005 20:55:20 -0000 @@ -46,12 +46,9 @@ JNIEXPORT void JNICALL Java_gnu_java_awt JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoStroke (JNIEnv *env, jobject); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoFill (JNIEnv *env, jobject); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoClip (JNIEnv *env, jobject); -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGdkGlyphVector (JNIEnv *env, jobject, jobject, jobject, jfloat, jfloat); -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGdkTextLayout (JNIEnv *env, jobject, jobject, jobject, jfloat, jfloat); -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawString (JNIEnv *env, jobject, jobject, jstring, jfloat, jfloat); +JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGlyphVector (JNIEnv *env, jobject, jobject, jfloat, jfloat, jint, jintArray, jfloatArray); +JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGdkTextLayout (JNIEnv *env, jobject, jobject, jfloat, jfloat); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_releasePeerGraphicsResource (JNIEnv *env, jclass, jobject); -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getPeerTextMetrics (JNIEnv *env, jclass, jobject, jstring, jdoubleArray); -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getPeerFontMetrics (JNIEnv *env, jclass, jobject, jdoubleArray); #ifdef __cplusplus } Index: java/awt/AWTKeyStroke.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/awt/AWTKeyStroke.java,v retrieving revision 1.5.2.2 diff -u -3 -p -u -r1.5.2.2 AWTKeyStroke.java --- java/awt/AWTKeyStroke.java 14 Jan 2005 10:24:14 -0000 1.5.2.2 +++ java/awt/AWTKeyStroke.java 15 Feb 2005 20:55:20 -0000 @@ -397,15 +397,16 @@ public class AWTKeyStroke implements Ser * * * @param s the string to parse + * @throws IllegalArgumentException if s is null or cannot be parsed * @return the specified keystroke - * @throws NullPointerException if s is null - * @throws IllegalArgumentException if s cannot be parsed */ public static AWTKeyStroke getAWTKeyStroke(String s) { + if (s == null) + throw new IllegalArgumentException("null argument"); StringTokenizer t = new StringTokenizer(s, " "); if (! t.hasMoreTokens()) - throw new IllegalArgumentException(); + throw new IllegalArgumentException("no tokens '" + s + "'"); int modifiers = 0; boolean released = false; String token = null; @@ -436,7 +437,8 @@ public class AWTKeyStroke implements Ser KeyEvent.VK_UNDEFINED, modifiers, false); } - throw new IllegalArgumentException(); + throw new IllegalArgumentException("Invalid 'typed' argument '" + + s + "'"); } else if ("pressed".equals(token)) { @@ -457,8 +459,11 @@ public class AWTKeyStroke implements Ser while (t.hasMoreTokens()); // Now token contains the VK name we must parse. Integer code = (Integer) vktable.get(token); - if (code == null || t.hasMoreTokens()) - throw new IllegalArgumentException(); + if (code == null) + throw new IllegalArgumentException("Unknown token '" + token + + "' in '" + s + "'"); + if (t.hasMoreTokens()) + throw new IllegalArgumentException("Too many tokens: " + s); return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, code.intValue(), modifiers, released); } Index: java/awt/BasicStroke.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/awt/BasicStroke.java,v retrieving revision 1.4.2.2 diff -u -3 -p -u -r1.4.2.2 BasicStroke.java --- java/awt/BasicStroke.java 21 Jan 2005 02:16:35 -0000 1.4.2.2 +++ java/awt/BasicStroke.java 15 Feb 2005 20:55:20 -0000 @@ -222,9 +222,10 @@ public class BasicStroke implements Stro hash ^= cap; hash ^= join; hash ^= Float.floatToIntBits(limit); - - for (int i = 0; i < dash.length; i++) - hash ^= Float.floatToIntBits(dash[i]); + + if (dash != null) + for (int i = 0; i < dash.length; i++) + hash ^= Float.floatToIntBits(dash[i]); hash ^= Float.floatToIntBits(phase); Index: java/awt/CheckboxMenuItem.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/awt/CheckboxMenuItem.java,v retrieving revision 1.12.2.3 diff -u -3 -p -u -r1.12.2.3 CheckboxMenuItem.java --- java/awt/CheckboxMenuItem.java 16 Jan 2005 15:15:11 -0000 1.12.2.3 +++ java/awt/CheckboxMenuItem.java 15 Feb 2005 20:55:20 -0000 @@ -274,6 +274,14 @@ processItemEvent(ItemEvent event) void dispatchEventImpl(AWTEvent e) { + if (e instanceof ItemEvent) + { + synchronized (this) + { + state = (((ItemEvent) e).getStateChange() == ItemEvent.SELECTED); + } + } + if (e.id <= ItemEvent.ITEM_LAST && e.id >= ItemEvent.ITEM_FIRST && (item_listeners != null Index: java/awt/Container.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/awt/Container.java,v retrieving revision 1.37.2.7 diff -u -3 -p -u -r1.37.2.7 Container.java --- java/awt/Container.java 29 Jan 2005 02:45:23 -0000 1.37.2.7 +++ java/awt/Container.java 15 Feb 2005 20:55:20 -0000 @@ -1054,7 +1054,7 @@ public class Container extends Component */ protected String paramString() { - if (layoutMgr != null) + if (layoutMgr == null) return super.paramString(); StringBuffer sb = new StringBuffer(); Index: java/awt/MenuItem.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/awt/MenuItem.java,v retrieving revision 1.15.2.3 diff -u -3 -p -u -r1.15.2.3 MenuItem.java --- java/awt/MenuItem.java 16 Jan 2005 15:15:11 -0000 1.15.2.3 +++ java/awt/MenuItem.java 15 Feb 2005 20:55:20 -0000 @@ -563,7 +563,10 @@ protected void processActionEvent(ActionEvent event) { if (action_listeners != null) - action_listeners.actionPerformed(event); + { + event.setSource(this); + action_listeners.actionPerformed(event); + } } /*************************************************************************/ Index: java/awt/Scrollbar.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/awt/Scrollbar.java,v retrieving revision 1.18.2.5 diff -u -3 -p -u -r1.18.2.5 Scrollbar.java --- java/awt/Scrollbar.java 21 Jan 2005 02:16:35 -0000 1.18.2.5 +++ java/awt/Scrollbar.java 15 Feb 2005 20:55:21 -0000 @@ -52,693 +52,596 @@ import javax.accessibility.AccessibleSta import javax.accessibility.AccessibleValue; /** - * This class implements a scrollbar widget. - * - * @author Aaron M. Renn (address@hidden) - * @author Tom Tromey (address@hidden) - * @author Andrew John Hughes (address@hidden) - */ -public class Scrollbar extends Component implements Accessible, - Adjustable -{ - -// FIXME: Serialization readObject/writeObject - -/* - * Static Variables - */ - -/** - * Constant indicating that a scrollbar is horizontal. - */ -public static final int HORIZONTAL = 0; - -/** - * Constant indicating that a scrollbar is vertical. - */ -public static final int VERTICAL = 1; - -// Serialization Constant -private static final long serialVersionUID = 8451667562882310543L; - -/*************************************************************************/ - -/** - * @serial The amount by which the value of the scrollbar is changed - * when incrementing in line mode. - */ -private int lineIncrement; - -/** - * @serial The amount by which the value of the scrollbar is changed - * when incrementing in page mode. - */ -private int pageIncrement; - -/** - * @serial The maximum value for this scrollbar - */ -private int maximum; - -/** - * @serial The minimum value for this scrollbar - */ -private int minimum; - -/** - * @serial The orientation of this scrollbar, which will be either - * the HORIZONTAL or VERTICAL constant - * from this class. - */ -private int orientation; - -/** - * @serial The current value of this scrollbar. - */ -private int value; - -/** - * @serial The width of the scrollbar's thumb, which is relative - * to the minimum and maximum value of the scrollbar. - */ -private int visibleAmount; - -// List of AdjustmentListener's. -private AdjustmentListener adjustment_listeners; - -private transient boolean valueIsAdjusting = false; - - /* - * The number used to generate the name returned by getName. - */ - private static transient long next_scrollbar_number; - -/*************************************************************************/ - -/* - * Constructors + * This class implements a scrollbar widget. + * + * @author Aaron M. Renn (address@hidden) + * @author Tom Tromey (address@hidden) + * @author Andrew John Hughes (address@hidden) */ - -/** - * Initializes a new instance of Scrollbar with a - * vertical orientation and default values for all other parameters. - * - * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true, - */ -public -Scrollbar() -{ - this(VERTICAL); -} - -/*************************************************************************/ - -/** - * Initializes a new instance of Scrollbar with the - * specified orientation and default values for all other parameters. - * The orientation must be either the constant HORIZONTAL or - * VERTICAL from this class. An incorrect value will throw - * an exception. - * - * @param orientation The orientation of this scrollbar. - * - * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true, - * @exception IllegalArgumentException If the orientation value is not valid. - */ -public -Scrollbar(int orientation) throws IllegalArgumentException -{ - this(orientation, 0, 10, 0, 100); -} - -/*************************************************************************/ - -/** - * Initializes a new instance of Scrollbar with the - * specified parameters. The orientation must be either the constant - * HORIZONTAL or VERTICAL. An incorrect value - * will throw an exception. Inconsistent values for other parameters - * are silently corrected to valid values. - * - * @param orientation The orientation of this scrollbar. - * @param value The initial value of the scrollbar. - * @param visibleAmount The width of the scrollbar thumb. - * @param minimum The minimum value of the scrollbar. - * @param maximum The maximum value of the scrollbar. - * - * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true, - * @exception IllegalArgumentException If the orientation value is not valid. - */ -public -Scrollbar(int orientation, int value, int visibleAmount, int minimum, - int maximum) throws IllegalArgumentException -{ - if (GraphicsEnvironment.isHeadless()) - throw new HeadlessException (); - - if ((orientation != HORIZONTAL) && (orientation != VERTICAL)) - throw new IllegalArgumentException("Bad orientation value: " - + orientation); - - this.orientation = orientation; - - setValues(value, visibleAmount, minimum, maximum); - - // Default is 1 according to online docs. - lineIncrement = 1; - - // Default is 10 according to javadocs. - pageIncrement = 10; -} - -/*************************************************************************/ - -/* - * Instance Methods - */ - -/** - * Returns the orientation constant for this object. - * - * @return The orientation constant for this object. - */ -public int -getOrientation() -{ - return(orientation); -} - -/*************************************************************************/ - -/** - * Sets the orientation of this scrollbar to the specified value. This - * value must be either the constant HORIZONTAL or - * VERTICAL from this class or an exception will be thrown. - * - * @param orientation The new orientation value. - * - * @exception IllegalArgumentException If the orientation value is not valid. - */ -public void -setOrientation(int orientation) -{ - if ((orientation != HORIZONTAL) && (orientation != VERTICAL)) - throw new IllegalArgumentException("Bad orientation value: " - + orientation); - - // FIXME: Communicate to peer? Or must this be called before peer creation? - this.orientation = orientation; -} - -/*************************************************************************/ - -/** - * Returns the current value for this scrollbar. - * - * @return The current value for this scrollbar. - */ -public int -getValue() -{ - return(value); -} - -/*************************************************************************/ - -/** - * Sets the current value for this scrollbar to the specified value. - * If this is inconsistent with the minimum and maximum values for this - * scrollbar, the value is silently adjusted. - * - * @param value The new value for this scrollbar. - */ -public void -setValue(int value) -{ - setValues(value, visibleAmount, minimum, maximum); -} - -/*************************************************************************/ - -/** - * Returns the maximum value for this scrollbar. - * - * @return The maximum value for this scrollbar. - */ -public int -getMaximum() -{ - return(maximum); -} - -/*************************************************************************/ - -/** - * Sets the maximum value for this scrollbar to the specified value. - * If the value is less than the current minimum value, it is silent - * set to equal the minimum value. - * - * @param maximum The new maximum value for this scrollbar. - */ -public void -setMaximum(int maximum) +public class Scrollbar extends Component implements Accessible, Adjustable { - setValues(value, visibleAmount, minimum, maximum); -} - -/*************************************************************************/ + // FIXME: Serialization readObject/writeObject -/** - * Returns the minimum value for this scrollbar. - * - * @return The minimum value for this scrollbar. - */ -public int -getMinimum() -{ - return(minimum); -} + /** + * Constant indicating that a scrollbar is horizontal. + */ + public static final int HORIZONTAL = 0; -/*************************************************************************/ + /** + * Constant indicating that a scrollbar is vertical. + */ + public static final int VERTICAL = 1; -/** - * Sets the minimum value for this scrollbar to the specified value. If - * this is not consistent with the current value and maximum, it is - * silently adjusted to be consistent. - * - * @param minimum The new minimum value for this scrollbar. - */ -public void -setMinimum(int minimum) -{ - setValues(value, visibleAmount, minimum, maximum); -} + /** + * Serialization Constant. + */ + private static final long serialVersionUID = 8451667562882310543L; -/*************************************************************************/ + /** + * @serial The amount by which the value of the scrollbar is changed + * when incrementing in line mode. + */ + private int lineIncrement; -/** - * Returns the width of the scrollbar's thumb, in units relative to the - * maximum and minimum value of the scrollbar. - * - * @return The width of the scrollbar's thumb. - */ -public int -getVisibleAmount() -{ - return getVisible (); -} + /** + * @serial The amount by which the value of the scrollbar is changed + * when incrementing in page mode. + */ + private int pageIncrement; -/*************************************************************************/ + /** + * @serial The maximum value for this scrollbar + */ + private int maximum; -/** - * Returns the width of the scrollbar's thumb, in units relative to the - * maximum and minimum value of the scrollbar. - * - * @return The width of the scrollbar's thumb. - * - * @deprecated This method is deprecated in favor of - * getVisibleAmount(). - */ -public int -getVisible() -{ - return visibleAmount; -} + /** + * @serial The minimum value for this scrollbar + */ + private int minimum; -/*************************************************************************/ + /** + * @serial The orientation of this scrollbar, which will be either + * the HORIZONTAL or VERTICAL constant + * from this class. + */ + private int orientation; -/** - * Sets the width of the scrollbar's thumb, in units relative to the - * maximum and minimum value of the scrollbar. - * - * @param visibleAmount The new visible amount value of the scrollbar. - */ -public void -setVisibleAmount(int visibleAmount) -{ - setValues(value, visibleAmount, minimum, maximum); -} + /** + * @serial The current value of this scrollbar. + */ + private int value; -/*************************************************************************/ + /** + * @serial The width of the scrollbar's thumb, which is relative + * to the minimum and maximum value of the scrollbar. + */ + private int visibleAmount; -/** - * Sets the current value, visible amount, minimum, and maximum for this - * scrollbar. These values are adjusted to be internally consistent - * if necessary. - * - * @param value The new value for this scrollbar. - * @param visibleAmount The new visible amount for this scrollbar. - * @param minimum The new minimum value for this scrollbar. - * @param maximum The new maximum value for this scrollbar. - */ -public synchronized void -setValues(int value, int visibleAmount, int minimum, int maximum) -{ - if (maximum < minimum) - maximum = minimum; + /** + * List of AdjustmentListener's. + */ + private AdjustmentListener adjustment_listeners; - if (value < minimum) - value = minimum; + /** + * true if the scrollbar is adjusting, false otherwise. + */ + private transient boolean valueIsAdjusting = false; - if (value > maximum) - value = maximum; + /** + * The number used to generate the name returned by getName. + */ + private static transient long next_scrollbar_number; - if (visibleAmount > maximum - minimum) - visibleAmount = maximum - minimum; - - ScrollbarPeer peer = (ScrollbarPeer) getPeer (); - if (peer != null - && (this.value != value || this.visibleAmount != visibleAmount - || this.minimum != minimum || this.maximum != maximum)) - peer.setValues(value, visibleAmount, minimum, maximum); - - this.value = value; - this.visibleAmount = visibleAmount; - this.minimum = minimum; - this.maximum = maximum; + /** + * Initializes a new instance of Scrollbar with a + * vertical orientation and default values for all other parameters. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true, + */ + public Scrollbar() + { + this(VERTICAL); + } - int range = maximum - minimum; - if (lineIncrement > range) - { - if (range == 0) - lineIncrement = 1; - else - lineIncrement = range; + /** + * Initializes a new instance of Scrollbar with the + * specified orientation and default values for all other parameters. + * The orientation must be either the constant HORIZONTAL or + * VERTICAL from this class. An incorrect value will throw + * an exception. + * + * @param orientation The orientation of this scrollbar. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true, + * @exception IllegalArgumentException If the orientation value is not valid. + */ + public Scrollbar(int orientation) throws IllegalArgumentException + { + this(orientation, 0, 10, 0, 100); + } - if (peer != null) - peer.setLineIncrement(lineIncrement); - } + /** + * Initializes a new instance of Scrollbar with the + * specified parameters. The orientation must be either the constant + * HORIZONTAL or VERTICAL. An incorrect value + * will throw an exception. Inconsistent values for other parameters + * are silently corrected to valid values. + * + * @param orientation The orientation of this scrollbar. + * @param value The initial value of the scrollbar. + * @param visibleAmount The width of the scrollbar thumb. + * @param minimum The minimum value of the scrollbar. + * @param maximum The maximum value of the scrollbar. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true, + * @exception IllegalArgumentException If the orientation value is not valid. + */ + public Scrollbar(int orientation, int value, int visibleAmount, int minimum, + int maximum) throws IllegalArgumentException + { + if (GraphicsEnvironment.isHeadless()) + throw new HeadlessException(); - if (pageIncrement > range) - { - if (range == 0) - pageIncrement = 1; - else - pageIncrement = range; + if ((orientation != HORIZONTAL) && (orientation != VERTICAL)) + throw new IllegalArgumentException("Bad orientation value: " + + orientation); - if (peer != null) - peer.setPageIncrement(pageIncrement); - } -} + this.orientation = orientation; -/*************************************************************************/ + setValues(value, visibleAmount, minimum, maximum); -/** - * Returns the value added or subtracted when the user activates the scrollbar - * scroll by a "unit" amount. - * - * @return The unit increment value. - */ -public int -getUnitIncrement() -{ - return getLineIncrement (); -} + // Default is 1 according to online docs. + lineIncrement = 1; -/*************************************************************************/ + // Default is 10 according to javadocs. + pageIncrement = 10; + } -/** - * Returns the value added or subtracted when the user selects the scrollbar - * scroll by a "unit" amount control. - * - * @return The unit increment value. - * - * @deprecated This method is deprecated in favor of - * getUnitIncrement(). - */ -public int -getLineIncrement() -{ - return lineIncrement; -} + /** + * Returns the orientation constant for this object. + * + * @return The orientation constant for this object. + */ + public int getOrientation() + { + return orientation; + } -/*************************************************************************/ + /** + * Sets the orientation of this scrollbar to the specified value. This + * value must be either the constant HORIZONTAL or + * VERTICAL from this class or an exception will be thrown. + * + * @param orientation The new orientation value. + * + * @exception IllegalArgumentException If the orientation value is not valid. + */ + public void setOrientation(int orientation) + { + if ((orientation != HORIZONTAL) && (orientation != VERTICAL)) + throw new IllegalArgumentException("Bad orientation value: " + + orientation); -/** - * Sets the value added or subtracted to the scrollbar value when the - * user selects the scroll by a "unit" amount control. - * - * @param unitIncrement The new unit increment amount. - */ -public synchronized void -setUnitIncrement(int unitIncrement) -{ - setLineIncrement (unitIncrement); -} + // FIXME: Communicate to peer? Or must this be called before peer creation? + this.orientation = orientation; + } -/*************************************************************************/ + /** + * Returns the current value for this scrollbar. + * + * @return The current value for this scrollbar. + */ + public int getValue() + { + return value; + } -/** - * Sets the value added or subtracted to the scrollbar value when the - * user selects the scroll by a "unit" amount control. - * - * @param lineIncrement The new unit increment amount. - * - * @deprecated This method is deprecated in favor of - * setUnitIncrement(). - */ -public void -setLineIncrement(int lineIncrement) -{ - if (lineIncrement < 0) - throw new IllegalArgumentException ("Unit increment less than zero."); + /** + * Sets the current value for this scrollbar to the specified value. + * If this is inconsistent with the minimum and maximum values for this + * scrollbar, the value is silently adjusted. + * + * @param value The new value for this scrollbar. + */ + public void setValue(int value) + { + setValues(value, visibleAmount, minimum, maximum); + } - int range = maximum - minimum; - if (lineIncrement > range) - { - if (range == 0) - lineIncrement = 1; - else - lineIncrement = range; - } + /** + * Returns the maximum value for this scrollbar. + * + * @return The maximum value for this scrollbar. + */ + public int getMaximum() + { + return maximum; + } - if (lineIncrement == this.lineIncrement) - return; + /** + * Sets the maximum value for this scrollbar to the specified value. + * If the value is less than the current minimum value, it is silent + * set to equal the minimum value. + * + * @param maximum The new maximum value for this scrollbar. + */ + public void setMaximum(int maximum) + { + setValues(value, visibleAmount, minimum, maximum); + } - this.lineIncrement = lineIncrement; + /** + * Returns the minimum value for this scrollbar. + * + * @return The minimum value for this scrollbar. + */ + public int getMinimum() + { + return minimum; + } - ScrollbarPeer peer = (ScrollbarPeer) getPeer (); - if (peer != null) - peer.setLineIncrement (this.lineIncrement); -} + /** + * Sets the minimum value for this scrollbar to the specified value. If + * this is not consistent with the current value and maximum, it is + * silently adjusted to be consistent. + * + * @param minimum The new minimum value for this scrollbar. + */ + public void setMinimum(int minimum) + { + setValues(value, visibleAmount, minimum, maximum); + } -/*************************************************************************/ + /** + * Returns the width of the scrollbar's thumb, in units relative to the + * maximum and minimum value of the scrollbar. + * + * @return The width of the scrollbar's thumb. + */ + public int getVisibleAmount() + { + return getVisible(); + } -/** - * Returns the value added or subtracted when the user activates the scrollbar - * scroll by a "block" amount. - * - * @return The block increment value. - */ -public int -getBlockIncrement() -{ - return getPageIncrement (); -} + /** + * Returns the width of the scrollbar's thumb, in units relative to the + * maximum and minimum value of the scrollbar. + * + * @return The width of the scrollbar's thumb. + * + * @deprecated This method is deprecated in favor of + * getVisibleAmount(). + */ + public int getVisible() + { + return visibleAmount; + } -/*************************************************************************/ + /** + * Sets the width of the scrollbar's thumb, in units relative to the + * maximum and minimum value of the scrollbar. + * + * @param visibleAmount The new visible amount value of the scrollbar. + */ + public void setVisibleAmount(int visibleAmount) + { + setValues(value, visibleAmount, minimum, maximum); + } -/** - * Returns the value added or subtracted when the user selects the scrollbar - * scroll by a "block" amount control. - * - * @return The block increment value. - * - * @deprecated This method is deprecated in favor of - * getBlockIncrement(). - */ -public int -getPageIncrement() -{ - return pageIncrement; -} + /** + * Sets the current value, visible amount, minimum, and maximum for this + * scrollbar. These values are adjusted to be internally consistent + * if necessary. + * + * @param value The new value for this scrollbar. + * @param visibleAmount The new visible amount for this scrollbar. + * @param minimum The new minimum value for this scrollbar. + * @param maximum The new maximum value for this scrollbar. + */ + public synchronized void setValues(int value, int visibleAmount, + int minimum, int maximum) + { + if (maximum < minimum) + maximum = minimum; -/*************************************************************************/ + if (value < minimum) + value = minimum; -/** - * Sets the value added or subtracted to the scrollbar value when the - * user selects the scroll by a "block" amount control. - * - * @param blockIncrement The new block increment amount. - */ -public synchronized void -setBlockIncrement(int blockIncrement) -{ - setPageIncrement (blockIncrement); -} + if (value > maximum) + value = maximum; -/*************************************************************************/ + if (visibleAmount > maximum - minimum) + visibleAmount = maximum - minimum; + + ScrollbarPeer peer = (ScrollbarPeer) getPeer(); + if (peer != null + && (this.value != value || this.visibleAmount != visibleAmount + || this.minimum != minimum || this.maximum != maximum)) + peer.setValues(value, visibleAmount, minimum, maximum); + + this.value = value; + this.visibleAmount = visibleAmount; + this.minimum = minimum; + this.maximum = maximum; + + int range = maximum - minimum; + if (lineIncrement > range) + { + if (range == 0) + lineIncrement = 1; + else + lineIncrement = range; + + if (peer != null) + peer.setLineIncrement(lineIncrement); + } + + if (pageIncrement > range) + { + if (range == 0) + pageIncrement = 1; + else + pageIncrement = range; + + if (peer != null) + peer.setPageIncrement(pageIncrement); + } + } -/** - * Sets the value added or subtracted to the scrollbar value when the - * user selects the scroll by a "block" amount control. - * - * @param pageIncrement The new block increment amount. - * - * @deprecated This method is deprecated in favor of - * setBlockIncrement(). - */ -public void -setPageIncrement(int pageIncrement) -{ - if (pageIncrement < 0) - throw new IllegalArgumentException ("Block increment less than zero."); + /** + * Returns the value added or subtracted when the user activates the scrollbar + * scroll by a "unit" amount. + * + * @return The unit increment value. + */ + public int getUnitIncrement() + { + return getLineIncrement(); + } - int range = maximum - minimum; - if (pageIncrement > range) - { - if (range == 0) - pageIncrement = 1; - else - pageIncrement = range; - } + /** + * Returns the value added or subtracted when the user selects the scrollbar + * scroll by a "unit" amount control. + * + * @return The unit increment value. + * + * @deprecated This method is deprecated in favor of + * getUnitIncrement(). + */ + public int getLineIncrement() + { + return lineIncrement; + } - if (pageIncrement == this.pageIncrement) - return; + /** + * Sets the value added or subtracted to the scrollbar value when the + * user selects the scroll by a "unit" amount control. + * + * @param unitIncrement The new unit increment amount. + */ + public synchronized void setUnitIncrement(int unitIncrement) + { + setLineIncrement(unitIncrement); + } - this.pageIncrement = pageIncrement; + /** + * Sets the value added or subtracted to the scrollbar value when the + * user selects the scroll by a "unit" amount control. + * + * @param lineIncrement The new unit increment amount. + * + * @deprecated This method is deprecated in favor of + * setUnitIncrement(). + */ + public void setLineIncrement(int lineIncrement) + { + if (lineIncrement < 0) + throw new IllegalArgumentException("Unit increment less than zero."); - ScrollbarPeer peer = (ScrollbarPeer) getPeer (); - if (peer != null) - peer.setPageIncrement (this.pageIncrement); -} + int range = maximum - minimum; + if (lineIncrement > range) + { + if (range == 0) + lineIncrement = 1; + else + lineIncrement = range; + } + + if (lineIncrement == this.lineIncrement) + return; + + this.lineIncrement = lineIncrement; + + ScrollbarPeer peer = (ScrollbarPeer) getPeer(); + if (peer != null) + peer.setLineIncrement(this.lineIncrement); + } -/*************************************************************************/ + /** + * Returns the value added or subtracted when the user activates the scrollbar + * scroll by a "block" amount. + * + * @return The block increment value. + */ + public int getBlockIncrement() + { + return getPageIncrement(); + } -/** - * Notifies this object to create its native peer. - */ -public synchronized void -addNotify() -{ - if (peer == null) - peer = getToolkit ().createScrollbar (this); - super.addNotify (); -} + /** + * Returns the value added or subtracted when the user selects the scrollbar + * scroll by a "block" amount control. + * + * @return The block increment value. + * + * @deprecated This method is deprecated in favor of + * getBlockIncrement(). + */ + public int getPageIncrement() + { + return pageIncrement; + } -/*************************************************************************/ + /** + * Sets the value added or subtracted to the scrollbar value when the + * user selects the scroll by a "block" amount control. + * + * @param blockIncrement The new block increment amount. + */ + public synchronized void setBlockIncrement(int blockIncrement) + { + setPageIncrement(blockIncrement); + } -/** - * Adds a new adjustment listener to the list of registered listeners - * for this object. - * - * @param listener The listener to add. - */ -public synchronized void -addAdjustmentListener(AdjustmentListener listener) -{ - adjustment_listeners = AWTEventMulticaster.add(adjustment_listeners, listener); - enableEvents(AWTEvent.ADJUSTMENT_EVENT_MASK); -} + /** + * Sets the value added or subtracted to the scrollbar value when the + * user selects the scroll by a "block" amount control. + * + * @param pageIncrement The new block increment amount. + * + * @deprecated This method is deprecated in favor of + * setBlockIncrement(). + */ + public void setPageIncrement(int pageIncrement) + { + if (pageIncrement < 0) + throw new IllegalArgumentException("Block increment less than zero."); -/*************************************************************************/ + int range = maximum - minimum; + if (pageIncrement > range) + { + if (range == 0) + pageIncrement = 1; + else + pageIncrement = range; + } + + if (pageIncrement == this.pageIncrement) + return; + + this.pageIncrement = pageIncrement; + + ScrollbarPeer peer = (ScrollbarPeer) getPeer(); + if (peer != null) + peer.setPageIncrement(this.pageIncrement); + } -/** - * Removes the specified listener from the list of registered listeners - * for this object. - * - * @param listener The listener to remove. - */ -public synchronized void -removeAdjustmentListener(AdjustmentListener listener) -{ - adjustment_listeners = AWTEventMulticaster.remove(adjustment_listeners, - listener); -} + /** + * Notifies this object to create its native peer. + */ + public synchronized void addNotify() + { + if (peer == null) + peer = getToolkit().createScrollbar(this); + super.addNotify(); + } -/*************************************************************************/ + /** + * Adds a new adjustment listener to the list of registered listeners + * for this object. + * + * @param listener The listener to add. + */ + public synchronized void addAdjustmentListener(AdjustmentListener listener) + { + adjustment_listeners = AWTEventMulticaster.add(adjustment_listeners, + listener); + enableEvents(AWTEvent.ADJUSTMENT_EVENT_MASK); + } -/** - * Processes events for this scrollbar. It does this by calling - * processAdjustmentEvent() if the event is an instance of - * AdjustmentEvent, otherwise it calls the superclass to - * process the event. - * - * @param event The event to process. - */ -protected void -processEvent(AWTEvent event) -{ - if (event instanceof AdjustmentEvent) - processAdjustmentEvent((AdjustmentEvent)event); - else - super.processEvent(event); -} + /** + * Removes the specified listener from the list of registered listeners + * for this object. + * + * @param listener The listener to remove. + */ + public synchronized void removeAdjustmentListener(AdjustmentListener listener) + { + adjustment_listeners = AWTEventMulticaster.remove(adjustment_listeners, + listener); + } -/*************************************************************************/ + /** + * Processes events for this scrollbar. It does this by calling + * processAdjustmentEvent() if the event is an instance of + * AdjustmentEvent, otherwise it calls the superclass to + * process the event. + * + * @param event The event to process. + */ + protected void processEvent(AWTEvent event) + { + if (event instanceof AdjustmentEvent) + processAdjustmentEvent((AdjustmentEvent) event); + else + super.processEvent(event); + } -/** - * Processes adjustment events for this object by dispatching them to - * any registered listeners. Note that this method will only be called - * if adjustment events are enabled. This will happen automatically if - * any listeners are registered. Otherwise, it can be enabled by a - * call to enableEvents(). - * - * @param event The event to process. - */ -protected void -processAdjustmentEvent(AdjustmentEvent event) -{ - value = event.getValue(); - if (adjustment_listeners != null) - adjustment_listeners.adjustmentValueChanged(event); -} + /** + * Processes adjustment events for this object by dispatching them to + * any registered listeners. Note that this method will only be called + * if adjustment events are enabled. This will happen automatically if + * any listeners are registered. Otherwise, it can be enabled by a + * call to enableEvents(). + * + * @param event The event to process. + */ + protected void processAdjustmentEvent(AdjustmentEvent event) + { + value = event.getValue(); + if (adjustment_listeners != null) + adjustment_listeners.adjustmentValueChanged(event); + } -void -dispatchEventImpl(AWTEvent e) -{ - if (e.id <= AdjustmentEvent.ADJUSTMENT_LAST + void dispatchEventImpl(AWTEvent e) + { + if (e.id <= AdjustmentEvent.ADJUSTMENT_LAST && e.id >= AdjustmentEvent.ADJUSTMENT_FIRST && (adjustment_listeners != null || (eventMask & AWTEvent.ADJUSTMENT_EVENT_MASK) != 0)) - processEvent(e); - else - super.dispatchEventImpl(e); -} - -/*************************************************************************/ + processEvent(e); + else + super.dispatchEventImpl(e); + } -/** - * Returns a debugging string for this object. - * - * @return A debugging string for this object. - */ -protected String -paramString() -{ - return("value=" + getValue() + ",visibleAmount=" + - getVisibleAmount() + ",minimum=" + getMinimum() - + ",maximum=" + getMaximum() - + ",pageIncrement=" + pageIncrement - + ",lineIncrement=" + lineIncrement - + ",orientation=" + (orientation == HORIZONTAL - ? "HORIZONTAL" : "VERTICAL") - + super.paramString()); -} + /** + * Returns a debugging string for this object. + * + * @return A debugging string for this object. + */ + protected String paramString() + { + return ("value=" + getValue() + ",visibleAmount=" + getVisibleAmount() + + ",minimum=" + getMinimum() + ",maximum=" + getMaximum() + + ",pageIncrement=" + pageIncrement + ",lineIncrement=" + + lineIncrement + ",orientation=" + + (orientation == HORIZONTAL ? "HORIZONTAL" : "VERTICAL") + + super.paramString()); + } /** * Returns an array of all the objects currently registered as FooListeners - * upon this Scrollbar. FooListeners are registered using the + * upon this Scrollbar. FooListeners are registered using the * addFooListener method. * * @exception ClassCastException If listenerType doesn't specify a class or * interface that implements java.util.EventListener. */ - public EventListener[] getListeners (Class listenerType) + public EventListener[] getListeners(Class listenerType) { if (listenerType == AdjustmentListener.class) - return AWTEventMulticaster.getListeners (adjustment_listeners, - listenerType); + return AWTEventMulticaster.getListeners(adjustment_listeners, + listenerType); - return super.getListeners (listenerType); + return super.getListeners(listenerType); } /** * Returns an array of all registered adjustment listeners. */ - public AdjustmentListener[] getAdjustmentListeners () + public AdjustmentListener[] getAdjustmentListeners() { - return (AdjustmentListener[]) getListeners (AdjustmentListener.class); + return (AdjustmentListener[]) getListeners(AdjustmentListener.class); } /** @@ -746,7 +649,7 @@ paramString() * * @since 1.4 */ - public boolean getValueIsAdjusting () + public boolean getValueIsAdjusting() { return valueIsAdjusting; } @@ -756,7 +659,7 @@ paramString() * * @since 1.4 */ - public void setValueIsAdjusting (boolean valueIsAdjusting) + public void setValueIsAdjusting(boolean valueIsAdjusting) { this.valueIsAdjusting = valueIsAdjusting; } @@ -766,16 +669,16 @@ paramString() * * @return A unique name for this scroll bar. */ - String generateName () + String generateName() { - return "scrollbar" + getUniqueLong (); + return "scrollbar" + getUniqueLong(); } - private static synchronized long getUniqueLong () + private static synchronized long getUniqueLong() { return next_scrollbar_number++; } - + /** * This class provides accessibility support for the * scrollbar. @@ -784,9 +687,8 @@ paramString() * @author Andrew John Hughes (address@hidden) */ protected class AccessibleAWTScrollBar extends AccessibleAWTComponent - implements AccessibleValue + implements AccessibleValue { - /** * Serialization constant to match JDK 1.5 */ @@ -796,20 +698,21 @@ paramString() * Returns the role of this accessible object. * * @return the instance of AccessibleRole, - * which describes this object. + * which describes this object. + * * @see javax.accessibility.AccessibleRole */ public AccessibleRole getAccessibleRole() { return AccessibleRole.SCROLL_BAR; } - + /** * Returns the state set of this accessible object. * - * @return a set of AccessibleStates - * which represent the current state of the - * accessible object. + * @return a set of AccessibleStates which + * represent the current state of the accessible object. + * * @see javax.accessibility.AccessibleState * @see javax.accessibility.AccessibleStateSet */ @@ -817,14 +720,14 @@ paramString() { AccessibleStateSet states = super.getAccessibleStateSet(); if (getOrientation() == HORIZONTAL) - states.add(AccessibleState.HORIZONTAL); + states.add(AccessibleState.HORIZONTAL); else - states.add(AccessibleState.VERTICAL); + states.add(AccessibleState.VERTICAL); if (getValueIsAdjusting()) - states.add(AccessibleState.BUSY); + states.add(AccessibleState.BUSY); return states; } - + /** * Returns an implementation of the AccessibleValue * interface for this accessible object. In this case, the @@ -833,6 +736,7 @@ paramString() * the context. * * @return the accessible value associated with this context. + * * @see javax.accessibility.AccessibleValue */ public AccessibleValue getAccessibleValue() @@ -847,6 +751,7 @@ paramString() * object. * * @return the numeric value of this scrollbar. + * * @see javax.accessibility.AccessibleValue#getCurrentAccessibleValue() */ public Number getCurrentAccessibleValue() @@ -861,7 +766,9 @@ paramString() * true. * * @param number the new accessible value. + * * @return true if the value was set. + * * @see javax.accessibility.AccessibleValue#setCurrentAccessibleValue(java.lang.Number) */ public boolean setCurrentAccessibleValue(Number number) @@ -877,6 +784,7 @@ paramString() * object. * * @return the minimum value of this scrollbar. + * * @see javax.accessibility.AccessibleValue#getMinimumAccessibleValue() */ public Number getMinimumAccessibleValue() @@ -891,6 +799,7 @@ paramString() * object. * * @return the maximum value of this scrollbar. + * * @see javax.accessibility.AccessibleValue#getMaximumAccessibleValue() */ public Number getMaximumAccessibleValue() @@ -898,7 +807,7 @@ paramString() return new Integer(getMaximum()); } } - + /** * Gets the AccessibleContext associated with this Scrollbar. * The context is created, if necessary. @@ -910,8 +819,7 @@ paramString() /* Create the context if this is the first request */ if (accessibleContext == null) accessibleContext = new AccessibleAWTScrollBar(); + return accessibleContext; } - -} // class Scrollbar - +} Index: java/beans/XMLDecoder.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/beans/XMLDecoder.java,v retrieving revision 1.2.2.1 diff -u -3 -p -u -r1.2.2.1 XMLDecoder.java --- java/beans/XMLDecoder.java 16 Jan 2005 15:15:11 -0000 1.2.2.1 +++ java/beans/XMLDecoder.java 15 Feb 2005 20:55:21 -0000 @@ -38,7 +38,6 @@ exception statement from your version. * package java.beans; -import gnu.java.beans.decoder.DecoderContext; import gnu.java.beans.decoder.DefaultExceptionListener; import gnu.java.beans.decoder.PersistenceParser; Index: java/io/ObjectInputStream.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/io/ObjectInputStream.java,v retrieving revision 1.43.2.7 diff -u -3 -p -u -r1.43.2.7 ObjectInputStream.java --- java/io/ObjectInputStream.java 4 Feb 2005 09:44:44 -0000 1.43.2.7 +++ java/io/ObjectInputStream.java 15 Feb 2005 20:55:21 -0000 @@ -773,8 +773,6 @@ public class ObjectInputStream extends I return Float.TYPE; if (name.equals("double")) return Double.TYPE; - if (name.equals("void")) - return Void.TYPE; throw cnfe; } Index: java/net/URI.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/net/URI.java,v retrieving revision 1.6.2.3 diff -u -3 -p -u -r1.6.2.3 URI.java --- java/net/URI.java 18 Jan 2005 11:38:30 -0000 1.6.2.3 +++ java/net/URI.java 15 Feb 2005 20:55:22 -0000 @@ -65,7 +65,7 @@ public final class URI implements Compar "^(([^:/?#]+):)?((//([^/?#]*))?([^?#]*)(\\?([^#]*))?)?(#(.*))?"; private static final String AUTHORITY_REGEXP = - "^(([^?#]*)@([^?#]*):([^?#]*))?"; + "^((([^?#]*)@)?([^?#:]*)(:([^?#]*)))?"; /** * Valid characters (taken from rfc2396) @@ -115,9 +115,9 @@ public final class URI implements Compar */ private static final int FRAGMENT_GROUP = 10; - private static final int AUTHORITY_USERINFO_GROUP = 2; - private static final int AUTHORITY_HOST_GROUP = 3; - private static final int AUTHORITY_PORT_GROUP = 4; + private static final int AUTHORITY_USERINFO_GROUP = 3; + private static final int AUTHORITY_HOST_GROUP = 4; + private static final int AUTHORITY_PORT_GROUP = 6; private transient String scheme; private transient String rawSchemeSpecificPart; Index: java/text/Collator.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/text/Collator.java,v retrieving revision 1.11 diff -u -3 -p -u -r1.11 Collator.java --- java/text/Collator.java 15 Jun 2004 22:40:39 -0000 1.11 +++ java/text/Collator.java 15 Feb 2005 20:55:22 -0000 @@ -308,7 +308,8 @@ public abstract class Collator implement } catch (MissingResourceException x) { - return null; + pattern = "<0<1<2<3<4<5<6<7<8<9 11) + { + year += (month / 12); + month = month % 12; + } + + if (month < 0) + { + year += (int) month / 12; + month = month % 12; + if (month < 0) + { + month += 12; + year--; + } + } + + int dayOfYear = dayCount[month] + 1; if (month > 1) if (isLeapYear(year)) dayOfYear++; @@ -508,22 +525,28 @@ public class GregorianCalendar extends C if (! isLenient()) nonLeniencyCheck(); - if (! isSet[MONTH]) + if (! isSet[MONTH] && (! isSet[DAY_OF_WEEK] || isSet[WEEK_OF_YEAR])) { // 5: YEAR + DAY_OF_WEEK + WEEK_OF_YEAR - if (isSet[DAY_OF_WEEK] || isSet[WEEK_OF_YEAR]) + if (isSet[WEEK_OF_YEAR]) { int first = getFirstDayOfMonth(year, 0); - int offs; - if ((8 - first) >= getMinimalDaysInFirstWeek()) - // start counting on first week - offs = 1; - else - offs = 1 + (8 - first); + int offs = 1; + int daysInFirstWeek = getFirstDayOfWeek() - first; + if (daysInFirstWeek <= 0) + daysInFirstWeek += 7; + if (daysInFirstWeek < getMinimalDaysInFirstWeek()) + offs += daysInFirstWeek; + else + offs -= 7 - daysInFirstWeek; month = 0; day = offs + 7 * (fields[WEEK_OF_YEAR] - 1); - day += fields[DAY_OF_WEEK] - first; + offs = fields[DAY_OF_WEEK] - getFirstDayOfWeek(); + + if (offs < 0) + offs += 7; + day += offs; } else { @@ -549,8 +572,21 @@ public class GregorianCalendar extends C } else { // 2: YEAR + MONTH + WEEK_OF_MONTH + DAY_OF_WEEK - day = 1 + 7 * (fields[WEEK_OF_MONTH] - 1); - day += fields[DAY_OF_WEEK] - first; + int offs = 1; + int daysInFirstWeek = getFirstDayOfWeek() - first; + if (daysInFirstWeek <= 0) + daysInFirstWeek += 7; + + if (daysInFirstWeek < getMinimalDaysInFirstWeek()) + offs += daysInFirstWeek; + else + offs -= 7 - daysInFirstWeek; + + day = offs + 7 * (fields[WEEK_OF_MONTH] - 1); + offs = fields[DAY_OF_WEEK] - getFirstDayOfWeek(); + if (offs < 0) + offs += 7; + day += offs; } } Index: java/util/ResourceBundle.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/util/ResourceBundle.java,v retrieving revision 1.24.2.3 diff -u -3 -p -u -r1.24.2.3 ResourceBundle.java --- java/util/ResourceBundle.java 16 Jan 2005 15:15:12 -0000 1.24.2.3 +++ java/util/ResourceBundle.java 15 Feb 2005 20:55:23 -0000 @@ -173,9 +173,11 @@ public abstract class ResourceBundle if (o != null) return o; } - - throw new MissingResourceException("Key not found", getClass().getName(), - key); + + String className = getClass().getName(); + throw new MissingResourceException("Key '" + key + + "'not found in Bundle: " + + className, className, key); } /** @@ -491,7 +493,7 @@ public abstract class ResourceBundle catch (IOException ex) { MissingResourceException mre = new MissingResourceException - ("Failed to load bundle", localizedName, ""); + ("Failed to load bundle: " + localizedName, localizedName, ""); mre.initCause(ex); throw mre; } Index: java/util/TreeMap.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/util/TreeMap.java,v retrieving revision 1.23.2.4 diff -u -3 -p -u -r1.23.2.4 TreeMap.java --- java/util/TreeMap.java 15 Jan 2005 17:02:16 -0000 1.23.2.4 +++ java/util/TreeMap.java 15 Feb 2005 20:55:23 -0000 @@ -729,7 +729,7 @@ public class TreeMap extends Abstr * or are not Comparable with natural ordering * @throws NullPointerException if o1 or o2 is null with natural ordering */ - final int compare(Object o1, Object o2) + final int compare(K o1, K o2) { return (comparator == null ? ((Comparable) o1).compareTo(o2) Index: java/util/zip/ZipFile.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/util/zip/ZipFile.java,v retrieving revision 1.16.2.3 diff -u -3 -p -u -r1.16.2.3 ZipFile.java --- java/util/zip/ZipFile.java 28 Jan 2005 10:43:57 -0000 1.16.2.3 +++ java/util/zip/ZipFile.java 15 Feb 2005 20:55:24 -0000 @@ -122,8 +122,6 @@ public class ZipFile implements ZipConst * * The contents of the zip file will be accessible until it is closed. * - * The OPEN_DELETE mode is currently unimplemented in this library - * * @since JDK1.3 * @param mode Must be one of OPEN_READ or OPEN_READ | OPEN_DELETE * @@ -133,11 +131,10 @@ public class ZipFile implements ZipConst */ public ZipFile(File file, int mode) throws ZipException, IOException { + if (mode != OPEN_READ && mode != (OPEN_READ | OPEN_DELETE)) + throw new IllegalArgumentException("invalid mode"); if ((mode & OPEN_DELETE) != 0) - { - throw new IllegalArgumentException - ("OPEN_DELETE mode not supported yet in java.util.zip.ZipFile"); - } + file.deleteOnExit(); this.raf = new RandomAccessFile(file, "r"); this.name = file.getPath(); checkZipFile(); Index: javax/swing/JPopupMenu.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/JPopupMenu.java,v retrieving revision 1.8.2.5 diff -u -3 -p -u -r1.8.2.5 JPopupMenu.java --- javax/swing/JPopupMenu.java 29 Jan 2005 02:45:23 -0000 1.8.2.5 +++ javax/swing/JPopupMenu.java 15 Feb 2005 20:55:24 -0000 @@ -41,7 +41,6 @@ package javax.swing; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; -import java.awt.Graphics; import java.awt.GridBagConstraints; import java.awt.Insets; import java.awt.Panel; Index: javax/swing/JRootPane.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/JRootPane.java,v retrieving revision 1.12.2.3 diff -u -3 -p -u -r1.12.2.3 JRootPane.java --- javax/swing/JRootPane.java 16 Jan 2005 15:15:13 -0000 1.12.2.3 +++ javax/swing/JRootPane.java 15 Feb 2005 20:55:24 -0000 @@ -346,8 +346,12 @@ public class JRootPane extends JComponen */ public void setJMenuBar(JMenuBar m) { + JLayeredPane jlPane = getLayeredPane(); + if (menuBar != null) + jlPane.remove(menuBar); menuBar = m; - getLayeredPane().add(menuBar, JLayeredPane.FRAME_CONTENT_LAYER); + if (menuBar != null) + jlPane.add(menuBar, JLayeredPane.FRAME_CONTENT_LAYER); } /** Index: javax/swing/JSpinner.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/JSpinner.java,v retrieving revision 1.6.2.3 diff -u -3 -p -u -r1.6.2.3 JSpinner.java --- javax/swing/JSpinner.java 25 Jan 2005 12:41:41 -0000 1.6.2.3 +++ javax/swing/JSpinner.java 15 Feb 2005 20:55:24 -0000 @@ -50,7 +50,6 @@ import java.text.ParseException; import javax.swing.border.EtchedBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import javax.swing.event.EventListenerList; import javax.swing.plaf.SpinnerUI; Index: javax/swing/JTabbedPane.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/JTabbedPane.java,v retrieving revision 1.11.2.3 diff -u -3 -p -u -r1.11.2.3 JTabbedPane.java --- javax/swing/JTabbedPane.java 27 Jan 2005 09:45:35 -0000 1.11.2.3 +++ javax/swing/JTabbedPane.java 15 Feb 2005 20:55:25 -0000 @@ -518,12 +518,12 @@ public class JTabbedPane extends JCompon * or equal to title.length. */ public void setDisplayedMnemonicIndex(int index) - throws IllegalArgumentException + throws IllegalArgumentException { if (index < -1 || title != null && index >= title.length()) throw new IllegalArgumentException(); - if (title == null || title.charAt(index) != mnemonicKey) + if (title == null || mnemonicKey == 0 || title.charAt(index) != mnemonicKey) index = -1; underlinedChar = index; Index: javax/swing/JViewport.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/JViewport.java,v retrieving revision 1.10.2.4 diff -u -3 -p -u -r1.10.2.4 JViewport.java --- javax/swing/JViewport.java 26 Jan 2005 02:30:49 -0000 1.10.2.4 +++ javax/swing/JViewport.java 15 Feb 2005 20:55:25 -0000 @@ -158,12 +158,23 @@ public class JViewport extends JComponen fireStateChanged(); } + /** + * Returns the viewSize when set, or the preferred size of the set + * Component view. If no viewSize and no Component view is set an + * empty Dimension is returned. + */ public Dimension getViewSize() { if (isViewSizeSet) return viewSize; else - return getView().getSize(); + { + Component view = getView(); + if (view != null) + return view.getPreferredSize(); + else + return new Dimension(); + } } Index: javax/swing/KeyStroke.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/KeyStroke.java,v retrieving revision 1.9.2.3 diff -u -3 -p -u -r1.9.2.3 KeyStroke.java --- javax/swing/KeyStroke.java 27 Jan 2005 09:45:35 -0000 1.9.2.3 +++ javax/swing/KeyStroke.java 15 Feb 2005 20:55:25 -0000 @@ -96,9 +96,22 @@ public class KeyStroke return (KeyStroke) getAWTKeyStroke(keyCode, modifiers); } + /** + * Returns the KeyStroke according to getAWTKeyStroke(). + * But it returns null instead of throwing + * IllegalArugmentException when + * the keystoke sequence cannot be parsed from the given string. + */ public static KeyStroke getKeyStroke(String str) { - return (KeyStroke) getAWTKeyStroke(str); + try + { + return (KeyStroke) getAWTKeyStroke(str); + } + catch (IllegalArgumentException iae) + { + return null; + } } public static KeyStroke getKeyStrokeForEvent(KeyEvent event) Index: javax/swing/SortingFocusTraversalPolicy.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/SortingFocusTraversalPolicy.java,v retrieving revision 1.1.2.2 diff -u -3 -p -u -r1.1.2.2 SortingFocusTraversalPolicy.java --- javax/swing/SortingFocusTraversalPolicy.java 6 Feb 2005 02:24:18 -0000 1.1.2.2 +++ javax/swing/SortingFocusTraversalPolicy.java 15 Feb 2005 20:55:25 -0000 @@ -40,7 +40,6 @@ package javax.swing; import java.awt.Component; import java.awt.Container; -import java.awt.FocusTraversalPolicy; import java.util.Comparator; import java.util.Iterator; import java.util.TreeSet; Index: javax/swing/SpinnerDateModel.java =================================================================== RCS file: javax/swing/SpinnerDateModel.java diff -N javax/swing/SpinnerDateModel.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/swing/SpinnerDateModel.java 15 Feb 2005 20:55:25 -0000 @@ -0,0 +1,237 @@ +/* SpinnerDateModel.java -- + Copyright (C) 2002, 2004 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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 javax.swing; + +import java.io.Serializable; +import java.util.Calendar; +import java.util.Date; + +/** + * SpinnerDateModel + * + * Implements a SpinnerModel for dates, rotating a calendar field such as + * month, year, day, week, hour, minute. + * + * @author Sven de Marothy + * @version 0.1 (first implementation) + */ +public class SpinnerDateModel extends AbstractSpinnerModel + implements Serializable +{ + private Calendar date; + private Comparable start; + private Comparable end; + private int calendarField; + + /** + * For compatability with Sun's JDK + * FIXME: what's the number? And which fields should be serialized? + */ + private static final long serialVersionUID = 1L; + + /** + * Constructs a SpinnerDateModel using the current date, + * no start or end limit, and Calendar.DAY_OF_MONTH as the calendar field. + */ + public SpinnerDateModel() + { + this(new Date(), null, null, Calendar.DAY_OF_MONTH); + } + + /** + * Constructs a SpinnerDateModel which spins a given calendar field, + * using a given date and start and end date limits. + * @param value - the initial Date value + * @param start - start limit, as a Date object, or null + * for no lower limit. + * @param end - end limit, or null for no upper limit. + * @param calendarField - the Calendar field to spin, + * (Calendar.ZONE_OFFSET and Calendar.DST_OFFSET are invalid) + */ + public SpinnerDateModel(Date value, Comparable start, Comparable end, + int calendarField) + { + date = Calendar.getInstance(); + date.setTime(value); + this.start = start; + this.end = end; + setCalendarField(calendarField); + } + + /** + * Returns the value of the Calendar field to spin. + */ + public int getCalendarField() + { + return calendarField; + } + + /** + * Returns the current date in the sequence. + * @return a Date object. + */ + public Date getDate() + { + return date.getTime(); + } + + /** + * Returns the starting limit of the SpinnerModel. + * @return a Date object, or null if there is no limit. + */ + public Comparable getStart() + { + return start; + } + + /** + * Returns the end limit of the SpinnerModel. + * @return a Date object, or null if there is no limit. + */ + public Comparable getEnd() + { + return end; + } + + /** + * Returns the current date in the sequence, + * this method returns the same as getDate(). + * @return a Date object. + */ + public Object getValue() + { + return date.getTime(); + } + + /** + * Returns the next date in the sequence, or null if the + * next date is equal to or past the end limit. + * @return a Date object, or null. + */ + public Object getNextValue() + { + Calendar nextCal = Calendar.getInstance(); + nextCal.setTime(date.getTime()); + nextCal.roll(calendarField, true); + Date nextDate = nextCal.getTime(); + if (end != null) + if (end.compareTo(nextDate) < 0) + return null; + return nextDate; + } + + /** + * Returns the previous date in the sequence, or null if the + * next date is equal to or past the end limit. + * @return a Date object, or null. + */ + public Object getPreviousValue() + { + Calendar prevCal = Calendar.getInstance(); + prevCal.setTime(date.getTime()); + prevCal.roll(calendarField, false); + Date prevDate = prevCal.getTime(); + if (end != null) + if (end.compareTo(prevDate) > 0) + return null; + return prevDate; + } + + /** + * Sets the date field to change. It must be a valid Calendar field, + * excluding Calendar.ZONE_OFFSET and Calendar.DST_OFFSET. + * @param calendarField - the calendar field to set. + */ + public void setCalendarField(int calendarField) + { + if (calendarField < 0 || calendarField >= Calendar.FIELD_COUNT + || calendarField == Calendar.ZONE_OFFSET + || calendarField == Calendar.DST_OFFSET) + throw new IllegalArgumentException("Illegal calendarField"); + + if (this.calendarField != calendarField) + { + this.calendarField = calendarField; + fireStateChanged(); + } + } + + /** + * Sets the starting date limit for the sequence. + * + * @param start - a Date object of the limit date, + * or null for no limit. + */ + public void setStart(Comparable start) + { + if (this.start != start) + { + this.start = start; + fireStateChanged(); + } + } + + /** + * Sets the end date limit for the sequence. + * + * @param end - a Date object of the limit date, + * or null for no limit. + */ + public void setEnd(Comparable end) + { + if (this.end != end) + { + this.end = end; + fireStateChanged(); + } + } + + /** + * Sets the current date in the sequence. + * + * @param value - a Date object. + */ + public void setValue(Object value) + { + if (! (value instanceof Date) || value == null) + throw new IllegalArgumentException("Value not a date."); + date.setTime((Date) value); + fireStateChanged(); + } +} Index: javax/swing/SwingUtilities.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/SwingUtilities.java,v retrieving revision 1.15.2.6 diff -u -3 -p -u -r1.15.2.6 SwingUtilities.java --- javax/swing/SwingUtilities.java 29 Jan 2005 02:45:23 -0000 1.15.2.6 +++ javax/swing/SwingUtilities.java 15 Feb 2005 20:55:25 -0000 @@ -42,7 +42,6 @@ import java.applet.Applet; import java.awt.Component; import java.awt.ComponentOrientation; import java.awt.Container; -import java.awt.Font; import java.awt.FontMetrics; import java.awt.Frame; import java.awt.Graphics; @@ -51,7 +50,6 @@ import java.awt.KeyboardFocusManager; import java.awt.Point; import java.awt.Rectangle; import java.awt.Shape; -import java.awt.Toolkit; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.InputEvent; Index: javax/swing/ViewportLayout.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/ViewportLayout.java,v retrieving revision 1.10.2.1 diff -u -3 -p -u -r1.10.2.1 ViewportLayout.java --- javax/swing/ViewportLayout.java 16 Jan 2005 15:15:13 -0000 1.10.2.1 +++ javax/swing/ViewportLayout.java 15 Feb 2005 20:55:25 -0000 @@ -63,17 +63,25 @@ public class ViewportLayout implements L public void removeLayoutComponent(Component c) { } + public Dimension preferredLayoutSize(Container parent) { JViewport vp = (JViewport)parent; Component view = vp.getView(); - return view.getPreferredSize(); + if (view != null) + return view.getPreferredSize(); + else + return new Dimension(); } + public Dimension minimumLayoutSize(Container parent) { JViewport vp = (JViewport)parent; Component view = vp.getView(); - return view.getMinimumSize(); + if (view != null) + return view.getMinimumSize(); + else + return new Dimension(); } /** @@ -113,6 +121,9 @@ public class ViewportLayout implements L JViewport port = (JViewport) parent; Component view = port.getView(); + if (view == null) + return; + // These dimensions and positions are in *view space*. Do not mix // variables in here from port space (eg. parent.getBounds()). This // function should be entirely in view space, because the methods on Index: javax/swing/plaf/basic/BasicComboBoxEditor.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java,v retrieving revision 1.2.2.2 diff -u -3 -p -u -r1.2.2.2 BasicComboBoxEditor.java --- javax/swing/plaf/basic/BasicComboBoxEditor.java 15 Jan 2005 17:02:21 -0000 1.2.2.2 +++ javax/swing/plaf/basic/BasicComboBoxEditor.java 15 Feb 2005 20:55:25 -0000 @@ -46,7 +46,6 @@ import java.awt.event.FocusListener; import javax.swing.ComboBoxEditor; import javax.swing.JTextField; import javax.swing.border.EmptyBorder; -import javax.swing.plaf.UIResource; /** * This is a component that is responsible for displaying/editting selected Index: javax/swing/plaf/basic/BasicComboBoxRenderer.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java,v retrieving revision 1.2.2.2 diff -u -3 -p -u -r1.2.2.2 BasicComboBoxRenderer.java --- javax/swing/plaf/basic/BasicComboBoxRenderer.java 15 Jan 2005 17:02:21 -0000 1.2.2.2 +++ javax/swing/plaf/basic/BasicComboBoxRenderer.java 15 Feb 2005 20:55:25 -0000 @@ -50,7 +50,6 @@ import javax.swing.UIDefaults; import javax.swing.UIManager; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; -import javax.swing.plaf.UIResource; /** * This class is renderer for the combo box. Index: javax/swing/tree/DefaultMutableTreeNode.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/tree/DefaultMutableTreeNode.java,v retrieving revision 1.5.2.2 diff -u -3 -p -u -r1.5.2.2 DefaultMutableTreeNode.java --- javax/swing/tree/DefaultMutableTreeNode.java 29 Jan 2005 02:45:23 -0000 1.5.2.2 +++ javax/swing/tree/DefaultMutableTreeNode.java 15 Feb 2005 20:55:25 -0000 @@ -46,7 +46,6 @@ import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.ArrayList; import java.util.Enumeration; -import java.util.Random; import java.util.Stack; import java.util.Vector; @@ -87,7 +86,8 @@ public class DefaultMutableTreeNode protected boolean allowsChildren; /** - * Constructor DefaultMutableTreeNode + * Creates a DefaultMutableTreeNode object. + * This node allows to add child nodes. */ public DefaultMutableTreeNode() { @@ -95,9 +95,10 @@ public class DefaultMutableTreeNode } /** - * Constructor DefaultMutableTreeNode + * Creates a DefaultMutableTreeNode object with the given + * user object attached to it. This node allows to add child nodes. * - * @param userObject TODO + * @param userObject the user object */ public DefaultMutableTreeNode(Object userObject) { @@ -105,10 +106,12 @@ public class DefaultMutableTreeNode } /** - * Constructor DefaultMutableTreeNode + * Creates a DefaultMutableTreeNode object with the given + * user object attached to it. * - * @param userObject TODO - * @param allowsChildren TODO + * @param userObject the user object + * @param allowsChildren true if the code allows to add child + * nodes, false otherwise */ public DefaultMutableTreeNode(Object userObject, boolean allowsChildren) { @@ -136,9 +139,9 @@ public class DefaultMutableTreeNode } /** - * toString + * Returns a string representation of this node * - * @return String + * @return a human-readable String representing this node */ public String toString() { @@ -149,9 +152,9 @@ public class DefaultMutableTreeNode } /** - * add + * Adds a new child node to this node. * - * @param child TODO + * @param child the child node * * @throws IllegalArgumentException if child is null * @throws IllegalStateException if the node does not allow children @@ -169,9 +172,9 @@ public class DefaultMutableTreeNode } /** - * getParent + * Returns the parent node of this node. * - * @return TreeNode + * @return the parent node */ public TreeNode getParent() { @@ -179,9 +182,9 @@ public class DefaultMutableTreeNode } /** - * remove + * Removes the child with the given index from this node * - * @param index TODO + * @param index the index */ public void remove(int index) { @@ -189,9 +192,9 @@ public class DefaultMutableTreeNode } /** - * remove + * Removes the given child from this node. * - * @param node TODO + * @param node the child node */ public void remove(MutableTreeNode node) { @@ -201,7 +204,7 @@ public class DefaultMutableTreeNode /** * writeObject * - * @param stream TODO + * @param stream the output stream * * @exception IOException If an error occurs */ @@ -214,7 +217,7 @@ public class DefaultMutableTreeNode /** * readObject * - * @param stream TODO + * @param stream the input stream * * @exception IOException If an error occurs * @exception ClassNotFoundException TODO @@ -226,10 +229,10 @@ public class DefaultMutableTreeNode } /** - * insert + * Inserts given child node at the given index. * - * @param node TODO - * @param value TODO + * @param node the child node + * @param value the index. */ public void insert(MutableTreeNode node, int index) { @@ -237,7 +240,7 @@ public class DefaultMutableTreeNode } /** - * getPath + * Returns a path to this node from the root. * * @return an array of tree nodes */ @@ -247,7 +250,8 @@ public class DefaultMutableTreeNode } /** - * children + * Returns an enumeration containing all children of this node. + * EMPTY_ENUMERATION is returned if this node has no children. * * @return an enumeration of tree nodes */ @@ -260,9 +264,9 @@ public class DefaultMutableTreeNode } /** - * setParent + * Set the parent node for this node. * - * @param node TODO + * @param node the parent node */ public void setParent(MutableTreeNode node) { @@ -270,11 +274,11 @@ public class DefaultMutableTreeNode } /** - * getChildAt + * Returns the child node at a given index. * - * @param index TODO + * @param index the index * - * @return TreeNode + * @return the child node */ public TreeNode getChildAt(int index) { @@ -282,9 +286,9 @@ public class DefaultMutableTreeNode } /** - * getChildCount + * Returns the number of children of this node. * - * @return int + * @return the number of children */ public int getChildCount() { @@ -292,11 +296,11 @@ public class DefaultMutableTreeNode } /** - * getIndex + * Returns the child index for a given node. * - * @param node TODO + * @param node this node * - * @return int + * @return the index */ public int getIndex(TreeNode node) { @@ -324,9 +328,9 @@ public class DefaultMutableTreeNode } /** - * setUserObject + * Sets the user object for this node * - * @param userObject TODO + * @param userObject the user object */ public void setUserObject(Object userObject) { @@ -334,9 +338,10 @@ public class DefaultMutableTreeNode } /** - * getUserObject + * Returns the user object attached to this node. null is + * returned when no user object is set. * - * @return Object + * @return the user object */ public Object getUserObject() { @@ -344,15 +349,16 @@ public class DefaultMutableTreeNode } /** - * removeFromParent + * Removes this node from its parent. */ public void removeFromParent() { + // FIXME: IS this implementation really correct ? parent = null; } /** - * removeAllChildren + * Removes all child nodes from this node. */ public void removeAllChildren() { @@ -541,7 +547,7 @@ public class DefaultMutableTreeNode } TreeNode[] path = getPathToRoot(node.getParent(), depth + 1); - path[depth] = node; + path[path.length - depth - 1] = node; return path; } @@ -562,9 +568,9 @@ public class DefaultMutableTreeNode } /** - * getRoot + * Returns the root node by iterating the parents of this node. * - * @return TreeNode + * @return the root node */ public TreeNode getRoot() { @@ -581,13 +587,14 @@ public class DefaultMutableTreeNode } /** - * isRoot + * Tells whether this node is the root node or not. * - * @return boolean + * @return true if this is the root node, + * falseotherwise */ public boolean isRoot() { - return (parent == null); + return parent == null; } /** Index: javax/xml/parsers/DocumentBuilder.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/xml/parsers/DocumentBuilder.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 DocumentBuilder.java --- javax/xml/parsers/DocumentBuilder.java 16 Jan 2005 15:15:14 -0000 1.1.2.1 +++ javax/xml/parsers/DocumentBuilder.java 15 Feb 2005 20:55:25 -0000 @@ -47,7 +47,6 @@ import org.w3c.dom.DOMImplementation; import org.xml.sax.InputSource; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; -import org.xml.sax.InputSource; import org.xml.sax.SAXException; /** Index: javax/xml/parsers/DocumentBuilderFactory.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/xml/parsers/DocumentBuilderFactory.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 DocumentBuilderFactory.java --- javax/xml/parsers/DocumentBuilderFactory.java 16 Jan 2005 15:15:14 -0000 1.1.2.1 +++ javax/xml/parsers/DocumentBuilderFactory.java 15 Feb 2005 20:55:25 -0000 @@ -45,9 +45,6 @@ import java.io.InputStreamReader; import java.io.IOException; import java.util.Properties; import javax.xml.validation.Schema; -import org.xml.sax.SAXException; -import org.xml.sax.SAXNotRecognizedException; -import org.xml.sax.SAXNotSupportedException; /** * Factory for obtaining document builders. Index: javax/xml/transform/sax/SAXTransformerFactory.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/xml/transform/sax/SAXTransformerFactory.java,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 SAXTransformerFactory.java --- javax/xml/transform/sax/SAXTransformerFactory.java 16 Jan 2005 15:15:14 -0000 1.1.2.1 +++ javax/xml/transform/sax/SAXTransformerFactory.java 15 Feb 2005 20:55:25 -0000 @@ -37,13 +37,10 @@ exception statement from your version. * package javax.xml.transform.sax; -import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.Templates; -import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerFactory; -import org.xml.sax.InputSource; import org.xml.sax.XMLFilter; /** Index: lib/Makefile.am =================================================================== RCS file: /cvsroot/classpath/classpath/lib/Makefile.am,v retrieving revision 1.63.2.6 diff -u -3 -p -u -r1.63.2.6 Makefile.am --- lib/Makefile.am 31 Jan 2005 18:02:50 -0000 1.63.2.6 +++ lib/Makefile.am 15 Feb 2005 20:55:26 -0000 @@ -29,6 +29,10 @@ JAVAC = $(KJC) -classpath .:$(USER_CLASS else if FOUND_GCJX JAVAC = $(GCJX) -classpath .:$(USER_CLASSLIB) -d . @classes +else +if FOUND_ECJ +JAVAC = $(ECJ) -warn:-deprecation,serial -proceedOnError -bootclasspath '' -classpath $(compile_classpath) -d . @classes +endif # FOUND_ECJ endif # FOUND_GCJX endif # FOUND_KJC endif # FOUND_GCJ Index: native/jni/classpath/native_state.c =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/classpath/native_state.c,v retrieving revision 1.8 diff -u -3 -p -u -r1.8 native_state.c --- native/jni/classpath/native_state.c 21 Jun 2004 19:35:37 -0000 1.8 +++ native/jni/classpath/native_state.c 15 Feb 2005 20:55:26 -0000 @@ -151,6 +151,7 @@ add_node (struct state_node **head, jint { back_ptr->next = node->next; node->next = *head; + *head = node; } node->c_state = state; return; Index: native/jni/gtk-peer/Makefile.am =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/Makefile.am,v retrieving revision 1.12.2.4 diff -u -3 -p -u -r1.12.2.4 Makefile.am --- native/jni/gtk-peer/Makefile.am 16 Jan 2005 15:15:14 -0000 1.12.2.4 +++ native/jni/gtk-peer/Makefile.am 15 Feb 2005 20:55:26 -0000 @@ -3,7 +3,6 @@ pkglib_LTLIBRARIES = libgtkpeer.la # Gtk/Cairo JNI sources. if GTK_CAIRO gtk_cairo_c_source_files = \ - gnu_java_awt_peer_gtk_GdkGlyphVector.c \ gnu_java_awt_peer_gtk_GdkGraphics2D.c else gtk_cairo_c_source_files = @@ -11,7 +10,6 @@ endif libgtkpeer_la_SOURCES = $(gtk_cairo_c_source_files) \ gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c \ - gnu_java_awt_peer_gtk_GdkFontMetrics.c \ gnu_java_awt_peer_gtk_GdkFontPeer.c \ gnu_java_awt_peer_gtk_GdkGraphics.c \ gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c \ Index: native/jni/gtk-peer/gdkfont.h =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gdkfont.h,v retrieving revision 1.3.2.1 diff -u -3 -p -u -r1.3.2.1 gdkfont.h --- native/jni/gtk-peer/gdkfont.h 15 Jan 2005 17:02:22 -0000 1.3.2.1 +++ native/jni/gtk-peer/gdkfont.h 15 Feb 2005 20:55:26 -0000 @@ -102,6 +102,21 @@ extern struct state_table *native_text_l #define TEXT_METRICS_Y_ADVANCE 5 #define NUM_TEXT_METRICS 6 +#define NUM_GLYPH_METRICS 10 + +#define GLYPH_LOG_X(i) (NUM_GLYPH_METRICS * (i) ) +#define GLYPH_LOG_Y(i) (NUM_GLYPH_METRICS * (i) + 1) +#define GLYPH_LOG_WIDTH(i) (NUM_GLYPH_METRICS * (i) + 2) +#define GLYPH_LOG_HEIGHT(i) (NUM_GLYPH_METRICS * (i) + 3) + +#define GLYPH_INK_X(i) (NUM_GLYPH_METRICS * (i) + 4) +#define GLYPH_INK_Y(i) (NUM_GLYPH_METRICS * (i) + 5) +#define GLYPH_INK_WIDTH(i) (NUM_GLYPH_METRICS * (i) + 6) +#define GLYPH_INK_HEIGHT(i) (NUM_GLYPH_METRICS * (i) + 7) + +#define GLYPH_POS_X(i) (NUM_GLYPH_METRICS * (i) + 8) +#define GLYPH_POS_Y(i) (NUM_GLYPH_METRICS * (i) + 9) + struct peerfont { PangoFont *font; @@ -119,16 +134,6 @@ struct peerfont void *graphics_resource; }; -struct glyphvec -{ - /* the GList is list of PangoGlyphItems, each of which is a pair of 1 - PangoItem and 1 PangoGlyphString. */ - GList *glyphitems; - PangoFontDescription *desc; - PangoFont *font; - PangoContext *ctx; -}; - struct textlayout { PangoLayout *pango_layout; Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c =================================================================== RCS file: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c diff -N native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c 15 Jan 2005 17:02:22 -0000 1.9.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,115 +0,0 @@ -/* gdkfontmetrics.c - Copyright (C) 1999, 2003, 2004 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., 59 Temple Place, Suite 330, Boston, MA -02111-1307 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. */ - -#include "gtkpeer.h" -#include "gdkfont.h" - -#include "gnu_java_awt_peer_gtk_GdkFontMetrics.h" -#include - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GdkFontMetrics_getPeerFontMetrics - (JNIEnv *env, jclass clazz __attribute__ ((unused)), jobject java_font, jdoubleArray java_metrics) -{ - struct peerfont *pfont = NULL; - jdouble *native_metrics = NULL; - PangoFontMetrics *pango_metrics; - - gdk_threads_enter(); - - pfont = (struct peerfont *) NSA_GET_FONT_PTR (env, java_font); - g_assert (pfont != NULL); - - pango_metrics = pango_context_get_metrics (pfont->ctx, pfont->desc, - gtk_get_default_language ()); - - native_metrics = (*env)->GetDoubleArrayElements (env, java_metrics, NULL); - g_assert (native_metrics != NULL); - - native_metrics[FONT_METRICS_ASCENT] = PANGO_PIXELS (pango_font_metrics_get_ascent (pango_metrics)); - native_metrics[FONT_METRICS_MAX_ASCENT] = native_metrics[FONT_METRICS_ASCENT]; - native_metrics[FONT_METRICS_DESCENT] = PANGO_PIXELS (pango_font_metrics_get_descent (pango_metrics)); - if (native_metrics[FONT_METRICS_DESCENT] < 0) - native_metrics[FONT_METRICS_DESCENT] = - native_metrics[FONT_METRICS_DESCENT]; - native_metrics[FONT_METRICS_MAX_DESCENT] = native_metrics[FONT_METRICS_DESCENT]; - native_metrics[FONT_METRICS_MAX_ADVANCE] = PANGO_PIXELS (pango_font_metrics_get_approximate_char_width (pango_metrics)); - - (*env)->ReleaseDoubleArrayElements (env, java_metrics, native_metrics, 0); - - pango_font_metrics_unref (pango_metrics); - - gdk_threads_leave(); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GdkFontMetrics_getPeerTextMetrics - (JNIEnv *env, jclass clazz __attribute__ ((unused)), jobject java_font, jstring str, jdoubleArray java_metrics) -{ - struct peerfont *pfont = NULL; - const char *cstr = NULL; - jdouble *native_metrics = NULL; - PangoRectangle log; - - gdk_threads_enter(); - - pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, java_font); - g_assert (pfont != NULL); - - cstr = (*env)->GetStringUTFChars (env, str, NULL); - g_assert(cstr != NULL); - - pango_layout_set_text (pfont->layout, cstr, -1); - pango_layout_get_extents (pfont->layout, NULL, &log); - - (*env)->ReleaseStringUTFChars (env, str, cstr); - pango_layout_set_text (pfont->layout, "", -1); - - native_metrics = (*env)->GetDoubleArrayElements (env, java_metrics, NULL); - g_assert (native_metrics != NULL); - - native_metrics[TEXT_METRICS_X_BEARING] = PANGO_PIXELS(log.x); - native_metrics[TEXT_METRICS_Y_BEARING] = PANGO_PIXELS(log.y); - native_metrics[TEXT_METRICS_WIDTH] = PANGO_PIXELS(log.width); - native_metrics[TEXT_METRICS_HEIGHT] = PANGO_PIXELS(log.height); - native_metrics[TEXT_METRICS_X_ADVANCE] = PANGO_PIXELS(log.x + log.width); - native_metrics[TEXT_METRICS_Y_ADVANCE] = PANGO_PIXELS(log.y + log.height); - - (*env)->ReleaseDoubleArrayElements (env, java_metrics, native_metrics, 0); - - gdk_threads_leave(); -} - Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c,v retrieving revision 1.4.2.2 diff -u -3 -p -u -r1.4.2.2 gnu_java_awt_peer_gtk_GdkFontPeer.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c 16 Jan 2005 02:14:50 -0000 1.4.2.2 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c 15 Feb 2005 20:55:26 -0000 @@ -40,23 +40,6 @@ struct state_table *native_font_state_table; -/* -rough sketch of the mapping between java and -pango text objects: - - Font <-> - PangoFont - - PangoFontDescription - - PangoContext - - PangoLayout (for rendering and measuring) - - GlyphVector <-> - GList of PangoGlyphItem - - PangoFontDescription - - PangoContext - - FontRenderContext <-> stays in plain java - -*/ - enum java_awt_font_style { java_awt_font_PLAIN = 0, java_awt_font_BOLD = 1, @@ -69,11 +52,22 @@ enum java_awt_font_baseline { java_awt_font_HANGING_BASELINE = 2 }; +static jmethodID glyphVector_ctor; +static jclass glyphVector_class; +static PangoAttrList *attrs = NULL; + JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkFontPeer_initStaticState (JNIEnv *env, jclass clazz) { NSA_FONT_INIT (env, clazz); + + glyphVector_class = (*env)->FindClass + (env, "gnu/java/awt/peer/gtk/GdkGlyphVector"); + + glyphVector_ctor = (*env)->GetMethodID + (env, glyphVector_class, "", + "([D[ILjava/awt/Font;Ljava/awt/font/FontRenderContext;)V"); } JNIEXPORT void JNICALL @@ -111,6 +105,223 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_d gdk_threads_leave (); } + +JNIEXPORT jobject JNICALL +Java_gnu_java_awt_peer_gtk_GdkFontPeer_getGlyphVector + (JNIEnv *env, jobject self, + jstring chars, + jobject font, + jobject fontRenderContext) +{ + struct peerfont *pfont = NULL; + GList *items = NULL, *i = NULL; + gchar *str = NULL; + int len, j; + double *native_extents; + int *native_codes; + jintArray java_codes = NULL; + jdoubleArray java_extents = NULL; + + gdk_threads_enter (); + + pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, self); + g_assert (pfont != NULL); + + len = (*gdk_env())->GetStringUTFLength (env, chars); + str = (gchar *)(*env)->GetStringUTFChars (env, chars, NULL); + g_assert (str != NULL); + + if (attrs == NULL) + attrs = pango_attr_list_new (); + + if (len > 0 && str[len-1] == '\0') + len--; + + items = pango_itemize (pfont->ctx, str, 0, len, attrs, NULL); + + i = g_list_first (items); + + if (i == NULL) + { + java_extents = (*env)->NewDoubleArray (env, 0); + java_codes = (*env)->NewIntArray (env, 0); + } + else + { + PangoGlyphString *glyphs; + PangoItem *item = (PangoItem *)i->data; + + pango_context_set_font_description (pfont->ctx, pfont->desc); + pango_context_set_language (pfont->ctx, gtk_get_default_language()); + pango_context_load_font (pfont->ctx, pfont->desc); + + glyphs = pango_glyph_string_new (); + g_assert (glyphs != NULL); + + pango_shape (str + item->offset, item->length, + &(item->analysis), glyphs); + + if (glyphs->num_glyphs > 0) + { + int x = 0; + double scale = ((double) PANGO_SCALE); + + java_extents = (*env)->NewDoubleArray (env, glyphs->num_glyphs * NUM_GLYPH_METRICS); + java_codes = (*env)->NewIntArray (env, glyphs->num_glyphs); + native_extents = (*env)->GetDoubleArrayElements (env, java_extents, NULL); + native_codes = (*env)->GetIntArrayElements (env, java_codes, NULL); + + for (j = 0; j < glyphs->num_glyphs; ++j) + { + PangoRectangle ink; + PangoRectangle logical; + PangoGlyphGeometry *geom = &glyphs->glyphs[j].geometry; + + pango_font_get_glyph_extents (pfont->font, + glyphs->glyphs[j].glyph, + &ink, &logical); + + native_codes[j] = glyphs->glyphs[j].glyph; + + native_extents[ GLYPH_LOG_X(j) ] = (logical.x) / scale; + native_extents[ GLYPH_LOG_Y(j) ] = (- logical.y) / scale; + native_extents[ GLYPH_LOG_WIDTH(j) ] = (logical.width) / scale; + native_extents[ GLYPH_LOG_HEIGHT(j) ] = (logical.height) / scale; + + native_extents[ GLYPH_INK_X(j) ] = (ink.x) / scale; + native_extents[ GLYPH_INK_Y(j) ] = (- ink.y) / scale; + native_extents[ GLYPH_INK_WIDTH(j) ] = (ink.width) / scale; + native_extents[ GLYPH_INK_HEIGHT(j) ] = (ink.height) / scale; + + native_extents[ GLYPH_POS_X(j) ] = (x + geom->x_offset) / scale; + native_extents[ GLYPH_POS_Y(j) ] = ( - geom->y_offset) / scale; + + x += geom->width; + } + (*env)->ReleaseDoubleArrayElements (env, java_extents, native_extents, 0); + (*env)->ReleaseIntArrayElements (env, java_codes, native_codes, 0); + } + + pango_glyph_string_free (glyphs); + } + + (*env)->ReleaseStringUTFChars (env, chars, str); + + for (i = g_list_first (items); i != NULL; i = g_list_next (i)) + g_free (i->data); + + g_list_free (items); + + gdk_threads_leave (); + + return (*env)->NewObject (env, + glyphVector_class, + glyphVector_ctor, + java_extents, java_codes, + font, fontRenderContext); +} + +JNIEXPORT void JNICALL +Java_gnu_java_awt_peer_gtk_GdkFontPeer_getFontMetrics + (JNIEnv *env, jobject java_font, jdoubleArray java_metrics) +{ + struct peerfont *pfont = NULL; + jdouble *native_metrics = NULL; + PangoFontMetrics *pango_metrics; + + gdk_threads_enter(); + + pfont = (struct peerfont *) NSA_GET_FONT_PTR (env, java_font); + g_assert (pfont != NULL); + + pango_metrics + = pango_context_get_metrics (pfont->ctx, pfont->desc, + gtk_get_default_language ()); + + native_metrics + = (*env)->GetDoubleArrayElements (env, java_metrics, NULL); + + g_assert (native_metrics != NULL); + + native_metrics[FONT_METRICS_ASCENT] + = PANGO_PIXELS (pango_font_metrics_get_ascent (pango_metrics)); + + native_metrics[FONT_METRICS_MAX_ASCENT] + = native_metrics[FONT_METRICS_ASCENT]; + + native_metrics[FONT_METRICS_DESCENT] + = PANGO_PIXELS (pango_font_metrics_get_descent (pango_metrics)); + + if (native_metrics[FONT_METRICS_DESCENT] < 0) + native_metrics[FONT_METRICS_DESCENT] + = - native_metrics[FONT_METRICS_DESCENT]; + + native_metrics[FONT_METRICS_MAX_DESCENT] + = native_metrics[FONT_METRICS_DESCENT]; + + native_metrics[FONT_METRICS_MAX_ADVANCE] + = PANGO_PIXELS (pango_font_metrics_get_approximate_char_width + (pango_metrics)); + + (*env)->ReleaseDoubleArrayElements (env, + java_metrics, + native_metrics, 0); + + pango_font_metrics_unref (pango_metrics); + + gdk_threads_leave(); +} + +JNIEXPORT void JNICALL +Java_gnu_java_awt_peer_gtk_GdkFontPeer_getTextMetrics + (JNIEnv *env, jobject java_font, jstring str, jdoubleArray java_metrics) +{ + struct peerfont *pfont = NULL; + const char *cstr = NULL; + jdouble *native_metrics = NULL; + PangoRectangle log; + + gdk_threads_enter(); + + pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, java_font); + g_assert (pfont != NULL); + + cstr = (*env)->GetStringUTFChars (env, str, NULL); + g_assert(cstr != NULL); + + pango_layout_set_text (pfont->layout, cstr, -1); + pango_layout_get_extents (pfont->layout, NULL, &log); + + (*env)->ReleaseStringUTFChars (env, str, cstr); + pango_layout_set_text (pfont->layout, "", -1); + + native_metrics = (*env)->GetDoubleArrayElements (env, java_metrics, NULL); + g_assert (native_metrics != NULL); + + native_metrics[TEXT_METRICS_X_BEARING] + = PANGO_PIXELS( ((double)log.x) ); + + native_metrics[TEXT_METRICS_Y_BEARING] + = PANGO_PIXELS( ((double)log.y) ); + + native_metrics[TEXT_METRICS_WIDTH] + = PANGO_PIXELS( ((double)log.width) ); + + native_metrics[TEXT_METRICS_HEIGHT] + = PANGO_PIXELS( ((double)log.height) ); + + native_metrics[TEXT_METRICS_X_ADVANCE] + = PANGO_PIXELS( ((double) (log.x + log.width)) ); + + native_metrics[TEXT_METRICS_Y_ADVANCE] + = PANGO_PIXELS( ((double) (log.y + log.height)) ); + + (*env)->ReleaseDoubleArrayElements (env, java_metrics, native_metrics, 0); + + gdk_threads_leave(); +} + + JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkFontPeer_setFont (JNIEnv *env, jobject self, jstring family_name_str, jint style_int, jint size, jboolean useGraphics2D) @@ -142,7 +353,6 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_s pango_font_description_set_family (pfont->desc, family_name); (*env)->ReleaseStringUTFChars(env, family_name_str, family_name); - pango_font_description_set_size (pfont->desc, size * dpi_conversion_factor); if (style & java_awt_font_BOLD) pango_font_description_set_weight (pfont->desc, PANGO_WEIGHT_BOLD); @@ -152,6 +362,7 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_s if (useGraphics2D) { + pango_font_description_set_size (pfont->desc, size * PANGO_SCALE); if (pfont->ctx == NULL) { ft2_map = PANGO_FT2_FONT_MAP(pango_ft2_font_map_for_display ()); @@ -160,6 +371,9 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_s } else { + /* GDK uses a slightly different DPI setting. */ + pango_font_description_set_size (pfont->desc, + size * dpi_conversion_factor); if (pfont->ctx == NULL) pfont->ctx = gdk_pango_context_get(); } Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c =================================================================== RCS file: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c diff -N native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c 20 Jan 2005 00:37:22 -0000 1.6.2.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,696 +0,0 @@ -/* gdkglyphvector.c - Copyright (C) 2003, 2004 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., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 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. */ - -#include "gdkfont.h" -#include "gnu_java_awt_peer_gtk_GdkGlyphVector.h" - -struct state_table *native_glyphvector_state_table; - -typedef struct { - double x; - double y; - double width; - double height; -} rect_t; - -#define DOUBLE_TO_26_6(d) ((FT_F26Dot6)((d) * 64.0)) -#define DOUBLE_FROM_26_6(t) ((double)(t) / 64.0) -#define DOUBLE_TO_16_16(d) ((FT_Fixed)((d) * 65536.0)) -#define DOUBLE_FROM_16_16(t) ((double)(t) / 65536.0) - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GdkGlyphVector_initStaticState - (JNIEnv *env, jclass clazz) -{ - NSA_GV_INIT (env, clazz); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GdkGlyphVector_initState - (JNIEnv *env, jobject self, jobject font, jobject ctx __attribute__ ((unused))) -{ - struct glyphvec *vec = NULL; - struct peerfont *pfont = NULL; - - gdk_threads_enter (); - g_assert (font != NULL); - pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, font); - g_assert (pfont != NULL); - g_assert (pfont->ctx != NULL); - g_assert (pfont->desc != NULL); - - g_assert (self != NULL); - vec = (struct glyphvec *) g_malloc0 (sizeof (struct glyphvec)); - g_assert (vec != NULL); - - vec->desc = pango_font_describe (pfont->font); - g_assert (vec->desc != NULL); - - vec->font = pfont->font; - g_object_ref (vec->font); - - vec->ctx = pfont->ctx; - g_object_ref (vec->ctx); - - NSA_SET_GV_PTR (env, self, vec); - gdk_threads_leave (); -} - -static void free_glyphitems (GList *list) -{ - GList *i = NULL; - PangoGlyphItem *gi = NULL; - - for (i = g_list_first (list); i != NULL; i = g_list_next (i)) - { - g_assert (i->data != NULL); - gi = (PangoGlyphItem *)i->data; - - if (gi->glyphs != NULL) - pango_glyph_string_free (gi->glyphs); - - if (gi->item != NULL) - g_free (gi->item); - } - g_list_free (list); -} - -static void seek_glyphstring_idx (GList *list, int idx, - int *nidx, - PangoGlyphString **gs, - PangoFont **fnt) -{ - GList *i = NULL; - PangoGlyphItem *gi = NULL; - int begin = 0; - - g_assert (list != NULL); - g_assert (gs != NULL); - g_assert (nidx != NULL); - - - for (i = g_list_first (list); i != NULL; i = g_list_next (i)) - { - g_assert (i->data != NULL); - gi = (PangoGlyphItem *)i->data; - - g_assert (gi->glyphs != NULL); - - if (begin <= idx && idx < begin + gi->glyphs->num_glyphs) - { - *gs = gi->glyphs; - *nidx = idx - begin; - if (fnt && gi->item) - *fnt = gi->item->analysis.font; - return; - } - else - { - begin += gi->glyphs->num_glyphs; - } - } - *gs = NULL; - *nidx = -1; -} - -static void seek_glyph_idx (GList *list, int idx, - PangoGlyphInfo **g, - PangoFont **fnt) -{ - PangoGlyphString *gs = NULL; - int nidx = -1; - - g_assert (list != NULL); - g_assert (g != NULL); - - seek_glyphstring_idx (list, idx, &nidx, &gs, fnt); - - g_assert (gs != NULL); - g_assert (nidx != -1); - g_assert (nidx < gs->num_glyphs); - g_assert (gs->glyphs != NULL); - - *g = gs->glyphs + nidx; -} - -static void union_rects (rect_t *r1, - const rect_t *r2) -{ - rect_t r; - - g_assert (r1 != NULL); - g_assert (r2 != NULL); - - /* - x is the left edge of the rect, - y is the top edge of the rect - */ - -#ifndef min -#define min(x,y) ((x) < (y) ? (x) : (y)) -#endif - -#ifndef max -#define max(x,y) ((x) < (y) ? (y) : (x)) -#endif - - r.x = min(r1->x, r2->x); - - r.y = min(r1->y, r2->y); - - r.width = max(r1->x + r1->width, - r2->x + r2->width) - r.x; - - r.height = max(r1->y + r1->height, - r2->y + r2->height) - r.y; - - *r1 = r; -} - -static jdoubleArray rect_to_array (JNIEnv *env, const rect_t *r) -{ - /* We often return rectangles as arrays : { x, y, w, h } */ - jdoubleArray ret; - double *rp = NULL; - g_assert (r != NULL); - ret = (*env)->NewDoubleArray (env, 4); - rp = (*env)->GetDoubleArrayElements (env, ret, NULL); - g_assert (rp != NULL); - rp[0] = r->x; - /* freetype and pango's view of space is upside down from java2d's */ - rp[1] = r->y * -1; - rp[2] = r->width; - rp[3] = r->height; - (*env)->ReleaseDoubleArrayElements (env, ret, rp, 0); - return ret; -} - - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GdkGlyphVector_dispose - (JNIEnv *env, jobject self) -{ - struct glyphvec *vec = NULL; - - gdk_threads_enter (); - g_assert (self != NULL); - vec = (struct glyphvec *)NSA_DEL_GV_PTR (env, self); - g_assert (vec != NULL); - - if (vec->glyphitems != NULL) - { - free_glyphitems (vec->glyphitems); - vec->glyphitems = NULL; - } - - if (vec->desc != NULL) - pango_font_description_free (vec->desc); - - if (vec->ctx != NULL) - g_object_unref (vec->ctx); - - g_free (vec); - gdk_threads_leave (); -} - - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GdkGlyphVector_setChars - (JNIEnv *env, jobject self, jstring chars) -{ - struct glyphvec *vec = NULL; - gchar *str = NULL; - GList *items = NULL, *item = NULL; - PangoGlyphItem *gi; - PangoAttrList *attrs = NULL; - gint len = 0; - - gdk_threads_enter (); - g_assert (self != NULL); - vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self); - g_assert (vec != NULL); - g_assert (vec->desc != NULL); - g_assert (vec->ctx != NULL); - - len = (*gdk_env())->GetStringUTFLength (env, chars); - str = (gchar *)(*env)->GetStringUTFChars (env, chars, NULL); - g_assert (str != NULL); - - /* step 1: set our FontFescription in the context, then "itemize" the - text */ - - attrs = pango_attr_list_new (); - g_assert (attrs != NULL); - - pango_context_set_font_description (vec->ctx, vec->desc); - - if (vec->glyphitems != NULL) - items = pango_itemize (vec->ctx, str, 0, len, attrs, NULL); - if (items != NULL) - { - - /* - step 2: for each item: - - shape the item into a glyphstring - - store the (item, glyphstring) pair in the vec->glyphitems list - */ - - if (vec->glyphitems != NULL) - { - free_glyphitems (vec->glyphitems); - vec->glyphitems = NULL; - } - - for (item = g_list_first (items); - item != NULL; - item = g_list_next (item)) - { - g_assert (item->data != NULL); - - gi = NULL; - gi = g_malloc0 (sizeof(PangoGlyphItem)); - g_assert (gi != NULL); - - gi->item = (PangoItem *)item->data; - gi->glyphs = pango_glyph_string_new (); - g_assert (gi->glyphs != NULL); - - if (gi->glyphs->num_glyphs > 0) - { - pango_shape (str + gi->item->offset, - gi->item->length, - &(gi->item->analysis), - gi->glyphs); - - vec->glyphitems = g_list_append (vec->glyphitems, gi); - } - } - - /* - ownership of each item has been transferred to glyphitems, - but the list should be freed. - */ - - g_list_free (items); - } - - pango_attr_list_unref (attrs); - - (*env)->ReleaseStringUTFChars (env, chars, str); - gdk_threads_leave (); -} - - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GdkGlyphVector_setGlyphCodes - (JNIEnv *env, jobject self, jintArray codes __attribute__ ((unused))) -{ - struct glyphvec *vec = NULL; - - gdk_threads_enter (); - g_assert (self != NULL); - vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self); - g_assert (vec != NULL); - - /* - FIXME: setting glyph codes doesn't seem particularly plausible at the - moment. - */ - - gdk_threads_leave (); - -} - - -JNIEXPORT jint JNICALL -Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphCode - (JNIEnv *env, jobject self, jint idx) -{ - struct glyphvec *vec = NULL; - PangoGlyphInfo *gi = NULL; - jint ret = 0; - - gdk_threads_enter (); - g_assert (self != NULL); - vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self); - g_assert (vec != NULL); - g_assert (vec->glyphitems != NULL); - - seek_glyph_idx (vec->glyphitems, idx, &gi, NULL); - g_assert (gi != NULL); - ret = gi->glyph; - gdk_threads_leave (); - - return (jint)(ret); -} - - -JNIEXPORT jint JNICALL -Java_gnu_java_awt_peer_gtk_GdkGlyphVector_numGlyphs - (JNIEnv *env, jobject self) -{ - GList *i = NULL; - PangoGlyphItem *gi = NULL; - struct glyphvec *vec = NULL; - jint count = 0; - - gdk_threads_enter (); - g_assert (self != NULL); - vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self); - g_assert (vec != NULL); - - for (i = g_list_first (vec->glyphitems); i != NULL; i = g_list_next (i)) - { - g_assert (i->data != NULL); - gi = (PangoGlyphItem *)i->data; - g_assert (gi->glyphs != NULL); - count += gi->glyphs->num_glyphs; - } - gdk_threads_leave (); - - return count; -} - - -JNIEXPORT jint JNICALL -Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphCharIndex -(JNIEnv *env __attribute__ ((unused)), jobject self __attribute__ ((unused)), jint idx) -{ - /* - FIXME: this is not correct, rather it assumes a (broken) 1:1 - glyph:char model. it can be implemented in terms of bytes (also - broken) using pango's current interface, or perhaps in terms of - characters if some better byte->character conversion operator is - found. for the time being we leave it broken. - */ - return idx; -} - -static void -assume_pointsize_and_identity_transform(double pointsize, - FT_Face face) -{ - FT_Matrix mat; - mat.xx = DOUBLE_TO_16_16(1); - mat.xy = DOUBLE_TO_16_16(0); - mat.yx = DOUBLE_TO_16_16(0); - mat.yy = DOUBLE_TO_16_16(1); - FT_Set_Transform(face, &mat, NULL); - FT_Set_Char_Size( face, - DOUBLE_TO_26_6 (pointsize), - DOUBLE_TO_26_6 (pointsize), - 0, 0); -} - -JNIEXPORT jdoubleArray JNICALL -Java_gnu_java_awt_peer_gtk_GdkGlyphVector_allInkExtents - (JNIEnv *env, jobject self) -{ - struct glyphvec *vec = NULL; - int j; - GList *i; - PangoGlyphItem *gi = NULL; - rect_t rect = {0,0,0,0}; - rect_t tmp; - jdoubleArray ret; - double x = 0, y = 0; - double pointsize; - FT_Face face; - - gdk_threads_enter (); - g_assert (self != NULL); - vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self); - g_assert (vec != NULL); - if (vec->glyphitems != NULL) - { - pointsize = pango_font_description_get_size (vec->desc); - pointsize /= (double) PANGO_SCALE; - - for (i = g_list_first (vec->glyphitems); i != NULL; i = g_list_next (i)) - { - g_assert (i->data != NULL); - gi = (PangoGlyphItem *)i->data; - g_assert (gi->glyphs != NULL); - - face = pango_ft2_font_get_face (gi->item->analysis.font); - assume_pointsize_and_identity_transform (pointsize, face); - - for (j = 0; j < gi->glyphs->num_glyphs; ++j) - { - FT_Load_Glyph (face, - gi->glyphs->glyphs[j].glyph, - FT_LOAD_DEFAULT); - /* FIXME: this needs to change for vertical layouts */ - tmp.x = x + DOUBLE_FROM_26_6 (face->glyph->metrics.horiBearingX); - tmp.y = y + DOUBLE_FROM_26_6 (face->glyph->metrics.horiBearingY); - tmp.width = DOUBLE_FROM_26_6 (face->glyph->metrics.width); - tmp.height = DOUBLE_FROM_26_6 (face->glyph->metrics.height); - union_rects (&rect, &tmp); - x += DOUBLE_FROM_26_6 (face->glyph->advance.x); - y += DOUBLE_FROM_26_6 (face->glyph->advance.y); - } - } - } - - ret = rect_to_array (env, &rect); - gdk_threads_leave (); - return ret; -} - - -JNIEXPORT jdoubleArray JNICALL -Java_gnu_java_awt_peer_gtk_GdkGlyphVector_allLogicalExtents - (JNIEnv *env, jobject self) -{ - struct glyphvec *vec = NULL; - int j; - GList *i; - PangoGlyphItem *gi = NULL; - rect_t rect = {0,0,0,0}; - rect_t tmp; - jdoubleArray ret; - double x = 0, y = 0; - double pointsize; - FT_Face face; - - gdk_threads_enter (); - g_assert (self != NULL); - vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self); - g_assert (vec != NULL); - g_assert (vec->glyphitems != NULL); - - pointsize = pango_font_description_get_size (vec->desc); - pointsize /= (double) PANGO_SCALE; - - for (i = g_list_first (vec->glyphitems); i != NULL; i = g_list_next (i)) - { - g_assert (i->data != NULL); - gi = (PangoGlyphItem *)i->data; - g_assert (gi->glyphs != NULL); - - face = pango_ft2_font_get_face (gi->item->analysis.font); - assume_pointsize_and_identity_transform (pointsize, face); - - for (j = 0; j < gi->glyphs->num_glyphs; ++j) - { - FT_Load_Glyph (face, gi->glyphs->glyphs[j].glyph, FT_LOAD_DEFAULT); - - /* FIXME: also, this is probably not the correct set of metrics; - the "logical bounds" are some fancy combination of hori - advance and height such that it's good for inverting as a - highlight. revisit. */ - - tmp.x = x; - tmp.y = y; - tmp.width = DOUBLE_FROM_26_6 (face->glyph->advance.x); - tmp.height = DOUBLE_FROM_26_6 (face->glyph->advance.y); - union_rects (&rect, &tmp); - x += DOUBLE_FROM_26_6 (face->glyph->advance.x); - y += DOUBLE_FROM_26_6 (face->glyph->advance.y); - } - } - - ret = rect_to_array (env, &rect); - gdk_threads_leave (); - return ret; -} - - -JNIEXPORT jdoubleArray JNICALL -Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphLogicalExtents - (JNIEnv *env, jobject self, jint idx) -{ - struct glyphvec *vec = NULL; - rect_t rect = {0,0,0,0}; - PangoGlyphInfo *gi = NULL; - PangoFont *font = NULL; - jdoubleArray ret; - double pointsize; - FT_Face face; - - gdk_threads_enter (); - g_assert (self != NULL); - vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self); - g_assert (vec != NULL); - g_assert (vec->glyphitems != NULL); - - seek_glyph_idx (vec->glyphitems, idx, &gi, &font); - g_assert (gi != NULL); - g_assert (font != NULL); - - pointsize = pango_font_description_get_size (vec->desc); - pointsize /= (double) PANGO_SCALE; - face = pango_ft2_font_get_face (font); - - assume_pointsize_and_identity_transform (pointsize, face); - - FT_Load_Glyph (face, gi->glyph, FT_LOAD_DEFAULT); - - /* FIXME: this is probably not the correct set of metrics; - the "logical bounds" are some fancy combination of hori - advance and height such that it's good for inverting as a - highlight. revisit. */ - - rect.x = 0; - rect.y = 0; - rect.width = DOUBLE_FROM_26_6 (face->glyph->advance.x); - rect.height = DOUBLE_FROM_26_6 (face->glyph->advance.y); - - ret = rect_to_array (env, &rect); - gdk_threads_leave (); - return ret; -} - - -JNIEXPORT jdoubleArray JNICALL -Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphInkExtents - (JNIEnv *env, jobject self, jint idx) -{ - struct glyphvec *vec = NULL; - rect_t rect = {0,0,0,0}; - PangoGlyphInfo *gi = NULL; - PangoFont *font = NULL; - jdoubleArray ret; - double pointsize; - FT_Face face; - - gdk_threads_enter (); - g_assert (self != NULL); - vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self); - g_assert (vec != NULL); - g_assert (vec->glyphitems != NULL); - - seek_glyph_idx (vec->glyphitems, idx, &gi, &font); - g_assert (gi != NULL); - g_assert (font != NULL); - - pointsize = pango_font_description_get_size (vec->desc); - pointsize /= (double) PANGO_SCALE; - face = pango_ft2_font_get_face (font); - - assume_pointsize_and_identity_transform (pointsize, face); - - FT_Load_Glyph (face, gi->glyph, FT_LOAD_DEFAULT); - /* FIXME: this needs to change for vertical layouts */ - rect.x = DOUBLE_FROM_26_6 (face->glyph->metrics.horiBearingX); - rect.y = DOUBLE_FROM_26_6 (face->glyph->metrics.horiBearingY); - rect.width = DOUBLE_FROM_26_6 (face->glyph->metrics.width); - rect.height = DOUBLE_FROM_26_6 (face->glyph->metrics.height); - - ret = rect_to_array (env, &rect); - gdk_threads_leave (); - return ret; -} - - -JNIEXPORT jboolean JNICALL -Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphIsHorizontal -(JNIEnv *env, jobject self, jint idx __attribute__ ((unused))) -{ - struct glyphvec *vec = NULL; - PangoDirection dir; - - gdk_threads_enter (); - g_assert (self != NULL); - vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self); - g_assert (vec != NULL); - g_assert (vec->desc != NULL); - g_assert (vec->ctx != NULL); - - /* - FIXME: this is an approximation; it's not clear to me whether - glyphs themselves are horizontal or vertical so much as the - writing system or writing context. pango thinks it's a context - issue, so we use that for now. - */ - - dir = pango_context_get_base_dir (vec->ctx); - - gdk_threads_leave (); - - return 1; - /* FIXME: Pango doesn't seem to have decided how it will deal - with vertical text. for the time being we inherit this limitation. - ((dir == PANGO_DIRECTION_LTR) || - (dir == PANGO_DIRECTION_RTL)); - */ -} - - -JNIEXPORT jboolean JNICALL -Java_gnu_java_awt_peer_gtk_GdkGlyphVector_isEqual - (JNIEnv *env, jobject self, jobject other) -{ - struct glyphvec *vec1 = NULL, *vec2 = NULL; - jboolean eq = 0; - - gdk_threads_enter (); - g_assert (self != NULL); - vec1 = (struct glyphvec *)NSA_GET_GV_PTR (env, self); - vec2 = (struct glyphvec *)NSA_GET_GV_PTR (env, other); - g_assert (vec1 != NULL); - g_assert (vec2 != NULL); - - /* FIXME: is there some more advantageous definition of equality for - glyph vectors? */ - eq = (vec1 == vec2); - - gdk_threads_leave (); - return eq; -} - - Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c,v retrieving revision 1.11.2.5 diff -u -3 -p -u -r1.11.2.5 gnu_java_awt_peer_gtk_GdkGraphics.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c 20 Jan 2005 00:37:22 -0000 1.11.2.5 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c 15 Feb 2005 20:55:26 -0000 @@ -133,13 +133,17 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_c (JNIEnv *env, jobject obj, jobject peer) { void *ptr; + jobject *gref; + + NSA_SET_GLOBAL_REF (env, obj); + gref = NSA_GET_GLOBAL_REF (env, obj); ptr = NSA_GET_PTR (env, peer); gdk_threads_enter (); g_signal_connect_after (G_OBJECT (ptr), "realize", - G_CALLBACK (realize_cb), obj); + G_CALLBACK (realize_cb), *gref); gdk_threads_leave (); } @@ -682,5 +686,7 @@ static void realize_cb (GtkWidget *widge (*gdk_env())->CallVoidMethod (gdk_env(), peer, initComponentGraphicsID); + NSA_DEL_GLOBAL_REF (gdk_env(), peer); + gdk_threads_enter (); } Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c,v retrieving revision 1.9.2.6 diff -u -3 -p -u -r1.9.2.6 gnu_java_awt_peer_gtk_GdkGraphics2D.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c 4 Feb 2005 09:44:45 -0000 1.9.2.6 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c 15 Feb 2005 20:55:26 -0000 @@ -942,13 +942,13 @@ install_font_peer(cairo_t *cr, if (debug) printf ("install_font_peer made new cairo font for '%s' at %f\n", face->family_name, (pango_font_description_get_size (pfont->desc) / - (double)PANGO_SCALE) * (96.0 / 72.0)); + (double)PANGO_SCALE)); cairo_set_font (cr, ft); cairo_font_destroy (ft); cairo_scale_font (cr, (pango_font_description_get_size (pfont->desc) / - (double)PANGO_SCALE) * (96.0 / 72.0)); + (double)PANGO_SCALE)); ft = cairo_current_font (cr); pfont->graphics_resource = ft; } @@ -960,20 +960,6 @@ install_font_peer(cairo_t *cr, } } -static cairo_t *metrics_cairo = NULL; -static cairo_surface_t *metrics_surface = NULL; - -static void -ensure_metrics_cairo() -{ - if (metrics_cairo == NULL) - { - metrics_cairo = cairo_create (); - metrics_surface = cairo_image_surface_create (CAIRO_FORMAT_A8, 1, 1); - cairo_set_target_surface (metrics_cairo, metrics_surface); - } -} - JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_releasePeerGraphicsResource @@ -994,78 +980,6 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D gdk_threads_leave(); } -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getPeerTextMetrics - (JNIEnv *env, jclass clazz __attribute__ ((unused)), jobject java_font, jstring str, jdoubleArray java_metrics) -{ - struct peerfont *pfont = NULL; - const char *cstr = NULL; - jdouble *native_metrics = NULL; - cairo_text_extents_t extents; - - g_assert(java_font != NULL); - gdk_threads_enter(); - - pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, java_font); - g_assert (pfont != NULL); - - ensure_metrics_cairo(); - install_font_peer (metrics_cairo, pfont, 0); - - cstr = (*env)->GetStringUTFChars (env, str, NULL); - g_assert(cstr != NULL); - cairo_text_extents (metrics_cairo, (unsigned char *) cstr, &extents); - - native_metrics = (*env)->GetDoubleArrayElements (env, java_metrics, NULL); - g_assert (native_metrics != NULL); - - native_metrics[TEXT_METRICS_X_BEARING] = extents.x_bearing; - native_metrics[TEXT_METRICS_Y_BEARING] = extents.y_bearing; - native_metrics[TEXT_METRICS_WIDTH] = extents.width; - native_metrics[TEXT_METRICS_HEIGHT] = extents.height; - native_metrics[TEXT_METRICS_X_ADVANCE] = extents.x_advance; - native_metrics[TEXT_METRICS_Y_ADVANCE] = extents.y_advance; - - (*env)->ReleaseStringUTFChars (env, str, cstr); - (*env)->ReleaseDoubleArrayElements (env, java_metrics, native_metrics, 0); - gdk_threads_leave(); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getPeerFontMetrics - (JNIEnv *env, jclass clazz __attribute__ ((unused)), jobject java_font, jdoubleArray java_metrics) -{ - struct peerfont *pfont = NULL; - jdouble *native_metrics = NULL; - cairo_font_extents_t extents; - - g_assert(java_font != NULL); - - gdk_threads_enter(); - - pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, java_font); - g_assert (pfont != NULL); - - ensure_metrics_cairo(); - install_font_peer (metrics_cairo, pfont, 0); - - cairo_current_font_extents (metrics_cairo, &extents); - - native_metrics = (*env)->GetDoubleArrayElements (env, java_metrics, NULL); - g_assert (native_metrics != NULL); - - native_metrics[FONT_METRICS_ASCENT] = extents.ascent; - native_metrics[FONT_METRICS_MAX_ASCENT] = extents.ascent; - native_metrics[FONT_METRICS_DESCENT] = extents.descent; - if (native_metrics[FONT_METRICS_DESCENT] < 0) - native_metrics[FONT_METRICS_DESCENT] = - native_metrics[FONT_METRICS_DESCENT]; - native_metrics[FONT_METRICS_MAX_DESCENT] = native_metrics[FONT_METRICS_DESCENT]; - native_metrics[FONT_METRICS_MAX_ADVANCE] = extents.max_x_advance; - - (*env)->ReleaseDoubleArrayElements (env, java_metrics, native_metrics, 0); - gdk_threads_leave(); -} - static void paint_glyph_run(JNIEnv *env, struct graphics2d *gr, @@ -1122,128 +1036,65 @@ paint_glyph_run(JNIEnv *env, } } -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawString - (JNIEnv *env, jobject obj, jobject font, jstring str, float x, float y) -{ - struct graphics2d *gr = NULL; - const char *cstr = NULL; - struct peerfont *pfont = NULL; - - /* - cairo_glyph_t *glyphs = NULL; - gint n_glyphs = 0; - PangoLayoutRun *run = NULL; - PangoLayoutIter *iter = NULL; - */ - - g_assert(obj != NULL); - g_assert(font != NULL); - g_assert(str != NULL); - - gdk_threads_enter (); - if (peer_is_disposed(env, obj)) { gdk_threads_leave(); return; } - - gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj); - g_assert(gr != NULL); - - pfont = (struct peerfont *) NSA_GET_FONT_PTR (env, font); - g_assert (pfont != NULL); - - cstr = (*env)->GetStringUTFChars (env, str, NULL); - g_assert(cstr != NULL); - - if (gr->debug) printf ("painting string '%s' at (%f,%f)\n", cstr, x, y); - - /* For now we let cairo do the glyph conversion; eventually this - * ought to be unified with pango, but it is impossible to get - * pango and cairo to agree on metrics at the moment, so we either - * have to use "all cairo" metrics (the string-based APIs) or - * "all pango" metrics (the glyph-vector based APIs). - */ - - install_font_peer (gr->cr, pfont, gr->debug); - cairo_move_to (gr->cr, x, y); - cairo_show_text (gr->cr, (unsigned char *) cstr); - - /* - - pango_layout_set_text (gr->pango_layout, cstr, -1); - - iter = pango_layout_get_iter (gr->pango_layout); - g_assert(iter != NULL); - - cairo_translate (gr->cr, x, y); - - do - { - run = pango_layout_iter_get_run (iter); - if (run != NULL) - paint_glyph_run (gr, &glyphs, &n_glyphs, run); - } - while (pango_layout_iter_next_run (iter)); - - if (glyphs != NULL) - g_free (glyphs); - - cairo_translate (gr->cr, -x, -y); - - pango_layout_iter_free (iter); - - */ - - gdk_threads_leave (); - - (*env)->ReleaseStringUTFChars (env, str, cstr); -} - JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGdkGlyphVector - (JNIEnv *env, jobject self, jobject font, jobject java_vec, jfloat x, jfloat y) +Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGlyphVector + (JNIEnv *env, jobject self, + jobject font, + jfloat x, jfloat y, jint n, + jintArray java_codes, + jfloatArray java_positions) { struct graphics2d *gr = NULL; struct peerfont *pfont = NULL; - struct glyphvec *gv = NULL; - PangoLayoutRun *run = NULL; cairo_glyph_t *glyphs = NULL; - gint n_glyphs = 0; + int *native_codes; + float *native_positions; + jint i = 0; g_assert (self != NULL); - g_assert (java_vec != NULL); + g_assert (java_codes != NULL); + g_assert (java_positions != NULL); gdk_threads_enter (); if (peer_is_disposed(env, self)) { gdk_threads_leave(); return; } gr = (struct graphics2d *)NSA_GET_G2D_PTR (env, self); - gv = (struct glyphvec *)NSA_GET_GV_PTR (env, java_vec); - pfont = (struct peerfont *) NSA_GET_FONT_PTR (env, font); - g_assert (gr != NULL); - g_assert (gv != NULL); + + pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, font); g_assert (pfont != NULL); - if (gr->debug) printf ("painting pango glyph vector\n"); + install_font_peer(gr->cr, pfont, gr->debug); - install_font_peer (gr->cr, pfont, gr->debug); - cairo_translate (gr->cr, x, y); + glyphs = malloc( sizeof(cairo_glyph_t) * n); + g_assert (glyphs != NULL); - /* nb. PangoLayoutRun is a typedef for PangoGlyphItem. */ - run = (PangoLayoutRun *) gv->glyphitems; - if (run != NULL) - paint_glyph_run (env, gr, &glyphs, &n_glyphs, run); + native_codes = (*env)->GetIntArrayElements (env, java_codes, NULL); + native_positions = (*env)->GetFloatArrayElements (env, java_positions, NULL); + + for (i = 0; i < n; ++i) + { + glyphs[i].index = native_codes[i]; + glyphs[i].x = x + native_positions[ 2*i ]; + glyphs[i].y = y + native_positions[ 2*i + 1]; + } - if (glyphs != NULL) - g_free (glyphs); + (*env)->ReleaseFloatArrayElements (env, java_positions, native_positions, 0); + (*env)->ReleaseIntArrayElements (env, java_codes, native_codes, 0); + + begin_drawing_operation (env, gr); + cairo_show_glyphs (gr->cr, glyphs, n); + end_drawing_operation (env, gr); - cairo_translate (gr->cr, -x, -y); gdk_threads_leave (); + free(glyphs); } JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGdkTextLayout - (JNIEnv *env, jobject self, jobject font, jobject java_layout, jfloat x, jfloat y) + (JNIEnv *env, jobject self, jobject java_layout, jfloat x, jfloat y) { /* * FIXME: Some day we expect either cairo or pango will know how to make @@ -1251,7 +1102,6 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D */ struct graphics2d *gr = NULL; - struct peerfont *pfont = NULL; struct textlayout *tl = NULL; PangoLayoutIter *i = NULL; PangoLayoutRun *run = NULL; @@ -1263,12 +1113,10 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D gr = (struct graphics2d *)NSA_GET_G2D_PTR (env, self); tl = (struct textlayout *)NSA_GET_TEXT_LAYOUT_PTR (env, java_layout); - pfont = (struct peerfont *) NSA_GET_FONT_PTR (env, font); g_assert (gr != NULL); g_assert (tl != NULL); g_assert (tl->pango_layout != NULL); - g_assert (pfont != NULL); if (gr->debug) printf ("painting pango layout\n"); @@ -1278,7 +1126,6 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D i = pango_layout_get_iter (tl->pango_layout); g_assert (i != NULL); - install_font_peer (gr->cr, pfont, gr->debug); cairo_translate (gr->cr, x, y); do Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c,v retrieving revision 1.16.2.3 diff -u -3 -p -u -r1.16.2.3 gnu_java_awt_peer_gtk_GtkButtonPeer.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c 20 Jan 2005 00:37:23 -0000 1.16.2.3 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c 15 Feb 2005 20:55:26 -0000 @@ -315,10 +315,12 @@ focus_in_cb (GtkWidget *widget __attribu GdkEventFocus *event __attribute((unused)), jobject peer) { + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, postFocusEventID, AWT_FOCUS_GAINED, JNI_FALSE); + gdk_threads_enter (); return FALSE; } @@ -327,21 +329,27 @@ focus_out_cb (GtkWidget *widget __attrib GdkEventFocus *event __attribute((unused)), jobject peer) { + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, postFocusEventID, AWT_FOCUS_LOST, JNI_FALSE); + gdk_threads_enter (); return FALSE; } static void block_expose_events_cb (GtkWidget *widget, jobject peer) { + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, beginNativeRepaintID); + gdk_threads_enter (); gdk_window_process_updates (widget->window, TRUE); + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, endNativeRepaintID); + gdk_threads_enter (); } Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c,v retrieving revision 1.11.2.2 diff -u -3 -p -u -r1.11.2.2 gnu_java_awt_peer_gtk_GtkChoicePeer.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c 20 Jan 2005 00:37:23 -0000 1.11.2.2 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c 15 Feb 2005 20:55:27 -0000 @@ -39,22 +39,24 @@ exception statement from your version. * #include "gtkpeer.h" #include "gnu_java_awt_peer_gtk_GtkChoicePeer.h" -static void selection_changed (GtkComboBox *combobox, gpointer data); +static void selection_changed (GtkComboBox *combobox, jobject peer); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkChoicePeer_create (JNIEnv *env, jobject obj) { GtkWidget *combobox; + jobject *gref; NSA_SET_GLOBAL_REF (env, obj); + gref = NSA_GET_GLOBAL_REF (env, obj); gdk_threads_enter (); combobox = gtk_combo_box_new_text (); g_signal_connect (combobox, "changed", - G_CALLBACK (selection_changed), obj); + G_CALLBACK (selection_changed), *gref); gdk_threads_leave (); @@ -175,7 +177,7 @@ Java_gnu_java_awt_peer_gtk_GtkChoicePeer return index; } -void selection_changed (GtkComboBox *combobox, jobject peer) +static void selection_changed (GtkComboBox *combobox, jobject peer) { jstring label; GtkTreeModel *model; Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c,v retrieving revision 1.36.2.4 diff -u -3 -p -u -r1.36.2.4 gnu_java_awt_peer_gtk_GtkComponentPeer.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c 20 Jan 2005 00:37:23 -0000 1.36.2.4 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c 15 Feb 2005 20:55:27 -0000 @@ -1054,10 +1054,12 @@ focus_in_cb (GtkWidget *widget __attribu GdkEventFocus *event __attribute((unused)), jobject peer) { + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, postFocusEventID, AWT_FOCUS_GAINED, JNI_FALSE); + gdk_threads_enter (); return FALSE; } @@ -1066,9 +1068,11 @@ focus_out_cb (GtkWidget *widget __attrib GdkEventFocus *event __attribute((unused)), jobject peer) { + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, postFocusEventID, AWT_FOCUS_LOST, JNI_FALSE); + gdk_threads_enter (); return FALSE; } Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c,v retrieving revision 1.28.2.3 diff -u -3 -p -u -r1.28.2.3 gnu_java_awt_peer_gtk_GtkEvents.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c 20 Jan 2005 00:37:23 -0000 1.28.2.3 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c 15 Feb 2005 20:55:28 -0000 @@ -883,6 +883,7 @@ pre_event_handler (GtkWidget *widget, Gd switch (event->type) { case GDK_BUTTON_PRESS: + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, postMouseEventID, AWT_MOUSE_PRESSED, @@ -894,12 +895,14 @@ pre_event_handler (GtkWidget *widget, Gd click_count, (event->button.button == 3) ? JNI_TRUE : JNI_FALSE); + gdk_threads_enter (); hasBeenDragged = FALSE; break; case GDK_BUTTON_RELEASE: { int width, height; + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, postMouseEventID, AWT_MOUSE_RELEASED, @@ -910,6 +913,7 @@ pre_event_handler (GtkWidget *widget, Gd (jint)event->button.y, click_count, JNI_FALSE); + gdk_threads_enter (); /* Generate an AWT click event only if the release occured in the window it was pressed in, and the mouse has not been dragged since @@ -921,6 +925,7 @@ pre_event_handler (GtkWidget *widget, Gd && event->button.x <= width && event->button.y <= height) { + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, postMouseEventID, AWT_MOUSE_CLICKED, @@ -931,6 +936,7 @@ pre_event_handler (GtkWidget *widget, Gd (jint)event->button.y, click_count, JNI_FALSE); + gdk_threads_enter (); } } break; @@ -941,6 +947,7 @@ pre_event_handler (GtkWidget *widget, Gd | GDK_BUTTON4_MASK | GDK_BUTTON5_MASK)) { + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, postMouseEventID, AWT_MOUSE_DRAGGED, @@ -950,44 +957,58 @@ pre_event_handler (GtkWidget *widget, Gd (jint)event->motion.y, 0, JNI_FALSE); + gdk_threads_enter (); hasBeenDragged = TRUE; } else - (*gdk_env())->CallVoidMethod (gdk_env(), peer, postMouseEventID, - AWT_MOUSE_MOVED, - (jlong)event->motion.time, - state_to_awt_mods (event->motion.state), - (jint)event->motion.x, - (jint)event->motion.y, - 0, - JNI_FALSE); + { + gdk_threads_leave (); + (*gdk_env())->CallVoidMethod (gdk_env(), peer, postMouseEventID, + AWT_MOUSE_MOVED, + (jlong)event->motion.time, + state_to_awt_mods (event->motion.state), + (jint)event->motion.x, + (jint)event->motion.y, + 0, + JNI_FALSE); + gdk_threads_enter (); + } + break; case GDK_ENTER_NOTIFY: /* We are not interested in enter events that are due to grab/ungrab and not to actually crossing boundaries */ if (event->crossing.mode == GDK_CROSSING_NORMAL) - (*gdk_env())->CallVoidMethod (gdk_env(), peer, postMouseEventID, - AWT_MOUSE_ENTERED, - (jlong)event->crossing.time, - state_to_awt_mods_with_button_states (event->crossing.state), - (jint)event->crossing.x, - (jint)event->crossing.y, - 0, - JNI_FALSE); + { + gdk_threads_leave (); + (*gdk_env())->CallVoidMethod (gdk_env(), peer, postMouseEventID, + AWT_MOUSE_ENTERED, + (jlong)event->crossing.time, + state_to_awt_mods_with_button_states (event->crossing.state), + (jint)event->crossing.x, + (jint)event->crossing.y, + 0, + JNI_FALSE); + gdk_threads_enter (); + } break; case GDK_LEAVE_NOTIFY: /* We are not interested in leave events that are due to grab/ungrab and not to actually crossing boundaries */ if (event->crossing.mode == GDK_CROSSING_NORMAL) - (*gdk_env())->CallVoidMethod (gdk_env(), peer, - postMouseEventID, - AWT_MOUSE_EXITED, - (jlong)event->crossing.time, - state_to_awt_mods_with_button_states (event->crossing.state), - (jint)event->crossing.x, - (jint)event->crossing.y, - 0, - JNI_FALSE); + { + gdk_threads_leave (); + (*gdk_env())->CallVoidMethod (gdk_env(), peer, + postMouseEventID, + AWT_MOUSE_EXITED, + (jlong)event->crossing.time, + state_to_awt_mods_with_button_states (event->crossing.state), + (jint)event->crossing.x, + (jint)event->crossing.y, + 0, + JNI_FALSE); + gdk_threads_enter (); + } break; case GDK_CONFIGURE: { @@ -1012,20 +1033,24 @@ pre_event_handler (GtkWidget *widget, Gd } break; case GDK_EXPOSE: + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, postExposeEventID, (jint)event->expose.area.x, (jint)event->expose.area.y, (jint)event->expose.area.width, (jint)event->expose.area.height); + gdk_threads_enter (); break; case GDK_FOCUS_CHANGE: + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, postFocusEventID, (jint) (event->focus_change.in) ? AWT_FOCUS_GAINED : AWT_FOCUS_LOST, JNI_FALSE); + gdk_threads_enter (); break; case GDK_KEY_PRESS: if (GTK_IS_WINDOW (widget)) @@ -1033,6 +1058,7 @@ pre_event_handler (GtkWidget *widget, Gd /* GdkEventKey *keyevent = (GdkEventKey *) event; */ /* g_printerr ("key press event: sent: %d time: %d state: %d keyval: %d length: %d string: %s hardware_keycode: %d group: %d\n", keyevent->send_event, keyevent->time, keyevent->state, keyevent->keyval, keyevent->length, keyevent->string, keyevent->hardware_keycode, keyevent->group); */ + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, postKeyEventID, (jint) AWT_KEY_PRESSED, @@ -1041,6 +1067,7 @@ pre_event_handler (GtkWidget *widget, Gd keysym_to_awt_keycode (event), keyevent_to_awt_keychar (event), keysym_to_awt_keylocation (event)); + gdk_threads_enter (); /* FIXME: generation of key typed events needs to be moved to GtkComponentPeer.postKeyEvent. If the key in a key press event is not an "action" key @@ -1054,6 +1081,7 @@ pre_event_handler (GtkWidget *widget, Gd case GDK_KEY_RELEASE: if (GTK_IS_WINDOW (widget)) { + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, postKeyEventID, (jint) AWT_KEY_RELEASED, @@ -1062,6 +1090,7 @@ pre_event_handler (GtkWidget *widget, Gd keysym_to_awt_keycode (event), keyevent_to_awt_keychar (event), keysym_to_awt_keylocation (event)); + gdk_threads_enter (); return TRUE; } else Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c,v retrieving revision 1.14.2.3 diff -u -3 -p -u -r1.14.2.3 gnu_java_awt_peer_gtk_GtkFileDialogPeer.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c 20 Jan 2005 00:37:23 -0000 1.14.2.3 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c 15 Feb 2005 20:55:28 -0000 @@ -62,15 +62,17 @@ Java_gnu_java_awt_peer_gtk_GtkFileDialog gdk_threads_enter (); - widget = gtk_file_chooser_dialog_new("", - GTK_WINDOW(parentp), - GTK_FILE_CHOOSER_ACTION_OPEN, - GTK_STOCK_OK, GTK_RESPONSE_OK, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - NULL); - - /* GtkFileChooser doesn't show hidden files by default. */ - g_object_set(GTK_FILE_CHOOSER(widget), "show_hidden", TRUE); + /* FIXME: we should be using the default gnome-vfs backend but it is + not currently thread-safe. See: + http://bugzilla.gnome.org/show_bug.cgi?id=166852 */ + widget = gtk_file_chooser_dialog_new_with_backend + ("Open File", + GTK_WINDOW(parentp), + GTK_FILE_CHOOSER_ACTION_OPEN, + "gtk+", + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + NULL); /* GtkFileSelect is not modal by default */ gtk_window_set_modal (GTK_WINDOW (widget), TRUE); @@ -221,7 +223,7 @@ handle_response (GtkDialog *dialog __att /* We only need this for the case when the user closed the window, or clicked ok or cancel. */ if (responseId != GTK_RESPONSE_DELETE_EVENT - && responseId != GTK_RESPONSE_OK + && responseId != GTK_RESPONSE_ACCEPT && responseId != GTK_RESPONSE_CANCEL) return; @@ -245,7 +247,7 @@ handle_response (GtkDialog *dialog __att return; } - if (responseId == GTK_RESPONSE_OK) { + if (responseId == GTK_RESPONSE_ACCEPT) { fileName = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (GTK_WIDGET (ptr))); str_fileName = (*gdk_env())->NewStringUTF (gdk_env(), fileName); } Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c,v retrieving revision 1.1.2.3 diff -u -3 -p -u -r1.1.2.3 gnu_java_awt_peer_gtk_GtkGenericPeer.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c 18 Jan 2005 11:38:30 -0000 1.1.2.3 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c 15 Feb 2005 20:55:28 -0000 @@ -45,9 +45,7 @@ Java_gnu_java_awt_peer_gtk_GtkGenericPee { void *ptr; - /* Remove entries from state tables */ - NSA_DEL_GLOBAL_REF (env, obj); - ptr = NSA_DEL_PTR (env, obj); + ptr = NSA_GET_PTR (env, obj); gdk_threads_enter (); @@ -57,6 +55,10 @@ Java_gnu_java_awt_peer_gtk_GtkGenericPee gdk_threads_leave (); + /* Remove entries from state tables */ + NSA_DEL_GLOBAL_REF (env, obj); + NSA_DEL_PTR (env, obj); + /* * Wake up the main thread, to make sure it re-checks the window * destruction condition. Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c,v retrieving revision 1.7.2.2 diff -u -3 -p -u -r1.7.2.2 gnu_java_awt_peer_gtk_GtkImagePainter.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c 16 Jan 2005 15:15:14 -0000 1.7.2.2 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c 15 Feb 2005 20:55:28 -0000 @@ -1,5 +1,5 @@ /* gtkimagepainter.c - Copyright (C) 1999 Free Software Foundation, Inc. + Copyright (C) 1999, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c,v retrieving revision 1.17.2.1 diff -u -3 -p -u -r1.17.2.1 gnu_java_awt_peer_gtk_GtkTextComponentPeer.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c 20 Jan 2005 00:37:23 -0000 1.17.2.1 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c 15 Feb 2005 20:55:28 -0000 @@ -492,5 +492,7 @@ static void textcomponent_changed_cb (GtkEditable *editable __attribute__((unused)), jobject peer) { + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, postTextEventID); + gdk_threads_enter (); } Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c,v retrieving revision 1.7.2.4 diff -u -3 -p -u -r1.7.2.4 gnu_java_awt_peer_gtk_GtkToolkit.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c 21 Jan 2005 02:16:36 -0000 1.7.2.4 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c 15 Feb 2005 20:55:28 -0000 @@ -1,5 +1,5 @@ /* gtktoolkit.c -- Native portion of GtkToolkit - Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -67,7 +67,9 @@ jmethodID beginNativeRepaintID; jmethodID endNativeRepaintID; jmethodID initComponentGraphicsID; +#ifdef GTK_CAIRO jmethodID initComponentGraphics2DID; +#endif jmethodID setCursorID; JavaVM *java_vm; @@ -119,7 +121,10 @@ Java_gnu_java_awt_peer_gtk_GtkToolkit_gt char *homedir, *rcpath = NULL; jclass gtkgenericpeer, gtkcomponentpeer, gtkchoicepeer, gtkwindowpeer, gtkscrollbarpeer, gtklistpeer, - gtkmenuitempeer, gtktextcomponentpeer, window, gdkgraphics, gdkgraphics2d; + gtkmenuitempeer, gtktextcomponentpeer, window, gdkgraphics; +#ifdef GTK_CAIRO + jclass gdkgraphics2d; +#endif gtkgenericpeer = (*env)->FindClass(env, "gnu/java/awt/peer/gtk/GtkGenericPeer"); @@ -188,8 +193,10 @@ Java_gnu_java_awt_peer_gtk_GtkToolkit_gt "gnu/java/awt/peer/gtk/GtkTextComponentPeer"); gdkgraphics = (*env)->FindClass (env, "gnu/java/awt/peer/gtk/GdkGraphics"); +#ifdef GTK_CAIRO gdkgraphics2d = (*env)->FindClass (env, "gnu/java/awt/peer/gtk/GdkGraphics2D"); +#endif setBoundsCallbackID = (*env)->GetMethodID (env, window, "setBoundsCallback", "(IIII)V"); @@ -236,9 +243,11 @@ Java_gnu_java_awt_peer_gtk_GtkToolkit_gt initComponentGraphicsID = (*env)->GetMethodID (env, gdkgraphics, "initComponentGraphics", "()V"); +#ifdef GTK_CAIRO initComponentGraphics2DID = (*env)->GetMethodID (env, gdkgraphics2d, "initComponentGraphics2D", "()V"); +#endif global_gtk_window_group = gtk_window_group_new (); init_dpi_conversion_factor (); Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c,v retrieving revision 1.31.2.4 diff -u -3 -p -u -r1.31.2.4 gnu_java_awt_peer_gtk_GtkWindowPeer.c --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c 20 Jan 2005 00:37:23 -0000 1.31.2.4 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c 15 Feb 2005 20:55:28 -0000 @@ -493,10 +493,12 @@ window_delete_cb (GtkWidget *widget __at GdkEvent *event __attribute__((unused)), jobject peer) { + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, postWindowEventID, (jint) AWT_WINDOW_CLOSING, (jobject) NULL, (jint) 0); + gdk_threads_enter (); } static void @@ -504,20 +506,24 @@ window_destroy_cb (GtkWidget *widget __a GdkEvent *event __attribute__((unused)), jobject peer) { + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, postWindowEventID, (jint) AWT_WINDOW_CLOSED, (jobject) NULL, (jint) 0); + gdk_threads_enter (); } static void window_show_cb (GtkWidget *widget __attribute__((unused)), jobject peer) { + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, postWindowEventID, (jint) AWT_WINDOW_OPENED, (jobject) NULL, (jint) 0); + gdk_threads_enter (); } static void @@ -528,6 +534,7 @@ window_active_state_change_cb (GtkWidget /* FIXME: not sure if this is needed or not. */ /* Remove the unused attributes if you fix the below. */ #if 0 + gdk_threads_leave (); if (GTK_WINDOW (widget)->is_active) (*gdk_env())->CallVoidMethod (gdk_env(), peer, postWindowEventID, @@ -538,6 +545,7 @@ window_active_state_change_cb (GtkWidget postWindowEventID, (jint) AWT_WINDOW_DEACTIVATED, (jobject) NULL, (jint) 0); + gdk_threads_enter (); #endif } @@ -546,6 +554,7 @@ window_focus_state_change_cb (GtkWidget GParamSpec *pspec __attribute__((unused)), jobject peer) { + gdk_threads_leave (); if (GTK_WINDOW (widget)->has_toplevel_focus) (*gdk_env())->CallVoidMethod (gdk_env(), peer, postWindowEventID, @@ -556,6 +565,7 @@ window_focus_state_change_cb (GtkWidget postWindowEventID, (jint) AWT_WINDOW_DEACTIVATED, (jobject) NULL, (jint) 0); + gdk_threads_enter (); } static gboolean @@ -563,12 +573,14 @@ window_focus_in_cb (GtkWidget * widget GdkEventFocus *event __attribute__((unused)), jobject peer) { + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, postWindowEventID, (jint) AWT_WINDOW_GAINED_FOCUS, (jobject) NULL, (jint) 0); /* FIXME: somewhere after this is handled, the child window is getting an expose event. */ + gdk_threads_enter (); return FALSE; } @@ -577,12 +589,14 @@ window_focus_out_cb (GtkWidget * widget GdkEventFocus *event __attribute__((unused)), jobject peer) { + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, postWindowEventID, (jint) AWT_WINDOW_LOST_FOCUS, (jobject) NULL, (jint) 0); /* FIXME: somewhere after this is handled, the child window is getting an expose event. */ + gdk_threads_enter (); return FALSE; } @@ -600,18 +614,22 @@ window_window_state_cb (GtkWidget *widge if (event->window_state.new_window_state & GDK_WINDOW_STATE_ICONIFIED) { /* We've been iconified. */ + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, postWindowEventID, (jint) AWT_WINDOW_ICONIFIED, (jobject) NULL, (jint) 0); + gdk_threads_enter (); } else { /* We've been deiconified. */ + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, postWindowEventID, (jint) AWT_WINDOW_DEICONIFIED, (jobject) NULL, (jint) 0); + gdk_threads_enter (); } } @@ -624,10 +642,12 @@ window_window_state_cb (GtkWidget *widge new_state |= window_get_new_state (widget); + gdk_threads_leave (); (*gdk_env())->CallVoidMethod (gdk_env(), peer, postWindowEventID, (jint) AWT_WINDOW_STATE_CHANGED, (jobject) NULL, new_state); + gdk_threads_enter (); return TRUE; } @@ -705,12 +725,17 @@ window_property_changed_cb (GtkWidget *w NULL, NULL, gu_ex.gu_extents)) - (*gdk_env())->CallVoidMethod (gdk_env(), peer, - postInsetsChangedEventID, - (jint) extents[2], /* top */ - (jint) extents[0], /* left */ - (jint) extents[3], /* bottom */ - (jint) extents[1]); /* right */ + { + gdk_threads_leave (); + (*gdk_env())->CallVoidMethod (gdk_env(), peer, + postInsetsChangedEventID, + (jint) extents[2], /* top */ + (jint) extents[0], /* left */ + (jint) extents[3], /* bottom */ + (jint) extents[1]); /* right */ + gdk_threads_enter (); + } + return FALSE; } Index: native/jni/java-nio/java_nio_VMDirectByteBuffer.c =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/java-nio/java_nio_VMDirectByteBuffer.c,v retrieving revision 1.1.2.1 diff -u -3 -p -u -r1.1.2.1 java_nio_VMDirectByteBuffer.c --- native/jni/java-nio/java_nio_VMDirectByteBuffer.c 16 Jan 2005 02:14:50 -0000 1.1.2.1 +++ native/jni/java-nio/java_nio_VMDirectByteBuffer.c 15 Feb 2005 20:55:28 -0000 @@ -1,5 +1,5 @@ /* java_nio_VMDirectByteBuffer.c - Native methods for VMDirectByteBuffer - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -55,14 +55,27 @@ static jobject NIOGetRawData (JNIEnv *, static void * NIOGetPointer (JNIEnv *env, jobject rawdata) { +#if SIZEOF_VOID_P == 4 return (void *) (*env)->GetIntField (env, rawdata, fieldNativePointer); +#elif SIZEOF_VOID_P == 8 + return (void *) (*env)->GetLongField (env, rawdata, fieldNativePointer); +#else +#error unsupported pointer size +#endif } static jobject NIOGetRawData (JNIEnv *env, void *pointer) { +#if SIZEOF_VOID_P == 4 return (*env)->NewObject (env, classRawData, methodRawDataInit, (jint) pointer); +#elif SIZEOF_VOID_P == 8 + return (*env)->NewObject (env, classRawData, methodRawDataInit, + (jlong) pointer); +#else +#error unsupported pointer size +#endif } JNIEXPORT void JNICALL @@ -94,7 +107,7 @@ Java_java_nio_VMDirectByteBuffer_init "unable to find internal field"); return; } -#else /* SIZEOF_VOID_P != 4 */ +#elif SIZEOF_VOID_P == 8 classRawData = (*env)->FindClass (env, "gnu/classpath/RawData64"); if (classRawData == NULL) { @@ -104,7 +117,7 @@ Java_java_nio_VMDirectByteBuffer_init } methodRawDataInit = (*env)->GetMethodID (env, classRawData, - "", "(L)V"); + "", "(J)V"); if (methodRawDataInit == NULL) { JCL_ThrowException(env, "java/lang/InternalError", @@ -112,14 +125,16 @@ Java_java_nio_VMDirectByteBuffer_init return; } - fieldNativePointer = (*env)->GetFieldID (env, classRawData, "data", "L"); + fieldNativePointer = (*env)->GetFieldID (env, classRawData, "data", "J"); if (fieldNativePointer == NULL) { JCL_ThrowException(env, "java/lang/InternalError", "unable to find internal field"); return; } -#endif /* SIZEOF_VOID_P != 4 */ +#else +#error unsupported pointer size +#endif } JNIEXPORT jobject JNICALL Index: vm/reference/java/lang/VMClassLoader.java =================================================================== RCS file: /cvsroot/classpath/classpath/vm/reference/java/lang/VMClassLoader.java,v retrieving revision 1.16.2.5 diff -u -3 -p -u -r1.16.2.5 VMClassLoader.java --- vm/reference/java/lang/VMClassLoader.java 3 Feb 2005 00:55:48 -0000 1.16.2.5 +++ vm/reference/java/lang/VMClassLoader.java 15 Feb 2005 20:55:28 -0000 @@ -40,11 +40,8 @@ exception statement from your version. * package java.lang; import gnu.classpath.SystemProperties; -import gnu.java.util.EmptyEnumeration; import java.io.File; -import java.io.IOException; -import java.lang.reflect.Constructor; import java.net.MalformedURLException; import java.net.URL; import java.security.ProtectionDomain; Index: vm/reference/java/lang/VMProcess.java =================================================================== RCS file: /cvsroot/classpath/classpath/vm/reference/java/lang/VMProcess.java,v retrieving revision 1.2.2.2 diff -u -3 -p -u -r1.2.2.2 VMProcess.java --- vm/reference/java/lang/VMProcess.java 16 Jan 2005 15:15:15 -0000 1.2.2.2 +++ vm/reference/java/lang/VMProcess.java 15 Feb 2005 20:55:28 -0000 @@ -38,8 +38,6 @@ exception statement from your version. * package java.lang; import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; Index: vm/reference/java/lang/VMRuntime.java =================================================================== RCS file: /cvsroot/classpath/classpath/vm/reference/java/lang/VMRuntime.java,v retrieving revision 1.5.2.1 diff -u -3 -p -u -r1.5.2.1 VMRuntime.java --- vm/reference/java/lang/VMRuntime.java 16 Jan 2005 15:15:15 -0000 1.5.2.1 +++ vm/reference/java/lang/VMRuntime.java 15 Feb 2005 20:55:28 -0000 @@ -39,7 +39,6 @@ package java.lang; import java.io.File; import java.io.IOException; -import java.util.Properties; /** * VMRuntime represents the interface to the Virtual Machine. Index: vm/reference/java/security/VMAccessController.java =================================================================== RCS file: /cvsroot/classpath/classpath/vm/reference/java/security/VMAccessController.java,v retrieving revision 1.2.2.2 diff -u -3 -p -u -r1.2.2.2 VMAccessController.java --- vm/reference/java/security/VMAccessController.java 16 Jan 2005 15:15:15 -0000 1.2.2.2 +++ vm/reference/java/security/VMAccessController.java 15 Feb 2005 20:55:28 -0000 @@ -36,14 +36,8 @@ exception statement from your version. * package java.security; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; final class VMAccessController {