aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath
diff options
context:
space:
mode:
authorTom Tromey <tromey@gcc.gnu.org>2005-09-23 21:31:04 +0000
committerTom Tromey <tromey@gcc.gnu.org>2005-09-23 21:31:04 +0000
commit1ea63ef8be1cc54dd0de9d82c684713a1dcf1e06 (patch)
tree3ca4b2e68dc14c3128b9c781d23f1d0b1f2bee49 /libjava/classpath
parent9b044d19517541c95681d35a92dbc81e6e21d94f (diff)
downloadgcc-1ea63ef8be1cc54dd0de9d82c684713a1dcf1e06.zip
gcc-1ea63ef8be1cc54dd0de9d82c684713a1dcf1e06.tar.gz
gcc-1ea63ef8be1cc54dd0de9d82c684713a1dcf1e06.tar.bz2
Imported Classpath 0.18.
* sources.am, Makefile.in: Updated. * Makefile.am (nat_source_files): Removed natProxy.cc. * java/lang/reflect/natProxy.cc: Removed. * gnu/classpath/jdwp/VMFrame.java, gnu/classpath/jdwp/VMIdManager.java, gnu/classpath/jdwp/VMVirtualMachine.java, java/lang/reflect/VMProxy.java: New files. 2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com> * scripts/makemake.tcl (verbose): Add gnu/java/awt/peer/qt to BC list. 2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com> * gnu/java/net/DefaultContentHandlerFactory.java (getContent): Remove ClasspathToolkit references. 2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com> * gnu/awt/xlib/XCanvasPeer.java: Add new peer methods. * gnu/awt/xlib/XFramePeer.java: Likewise. * gnu/awt/xlib/XGraphicsConfiguration.java: Likewise. 2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com> * Makefile.am (libgcjawt_la_SOURCES): Remove jawt.c. Add classpath/native/jawt/jawt.c. * Makefile.in: Regenerate. * jawt.c: Remove file. * include/Makefile.am (tool_include__HEADERS): Remove jawt.h and jawt_md.h. Add ../classpath/include/jawt.h and ../classpath/include/jawt_md.h. * include/Makefile.in: Regenerate. * include/jawt.h: Regenerate. * include/jawt_md.h: Regenerate. From-SVN: r104586
Diffstat (limited to 'libjava/classpath')
-rw-r--r--libjava/classpath/.classpath28
-rw-r--r--libjava/classpath/.cvsignore1
-rw-r--r--libjava/classpath/.externalToolBuilders/Configure.launch12
-rw-r--r--libjava/classpath/.project20
-rw-r--r--libjava/classpath/AUTHORS1
-rw-r--r--libjava/classpath/ChangeLog5602
-rw-r--r--libjava/classpath/ChangeLog.gcj4
-rw-r--r--libjava/classpath/INSTALL25
-rw-r--r--libjava/classpath/Makefile.am1
-rw-r--r--libjava/classpath/Makefile.in39
-rw-r--r--libjava/classpath/NEWS83
-rw-r--r--libjava/classpath/README5
-rw-r--r--libjava/classpath/aclocal.m4432
-rwxr-xr-xlibjava/classpath/autogen.sh16
-rwxr-xr-xlibjava/classpath/configure1727
-rw-r--r--libjava/classpath/configure.ac58
-rw-r--r--libjava/classpath/doc/Makefile.in37
-rw-r--r--libjava/classpath/doc/README.jaxp6
-rw-r--r--libjava/classpath/doc/api/Makefile.am2
-rw-r--r--libjava/classpath/doc/api/Makefile.in59
-rw-r--r--libjava/classpath/doc/www.gnu.org/events/events.wml48
-rw-r--r--libjava/classpath/doc/www.gnu.org/faq/faq.wml22
-rw-r--r--libjava/classpath/doc/www.gnu.org/include/layout.wml2
-rw-r--r--libjava/classpath/doc/www.gnu.org/newsitems.txt10
-rw-r--r--libjava/classpath/examples/.cvsignore1
-rw-r--r--libjava/classpath/examples/Makefile.am20
-rw-r--r--libjava/classpath/examples/Makefile.in44
-rw-r--r--libjava/classpath/examples/README26
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/Demo.java38
-rw-r--r--libjava/classpath/external/Makefile.in37
-rw-r--r--libjava/classpath/external/sax/Makefile.in17
-rw-r--r--libjava/classpath/external/w3c_dom/Makefile.in17
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/Vio.java186
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/cdrInput.java3
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/cdrOutput.java12
-rw-r--r--libjava/classpath/gnu/CORBA/Connected_objects.java63
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/NameValuePairHolder.java7
-rw-r--r--libjava/classpath/gnu/CORBA/ExceptionCreator.java9
-rw-r--r--libjava/classpath/gnu/CORBA/Functional_ORB.java809
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java27
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java39
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java138
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java4
-rw-r--r--libjava/classpath/gnu/CORBA/IOR.java351
-rw-r--r--libjava/classpath/gnu/CORBA/IOR_Delegate.java343
-rw-r--r--libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java82
-rw-r--r--libjava/classpath/gnu/CORBA/ObjectCreator.java195
-rw-r--r--libjava/classpath/gnu/CORBA/Restricted_ORB.java135
-rw-r--r--libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java37
-rw-r--r--libjava/classpath/gnu/CORBA/Simple_delegate.java33
-rw-r--r--libjava/classpath/gnu/CORBA/SocketRepository.java22
-rw-r--r--libjava/classpath/gnu/CORBA/bufferedResponseHandler.java88
-rw-r--r--libjava/classpath/gnu/CORBA/fixedTypeCode.java14
-rw-r--r--libjava/classpath/gnu/CORBA/gnuAny.java94
-rw-r--r--libjava/classpath/gnu/CORBA/gnuCodecFactory.java21
-rw-r--r--libjava/classpath/gnu/CORBA/gnuRequest.java668
-rw-r--r--libjava/classpath/gnu/CORBA/holderFactory.java123
-rw-r--r--libjava/classpath/gnu/CORBA/primitiveArrayTypeCode.java78
-rw-r--r--libjava/classpath/gnu/CORBA/primitiveTypeCode.java69
-rw-r--r--libjava/classpath/gnu/CORBA/typeNamer.java13
-rw-r--r--libjava/classpath/gnu/CORBA/universalHolder.java23
-rw-r--r--libjava/classpath/gnu/classpath/Configuration.java.in27
-rw-r--r--libjava/classpath/gnu/classpath/RawData.java47
-rw-r--r--libjava/classpath/gnu/classpath/RawData32.java52
-rw-r--r--libjava/classpath/gnu/classpath/RawData64.java52
-rw-r--r--libjava/classpath/gnu/classpath/debug/Component.java6
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/exception/InvalidThreadGroupException.java4
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/exception/JdwpInternalErrorException.java9
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/id/ClassLoaderId.java18
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/id/ClassObjectId.java18
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/id/JdwpId.java34
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/id/JdwpIdFactory.java165
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/id/ObjectId.java42
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/id/ReferenceTypeId.java18
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/id/StringId.java18
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/id/ThreadGroupId.java18
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/id/ThreadId.java21
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/CommandSet.java16
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/FieldCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/InterfaceTypeCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java104
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/PacketProcessor.java7
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java51
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java10
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java56
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/transport/ITransport.java7
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/transport/JdwpConnection.java5
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/transport/SocketTransport.java18
-rw-r--r--libjava/classpath/gnu/java/awt/AWTUtilities.java377
-rw-r--r--libjava/classpath/gnu/java/awt/ClasspathToolkit.java248
-rw-r--r--libjava/classpath/gnu/java/awt/EmbeddedWindow.java6
-rw-r--r--libjava/classpath/gnu/java/awt/peer/GLightweightPeer.java41
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics.java32
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java180
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java14
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java12
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java6
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java8
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkButtonPeer.java40
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java12
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java13
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkClipboard.java390
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java124
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkContainerPeer.java21
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java28
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java62
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkImage.java100
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkImageConsumer.java6
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkLabelPeer.java7
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java5
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java6
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuPeer.java5
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java7
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java6
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java42
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java65
-rw-r--r--libjava/classpath/gnu/java/nio/FileLockImpl.java42
-rw-r--r--libjava/classpath/gnu/java/nio/channels/FileChannelImpl.java90
-rw-r--r--libjava/classpath/gnu/java/nio/charset/UTF_16Decoder.java12
-rw-r--r--libjava/classpath/gnu/java/nio/charset/iconv/IconvDecoder.java4
-rw-r--r--libjava/classpath/gnu/java/nio/charset/iconv/IconvEncoder.java4
-rw-r--r--libjava/classpath/gnu/java/security/OID.java4
-rw-r--r--libjava/classpath/gnu/java/security/PolicyFile.java93
-rw-r--r--libjava/classpath/gnu/java/security/provider/DSAKeyPairGenerator.java121
-rw-r--r--libjava/classpath/gnu/java/security/provider/PKIXCertPathValidatorImpl.java4
-rw-r--r--libjava/classpath/gnu/javax/swing/plaf/gtk/GtkBorders.java83
-rw-r--r--libjava/classpath/gnu/javax/swing/plaf/gtk/GtkCheckBoxUI.java69
-rw-r--r--libjava/classpath/gnu/javax/swing/plaf/gtk/GtkIconFactory.java99
-rw-r--r--libjava/classpath/gnu/javax/swing/plaf/gtk/GtkLookAndFeel.java241
-rw-r--r--libjava/classpath/gnu/javax/swing/plaf/gtk/GtkRadioButtonUI.java69
-rw-r--r--libjava/classpath/gnu/javax/swing/plaf/gtk/GtkSliderUI.java230
-rw-r--r--libjava/classpath/gnu/javax/swing/plaf/gtk/README37
-rw-r--r--libjava/classpath/gnu/javax/swing/plaf/gtk/SliderTest.java82
-rw-r--r--libjava/classpath/gnu/xml/xpath/ArithmeticExpr.java28
-rw-r--r--libjava/classpath/gnu/xml/xpath/XPathParser.java74
-rw-r--r--libjava/classpath/gnu/xml/xpath/XPathParser.y74
-rw-r--r--libjava/classpath/include/Makefile.am45
-rw-r--r--libjava/classpath/include/Makefile.in173
-rw-r--r--libjava/classpath/include/config.h.in24
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_GdkGraphics.h2
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_GdkGraphics2D.h11
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_GtkButtonPeer.h1
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_GtkChoicePeer.h3
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_GtkClipboard.h7
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_GtkComponentPeer.h5
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_GtkFileDialogPeer.h2
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_GtkFramePeer.h1
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_GtkImage.h2
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_GtkLabelPeer.h1
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_GtkToolkit.h4
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_GtkWindowPeer.h5
-rw-r--r--libjava/classpath/include/java_nio_VMDirectByteBuffer.h8
-rw-r--r--libjava/classpath/java/awt/AWTKeyStroke.java20
-rw-r--r--libjava/classpath/java/awt/BorderLayout.java974
-rw-r--r--libjava/classpath/java/awt/Component.java179
-rw-r--r--libjava/classpath/java/awt/Container.java323
-rw-r--r--libjava/classpath/java/awt/EventQueue.java75
-rw-r--r--libjava/classpath/java/awt/FlowLayout.java14
-rw-r--r--libjava/classpath/java/awt/Font.java8
-rw-r--r--libjava/classpath/java/awt/FontMetrics.java6
-rw-r--r--libjava/classpath/java/awt/Frame.java25
-rw-r--r--libjava/classpath/java/awt/GraphicsConfiguration.java16
-rw-r--r--libjava/classpath/java/awt/GridBagLayout.java10
-rw-r--r--libjava/classpath/java/awt/Label.java15
-rw-r--r--libjava/classpath/java/awt/List.java1
-rw-r--r--libjava/classpath/java/awt/MenuItem.java13
-rw-r--r--libjava/classpath/java/awt/TextComponent.java2
-rw-r--r--libjava/classpath/java/awt/Toolkit.java6
-rw-r--r--libjava/classpath/java/awt/Window.java63
-rw-r--r--libjava/classpath/java/awt/datatransfer/Clipboard.java123
-rw-r--r--libjava/classpath/java/awt/datatransfer/DataFlavor.java55
-rw-r--r--libjava/classpath/java/awt/event/MouseWheelEvent.java2
-rw-r--r--libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java3
-rw-r--r--libjava/classpath/java/awt/image/ConvolveOp.java10
-rw-r--r--libjava/classpath/java/awt/image/CropImageFilter.java18
-rw-r--r--libjava/classpath/java/awt/image/DirectColorModel.java18
-rw-r--r--libjava/classpath/java/awt/image/ImageFilter.java9
-rw-r--r--libjava/classpath/java/awt/image/PixelGrabber.java20
-rw-r--r--libjava/classpath/java/awt/image/RGBImageFilter.java14
-rw-r--r--libjava/classpath/java/awt/image/ReplicateScaleFilter.java20
-rw-r--r--libjava/classpath/java/awt/peer/ComponentPeer.java45
-rw-r--r--libjava/classpath/java/awt/peer/ContainerPeer.java27
-rw-r--r--libjava/classpath/java/awt/peer/FramePeer.java20
-rw-r--r--libjava/classpath/java/awt/peer/MenuBarPeer.java1
-rw-r--r--libjava/classpath/java/awt/peer/MenuComponentPeer.java10
-rw-r--r--libjava/classpath/java/awt/peer/MenuPeer.java1
-rw-r--r--libjava/classpath/java/awt/peer/TextComponentPeer.java9
-rw-r--r--libjava/classpath/java/awt/peer/WindowPeer.java14
-rw-r--r--libjava/classpath/java/beans/Expression.java10
-rw-r--r--libjava/classpath/java/beans/Statement.java83
-rw-r--r--libjava/classpath/java/io/ObjectInputStream.java106
-rw-r--r--libjava/classpath/java/lang/Character.java165
-rw-r--r--libjava/classpath/java/lang/Class.java24
-rw-r--r--libjava/classpath/java/lang/ClassLoader.java36
-rw-r--r--libjava/classpath/java/lang/IllegalArgumentException.java56
-rw-r--r--libjava/classpath/java/lang/IllegalStateException.java57
-rw-r--r--libjava/classpath/java/lang/Integer.java10
-rw-r--r--libjava/classpath/java/lang/SecurityException.java56
-rw-r--r--libjava/classpath/java/lang/UnsupportedOperationException.java56
-rw-r--r--libjava/classpath/java/lang/reflect/Proxy.java133
-rw-r--r--libjava/classpath/java/net/DatagramSocket.java6
-rw-r--r--libjava/classpath/java/net/Inet4Address.java4
-rw-r--r--libjava/classpath/java/net/JarURLConnection.java5
-rw-r--r--libjava/classpath/java/net/NetworkInterface.java52
-rw-r--r--libjava/classpath/java/net/URLClassLoader.java32
-rw-r--r--libjava/classpath/java/nio/Buffer.java4
-rw-r--r--libjava/classpath/java/nio/DirectByteBufferImpl.java94
-rw-r--r--libjava/classpath/java/nio/MappedByteBufferImpl.java6
-rw-r--r--libjava/classpath/java/nio/channels/FileLock.java8
-rw-r--r--libjava/classpath/java/nio/charset/Charset.java30
-rw-r--r--libjava/classpath/java/rmi/server/RMIClassLoader.java4
-rw-r--r--libjava/classpath/java/security/KeyPairGenerator.java3
-rw-r--r--libjava/classpath/java/security/cert/X509CertSelector.java4
-rw-r--r--libjava/classpath/java/sql/Date.java6
-rw-r--r--libjava/classpath/java/sql/Time.java6
-rw-r--r--libjava/classpath/java/text/AttributedCharacterIterator.java58
-rw-r--r--libjava/classpath/java/text/AttributedString.java687
-rw-r--r--libjava/classpath/java/text/AttributedStringIterator.java501
-rw-r--r--libjava/classpath/java/text/BreakIterator.java31
-rw-r--r--libjava/classpath/java/text/CharacterIterator.java18
-rw-r--r--libjava/classpath/java/text/ChoiceFormat.java19
-rw-r--r--libjava/classpath/java/text/CollationElementIterator.java20
-rw-r--r--libjava/classpath/java/text/CollationKey.java6
-rw-r--r--libjava/classpath/java/text/Collator.java18
-rw-r--r--libjava/classpath/java/text/DateFormat.java52
-rw-r--r--libjava/classpath/java/text/DateFormatSymbols.java47
-rw-r--r--libjava/classpath/java/text/DecimalFormatSymbols.java15
-rw-r--r--libjava/classpath/java/text/MessageFormat.java17
-rw-r--r--libjava/classpath/java/text/NumberFormat.java50
-rw-r--r--libjava/classpath/java/text/ParseException.java2
-rw-r--r--libjava/classpath/java/text/SimpleDateFormat.java117
-rw-r--r--libjava/classpath/java/text/StringCharacterIterator.java7
-rw-r--r--libjava/classpath/java/util/Observable.java2
-rw-r--r--libjava/classpath/java/util/Properties.java33
-rw-r--r--libjava/classpath/java/util/TimeZone.java260
-rw-r--r--libjava/classpath/java/util/Vector.java8
-rw-r--r--libjava/classpath/java/util/jar/JarFile.java6
-rw-r--r--libjava/classpath/java/util/logging/Logger.java48
-rw-r--r--libjava/classpath/java/util/zip/DeflaterHuffman.java4
-rw-r--r--libjava/classpath/java/util/zip/DeflaterOutputStream.java6
-rw-r--r--libjava/classpath/java/util/zip/ZipEntry.java13
-rw-r--r--libjava/classpath/java/util/zip/ZipFile.java24
-rw-r--r--libjava/classpath/java/util/zip/ZipInputStream.java13
-rw-r--r--libjava/classpath/java/util/zip/ZipOutputStream.java45
-rw-r--r--libjava/classpath/javax/imageio/spi/IIORegistry.java1
-rw-r--r--libjava/classpath/javax/imageio/stream/ImageInputStream.java1
-rw-r--r--libjava/classpath/javax/security/auth/x500/X500Principal.java18
-rw-r--r--libjava/classpath/javax/security/sasl/Sasl.java4
-rw-r--r--libjava/classpath/javax/swing/AbstractAction.java3
-rw-r--r--libjava/classpath/javax/swing/AbstractButton.java58
-rw-r--r--libjava/classpath/javax/swing/AbstractCellEditor.java5
-rw-r--r--libjava/classpath/javax/swing/AbstractListModel.java13
-rw-r--r--libjava/classpath/javax/swing/AbstractSpinnerModel.java7
-rw-r--r--libjava/classpath/javax/swing/Action.java2
-rw-r--r--libjava/classpath/javax/swing/ActionMap.java8
-rw-r--r--libjava/classpath/javax/swing/BorderFactory.java7
-rw-r--r--libjava/classpath/javax/swing/BoundedRangeModel.java58
-rw-r--r--libjava/classpath/javax/swing/Box.java6
-rw-r--r--libjava/classpath/javax/swing/BoxLayout.java9
-rw-r--r--libjava/classpath/javax/swing/ButtonGroup.java20
-rw-r--r--libjava/classpath/javax/swing/CellRendererPane.java10
-rw-r--r--libjava/classpath/javax/swing/ComponentInputMap.java9
-rw-r--r--libjava/classpath/javax/swing/DebugGraphics.java8
-rw-r--r--libjava/classpath/javax/swing/DefaultBoundedRangeModel.java4
-rw-r--r--libjava/classpath/javax/swing/DefaultButtonModel.java20
-rw-r--r--libjava/classpath/javax/swing/DefaultCellEditor.java154
-rw-r--r--libjava/classpath/javax/swing/DefaultComboBoxModel.java4
-rw-r--r--libjava/classpath/javax/swing/DefaultDesktopManager.java4
-rw-r--r--libjava/classpath/javax/swing/DefaultFocusManager.java8
-rw-r--r--libjava/classpath/javax/swing/DefaultListCellRenderer.java12
-rw-r--r--libjava/classpath/javax/swing/DefaultListModel.java2
-rw-r--r--libjava/classpath/javax/swing/DefaultListSelectionModel.java34
-rw-r--r--libjava/classpath/javax/swing/DefaultSingleSelectionModel.java3
-rw-r--r--libjava/classpath/javax/swing/FocusManager.java8
-rw-r--r--libjava/classpath/javax/swing/GrayFilter.java6
-rw-r--r--libjava/classpath/javax/swing/Icon.java23
-rw-r--r--libjava/classpath/javax/swing/ImageIcon.java110
-rw-r--r--libjava/classpath/javax/swing/InputMap.java12
-rw-r--r--libjava/classpath/javax/swing/InputVerifier.java7
-rw-r--r--libjava/classpath/javax/swing/InternalFrameFocusTraversalPolicy.java7
-rw-r--r--libjava/classpath/javax/swing/JApplet.java5
-rw-r--r--libjava/classpath/javax/swing/JButton.java31
-rw-r--r--libjava/classpath/javax/swing/JCheckBox.java11
-rw-r--r--libjava/classpath/javax/swing/JCheckBoxMenuItem.java17
-rw-r--r--libjava/classpath/javax/swing/JColorChooser.java6
-rw-r--r--libjava/classpath/javax/swing/JComboBox.java10
-rw-r--r--libjava/classpath/javax/swing/JComponent.java218
-rw-r--r--libjava/classpath/javax/swing/JDesktopPane.java2
-rw-r--r--libjava/classpath/javax/swing/JDialog.java11
-rw-r--r--libjava/classpath/javax/swing/JEditorPane.java25
-rw-r--r--libjava/classpath/javax/swing/JFileChooser.java15
-rw-r--r--libjava/classpath/javax/swing/JFormattedTextField.java22
-rw-r--r--libjava/classpath/javax/swing/JFrame.java14
-rw-r--r--libjava/classpath/javax/swing/JLabel.java251
-rw-r--r--libjava/classpath/javax/swing/JLayeredPane.java51
-rw-r--r--libjava/classpath/javax/swing/JList.java59
-rw-r--r--libjava/classpath/javax/swing/JMenuBar.java2
-rw-r--r--libjava/classpath/javax/swing/JOptionPane.java60
-rw-r--r--libjava/classpath/javax/swing/JPasswordField.java46
-rw-r--r--libjava/classpath/javax/swing/JPopupMenu.java6
-rw-r--r--libjava/classpath/javax/swing/JScrollBar.java2
-rw-r--r--libjava/classpath/javax/swing/JScrollPane.java26
-rw-r--r--libjava/classpath/javax/swing/JSeparator.java2
-rw-r--r--libjava/classpath/javax/swing/JSlider.java66
-rw-r--r--libjava/classpath/javax/swing/JSpinner.java3
-rw-r--r--libjava/classpath/javax/swing/JSplitPane.java2
-rw-r--r--libjava/classpath/javax/swing/JTable.java265
-rw-r--r--libjava/classpath/javax/swing/JTextArea.java20
-rw-r--r--libjava/classpath/javax/swing/JTextField.java2
-rw-r--r--libjava/classpath/javax/swing/JTextPane.java581
-rw-r--r--libjava/classpath/javax/swing/JToggleButton.java23
-rw-r--r--libjava/classpath/javax/swing/JTree.java124
-rw-r--r--libjava/classpath/javax/swing/JViewport.java43
-rw-r--r--libjava/classpath/javax/swing/MenuSelectionManager.java17
-rw-r--r--libjava/classpath/javax/swing/RepaintManager.java9
-rw-r--r--libjava/classpath/javax/swing/SizeRequirements.java1
-rw-r--r--libjava/classpath/javax/swing/SortingFocusTraversalPolicy.java10
-rw-r--r--libjava/classpath/javax/swing/SpinnerListModel.java2
-rw-r--r--libjava/classpath/javax/swing/Spring.java6
-rw-r--r--libjava/classpath/javax/swing/SpringLayout.java10
-rw-r--r--libjava/classpath/javax/swing/SwingUtilities.java31
-rw-r--r--libjava/classpath/javax/swing/UIDefaults.java36
-rw-r--r--libjava/classpath/javax/swing/UIManager.java298
-rw-r--r--libjava/classpath/javax/swing/ViewportLayout.java14
-rw-r--r--libjava/classpath/javax/swing/border/AbstractBorder.java2
-rw-r--r--libjava/classpath/javax/swing/border/BevelBorder.java4
-rw-r--r--libjava/classpath/javax/swing/border/EtchedBorder.java2
-rw-r--r--libjava/classpath/javax/swing/border/LineBorder.java2
-rw-r--r--libjava/classpath/javax/swing/border/SoftBevelBorder.java4
-rw-r--r--libjava/classpath/javax/swing/border/TitledBorder.java6
-rw-r--r--libjava/classpath/javax/swing/event/DocumentEvent.java134
-rw-r--r--libjava/classpath/javax/swing/event/EventListenerList.java4
-rw-r--r--libjava/classpath/javax/swing/event/MenuKeyEvent.java2
-rw-r--r--libjava/classpath/javax/swing/event/SwingPropertyChangeSupport.java494
-rw-r--r--libjava/classpath/javax/swing/event/TreeSelectionEvent.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/BorderUIResource.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/FileChooserUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/TextUI.java15
-rw-r--r--libjava/classpath/javax/swing/plaf/UIResource.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java2
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicButtonUI.java30
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java6
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java12
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java5
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicDesktopPaneUI.java2
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicEditorPaneUI.java39
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java16
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java6
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicIconFactory.java306
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java51
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java24
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java173
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicListUI.java92
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java85
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java22
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicMenuUI.java23
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java8
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicPanelUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java6
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java105
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java2
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java8
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java270
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java11
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java12
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java785
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java463
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java2
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java13
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java6146
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicViewportUI.java8
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalBorders.java392
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java50
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxIcon.java10
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxUI.java20
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalIconFactory.java806
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameUI.java11
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalLabelUI.java47
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java85
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalSliderUI.java263
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalTabbedPaneUI.java278
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java51
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalTreeUI.java4
-rw-r--r--libjava/classpath/javax/swing/table/DefaultTableCellRenderer.java7
-rw-r--r--libjava/classpath/javax/swing/text/AbstractDocument.java1236
-rw-r--r--libjava/classpath/javax/swing/text/AttributeSet.java121
-rw-r--r--libjava/classpath/javax/swing/text/BadLocationException.java23
-rw-r--r--libjava/classpath/javax/swing/text/Caret.java168
-rw-r--r--libjava/classpath/javax/swing/text/ComponentView.java18
-rw-r--r--libjava/classpath/javax/swing/text/DateFormatter.java2
-rw-r--r--libjava/classpath/javax/swing/text/DefaultCaret.java293
-rw-r--r--libjava/classpath/javax/swing/text/DefaultEditorKit.java590
-rw-r--r--libjava/classpath/javax/swing/text/DefaultStyledDocument.java307
-rw-r--r--libjava/classpath/javax/swing/text/FieldView.java5
-rw-r--r--libjava/classpath/javax/swing/text/GapContent.java360
-rw-r--r--libjava/classpath/javax/swing/text/InternationalFormatter.java2
-rw-r--r--libjava/classpath/javax/swing/text/JTextComponent.java27
-rw-r--r--libjava/classpath/javax/swing/text/PasswordView.java170
-rw-r--r--libjava/classpath/javax/swing/text/PlainDocument.java16
-rw-r--r--libjava/classpath/javax/swing/text/PlainView.java18
-rw-r--r--libjava/classpath/javax/swing/text/StyledEditorKit.java569
-rw-r--r--libjava/classpath/javax/swing/text/View.java140
-rw-r--r--libjava/classpath/javax/swing/text/html/HTMLEditorKit.java7
-rw-r--r--libjava/classpath/javax/swing/text/html/parser/DTD.java7
-rw-r--r--libjava/classpath/javax/swing/text/html/parser/DTDConstants.java6
-rw-r--r--libjava/classpath/javax/swing/text/html/parser/DocumentParser.java12
-rw-r--r--libjava/classpath/javax/swing/text/html/parser/Element.java2
-rw-r--r--libjava/classpath/javax/swing/text/html/parser/Parser.java12
-rw-r--r--libjava/classpath/javax/swing/text/html/parser/ParserDelegator.java4
-rw-r--r--libjava/classpath/javax/swing/tree/AbstractLayoutCache.java14
-rw-r--r--libjava/classpath/javax/swing/tree/DefaultTreeCellEditor.java520
-rw-r--r--libjava/classpath/javax/swing/tree/DefaultTreeCellRenderer.java1216
-rw-r--r--libjava/classpath/javax/swing/tree/DefaultTreeModel.java924
-rw-r--r--libjava/classpath/javax/swing/tree/DefaultTreeSelectionModel.java2
-rw-r--r--libjava/classpath/javax/swing/tree/FixedHeightLayoutCache.java2
-rw-r--r--libjava/classpath/javax/xml/datatype/DatatypeFactory.java10
-rw-r--r--libjava/classpath/javax/xml/namespace/QName.java78
-rw-r--r--libjava/classpath/javax/xml/parsers/DocumentBuilder.java2
-rw-r--r--libjava/classpath/javax/xml/parsers/SAXParser.java2
-rw-r--r--libjava/classpath/javax/xml/transform/Source.java2
-rw-r--r--libjava/classpath/lib/.cvsignore3
-rw-r--r--libjava/classpath/lib/Makefile.am26
-rw-r--r--libjava/classpath/lib/Makefile.gcj7
-rw-r--r--libjava/classpath/lib/Makefile.in41
-rwxr-xr-xlibjava/classpath/lib/gen-classlist.sh.in5
-rwxr-xr-xlibjava/classpath/lib/split-for-gcj.sh38
-rw-r--r--libjava/classpath/lib/standard.omit4
-rw-r--r--libjava/classpath/ltcf-c.sh2
-rw-r--r--libjava/classpath/ltcf-cxx.sh2
-rw-r--r--libjava/classpath/ltcf-gcj.sh2
-rwxr-xr-xlibjava/classpath/ltconfig6
-rw-r--r--libjava/classpath/m4/acinclude.m417
-rw-r--r--libjava/classpath/native/Makefile.am8
-rw-r--r--libjava/classpath/native/Makefile.in42
-rw-r--r--libjava/classpath/native/fdlibm/Makefile.in17
-rw-r--r--libjava/classpath/native/jni/Makefile.am10
-rw-r--r--libjava/classpath/native/jni/Makefile.in44
-rw-r--r--libjava/classpath/native/jni/classpath/Makefile.am3
-rw-r--r--libjava/classpath/native/jni/classpath/Makefile.in20
-rw-r--r--libjava/classpath/native/jni/classpath/classpath_jawt.h72
-rw-r--r--libjava/classpath/native/jni/classpath/jcl.c91
-rw-r--r--libjava/classpath/native/jni/classpath/jcl.h11
-rw-r--r--libjava/classpath/native/jni/classpath/native_state.c28
-rw-r--r--libjava/classpath/native/jni/gtk-peer/Makefile.am2
-rw-r--r--libjava/classpath/native/jni/gtk-peer/Makefile.in28
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c8
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c119
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c259
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c16
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c4
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c95
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c4
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c25
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c456
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c100
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c139
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c45
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c7
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c117
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c38
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c12
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c4
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c2
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c90
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c181
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gtkpeer.h28
-rw-r--r--libjava/classpath/native/jni/java-io/Makefile.in17
-rw-r--r--libjava/classpath/native/jni/java-lang/Makefile.in17
-rw-r--r--libjava/classpath/native/jni/java-lang/java_lang_VMDouble.c5
-rw-r--r--libjava/classpath/native/jni/java-net/Makefile.in17
-rw-r--r--libjava/classpath/native/jni/java-net/gnu_java_net_PlainSocketImpl.c1
-rw-r--r--libjava/classpath/native/jni/java-nio/Makefile.in17
-rw-r--r--libjava/classpath/native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c185
-rw-r--r--libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c26
-rw-r--r--libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c28
-rw-r--r--libjava/classpath/native/jni/java-nio/java_nio_MappedByteBufferImpl.c197
-rw-r--r--libjava/classpath/native/jni/java-nio/java_nio_VMDirectByteBuffer.c138
-rw-r--r--libjava/classpath/native/jni/java-util/Makefile.in17
-rw-r--r--libjava/classpath/native/jni/xmlj/Makefile.in17
-rw-r--r--libjava/classpath/native/jni/xmlj/xmlj_util.c27
-rw-r--r--libjava/classpath/native/target/Linux/Makefile.in17
-rw-r--r--libjava/classpath/native/target/Makefile.in37
-rw-r--r--libjava/classpath/native/target/generic/Makefile.in17
-rw-r--r--libjava/classpath/native/target/generic/target_generic_network.h10
-rw-r--r--libjava/classpath/org/omg/CORBA/Any.java12
-rw-r--r--libjava/classpath/org/omg/CORBA/DynAnyPackage/Invalid.java59
-rw-r--r--libjava/classpath/org/omg/CORBA/DynAnyPackage/InvalidSeq.java58
-rw-r--r--libjava/classpath/org/omg/CORBA/DynAnyPackage/InvalidValue.java58
-rw-r--r--libjava/classpath/org/omg/CORBA/DynAnyPackage/TypeMismatch.java58
-rw-r--r--libjava/classpath/org/omg/CORBA/ORB.java209
-rw-r--r--libjava/classpath/org/omg/CORBA/ObjectHelper.java7
-rw-r--r--libjava/classpath/org/omg/CORBA/ObjectHolder.java17
-rw-r--r--libjava/classpath/org/omg/CORBA/ServiceDetailHelper.java13
-rw-r--r--libjava/classpath/org/omg/CORBA/TypeCode.java66
-rw-r--r--libjava/classpath/org/omg/CORBA/package.html106
-rw-r--r--libjava/classpath/org/omg/CORBA/portable/ObjectImpl.java11
-rw-r--r--libjava/classpath/org/omg/CORBA_2_3/portable/InputStream.java13
-rw-r--r--libjava/classpath/org/omg/CORBA_2_3/portable/OutputStream.java2
-rw-r--r--libjava/classpath/org/omg/CosNaming/NamingContextOperations.java2
-rw-r--r--libjava/classpath/org/omg/CosNaming/_NamingContextExtImplBase.java2
-rw-r--r--libjava/classpath/org/omg/CosNaming/_NamingContextImplBase.java3
-rw-r--r--libjava/classpath/org/omg/IOP/ServiceContext.java2
-rw-r--r--libjava/classpath/org/omg/IOP/TaggedComponentHelper.java89
-rw-r--r--libjava/classpath/org/omg/IOP/TaggedProfileHelper.java93
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/LOCATION_FORWARD.java5
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateName.java36
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java23
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidName.java23
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHelper.java8
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/SUCCESSFUL.java3
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/SYSTEM_EXCEPTION.java3
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/TRANSPORT_RETRY.java5
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/USER_EXCEPTION.java3
-rw-r--r--libjava/classpath/resource/Makefile.am4
-rw-r--r--libjava/classpath/resource/Makefile.in21
-rw-r--r--libjava/classpath/resource/japhar-0.09.patch.1305
-rw-r--r--libjava/classpath/resource/orp-1.0.8.patch19
-rw-r--r--libjava/classpath/resource/orp-1.0.9.patch25
-rw-r--r--libjava/classpath/scripts/Makefile.in17
-rwxr-xr-xlibjava/classpath/scripts/check_jni_methods.sh41
-rwxr-xr-xlibjava/classpath/scripts/timezones.pl32
-rw-r--r--libjava/classpath/scripts/tzabbrevs2
-rw-r--r--libjava/classpath/vm/reference/java/lang/VMClass.java32
-rw-r--r--libjava/classpath/vm/reference/java/lang/VMClassLoader.java7
-rw-r--r--libjava/classpath/vm/reference/java/net/VMNetworkInterface.java10
-rw-r--r--libjava/classpath/vm/reference/java/nio/VMDirectByteBuffer.java23
526 files changed, 33600 insertions, 14372 deletions
diff --git a/libjava/classpath/.classpath b/libjava/classpath/.classpath
index 0689e09..5131536 100644
--- a/libjava/classpath/.classpath
+++ b/libjava/classpath/.classpath
@@ -1,24 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry excluding="compat/|examples/|external/|gnu/javax/swing/plaf/|test/|testsuite/|vm/reference/" kind="src" path="">
- <attributes>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" path="vm/reference">
- <attributes>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" path="external/sax">
- <attributes>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" path="external/w3c_dom">
- <attributes>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" path="examples">
- <attributes>
- </attributes>
- </classpathentry>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry excluding="compat/|examples/|external/|gnu/classpath/jdwp/|gnu/javax/swing/plaf/|test/|testsuite/|vm/reference/|resource/" kind="src" path=""/>
+ <classpathentry kind="src" path="resource"/>
+ <classpathentry excluding="gnu/classpath/jdwp/" kind="src" path="vm/reference"/>
+ <classpathentry kind="src" path="external/sax"/>
+ <classpathentry kind="src" path="external/w3c_dom"/>
+ <classpathentry kind="src" path="examples"/>
+ <classpathentry kind="output" path="install/share/classpath"/>
</classpath>
diff --git a/libjava/classpath/.cvsignore b/libjava/classpath/.cvsignore
index 8d1d08c1..83b1bb6 100644
--- a/libjava/classpath/.cvsignore
+++ b/libjava/classpath/.cvsignore
@@ -9,3 +9,4 @@ Makefile
stamp-h
stamp-h.in
autom4te*.cache
+install
diff --git a/libjava/classpath/.externalToolBuilders/Configure.launch b/libjava/classpath/.externalToolBuilders/Configure.launch
index acf9b35..575eb7b 100644
--- a/libjava/classpath/.externalToolBuilders/Configure.launch
+++ b/libjava/classpath/.externalToolBuilders/Configure.launch
@@ -1,10 +1,2 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
-<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
-<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
-<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/>
-<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${build_project}"/>
-<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${build_project}/configure"/>
-<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
-<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
-</launchConfiguration>
+<?xml version='1.0'?>
+<launchConfiguration type='org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType'><stringAttribute key='org.eclipse.debug.core.ATTR_REFRESH_SCOPE' value='${project}'/><stringAttribute key='org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS' value='full,incremental,'/><stringAttribute key='org.eclipse.ui.externaltools.ATTR_LOCATION' value='${build_project}/configure'/><stringAttribute key='org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY' value='${build_project}'/><booleanAttribute key='org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED' value='true'/><stringAttribute key='org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS' value='--prefix=${build_project}/install'/><booleanAttribute key='org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND' value='false'/><booleanAttribute key='org.eclipse.debug.core.appendEnvironmentVariables' value='true'/></launchConfiguration> \ No newline at end of file
diff --git a/libjava/classpath/.project b/libjava/classpath/.project
index 92d714d..f9372aa 100644
--- a/libjava/classpath/.project
+++ b/libjava/classpath/.project
@@ -26,6 +26,26 @@
</arguments>
</buildCommand>
<buildCommand>
+ <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ <dictionary>
+ <key>LaunchConfigHandle</key>
+ <value>&lt;project&gt;/.externalToolBuilders/CreateLocaleData.launch</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ <dictionary>
+ <key>LaunchConfigHandle</key>
+ <value>&lt;project&gt;/.externalToolBuilders/CompileNative.launch</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
diff --git a/libjava/classpath/AUTHORS b/libjava/classpath/AUTHORS
index 53255d1..2f021ea 100644
--- a/libjava/classpath/AUTHORS
+++ b/libjava/classpath/AUTHORS
@@ -20,6 +20,7 @@ Michael Koch (konqueror@gmx.de)
John Keiser (jkeiser@iname.com)
John Leuner (jewel@debian.org)
Warren Levy (warrenl@cygnus.com)
+Sven de Marothy (sven@physto.se)
Bryce McKinlay (bryce@waitaki.otago.ac.nz)
Audrius Meskauskas (audriusa@Bioinformatics.org)
Aaron M. Renn (arenn@urbanophile.com)
diff --git a/libjava/classpath/ChangeLog b/libjava/classpath/ChangeLog
index 71ae0c5..6463f49 100644
--- a/libjava/classpath/ChangeLog
+++ b/libjava/classpath/ChangeLog
@@ -1,3 +1,5605 @@
+2005-09-06 Mark Wielaard <mark@klomp.org>
+
+ * NEWS: Add new features for 0.18.
+ * configure.ac: Set version to 0.18.
+
+2005-09-06 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * native/jni/gtk-peer/gtkpeer.h (SYNCHRONIZE_GDK): Define.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c (gtkInit)
+ [SYNCHRONIZE_GDK]: Make GDK synchronous.
+
+2005-09-05 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ PR awt/20720
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (get_first_keyval_from_keymap): Return -1 if no keyval was found
+ for given hardware keycode.
+ (keysym_to_awt_keycode): Likewise.
+ (keysym_to_awt_keylocation): Likewise.
+ (key_press_cb): Return immediately if no keyval was found for
+ given hardware keycode.
+ (key_release_cb): Likewise.
+
+2005-09-05 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * native/jni/Makefile.am (all-local): Invoke $(SHELL) to execute
+ the script.
+
+ * scripts/check_jni_methods.sh: Make script working with non GNU
+ grep versions.
+
+2005-09-05 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/event/DocumentEvent.java:
+ (ElementChange) Made inner interface static to conform to the specs.
+
+2005-09-05 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JDesktopPane.java: Fixed typo in class description.
+ * javax/swing/JEditorPane.java: Removed unneeded import.
+ Added class description.
+ * javax/swing/JDialog.java: Made class description more useful.
+ * javax/swing/JFileChooser.java: Added class description.
+ * javax/swing/JFormattedTextField.java: Added class description.
+ (AbstractFormatter): Likewise.
+ (AbstractFormatterFactory): Likewise.
+ * javax/swing/JFrame.java: Made class description more useful.
+
+2005-09-05 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/event/DocumentEvent.java:
+ Reindented file to conform to our coding standards.
+
+2005-09-05 Chris Burdess <dog@gnu.org>
+
+ * gnu/xml/stream/XMLEventAllocatorImpl.java,
+ gnu/xml/stream/XMLInputFactoryImpl.java,
+ gnu/xml/stream/XMLStreamReaderImpl.java: Various fixes from system
+ testing.
+ * javax/xml/namespace/QName.java: Avoid unnecessary test.
+
+2005-09-05 Mark Wielaard <mark@klomp.org>
+
+ * lib/standard.omit: Add gnu/xml/stream and javax/xml/stream.
+ * NEWS: Describe Untested/Disabled new features.
+
+2005-09-04 Mark Wielaard <mark@klomp.org>
+
+ * configure.ac (AC_CONFIG_FILES): Add examples/Makefile.jawt.
+ * examples/.cvsignore: Add Makefile.jawt.
+ * examples/Makefile.am (EXAMPLE_C_FILES): New variable.
+ (ALL_EXAMPLE_FILES): Likewise.
+ (install-data-local): Use ALL_EXAMPLE_FILES and add Makefile.jawt.
+ (uninstall-local): Likewise.
+ (EXTRA_DIST): Add Makefile.awt.in.
+ * examples/Makefile.jawt.in: New file.
+ * examples/README: Add jawt instructions.
+ * examples/gnu/classpath/examples/jawt/DemoJAWT.c
+ (Java_DemoJAWT_paint): Rename to
+ Java_gnu_classpath_examples_jawt_DemoJAWT_paintIt.
+ (Java_gnu_classpath_examples_jawt_DemoJAWT_paintIt): Flip foreground
+ color based on on parameter.
+ * examples/gnu/classpath/examples/jawt/DemoJAWT.java (paint): Renamed
+ paintIt.
+ (paint): Call paintIt.
+ (on): New boolean field.
+ (main): Add Frame name, switch on variable every 0.5 seconds and call
+ Frame.repaint().
+ * examples/gnu/classpath/examples/jawt/Makefile: Removed.
+ * include/Makefile.am (include_HEADERS): New for jni.h, jni_md.h,
+ jawt.h and jawt_md.h.
+
+2005-09-05 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/lang/reflect/Proxy.java
+ (sameTypes): Removed.
+ (equals): Fixed bug #23727.
+
+2005-09-04 Mark Wielaard <mark@klomp.org>
+
+ * gnu/classpath/jdwp/event/filters/ClassMatchFilter.java
+ (matches): Remove InvalidClassException since it is never thrown.
+ * vm/reference/gnu/classpath/jdwp/VMIdManager.java
+ (newReferenceTypeId): Only return null when SoftReference is cleared,
+ don't catch InstantiationException or IllegalAccessException since
+ they are never thrown.
+
+2005-09-04 Mark Wielaard <mark@klomp.org>
+
+ * gnu/CORBA/NamingService/NamingServiceTransient.java: Re-un-indent
+ boilerplate.
+
+2005-09-04 Mark Wielaard <mark@klomp.org>
+
+ * gnu/CORBA/Interceptor/Registrator.java (m_prefix): Mark static.
+ * gnu/java/awt/peer/qt/QtButtonPeer.java: Replace uses of
+ toolkit.eventQueue.postEvent() with QtToolkit.eventQueue.postEvent().
+ * gnu/java/awt/peer/qt/QtCheckboxPeer.java: Likewise.
+ * gnu/java/awt/peer/qt/QtChoicePeer.java: Likewise.
+ * gnu/java/awt/peer/qt/QtComponentPeer.java: Likewise and similar
+ for guiThread and graphicsEnv.
+ * gnu/java/awt/peer/qt/QtListPeer.java: Likewise.
+ * gnu/java/awt/peer/qt/QtMenuItemPeer.java: Likewise.
+ * gnu/java/awt/peer/qt/QtMenuPeer.java: Likewise.
+ * gnu/java/awt/peer/qt/QtScrollbarPeer.java: Likewise.
+ * gnu/java/awt/peer/qt/QtTextAreaPeer.java: Likewise.
+ * gnu/java/awt/peer/qt/QtTextFieldPeer.java: Likewise.
+
+2005-09-04 Chris Burdess <dog@gnu.org>
+
+ * doc/README.jaxp: Updated JAXP documentation for StAX.
+ * javax/xml/stream/XMLEventFactory.java,
+ * javax/xml/stream/XMLInputFactory.java,
+ * javax/xml/stream/XMLOutputFactory.java: Use GNU implementation by
+ default.
+
+2005-09-04 Andreas Tobler <a.tobler@schweiz.ch>
+
+ Fix for bug #23653
+ * lib/Makefile.am (metafiles): Use find -name -prune not -path.
+
+2005-09-04 Mark Wielaard <mark@klomp.org>
+
+ * NEWS: Add description of new awt.datatransfer functionality.
+
+2005-09-04 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/text/AbstractDocument.java
+ (LeafElement.LeafElement): Set startPos and endPos through
+ createPosition() if parent is null.
+
+2005-09-04 Chris Burdess <dog@gnu.org>
+
+ * gnu/xml/stream: StAX implementation.
+
+2005-09-04 Guilhem Lavaux <guilhem@kaffe.org>
+
+ * java/lang/Integer.java
+ (parseInt): Added some messages to the exception thrown by this
+ method.
+
+2005-09-04 Chris Burdess <dog@gnu.org>
+
+ * javax/xml/stream/XMLEventFactory.java,
+ * javax/xml/stream/XMLEventWriter.java,
+ * javax/xml/stream/XMLInputFactory.java,
+ * javax/xml/stream/XMLOutputFactory.java,
+ * javax/xml/stream/XMLResolver.java,
+ * javax/xml/stream/XMLStreamConstants.java,
+ * javax/xml/stream/events/Attribute.java,
+ * javax/xml/stream/events/EndEntity.java,
+ * javax/xml/stream/events/EntityDeclaration.java,
+ * javax/xml/stream/events/EntityReference.java,
+ * javax/xml/stream/events/StartEntity.java,
+ * javax/xml/stream/events/XMLEvent.java,
+ * javax/xml/stream/util/EventReaderDelegate.java:
+ StAX API changes to conform to JWSDP 1.5.
+
+2005-09-03 Mark Wielaard <mark@klomp.org>
+
+ Fixes bug #23701
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
+ (clipboard_owner_change_cb): Only used when GTK_MINOR_VERSION > 4.
+ (Java_gnu_java_awt_peer_gtk_GtkClipboard_initNativeState):
+ Only request owner-change events for GTK_MINOR_VERSION > 4.
+ (clipboard_get_func): Only handle pixbuf and uri when
+ GTK_MINOR_VERSION > 4.
+ (Java_gnu_java_awt_peer_gtk_GtkClipboard_advertiseContent): Only call
+ gtk_target_list_add_* functions when GTK_MINOR_VERSION > 4. Similar
+ for gtk_clipboard_set_can_store.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
+ (Java_gnu_java_awt_peer_gtk_GtkImage_drawPixelsScaledFlipped): Mark
+ flipx and flipy unused for GTK_MINOR_VERSION <= 4.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c
+ (clipboard_targets_received): Don't handle images for
+ GTK_MINOR_VERSION <= 4.
+ (Java_gnu_java_awt_peer_gtk_GtkSelection_requestImage): Likewise.
+ (clipboard_uris_received): Likewise for text/uri-list.
+ (Java_gnu_java_awt_peer_gtk_GtkSelection_requestURIs): Likewise.
+
+2005-09-03 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * autogen.sh: Document libtool version needed for Darwin.
+ (LIBTOOLIZE): Don't special case Darwin, always use libtoolize.
+
+2005-09-03 Chris Burdess <dog@gnu.org>
+
+ * javax/xml/stream,
+ * javax/xml/stream/events,
+ * javax/xml/stream/util:
+ New StAX API classes.
+
+2005-09-02 Keith Seitz <keiths@redhat.com>
+
+ * gnu/classpath/jdwp/transport/ITransport.java (shutdown): New method.
+ * gnu/classpath/jdwp/transport/JdwpConnection.java (JdwpConnection):
+ Add ThreadGroup argument.
+ * gnu/classpath/jdwp/transport/SocketTransport.java (shutdown):
+ New method.
+
+2005-09-02 Keith Seitz <keiths@redhat.com>
+
+ * gnu/classpath/jdwp/Jdwp.java: New file.
+ * gnu/classpath/jdwp/JdwpConstants.java: New file.
+ * vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java: New file.
+
+2005-09-02 Keith Seitz <keiths@redhat.com>
+
+ * gnu/classpath/jdwp/processor/CommandSet.java [vm]: Remove.
+ VMVirtualMachine is entirely static.
+ * gnu/classpath/jdwp/event/EventManager.java (requestEvent)
+ (deleteRequest, clearRequests): Change all VMVirtualMachine calls
+ to reflect new API.
+ * gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java
+ (executeVisibleClasses): Likewise.
+ * gnu/classpath/jdwp/processor/ClassTypeCommandSet.java
+ (invokeMethod): Likewise.
+ * gnu/classpath/jdwp/processor/MethodCommandSet.java
+ (executeLineTable, executeVariableTable): Likewise.
+ * gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java
+ (executeInvokeMethod): Likewise.
+ * gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
+ (executeSourceFile, executeStatus): Likewise.
+ * gnu/classpath/jdwp/processor/StackFrameCommandSet.java
+ (executeGetValues, ,executeSetValues, executeThisObject): Likewise.
+ * gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java
+ (executeSuspend, executeResume, executeStatus, executeFrames)
+ (executeFrameCount, executeSuspendCount): Likewise.
+ * gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
+ (executeClassesBySignature, executeClassesBySignature)
+ (executeAllClasses, executeDispose, executeSuspend)
+ (executeResume): Likewise.
+
+2005-09-02 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/CosNaming/NamingContextOperations.java:
+ Do not inherit from CORBA object.
+ * org/omg/CosNaming/_NamingContextExtImplBase.java (_methods),
+ * omg/CosNaming/_NamingContextImplBase.java (methods):
+ Made package private.
+ * omg/CosNaming/NamingContextPOA.java,
+ * omg/CosNaming/NamingContextExtPOA.java,
+ * org/omg/CosNaming/BindingIteratorPOA.java: New files.
+
+2005-09-02 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * java/awt/image/CropImageFilter.java
+ (setPixels(int,int,int,int,ColorModel,byte[],int,int)): Set
+ consumer pixels at 0, 0 location.
+ (setPixels(int,int,int,int,ColorModel,int[],int,int)): Likewise.
+
+2005-09-02 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (mousepressed): Fixed, so that clicking on control icon will not
+ start editing.
+
+2005-09-02 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JTree.java:
+ (getScrollableTracksViewportHeight): Return true if parent is a
+ JViewport and parent's height is smaller than ours.
+ (getScrollableTracksViewportWidth): Return true if parent is a
+ JViewport and parent's width is smaller than ours.
+
+2005-09-02 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTree.java
+ (installUI): TreeSelectionListener removed because added too many
+ times.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java:
+ Fixed names for some tree defaults.
+ * javax/swing/plaf/basic/BasicTreeUI.java:
+ Added new fields for editing and keyboard actions.
+ (setCellEditor): Took out unneeded if statement.
+ (isEditing): Returned boolean instead.
+ (updateCellEditor): Used set method.
+ (installDefaults): Set focus to tree.
+ (installKeyBoardActions): Implemented.
+ (convertModifiers): New function implemented.
+ (installUI): Used set method and initialized isEditing.
+ (startEditing): set isEditing.
+ (TreeAction): New class implemented to perform keyboard actions.
+ (ActionListenerProxy): New private class used to distribute the key
+ board actions to the true receiver.
+ (editingStopped): Added code to prevent NPEs. set isEditing and focus
+ to tree. Also, removed TreeSelectionListeners for cellEditor.
+ (editingCanceled): Likewise.
+ (keyPressed): Removed code, not needed anymore.
+ (actionPerformed): Implemented for up/down keyboard actions.
+ (actionPerformed): Implemented for left/right keyboard actions.
+ * javax/swing/tree/DefaultTreeCellEditor.java
+ (DefaultTreeCellEditor): Set lastPath.
+ (isCellEditable): editingComponent should be configured if has not
+ been.
+ (stopCellEditing): No need to set cell editor to null here.
+ (cancelCellEditing): Likewise.
+ (valueChanged): Set tPath to the path that was last selected. Used for
+ the click-pause-click implementation.
+ (actionPerformed): Re-implemented in a simplier fashion.
+ * javax/swing/tree/DefaultTreeCellRenderer.java
+ (getTreeCellRendererComponent): Only set border color if val is lead
+ selection path.
+
+2005-09-02 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/Interceptor/ClientRequestInterceptors.java (send_poll):
+ remove ForwardRequest from declaration.
+
+2005-09-02 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableInterceptor/CurrentOperations.java:
+ Inherit from org.omg.CORBA.CurrentOperations.
+ * org/omg/PortableInterceptor/ClientRequestInterceptorOperations.java
+ (send_poll): Remove ForwardRequest from declaration.
+
+2005-09-02 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JList.java:
+ (getPreferredScrollableViewportSize): Implemented.
+
+2005-09-02 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/IOR_Delegate.java (request),
+ * gnu/CORBA/SocketRepository.java (get_socket),
+ * gnu/CORBA/gnuRequest (getParameterStream),
+ * gnu/CORBA/NamingService/NameParser.java,
+ * gnu/CORBA/NamingService/NamingServiceTransient.java: Rewritten.
+ * gnu/CORBA/Functional_ORB.java (nameParser): New field.
+ (string_to_object): Rewritten.
+ (ior_to_object): Made public.
+ * org/omg/CORBA/ORB.java (string_to_object):
+ Documentation update.
+
+2005-09-02 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JTree.java:
+ (getPreferredScrollableViewportSize): Implemented.
+
+2005-09-02 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): set correct value for
+ 'InternalFrame.titleFont'.
+
+2005-09-02 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/awt/ClasspathToolkit.java (registerImageIOSpis):
+ Reintroduced (empty) method.
+ * gnu/java/awt/peer/gtk/GtkToolkit.java (static): Moved initialization
+ of imageIOSpis to new registerImageIOSpis() method.
+ (registerImageIOSpis): New (overloaded) method.
+ * javax/imageio/spi/IIORegistry.java (IIORegistry): Call to Toolkit
+ registration method if instanceof ClasspathToolkit.
+
+2005-09-02 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ PR awt/22979
+ * gnu/java/awt/peer/gtk/GtkImage.java,
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c (GtkImage()):
+ New constructor.
+ (drawPixelsScaled): Return immediately if width or height is <= 0.
+ (drawPixelsScaledFlipped): Likewise for srcwidth, srcheight,
+ dstwidth, dstheight.
+ * gnu/java/awt/peer/gtk/GtkToolkit.java (createImage(String)):
+ Create a blank image when filename is "".
+ * javax/swing/ImageIcon.java (ImageIcon(String)): Mention blank
+ icons in documentation.
+ (ImageIcon(String,String)): Likewise.
+
+2005-09-02 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ PR awt/23557
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java (drawString(String,
+ float, float)): Return immediately if string is null or
+ zero-length.
+
+2005-09-02 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ PR awt/20014
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java (static): Always call
+ initStaticState.
+
+2005-09-02 Robert Schuster <robertschuster@fsfe.org>
+
+ * README: Added MysaifuVM to list of VMs
+ * INSTALL: Added info about Qt4 and ecj.
+
+2005-09-01 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ PR awt/23536
+ * gnu/java/awt/peer/gtk/GtkImage.java,
+ gnu_java_awt_peer_gtk_GtkImage.c (GtkImage(URL)): New constructor.
+ (GtkImage(byte[])) New constructor.
+ (loadImageFromData): New method.
+ * gnu/java/awt/peer/gtk/GtkToolkit.java (createImage(URL)): Call
+ GtkImage(URL) constructor.
+ (createImage(byte[],int,int)): Call GtkImage(byte[]) constructor.
+ * include/gnu_java_awt_peer_gtk_GtkImage.h: Regenerate.
+
+2005-09-01 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/awt/ClasspathToolkit.java (getFont): Get non-public
+ constructor from Font. Chain "cannot happen" exceptions in
+ AssertionError.
+
+2005-09-01 Mark Wielaard <mark@klomp.org>
+
+ * java/util/jar/JarFile.java (JarEnumeration.nextElement): Only
+ readSignature when verifying jar.
+ (getEntry): Likewise.
+
+2005-09-01 Anthony Balkissoon <abalkiss@redhat.com>
+
+ Fixes bug #23204
+ * javax/swing/ViewportLayout.java:
+ (preferredLayoutSize): If the view is scrollable, call its
+ getPreferredScrollableViewportSize method.
+ (layoutContainer): If the view is scrollable, check its
+ getScrollableTracksViewportWidth and getScrollableTracksViewportHeight
+ methods before resizing the view to match the viewport.
+
+2005-09-01 Mark Wielaard <mark@klomp.org>
+
+ * native/jni/gtk-peer/gtk_jawt.c
+ (classpath_jawt_get_visualID): Cast returned NULL to VisualID.
+ (classpath_jawt_get_drawable): Cast returned NULL to Drawable.
+
+2005-09-01 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java:
+ Added new field to keep track of contents in newly edited cell.
+ (isEditing): Made more intuitive.
+ (stopEditing): Changed because it was causing an infinite loop.
+ (installUI): Should be set to true when set.
+ (completeEditing): Passed newVal to valueForPathChanged instead.
+ (EditorTimerUpdate): Made timer faster because was not working well.
+ (actionPerformed): No need for 'BasicTreeUI.this.'
+ (update): Likewise.
+ (editingStopped): Likewise. Also, set newVal to appropriate value.
+ (editingCanceled): Likewise.
+ (keyPressed): Likewise.
+ (mousePressed): Likewise.
+ (treeExpanded): Likewise.
+ (treeCollapsed): Likewise.
+ (treeNodesChanged): Likewise.
+ (TreeNodesInserted): Likewise.
+ (treeNodesRemoved): Likewise.
+ (treeStructureChanged): Likewise.
+ (valueChanged): Editing is canceled when a new cell is clicked.
+ (getCellBounds): Initialized row for path.
+ * javax/swing/tree/DefaultTreeCellEditor.java
+ (startEditingTimer): No need to start timer if it is already set.
+ * javax/swing/tree/DefaultTreeModel.java
+ (valueForPathChanged): Fixed so value of node is changed only if it
+ is a MutableTreeNode. Otherwise, it cannot be changed. Also,
+ implemented with check if root node is the node being changed.
+ (nodeChanged): Should get the path of the node, not the parent.
+
+2005-08-31 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ PR awt/20782
+ * native/jni/gtk-peer/gtk_jawt.c
+ (classpath_jawt_get_default_display): Check if widget is realized
+ and return NULL if it is not.
+ (classpath_jawt_get_visualID): Likewise.
+ (classpath_jawt_get_drawable): Likewise.
+
+2005-08-31 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkComponentPeer.java (setBounds): Only
+ add parent's x and y co-ordinates to translation if parent's
+ parent is not a window.
+
+2005-08-31 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicFileChooserUI.java:
+ (boxEntries): Made this method package private because I added a
+ call to it from an implicitly defined listener class. Also fixed
+ indentation.
+ (createPropertyChangeListener): If the returned property listener
+ hears DIRECTORY_CHANGED_PROPERTY, call boxEntries() to update the
+ look-in box entries.
+
+2005-08-31 Anthony Balkissoon <abalkiss@redhat.com>
+
+ PR swing/23037
+ * javax/swing/JFileChooser.java
+ (changeToParentDirectory): If parent directory is null, do nothing.
+
+2005-08-31 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JTable.java:
+ (initializeLocalVars): Changed default autoResizeMode to
+ AUTO_RESIZE_SUBSEQUENT_COLUMNS to match the JDK.
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ (getMaximumSize): Implemented.
+ (getMinimumSize): Implemented.
+
+2005-08-31 Mark Wielaard <mark@klomp.org>
+
+ * java/nio/charset/Charset.java (charsetForName): Try default provider
+ before trying to load extra providers.
+ (availableCharsets): Explicitly add default provider Charsets.
+ (providers2): Don't include default provider.
+
+2005-08-31 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (textFieldBorder): new field,
+ (Flush3DBorder): new class,
+ (TextFieldBorder): new class,
+ (getTextFieldBorder): implemented.
+
+2005-08-31 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (getPropertyPrefix): include dot in prefix,
+ (installDefaults): remove dot which is included in prefix now,
+ * javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
+ (getPropertyPrefix): return correct prefix,
+ * javax/swing/plaf/basic/BasicCheckBoxUI.java
+ (getPropertyPrefix): return correct prefix,
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (getPropertyPrefix): return correct prefix,
+ * javax/swing/plaf/basic/BasicMenuUI.java
+ (getPropertyPrefix): return correct prefix,
+ * javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
+ (getPropertyPrefix): return correct prefix,
+ * javax/swing/plaf/basic/BasicRadioButtonUI.java
+ (getPropertyPrefix): include dot in prefix,
+ (getDefaultIcon): removed dot which is part of the prefix,
+ * javax/swing/plaf/basic/BasicToggleButtonUI.java
+ (getPropertyPrefix): include dot in prefix,
+ * javax/swing/plaf/metal/MetalCheckBoxUI.java: now extends
+ MetalRadioButtonUI,
+ (getPropertyPrefix): implemented.
+
+2005-08-30 Mark Wielaard <mark@klomp.org>
+ Christian Schlichtherle <christian@schlichtherle.de>
+
+ * java/util/zip/ZipEntry.java (setTime): Use
+ Calendar.setTimeInMillis().
+ (getTime): First parse extra bytes. Use Calendar.getTimeInMillis().
+ (parseExtra): Don't return early to make sure that KNOWN_EXTRA is
+ always set.
+ * java/util/zip/ZipFile.java (readEntries): Parse name and comment
+ as UTF-8 string.
+ (close): Check that raf is not null.
+ * java/util/zip/ZipInputStream.java (getNextEntry): Set name as
+ UTF-8 bytes.
+ * java/util/zip/ZipOutputStream.java (setComment): Set comment as
+ UTF-8 bytes.
+ (putNextEntry): Likewise for name.
+ (finish): Likewise for both.
+
+2005-08-30 David Gilbert <david.gilbert@object-refinery.com>
+
+ * examples/gnu/classpath/examples/swing/Demo.java
+ (mkMenuBar): added a JRadioButtonMenuItem,
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (RadioButtonMenuItemIcon): new inner class,
+ (getRadioButtonMenuItemIcon): implemented,
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): added RadioButtonMenuItem defaults.
+
+2005-08-30 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java:
+ Added a timer field for repainting the editing component.
+ (EditorUpdateTimer): Inner class added and implemented. Updates
+ the caret and text box. Still need to fix typing in text box.
+ (startEditing): Started the timer.
+ (editingCanceled): Stopped the timer.
+ (editingStopped): Likewise.
+
+2005-08-30 Lillian Angel <langel@redhat.com>
+
+ * examples/gnu/classpath/examples/swing/Demo.java
+ (mkTreeWorld): Made tree editable.
+ * javax/swing/DefaultCellEditor.java
+ (isCellEditable): Added in check for number of mouse clicks.
+ (DefaultCellEditor): To start editing a textfield, number of clicks
+ is 3.
+ * javax/swing/plaf/basic/BasicTreeUI.java:
+ Took out unneeded fields
+ (isEditing): Fixed to check boolean.
+ (updateCellEditor): Made more efficent.
+ (installUI): Created cell editor for initialization.
+ (editingStopped): Added in check to prevent a NPE.
+ (editingCanceled): Likewise.
+ (keyPressed): Added in check for pressing Enter. Enter should stop
+ editing and complete it, when in the process of editing.
+ (mousePressed): Optimized by using MouseEvent's getClickCount. The
+ clicking on nodes works better. Also, added in code to start the
+ editing.
+ (valueChanged): Implemented.
+ (selectPath): Took out code to remove an already selected path. A node
+ should remain selected if clicked on more than once. Works like JDK.
+ * javax/swing/tree/DefaultTreeCellEditor.java:
+ Added a helper field.
+ (paint): Took out redundant code.
+ (DefaultTreeCellEditor): Added class to listener list.
+ (configureEditingComponent): Updated since listener was added to list.
+ (isCellEditable): Finished implementation.
+ (stopCellEditing): Added a check for editingComponent to prevent a NPE.
+ (cancelCellEditing): Likewise.
+ (valueChanged): Took out redundant code.
+ (actionPerformed): Added code in to implement click-pause-click
+ editing.
+ (shouldStartTimer): Fixed check.
+ (canEditImmediately): Took out redunant code.
+ (inHitRegion): Changed region to be text area only (not icon).
+ (createTreeCellEditor): No need to use canEdit here, removed.
+
+2005-08-30 Christian Schlichtherle <christian@schlichtherle.de>
+
+ * java/util/zip/DeflaterOutputStream.java
+ (DeflaterOutputStream(OutputStream)): Increase buffer size to 4096.
+ (DeflaterOutputStream(OutputStream,Deflater)): Likewise.
+
+2005-08-30 Christian Schlichtherle <christian@schlichtherle.de>
+
+ * java/util/zip/DeflaterHuffman.java (bit4Reverse): Mark final.
+
+2005-08-30 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalLabelUI.java
+ (instance): renamed 'metalLabelUI' and changed from private to
+ protected,
+ (createUI): modified for renamed field,
+ (paintDisabledText): implemented,
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): modified Label defaults.
+
+2005-08-30 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): added some defaults for TabbedPane,
+ * javax/swing/plaf/metal/MetalTabbedPaneUI.java
+ (TabbedPaneLayout): implemented new class,
+ (createLayoutManager): implemented,
+ (paintTabBorder): implemented,
+ (paintTopTabBorder): implemented,
+ (paintLeftTabBorder): implemented,
+ (paintBottomTabBorder): implemented,
+ (paintRightTabBorder): implemented,
+ (paintTabBackground): implemented,
+ (shouldPadTabRun): implemented,
+ * examples/gnu/classpath/examples/swing/Demo.java:
+ (mkTabWorld): new method,
+ (mkTabbedPane): added tab for 'Tab World'.
+
+2005-08-30 Robert Schuster <robertschuster@fsfe.org>
+
+ * java/beans/Statement.java:
+ (Statement): Use zero length array if argument array is null.
+ (toString): Use StringBuffer for efficiency reasons, make use of
+ internal name.
+ (generateInternalName): New method, generates instance names like
+ the JDK has.
+ (doExecute): Removed debugging output that could lead to an exception
+ because wrong loop variable usage.
+ * java/beans/Expression.java: Static constant 'unset' renamed to
+ 'UNSET'.
+
+2005-08-29 Keith Seitz <keiths@redhat.com>
+
+ * gnu/classpath/jdwp/event/Event.java: New file describing JDWP
+ events.
+ * gnu/classpath/jdwp/event/ClassPrepareEvent.java: New file.
+ * gnu/classpath/jdwp/event/ThreadEndEvent.java: New file.
+ * gnu/classpath/jdwp/event/ThreadStartEvent.java: New file.
+ * gnu/classpath/jdwp/event/VmInitEvent.java (VmInitEvent): New file.
+
+2005-08-29 Tom Tromey <tromey@redhat.com>
+
+ * .externalToolBuilders/Configure.launch: Changed --prefix.
+ * .externalToolBuilders/CompileNative.launch: Invoke install target.
+ * .cdtproject: New file.
+ * .classpath: Changed output directory.
+ * .cvsignore: Added 'install'.
+
+2005-08-29 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JPasswordField.java
+ (getText): Changed to pass error to AssertionError.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (setCellEditor): Updated boolean when appropriate.
+ (stopEditing): Took out redundant code.
+ (updateCellEditor): Updated boolean when appropriate.
+ (installListeners): Took out CellEditorListener. It is added
+ when the cellEditor is set.
+ (installUI): Similar.
+ (ensureRowsAreVisible): Fixed API documentation
+ (startEditing): Fixed to add editing container to the tree.
+ (checkForClickInExpandControl): Fixed API documentation.
+ (editingStopped): Added code to remove listeners and container.
+ (editingCanceled): Similar.
+ (mousePressed): Updated to stop editing when a different cell is
+ clicked.
+ (treeNodesChanged): Called repaint.
+ (treeNodesRemoved): Likewise.
+ (treeStructureChanged): Likewise.
+ (paintNode): Updated to paint a node that is being edited.
+ (paintRecursive): Fixed API documentation.
+ * javax/swing/tree/DefaultTreeCellEditor.java
+ (paint): Fixed to paint icon and text box in correct location with
+ correct spacing.
+ (doLayout): Fixed API documentation.
+ (DefaultTreeCellEditor): Took out call to configure editing component.
+ (configureEditingComponent): Initialized editing icon.
+ (getTreeCellEditorComponent): Took out code to stop editing.
+ Not needed.
+ (addCellEditorListener): Passed on to realEditor.
+ (removeCellEditorListener): Likewise.
+
+2005-08-29 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/CORBA/ORB.java (string_to_object): Documentation update.
+ * gnu/CORBA/Functional_ORB.java (string_to_object): Rewritten.
+ (ior_to_object): New method.
+ * gnu/CORBA/NamingService/NameParser.java: New file.
+
+2005-08-28 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/text/AbstractDocument.java (addEdit): Document gcj bug
+ workaround.
+ (getChange): Likewise.
+
+2005-08-28 Tom Tromey <tromey@redhat.com>
+
+ * org/omg/PortableInterceptor/ORBInitInfoOperations.java: Removed
+ non-ascii character.
+
+2005-08-28 Chris Burdess <dog@gnu.org>
+
+ * javax/swing/text/AbstractDocument.java: Fully qualify references to
+ ElementChange class.
+
+2005-08-28 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/Interceptor/ForwardRequestHolder.java,
+ * gnu/CORBA/Interceptor/gnuClientRequestInfo.java,
+ * gnu/CORBA/Interceptor/gnuIcCurrent.java,
+ * gnu/CORBA/Interceptor/gnuIorInfo.java,
+ * gnu/CORBA/Interceptor/gnuServerRequestInfo.java,
+ * gnu/CORBA/Interceptor/IORInterceptors.java,
+ * gnu/CORBA/Interceptor/ClientRequestInterceptors.java,
+ * gnu/CORBA/Interceptor/Registrator.java,
+ * gnu/CORBA/Interceptor/ServerRequestInterceptors.java,
+ * gnu/CORBA/GIOP/contextSupportingHeader.java,
+ * org/omg/PortableInterceptor/ClientRequestInfo.java,
+ * org/omg/PortableInterceptor/ClientRequestInfoOperations.java,
+ * org/omg/PortableInterceptor/ClientRequestInterceptor.java,
+ * org/omg/PortableInterceptor/ClientRequestInterceptorOperations.java,
+ * org/omg/PortableInterceptor/Current.java,
+ * org/omg/PortableInterceptor/CurrentHelper.java,
+ * org/omg/PortableInterceptor/CurrentOperations.java,
+ * org/omg/PortableInterceptor/ForwardRequest.java,
+ * org/omg/PortableInterceptor/ForwardRequestHelper.java,
+ * org/omg/PortableInterceptor/InvalidSlot.java,
+ * org/omg/PortableInterceptor/InvalidSlotHelper.java,
+ * org/omg/PortableInterceptor/ORBInitInfo.java,
+ * org/omg/PortableInterceptor/ORBInitInfoOperations.java,
+ * org/omg/PortableInterceptor/ORBInitializer.java,
+ * org/omg/PortableInterceptor/ORBInitializerOperations.java,
+ * org/omg/PortableInterceptor/PolicyFactory.java,
+ * org/omg/PortableInterceptor/PolicyFactoryOperations.java,
+ * org/omg/PortableInterceptor/RequestInfo.java,
+ * org/omg/PortableInterceptor/RequestInfoOperations.java,
+ * org/omg/PortableInterceptor/ServerRequestInfo.java,
+ * org/omg/PortableInterceptor/ServerRequestInfoOperations.java,
+ * org/omg/PortableInterceptor/ServerRequestInterceptor.java,
+ * org/omg/PortableInterceptor/ServerRequestInterceptorOperations.java,
+ * org/omg/PortableInterceptor/package.html:
+ New files.
+ * gnu/CORBA/ExceptionCreator.java,
+ * gnu/CORBA/Functional_ORB.java,
+ * gnu/CORBA/IOR.java,
+ * gnu/CORBA/IOR_Delegate.java,
+ * gnu/CORBA/ObjectCreator.java,
+ * gnu/CORBA/Restricted_ORB.java,
+ * gnu/CORBA/bufferedResponseHandler.java,
+ * gnu/CORBA/gnuCodecFactory.java,
+ * gnu/CORBA/gnuRequest.java,
+ * gnu/CORBA/primitiveArrayTypeCode.java,
+ * gnu/CORBA/primitiveTypeCode.java,
+ * gnu/CORBA/CDR/Vio.java,
+ * gnu/CORBA/CDR/cdrOutput.java,
+ * gnu/CORBA/DynAn/gnuDynAny.java,
+ * gnu/CORBA/DynAn/gnuDynEnum.java,
+ * gnu/CORBA/DynAn/gnuDynFixed.java,
+ * gnu/CORBA/DynAn/gnuDynValue.java,
+ * gnu/CORBA/GIOP/ReplyHeader.java,
+ * gnu/CORBA/GIOP/RequestHeader.java,
+ * gnu/CORBA/GIOP/ServiceContext.java,
+ * gnu/CORBA/GIOP/v1_0/RequestHeader.java,
+ * gnu/CORBA/Poa/LocalDelegate.java,
+ * gnu/CORBA/Poa/LocalRequest.java,
+ * gnu/CORBA/Poa/ORB_1_4.java,
+ * gnu/CORBA/Poa/gnuServantObject.java,
+ * gnu/CORBA/Poa/servantDelegate.java,
+ * org/omg/CORBA/ServiceDetailHelper.java,
+ * org/omg/CORBA/DynAnyPackage/Invalid.java,
+ * org/omg/CORBA/DynAnyPackage/InvalidSeq.java,
+ * org/omg/CORBA/DynAnyPackage/InvalidValue.java,
+ * org/omg/CORBA/DynAnyPackage/TypeMismatch.java,
+ * org/omg/DynamicAny/NameDynAnyPairSeqHelper.java,
+ * org/omg/DynamicAny/_DynAnyFactoryStub.java,
+ * org/omg/DynamicAny/_DynAnyStub.java,
+ * org/omg/DynamicAny/_DynArrayStub.java,
+ * org/omg/DynamicAny/_DynEnumStub.java,
+ * org/omg/DynamicAny/_DynFixedStub.java,
+ * org/omg/DynamicAny/_DynSequenceStub.java,
+ * org/omg/DynamicAny/_DynStructStub.java,
+ * org/omg/DynamicAny/_DynUnionStub.java,
+ * org/omg/DynamicAny/_DynValueStub.java,
+ * org/omg/IOP/ServiceContext.java,
+ * org/omg/IOP/TaggedComponentHelper.java,
+ * org/omg/IOP/TaggedProfileHelper.java,
+ * org/omg/PortableInterceptor/IORInfo.java,
+ * org/omg/PortableInterceptor/IORInfoOperations.java,
+ * org/omg/PortableInterceptor/IORInterceptor.java,
+ * org/omg/PortableInterceptor/IORInterceptorOperations.java,
+ * org/omg/PortableInterceptor/Interceptor.java,
+ * org/omg/PortableInterceptor/LOCATION_FORWARD.java,
+ * org/omg/PortableInterceptor/SUCCESSFUL.java,
+ * org/omg/PortableInterceptor/SYSTEM_EXCEPTION.java,
+ * org/omg/PortableInterceptor/TRANSPORT_RETRY.java,
+ * org/omg/PortableInterceptor/USER_EXCEPTION.java,
+ * org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateName.java,
+ * org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java,
+ * org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidName.java,
+ * org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHelper.java,
+ * org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java:
+ Rewritten.
+ * org/omg/CORBA/ORB.java,
+ * org/omg/CORBA/package.html,
+ * NEWS:
+ Documentation update.
+
+2005-08-28 Chris Burdess <dog@gnu.org>
+
+ * gnu/xml/xpath/ArithmeticExpr.java: Fix div and mod by zero to
+ follow IEEE rules.
+
+2005-08-27 Tom Tromey <tromey@redhat.com>
+
+ * m4/acinclude.m4 (CLASSPATH_WITH_GLIBJ): Always check for 'zip'
+ program. Changed zip install handling.
+
+2005-08-26 Keith Seitz <keiths@redhat.com>
+
+ * gnu/classpath/jdwp/event/EventRequest.java: New file.
+ * gnu/classpath/jdwp/exception/JdwpIllegalArgumentException.java:
+ New file.
+
+2005-08-26 Keith Seitz <keiths@redhat.com>
+
+ * gnu/classpath/jdwp/event/filters/IEventFilter.java: New file.
+ Describes the interface used for event filtering managed by
+ the event manager.
+ * gnu/classpath/jdwp/event/filters/ClassExcludeFilter.java: New file.
+ * gnu/classpath/jdwp/event/filters/ClassMatchFilter.java: New file.
+ * gnu/classpath/jdwp/event/filters/ClassOnlyFilter.java: New file.
+ * gnu/classpath/jdwp/event/filters/ConditionalFilter.java: New file.
+ * gnu/classpath/jdwp/event/filters/CountFilter.java: New file.
+ * gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java: New file.
+ * gnu/classpath/jdwp/event/filters/FieldOnlyFilter.java: New file.
+ * gnu/classpath/jdwp/event/filters/InstanceOnlyFilter.java: New file.
+ * gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java: New file.
+ * gnu/classpath/jdwp/event/filters/StepFilter.java: New file.
+ * gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java: New file.
+
+2005-08-26 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicCheckBoxUI.java
+ (installUI): removed,
+ * javax/swing/plaf/basic/BasicIconFactory.java
+ (CheckBoxMenuItemIcon): new support class,
+ (getCheckBoxMenuItemIcon): return instance of CheckBoxMenuItemIcon,
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): changed value for 'CheckBoxMenuItem.checkIcon'
+ and removed entry for 'CheckBoxMenuItem.icon',
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (paintMenuItem): let icon handle selection status,
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (CheckBoxMenuItemIcon): new support class,
+ (getCheckBoxIcon): implemented,
+ (getCheckBoxMenuItemIcon): implemented,
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): added entry for 'CheckBoxMenuItem.checkIcon'.
+
+2005-08-26 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
+ (create): Only set overwrite confirmation if using GTK >= 2.8.
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (setVisibleNative): Call gdk_flush before releasing GDK lock.
+ (setVisibleNativeUnlocked): Don't call gdk_flush.
+
+2005-08-26 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ PR classpath/21660:
+ * gnu/java/awt/peer/gtk/GtkFileDialogPeer.java,
+ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
+ (AWT_FILEDIALOG_LOAD): New macro.
+ (AWT_FILEDIALOG_SAVE): Likewise.
+ (create(GtkContainerPeer,int)): Add mode parameter. Create Save
+ dialog if mode is AWT_FILEDIALOG_SAVE. Remove workaround for
+ http://bugzilla.gnome.org/show_bug.cgi?id=166852.
+ (create()): Add mode argument to create call.
+ * gnu/java/awt/peer/gtk/GtkWindowPeer.java,
+ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (setVisibleNative): Override method.
+ (setVisibleNativeUnlocked): Override method. Call gdk_flush after
+ showing or hiding window.
+ * include/gnu_java_awt_peer_gtk_GtkFileDialogPeer.h: Regenerate.
+ * include/gnu_java_awt_peer_gtk_GtkWindowPeer.h: Regenerate.
+
+2005-08-25 Mark Wielaard <mark@klomp.org>
+
+ * timezones.pl (parseRule): Add dayoffset when $time represents
+ more then a day.
+ * java/util/TimeZone.java (timezones): Regenerate.
+
+2005-08-25 Keith Seitz <keiths@redhat.com>
+
+ * gnu/classpath/jdwp/util/Value.java (Value): Update for
+ real VMIdManager API.
+ * gnu/classpath/jdwp/util/Location.java (Location): Likewise.
+
+2005-08-25 Keith Seitz <keiths@redhat.com>
+
+ * gnu/classpath/jdwp/processor/EventRequestCommandSet.java
+ (executeSet): Use constants for case values.
+ Fix "typo": It is really ThreadOnlyFilter.
+ Correct arguments to InstanceOnlyFilter.
+
+2005-08-25 Keith Seitz <keiths@redhat.com>
+
+ * gnu/classpath/jdwp/processor/CommandSet.java (CommandSet): Make
+ an abstract class.
+ Add protected variables for VMIdManager and VMVirtualMachine.
+ (runCommand): Make abstract.
+ * gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java
+ (ArrayReferenceCommandSet): Derive from CommandSet instead of
+ implementing it. Remove private hooks to ID manager and VM.
+ Update all VMIdManager and EventManager API calls.
+ * gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java
+ (ArrayTypeCommandSet): Likewise.
+ * gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java
+ (ClassLoaderReferenceCommandSet): Likewise.
+ * gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java
+ (ClassObjectReferenceCommandSet): Likewise.
+ * gnu/classpath/jdwp/processor/ClassTypeCommandSet.java
+ (ClassTypeCommandSet): Likewise.
+ * gnu/classpath/jdwp/processor/EventRequestCommandSet.java
+ (EventRequestCommandSet): Likewise.
+ * gnu/classpath/jdwp/processor/FieldCommandSet.java
+ (FieldCommandSet): Likewise.
+ * gnu/classpath/jdwp/processor/InterfaceTypeCommandSet.java
+ (InterfaceTypeCommandSet): Likewise.
+ * gnu/classpath/jdwp/processor/MethodCommandSet.java
+ (MethodCommandSet): Likewise.
+ * gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java
+ (ObjectReferenceCommandSet): Likewise.
+ * gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
+ (ReferenceTypeCommandSet): Likewise.
+ * gnu/classpath/jdwp/processor/StackFrameCommandSet.java
+ (StackFrameCommandSet): Likewise.
+ * gnu/classpath/jdwp/processor/StringReferenceCommandSet.java
+ (StringReferenceCommandSet): Likewise.
+ * gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java
+ (ThreadGroupReferenceCommandSet.java): Likewise.
+ * gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java
+ (ThreadReferenceCommandSet): Likewise.
+ * gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
+ (VirtualMachineCommandSet): Likewise.
+
+ * gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java
+ (executeStatus): Fix constant name.
+ * gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
+ (executeDisposeObjects): Don't do anything yet -- this
+ is unimplemented.
+
+2005-08-25 Mark Wielaard <mark@klomp.org>
+
+ Reported by Bastiaan Huisman <huisman@science.uva.nl>
+ * scripts/tzabbrevs: Change America/Buenos_Aires to
+ America/Argentina/Buenos_Aires for AGT link.
+ * scripts/timezones.pl (parseTime): Assume and return wall time.
+ Reindent output.
+ * java/util/TimeZone.java (timezones): Regenerate using tzdata2005l.
+
+2005-08-25 Keith Seitz <keiths@redhat.com>
+
+ * gnu/classpath/jdwp/event/EventManager.java: New file concerning
+ JDWP event request management and notification infrastructure.
+
+2005-08-25 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * scripts/eclipse-gnu.xml: Reverted my patch 2005-07-31.
+
+2005-08-25 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JTextPane.java
+ (JTextPane()): Don't set the document to null here.
+
+2005-08-25 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (RootView.preferenceChanged): Revalidate the text component.
+ (RootView.setParent): Set parent of views to null. The parent
+ of the added child view is set to the root view in the
+ BasicTextUI class.
+ (RootView.getView): Implemented new method.
+ (RootView.getViewCount): Implemented new method.
+ (RootView.changedUpdate): Use the correct ViewFactory here.
+ (RootView.insertUpdate): Use the correct ViewFactory here.
+ (RootView.removeUpdate): Use the correct ViewFactory here.
+ (setView): Set the view's parent to the root view.
+
+2005-08-25 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/text/View.java
+ (View): Don't manage child views here.
+ (getContainer): Throw AssertionError if we have no parent. This
+ should not happen.
+ (append): Call replace to do the real action. Child views
+ are not managed in the View class itself.
+ (removeAll): Give replace an empty array instead of null.
+ Avoids NPEs in subclasses that don't handle the null case.
+ (preferenceChanged): Don't revalidate here. This is too
+ expensive and not necessary.
+ (updateChildren): Let replace do the actual action. We don't
+ manage child views in the View class.
+ (forwardUpdate): Don't access children directly.
+ (dump): Added package private methods useful for debugging.
+
+2005-08-25 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/text/StyledEditorKit.java
+ (StyledViewFactory.create): Use new BoxView constructor. Throw
+ AssertionError if an unknown element type is encountered,
+ since this should not happen.
+
+2005-08-25 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/text/GlyphView.java
+ (GlyphPainter): Implemented abstract inner class.
+ (DefaultGlyphPainter): Implemented concrete impl of
+ GlyphPainter.
+ (getGlyphPainter): Implemented new method.
+ (setGlyphPainter): Likewise.
+ (checkPainter): Likewise.
+ (paint): Likewise.
+ (getPreferredSpan): Likewise.
+ (modelToView): Likewise.
+ (getTabExpander): Likewise.
+ (getTabbedSpan): Likewise.
+ (getPartialSpan): Likewise.
+ (getBeginIndex): Likewise.
+ (getEndIndex): Likewise.
+ (getText): Likewise.
+ (getFont): Likewise.
+ (getForeground): Likewise.
+
+2005-08-25 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/text/GapContent.java
+ (getString): Throw BadLocationException instead of letting
+ a StringIndexOutOfBoundsException bubble up.
+
+2005-08-25 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/text/ParagraphView.java
+ (Row): Implemented inner class.
+ (ParagraphView(Element)): Implemented constructor.
+ (nextTabStop): Added dummy implementation for TabExpander
+ interface.
+ (createRow): Implemented new method.
+
+2005-08-25 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/text/FlowView.java
+ (FlowStrategy): Implemented inner class.
+ (LogicalView): Likewise.
+ (FlowView(Element, int)): Implemented constructor.
+ (getFlowAxis): Implemented new method.
+ (getFlowSpan): Likewise.
+ (getFlowStart): Likewise.
+ (createRow): Added new abstract method.
+ (loadChildren): Implemented new method.
+ (layout): Implemented new method.
+ (insertUpdate): Implemented new method.
+ (removeUpdate): Implemented new method.
+ (changedUpdate): Implemented new method.
+ (getViewIndexAtPosition): Implemented new method.
+
+2005-08-25 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/text/CompositeView.java
+ (loadChildren): Call replace to actually change the child
+ elements. This way subclasses can modify the child
+ management behaviour by simply overriding replace.
+ (setParent): Only call loadChildren if the parent to be set
+ is actually not null.
+ (replace): Check for null children. Set the parent of removed
+ children to null. Set the parent of the added children to
+ this.
+ (modelToView): Added some sanity checks.
+
+2005-08-25 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/text/BoxView.java
+ (BoxView(Element, int)): Implemented.
+ (getAxis): Likewise.
+ (setAxis): Likewise.
+ (layoutChanged): Likewise.
+ (isLayoutValid): Likewise.
+ (paintChild): Likewise.
+ (replace): Likewise.
+ (paint): Likewise.
+ (getPreferredSpan): Likewise.
+ (getMaximumSpan): Likewise.
+ (baselineRequirements): Likewise.
+ (calculateMajorAxisRequirements): Likewise.
+ (calculateMinorAxisRequirements): Likewise.
+ (isBefore): Likewise.
+ (isAfter): Likewise.
+ (getViewAtPoint): Likewise.
+ (childAllocation): Likewise.
+ (layout): Likewise.
+ (layoutMajorAxis): Likewise.
+ (layoutMinorAxis): Likewise.
+ (isAllocationValid): Likewise.
+ (getWidth): Likewise.
+ (getHeight): Likewise.
+ (setSize): Likewise.
+ (validateLayout): Likewise.
+
+2005-08-25 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/text/AbstractDocument.java
+ (AbstractElement.dumpElement): Throw AssertionError when
+ a BadLocationException is encountered.
+ (BranchElement.getElementIndex): Return -1 if there is no child
+ element. Return elementCount - 1 if the requested offset is after
+ the child elements of that element.
+ (BranchElement.getEndOffset): Throw NPE if this element has no
+ children.
+ (BranchElement.getStartOffset): Throw NPE if this element has
+ no children.
+ (DefaultDocumentEvent.addEdit): Implemented.
+ (DefaultDocumentEvent.getChange): Implemented.
+
+2005-08-25 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JPasswordField.java
+ (setText): Changed to raise an AssertionError when a
+ BadLocationException is caught.
+
+2005-08-25 Tom Tromey <tromey@redhat.com>
+
+ * configure.ac: Call AC_PROG_CXX.
+
+2005-08-25 Mark Wielaard <mark@klomp.org>
+
+ * javax/xml/namespace/QName.java: Updated boilerplate address.
+ * gnu/xml/xpath/XPathParser.y: Likewise.
+ * gnu/xml/xpath/XPathParser.java: Regenerated.
+
+2005-08-25 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/xml/datatype/DatatypeFactory.java: minor API doc fixes,
+ * javax/xml/parsers/DocumentBuilder.java: likewise,
+ * javax/xml/parsers/SAXParser.java: likewise,
+ * javax/xml/transform/Source.java: likewise.
+
+2005-08-25 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/tree/DefaultTreeModel.java
+ (nodesWereRemoved): minor API doc fix.
+
+2005-08-25 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+ (activeBGColor): removed,
+ (activeFGColor): removed,
+ (inactiveBGColor): removed,
+ (inactiveFGColor): removed,
+ (installDefaults): replaced removed fields above with correct ones,
+ (uninstallDefaults): likewise,
+ (setButtonIcons): implemented,
+ (paintComponent): replaced removed fields above with correct ones;
+ * javax/swing/plaf/metal/MetalInternalFrameTitlePane.java: implemented,
+ * javax/swing/plaf/metal/MetalInternalFrameUI.java
+ (createNorthPane): implemented,
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): added internal frame icons.
+
+2005-08-25 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/ClasspathToolkit.java (getFont): Throw
+ RuntimeException in case of error.
+ * gnu/java/awt/EmbeddedWindow.java (addNotify): Likewise.
+
+2005-08-24 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
+ (beginNativeRepaintID): Remove variable.
+ (endNativeRepaintID): Likewise.
+ (cp_gtk_button_init_jni): Don't look up beginNativeRepaint and
+ endNativeRepaint methods.
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java (resizing): Remove
+ field.
+ * gnu/java/awt/peer/gtk/GtkWindowPeer.java,
+ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (resizing): Remove field.
+ * gnu/java/awt/peer/gtk/GtkFileDialogPeer.java (hiding): Remove
+ field.
+ (setVisible): Don't override.
+ * gnu/java/awt/peer/gtk/GtkChoicePeer.java,
+ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
+ (selectNative): New method.
+ (selectNativeUnlocked): Likewise.
+ (select): Call setNativeUnlocked if in the GTK main thread,
+ selectNative otherwise.
+ * gnu/java/awt/peer/gtk/GtkComponentPeer.java,
+ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+ (gtkWidgetSetCursorUnlocked): New method.
+ (setCursor(Cursor)): Call gtkWidgetSetCursorUnlocked if in the GTK
+ main thread, gtkWidgetSetCursor otherwise.
+ (setVisibleNative): New method.
+ (setVisibleNativeUnlocked): Likewise.
+ (setVisible): Call setVisibleNativeUnlocked if in the GTK main
+ thread, setVisibleNative otherwise.
+ (hide): Call setVisible(false).
+ (show): Call setVisible(true).
+
+2005-08-24 Tom Tromey <tromey@redhat.com>
+
+ * java/text/SimpleDateFormat.java (compileFormat): Correctly
+ handle quoted single quotes. PR classpath/23183.
+
+2005-08-24 Mark Wielaard <mark@klomp.org>
+
+ * vm/reference/gnu/classpath/jdwp/VMFrame.java: Update copyright
+ boilerplate address.
+ * vm/reference/gnu/classpath/jdwp/VMIdManager.java: Likewise.
+
+2005-08-24 Mark Wielaard <mark@klomp.org>
+
+ * doc/www.gnu.org/newsitems.txt: Fix announcement url.
+
+2005-08-24 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (InternalFrameCloseIcon): new private class,
+ (InternalFrameAltMaximizeIcon): likewise,
+ (InternalFrameMaximizeIcon): likewise,
+ (InternalFrameMinimizeIcon): likewise,
+ (getInternalFrameCloseIcon): implemented,
+ (getInternalFrameMaximizeIcon): implemented,
+ (getInternalFrameMinimizeIcon): implemented,
+ (getInternalFrameAltMaximizeIcon): implemented.
+
+2005-08-24 Mark Wielaard <mark@klomp.org>
+
+ * gnu/CORBA/ForwardRequestHelper.java: Update copyright boilerplate
+ address.
+ * gnu/classpath/jdwp/processor/CommandSet.java: Likewise.
+ * gnu/classpath/jdwp/processor/StringReferenceCommandSet.java:
+ Likewise.
+ * gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java:
+ Likewise.
+ * gnu/classpath/jdwp/processor/ClassTypeCommandSet.java: Likewise.
+ * gnu/classpath/jdwp/processor/StackFrameCommandSet.java: Likewise.
+ * gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java:
+ Likewise.
+ * gnu/classpath/jdwp/util/LineTable.java: Likewise.
+ * gnu/classpath/jdwp/util/MethodResult.java: Likewise.
+ * gnu/classpath/jdwp/util/VariableTable.java: Likewise.
+ * javax/xml/namespace/QName.java: Likewise.
+ * org/omg/DynamicAny/_DynAnyFactoryStub.java: Likewise.
+ * org/omg/DynamicAny/_DynAnyStub.java: Likewise.
+ * org/omg/DynamicAny/_DynArrayStub.java: Likewise.
+ * org/omg/DynamicAny/_DynEnumStub.java: Likewise.
+ * org/omg/DynamicAny/_DynFixedStub.java: Likewise.
+ * org/omg/DynamicAny/_DynSequenceStub.java: Likewise.
+ * org/omg/DynamicAny/_DynStructStub.java: Likewise.
+ * org/omg/DynamicAny/_DynUnionStub.java: Likewise.
+ * org/omg/DynamicAny/_DynValueStub.java: Likewise.
+ * org/omg/PortableServer/ForwardRequest.java: Likewise.
+ * org/omg/PortableServer/CurrentHelper.java: Likewise.
+ * org/omg/PortableServer/ForwardRequestHelper.java: Likewise.
+ * org/omg/PortableServer/ServantActivatorHelper.java: Likewise.
+ * org/omg/PortableServer/ServantLocatorHelper.java: Likewise.
+ * org/omg/PortableServer/_ServantActivatorStub.java: Likewise.
+ * org/omg/PortableServer/_ServantLocatorStub.java: Likewise.
+
+2005-08-24 Mark Wielaard <mark@klomp.org>
+
+ * configure.ac: Set version to 0.18-pre.
+
+2005-08-24 Mark Wielaard <mark@klomp.org>
+
+ * doc/www.gnu.org/newsitems.txt: Add Generics Branch Merge
+ Announcement.
+
+2005-08-24 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/DefaultCellEditor.java
+ (isCellEditable): Reversed last changes.
+
+2005-08-24 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/DefaultCellEditor.java
+ (isCellEditable): If the event is null, the cell is still
+ editable.
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (getVisibleEditorRect): Use getPreferredSize to get the width
+ and height.
+ * javax/swing/tree/DefaultTreeCellEditor.java
+ (paint): Fixed to paint the JTextField with the background
+ and border at the correct location.
+ (DefaultTreeCellEditor): Changed to initialize realEditor.
+ (configureEditingComponent): Helper function implemented.
+ (getTreeCellEditorComponent): Fixed to use realEditor to get component.
+ (isCellEditable): Fixed to configure editing component.
+ (shouldSelectCell): Always returns true.
+ (stopCellEditing): Fixed to configure editing component if needed.
+ (cancelCellEditing): Fixed to configure editing component if needed.
+ (createTreeCellEditor): Fixed to initialize fields.
+
+2005-08-24 Mark Wielaard <mark@klomp.org>
+
+ * resource/japhar-0.09.patch.1: Removed.
+ * resource/orp-1.0.8.patch: Removed.
+ * resource/orp-1.0.9.patch: Removed.
+ * resource/Makefile.am (EXTRA_DIST): Removed.
+
+2005-08-24 Mark Wielaard <mark@klomp.org>
+
+ * NEWS: Split in general changes and vm interface changes. Add RawData
+ to Pointer conversion.
+
+2005-08-24 Mark Wielaard <mark@klomp.org>
+
+ * native/jni/java-lang/java_lang_VMDouble.c
+ (Java_java_lang_VMDouble_parseDouble): Remove KISSME_LINUX_USER hack.
+
+2005-08-24 Mark Wielaard <mark@klomp.org>
+
+ * configure.ac: Check for QtGui >= 4.0.1. Check for and
+ add extra include dirs ($includedir/Qt) to QT_CFLAGS.
+ * native/jni/qt-peer/.cvsignore: Add slotcallbacks.moc.h.
+ * native/jni/qt-peer/Makefile.am (QT_CXXFLAGS): Removed.
+ (libqtpeer_la_CXXFLAGS): Removed.
+ (libqtpeer_la_LDFLAGS): Removed.
+ (AM_LDFLAGS): Set to @CLASSPATH_MODULE@ @QT_LIBS@.
+ (AM_CXXFLAGS): Set to @QT_CFLAGS@.
+
+2005-08-24 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicInternalFrameUI.java
+ (installDefaults): just fetch border from UIDefaults,
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (InternalFrameDefaultMenuIcon): implemented,
+ (getInternalFrameDefaultMenuIcon): implemented,
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): add values for "InternalFrame.border" and
+ "InternalFrame.icon".
+
+2005-08-24 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (InternalFrameBorder): implemented.
+
+2005-08-24 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicDesktopPaneUI.java
+ (installDefaults): set background color using "desktop" color,
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initSystemColorDefaults): removed "Desktop.background" color,
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initSystemColorDefaults): added "desktop" color.
+
+2005-08-23 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (stopEditing): Implemented.
+ (cancelEditing): Implemented.
+ (startEditingAtPath): Implemented.
+ (getEditingPath): Implemented.
+ (createDefaultCellEditor): Implemented.
+ (updateCellEditor): Implemented.
+ (completeEditing): Implemented.
+ (completeEditing): Implemented.
+ (startEditing): Implemented.
+ (editingStopped): Implemented.
+ (editingCanceled): Implemented.
+ * javax/swing/tree/DefaultTreeCellEditor.java
+ (stopCellEditing): Stopped the timer.
+ (cancelCellEditing): Likewise.
+
+2005-08-23 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/DefaultCellEditor.java
+ (getTreeCellEditorComponent): Implemented cases for JCheckBox
+ and JComboBox.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (BasicTreeUI): Moved lines to installUI where the renderer
+ and editor are created.
+ (installUI): Likewise.
+ * javax/swing/tree/DefaultTreeCellEditor.java
+ (getPreferredSize): Implemented.
+ (DefaultTreeCellEditor): Implemented.
+ (DefaultTreeCellEditor): Implemented.
+ (getTreeCellEditorComponent): Implemented.
+ (getCellEditorValue): Implemented.
+ (isCellEditable): Implemented.
+ (shouldSelectCell): Implemented.
+ (stopCellEditing): Implemented.
+ (cancelCellEditing): Implemented.
+ (valueChanged): Implemented.
+ (actionPerformed): Implemented.
+ (shouldStartEditingTimer): Implemented.
+ (startEditingTimer): Implemented.
+ (canEditImmediately): Implemented.
+ (inHitRegion): Implemented.
+ (determineOffset): Implemented.
+ (prepareForEditing): Implemented.
+ (createContainer): Implemented.
+ (createTreeCellEditor): Implemented.
+
+2005-08-23 Tom Tromey <tromey@redhat.com>
+
+ * java/text/SimpleDateFormat.java (compileFormat): Reformatted.
+
+2005-08-23 Tom Tromey <tromey@redhat.com>
+
+ PR classpath/23531
+ * java/sql/Date.java (toString): Not deprecated.
+ (valueOf): Likewise.
+ * java/sql/Time.java (toString): Not deprecated.
+ (valueOf): Likewise.
+
+2005-08-23 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/UIManager.java:
+ (addAuxiliaryLookAndFeel): renamed field, added check for null
+ argument,
+ (removeAuxiliaryLookAndFeel): reimplemented,
+ (getAuxiliaryLookAndFeels): renamed field,
+ (installLookAndFeel): implemented by delegation.
+
+2005-08-23 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/UIManager.java: added API docs all over.
+
+2005-08-23 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/UIManager.java:
+ (look_and_feel): renamed currentLookAndFeel,
+ (currentUIDefaults): new field,
+ (get(Object)): access cached UIDefaults,
+ (get(Object, Locale)): likewise,
+ (getBoolean(Object)): likewise,
+ (getBoolean(Object, Locale)): likewise,
+ (getBorder(Object)): likewise,
+ (getBorder(Object, Locale)): likewise,
+ (getColor(Object)): likewise,
+ (getColor(Object, Locale)): likewise,
+ (getDefaults): return reference to UIDefaults from current look and
+ feel rather than recreating them every time,
+ (getDimension(Object)): access local defaults,
+ (getDimension(Object, Locale)): likewise,
+ (getFont(Object)): likewise,
+ (getFont(Object, Locale)): likewise,
+ (getIcon(Object)): likewise,
+ (getIcon(Object, Locale)): likewise,
+ (getInsets(Object)): likewise,
+ (getInsets(Object, Locale)): likewise,
+ (getInt(Object)): likewise,
+ (getInt(Object, Locale)): likewise,
+ (getLookAndFeel): renamed attribute,
+ (getLookAndFeelDefaults): return reference to UIDefaults from current
+ look and feel rather than recreating them every time,
+ (getString(Object)): access local defaults,
+ (getString(Object, Locale)): likewise,
+ (getUI(JComponent)): likewise,
+ (installLookAndFeel(String, String)): implemented by delegation,
+ (put(Object, Object)): update local defaults,
+ (setLookAndFeel): create and retain reference to UIDefaults.
+
+2005-08-23 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/UIManager.java:
+ (addPropertyChangeListener): implemented,
+ (removePropertyChangeListener): likewise,
+ (getPropertyChangeListeners): likewise,
+ (setLookAndFeel): fire a property change event.
+
+2005-08-23 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (BasicTreeUI): Moved these lines to installUI
+ because they were causing NullPointerExceptions.
+ (installUI): Added code from constructor.
+ * javax/swing/plaf/metal/MetalTreeUI.java
+ (createUI): Formatted code.
+
+2005-08-23 Tom Tromey <tromey@redhat.com>
+
+ * configure.ac: Fixed typo.
+
+2005-08-23 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/event/SwingPropertyChangeSupport.java
+ (writeObject): removed empty method,
+ (readObject): likewise,
+ (getPropertyChangeListeners()): implemented,
+ (getPropertyChangeListeners(String)): likewise,
+ (hasListeners): return true if there are any general listeners,
+ added API docs all over.
+
+2005-08-23 Mark Wielaard <mark@klomp.org>
+
+ * native/jni/qt-peer/qttextfieldpeer.cpp
+ (Java_gnu_java_awt_peer_qt_QtTextFieldPeer_getCaretPosition): Renamed
+ from Java_gnu_java_awt_peer_qt_QtTextFieldPeer_getCaretPositionNative.
+
+ * gnu/java/awt/peer/qt/QtComponentPeer.java (getMinimumSizeNative):
+ Removed unused native method.
+ (getPreferredSizeNative): Likewise.
+
+ * include/gnu_java_awt_peer_qt_QMatrix.h: Regenerated.
+ * include/gnu_java_awt_peer_qt_QPainterPath.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QPen.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtAudioClip.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtButtonPeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtCanvasPeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtCheckboxPeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtChoicePeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtComponentPeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtContainerPeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtDialogPeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtEmbeddedWindowPeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtFileDialogPeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtFontMetrics.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtFontPeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtFramePeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtGraphics.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtGraphicsEnvironment.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtImage.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtLabelPeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtListPeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtMenuBarPeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtMenuComponentPeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtMenuItemPeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtMenuPeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtPanelPeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtPopupMenuPeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtScreenDevice.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtScrollPanePeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtScrollbarPeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtTextAreaPeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtTextFieldPeer.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtToolkit.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtVolatileImage.h: Likewise.
+ * include/gnu_java_awt_peer_qt_QtWindowPeer.h: Likewise.
+
+2005-08-23 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * java/awt/EventQueue.java (getNextEvent): Don't check if this is
+ the dispatch thread.
+
+2005-08-23 Sven de Marothy <sven@physto.se>
+
+ * gnu/java/awt/peer/qt/QtAudioClip.java
+ * gnu/java/awt/peer/qt/QtComponentGraphics.java
+ * gnu/java/awt/peer/qt/QtComponentPeer.java
+ * gnu/java/awt/peer/qt/QtDialogPeer.java
+ * gnu/java/awt/peer/qt/QtFontPeer.java
+ * gnu/java/awt/peer/qt/QtFramePeer.java
+ * gnu/java/awt/peer/qt/QtGraphics.java
+ * gnu/java/awt/peer/qt/QtImage.java
+ * gnu/java/awt/peer/qt/QtImageGraphics.java
+ * gnu/java/awt/peer/qt/QtLabelPeer.java
+ * gnu/java/awt/peer/qt/QtMenuBarPeer.java
+ * gnu/java/awt/peer/qt/QtMenuComponentPeer.java
+ * gnu/java/awt/peer/qt/QtMenuPeer.java
+ * gnu/java/awt/peer/qt/QtPanelPeer.java
+ * gnu/java/awt/peer/qt/QtRepaintThread.java
+ * gnu/java/awt/peer/qt/QtToolkit.java
+ * gnu/java/awt/peer/qt/QtVolatileImage.java
+ * include/gnu_java_awt_peer_qt_QtComponentPeer.h
+ * include/gnu_java_awt_peer_qt_QtEmbeddedWindowPeer.h
+ * include/gnu_java_awt_peer_qt_QtGraphics.h
+ * include/gnu_java_awt_peer_qt_QtMenuPeer.h
+ * include/gnu_java_awt_peer_qt_QtVolatileImage.h
+ * native/jni/qt-peer/componentevent.cpp
+ * native/jni/qt-peer/componentevent.h
+ * native/jni/qt-peer/eventmethods.h
+ * native/jni/qt-peer/keybindings.cpp
+ * native/jni/qt-peer/keybindings.h
+ * native/jni/qt-peer/qtcomponentpeer.cpp
+ * native/jni/qt-peer/qtframepeer.cpp
+ * native/jni/qt-peer/qtgraphics.cpp
+ * native/jni/qt-peer/qtimage.h
+ * native/jni/qt-peer/qtlabelpeer.cpp
+ * native/jni/qt-peer/qtmenucomponentpeer.cpp
+ * native/jni/qt-peer/qtmenupeer.cpp
+ * native/jni/qt-peer/qtscrollpanepeer.cpp
+ * native/jni/qt-peer/qttextfieldpeer.cpp
+ * native/jni/qt-peer/qtvolatileimage.cpp
+ * native/jni/qt-peer/qtwindowpeer.cpp:
+ Reindented, minor fixes.
+ * gnu/java/awt/peer/qt/QtImageDirectGraphics.java
+ New file.
+
+2005-08-22 Tom Tromey <tromey@redhat.com>
+
+ * java/net/JarURLConnection.java (getJarEntry): Return null if no
+ entry specified.
+
+2005-08-22 Tom Tromey <tromey@redhat.com>
+
+ * lib/split-for-gcj.sh: Create Makefile.deps atomically.
+ * lib/gen-classlist.sh.in: Don't run split-for-gcj.sh.
+ * lib/Makefile.gcj (Makefile.deps): New target.
+ * lib/Makefile.am (compile-classes): Pass top_srcdir to
+ Makefile.gcj.
+
+2005-08-22 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicLookAndFeel.java:
+ Added in default border for Tree.
+ * javax/swing/tree/DefaultTreeCellRenderer.java:
+ Formatting entire class.
+ (getPreferredSize): Implemented.
+
+2005-08-22 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/event/SwingPropertyChangeSupport.java: reformatted.
+
+2005-08-22 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/ImageIcon.java: Add documentation.
+
+2005-08-22 Tom Tromey <tromey@redhat.com>
+
+ * javax/swing/text/LayoutQueue.java: New file.
+
+2005-08-22 Tom Tromey <tromey@redhat.com>
+
+ PR libgcj/23499:
+ * doc/api/Makefile.am (install-data-local): Now conditional on
+ CREATE_API_DOCS.
+ (uninstall-local): Likewise.
+
+2005-08-22 Kelley Cook <kcook@gcc.gnu.org>
+
+ * Makefile.am (ACLOCAL_AMFLAGS): New.
+
+2005-08-22 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/UIManager.java: fixed error message typo in static
+ initialization code.
+
+2005-08-22 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/text/AbstractDocument.java: fixed minor API doc problems,
+ * javax/swing/text/Caret.java: likewise,
+ * javax/swing/text/CompositeView.java: likewise,
+ * javax/swing/text/DefaultCaret.java: likewise,
+ * javax/swing/text/DefaultEditorKit.java: likewise,
+ * javax/swing/text/DefaultStyledDocument.java: likewise,
+ * javax/swing/text/ElementIterator.java: likewise,
+ * javax/swing/text/GlyphView.java: likewise,
+ * javax/swing/text/IconView.java: likewise,
+ * javax/swing/text/View.java: likewise.
+
+2005-08-22 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/SwingUtilities.java: fixed some minor API doc problems.
+
+2005-08-22 David Gilbert <david.gilbert@object-refinery.com>
+
+ * NEWS: added item regarding javax.swing.plaf.multi.* package
+ implementation.
+
+2005-08-22 Mark Wielaard <mark@klomp.org>
+
+ * native/jni/gtk-peer/gtkpeer.h (cp_gtk_clipboard,
+ cp_gtk_stringTarget, cp_gtk_imageTarget, cp_gtk_filesTarget): New
+ extern variables.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c: New file.
+ * native/jni/gtk-peer/Makefile.am (libgtkpeer_la_SOURCES): Add
+ gnu_java_awt_peer_gtk_GtkSelection.c.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c: Renames
+ clipboard to cp_gtk_clipboard, stringTarget to cp_gtk_stringTarget,
+ imageTarget to cp_gtk_imageTarget, filesTarget to cp_gtk_filesTarget,
+ cp_gtk_clipboard_owner_change_cb to clipboard_owner_change_cb,
+ cp_gtk_clipboard_get_func to clipboard_get_func,
+ cp_gtk_clipboard_clear_func to clipboard_clear_func, moved
+ GtkSelection native methods to new file.
+
+2005-08-21 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkSelection.java: Update for new FSF
+ address.
+
+2005-08-21 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/swing/plaf/basic/BasicSplitPaneUI.java
+ (KEYBOARD_DIVIDER_MOVE_OFFSET): Initialize with 3.
+
+2005-08-21 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/swing/ImageIcon.java (getIconHeight): Return -1 if image
+ is null.
+ (getIconWidth): Likewise.
+
+2005-08-21 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (window_get_frame_extents): If window is not decorated, guess 0,
+ 0, 0, 0 inset values.
+
+2005-08-21 Tom Tromey <tromey@redhat.com>
+
+ * javax/swing/text/AbstractWriter.java (NEWLINE): Now 'final'.
+
+2005-08-21 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * java/awt/Label.java (setText): Refine text inequality test.
+
+2005-08-21 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics.java (setClip(Shape)): Clear
+ clip when clip == null.
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java (setClip(Shape)):
+ Likewise.
+
+2005-08-20 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * java/awt/Label.java (setText): Invalidate label.
+
+2005-08-20 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * java/awt/image/AreaAveragingScaleFilter.java: Add checks for
+ consumer != null.
+ * java/awt/image/CropImageFilter.java: Likewise.
+ * java/awt/image/ImageFilter.java: Likewise.
+ * java/awt/image/RGBImageFilter.java: Likewise.
+ * java/awt/image/ReplicateScaleFilter.java: Likewise.
+
+2005-08-20 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GdkPixbufDecoder.java (findFormatName):
+ Just return null when ext == null.
+
+2005-08-20 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * java/awt/AWTKeyStroke.java (getAWTKeyStroke): Include old-style
+ modifiers in returned AWTKeyStroke's modifier mask.
+
+2005-08-20 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java (setStroke): Clear
+ dashes if dashes is null.
+ (setStrokeUnlocked): Likewise.
+
+2005-08-20 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * java/awt/Window.java (getMostRecentFocusOwner): New method.
+
+2005-08-20 Sven de Marothy <sven@physto.se>
+
+ * gnu/java/awt/peer/qt/MainQtThread.java
+ * gnu/java/awt/peer/qt/QtComponentGraphics.java
+ * gnu/java/awt/peer/qt/QtComponentPeer.java
+ * gnu/java/awt/peer/qt/QtEmbeddedWindowPeer.java
+ * gnu/java/awt/peer/qt/QtFramePeer.java
+ * gnu/java/awt/peer/qt/QtImage.java
+ * gnu/java/awt/peer/qt/QtListPeer.java
+ * gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java
+ * gnu/java/awt/peer/qt/QtToolkit.java
+ * native/jni/qt-peer/componentevent.cpp
+ * native/jni/qt-peer/componentevent.h
+ * native/jni/qt-peer/eventmethods.h
+ * native/jni/qt-peer/mainqtthread.cpp
+ * native/jni/qt-peer/mainthreadinterface.cpp
+ * native/jni/qt-peer/mainthreadinterface.h
+ * native/jni/qt-peer/qtcomponentpeer.cpp
+ * native/jni/qt-peer/qtframepeer.cpp
+ * native/jni/qt-peer/qtgraphics.cpp
+ Refactored.
+ * include/gnu_java_awt_peer_qt_MainQtThread.h
+ * include/gnu_java_awt_peer_qt_QMatrix.h
+ * include/gnu_java_awt_peer_qt_QPainterPath.h
+ * include/gnu_java_awt_peer_qt_QPen.h
+ * include/gnu_java_awt_peer_qt_QtAudioClip.h
+ * include/gnu_java_awt_peer_qt_QtButtonPeer.h
+ * include/gnu_java_awt_peer_qt_QtCanvasPeer.h
+ * include/gnu_java_awt_peer_qt_QtCheckboxPeer.h
+ * include/gnu_java_awt_peer_qt_QtChoicePeer.h
+ * include/gnu_java_awt_peer_qt_QtComponentPeer.h
+ * include/gnu_java_awt_peer_qt_QtContainerPeer.h
+ * include/gnu_java_awt_peer_qt_QtDialogPeer.h
+ * include/gnu_java_awt_peer_qt_QtEmbeddedWindowPeer.h
+ * include/gnu_java_awt_peer_qt_QtFileDialogPeer.h
+ * include/gnu_java_awt_peer_qt_QtFontMetrics.h
+ * include/gnu_java_awt_peer_qt_QtFontPeer.h
+ * include/gnu_java_awt_peer_qt_QtFramePeer.h
+ * include/gnu_java_awt_peer_qt_QtGraphics.h
+ * include/gnu_java_awt_peer_qt_QtGraphicsEnvironment.h
+ * include/gnu_java_awt_peer_qt_QtImage.h
+ * include/gnu_java_awt_peer_qt_QtLabelPeer.h
+ * include/gnu_java_awt_peer_qt_QtListPeer.h
+ * include/gnu_java_awt_peer_qt_QtMenuBarPeer.h
+ * include/gnu_java_awt_peer_qt_QtMenuComponentPeer.h
+ * include/gnu_java_awt_peer_qt_QtMenuItemPeer.h
+ * include/gnu_java_awt_peer_qt_QtMenuPeer.h
+ * include/gnu_java_awt_peer_qt_QtPanelPeer.h
+ * include/gnu_java_awt_peer_qt_QtPopupMenuPeer.h
+ * include/gnu_java_awt_peer_qt_QtScreenDevice.h
+ * include/gnu_java_awt_peer_qt_QtScrollPanePeer.h
+ * include/gnu_java_awt_peer_qt_QtScrollbarPeer.h
+ * include/gnu_java_awt_peer_qt_QtTextAreaPeer.h
+ * include/gnu_java_awt_peer_qt_QtTextFieldPeer.h
+ * include/gnu_java_awt_peer_qt_QtToolkit.h
+ * include/gnu_java_awt_peer_qt_QtVolatileImage.h
+ * include/gnu_java_awt_peer_qt_QtWindowPeer.h
+ Regenerated.
+ * gnu/java/awt/peer/qt/QtRepaintThread.java:
+ New file.
+
+2005-08-20 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * native/jni/gtk-peer/gtk_jawt.c
+ (classpath_jawt_get_default_display): Remove locking.
+ (classpath_jawt_get_visualID): Likewise.
+ (classpath_jawt_get_drawable): Likewise.
+ (classpath_jawt_object_lock): Remove function.
+ (classpath_jawt_object_unlock): Likewise.
+ (classpath_jawt_create_lock): Likewise.
+ (classpath_jawt_destroy_lock): Likewise.
+ * native/jni/classpath/classpath_jawt.h
+ (classpath_jawt_object_lock): Remove function.
+ (classpath_jawt_object_unlock): Likewise.
+ (classpath_jawt_create_lock): Likewise.
+ (classpath_jawt_destroy_lock): Likewise.
+ * native/jawt/jawt.c [!__GNUC__] (__attribute__): Define to
+ nothing.
+ (_Jv_Lock): Call classpath_jawt_lock.
+ (_Jv_Unlock): Call classpath_jawt_unlock.
+ (_Jv_GetDrawingSurfaceInfo): Move surface_info_x11 initialization
+ from ...
+ (_Jv_GetDrawingSurface): Remove surface_info_x11 initialization.
+ (_Jv_FreeDrawingSurface): Don't destroy target object.
+ * native/jawt/Makefile.am: Add SONAME FIXME.
+ * include/jawt_md.h (struct _JAWT_X11DrawingSurfaceInfo): Re-order
+ display field. Add colour map, depth and GetAWTColor function
+ pointer fields.
+ * include/jawt.h (struct _JAWT_Rectangle): New structure.
+ (struct _JAWT_DrawingSurfaceInfo): Add drawing surface, bounds,
+ clip size and clipping rectangle fields.
+ (struct _JAWT_DrawingSurface): Add env field. Rename lock field
+ target. Re-order function pointer and lock fields. Remove
+ surface_info field.
+ (struct _JAWT): Add GetComponent function pointer field.
+
+2005-08-20 Keith Seitz <keiths@redhat.com>
+
+ * gnu/classpath/jdwp/id/ClassLoaderId.java (getClassLoader): New method.
+ * gnu/classpath/jdwp/id/ClassObjectId.java (getClassObject): New method.
+ * gnu/classpath/jdwp/id/JdwpId.java
+ (getReference): New method.
+ (setReference): New method.
+ * gnu/classpath/jdwp/id/ObjectId.java (getObject): New method.
+ * gnu/classpath/jdwp/id/ReferenceTypeId.java (getType): New method.
+ * gnu/classpath/jdwp/id/StringId.java (getString): New method.
+ * gnu/classpath/jdwp/id/ThreadGroupId.java (getThreadGroup): New method.
+ * gnu/classpath/jdwp/id/ThreadId.java (getThread): New method.
+
+ * gnu/classpath/jdwp/id/ObjectId.java (setId): New method.
+ (disableCollection): New method.
+ (enableCollection): New method.
+
+ * gnu/classpath/jdwp/id/JdwpId.java (equals): Remove test for class equality.
+ (setId): Make public.
+
+2005-08-20 Keith Seitz <keiths@redhat.com>
+
+ * gnu/classpath/jdwp/exception/InvalidThreadGroupException.java
+ (InvalidThreadGroupException): Fix misleading string error message.
+ (InvalidThreadGroupException): Fix typo -- should be
+ JdwpConstants.Error.INVALID_THREAD_GROUP.
+
+ * gnu/classpath/jdwp/exception/InvalidClassLoaderException.java: New
+ exception.
+ * gnu/classpath/jdwp/exception/InvalidFieldException.java: New
+ exception.
+ * gnu/classpath/jdwp/exception/InvalidLocationException.java: New
+ exception.
+ * gnu/classpath/jdwp/exception/InvalidMethodException.java: New
+ exception.
+
+2005-08-19 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * NEWS: Added note about DynamicAny package.
+
+2005-08-19 Mark Wielaard <mark@klomp.org>
+
+ * native/jni/qt-peer/Makefile.am (libqtpeer_la_SOURCES):
+ Added eventmethods.h.
+
+2005-08-19 Tom Tromey <tromey@redhat.com>
+
+ * javax/swing/tree/DefaultTreeCellEditor.java: Removed erroneous
+ import.
+
+2005-08-19 Tom Tromey <tromey@redhat.com>
+
+ * javax/swing/text/AbstractWriter.java: New file.
+ * javax/swing/text/ElementIterator.java: New file.
+
+2005-08-19 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getCellBounds): No need to call getFont twice. This
+ is fixed.
+ * javax/swing/tree/DefaultTreeCellEditor.java:
+ Added API documentation for all fields.
+ (getPreferredSize): Implemented.
+ (paint): Implemented.
+ (doLayout): Implemented.
+ (getFont): Implemented.
+ (getPreferredSize): Implemented.
+ (DefaultTreeCellEditor): Partially implemented.
+ (DefaultTreeCellEditor): Partially implemented.
+ (setBorderSelectionColor): Implemented.
+ (getBorderSelectionColor): Implemented.
+ (setFont): Implemented.
+ (getFont): Implemented.
+ (getTreeCellEditorComponent): Added API documentation.
+ (getCellEditorValue): Added API documentation.
+ (isCellEditable): Added API documentation.
+ (shouldSelectCell): Added API documentation.
+ (stopCellEditing): Added API documentation.
+ (cancelCellEditing): Added API documentation.
+ (valueChanged): Added API documentation.
+ (actionPerformed): Added API documentation.
+ (setTree): Implemented.
+ (shouldStartEditingTimer): Added API documentation.
+ (startEditingTimer): Added API documentation.
+ (canEditImmediately): Added API documentation.
+ (inHitRegion): Added API documentation.
+ (determineOffset): Added API documentation.
+ (prepareForEditing): Added API documentation.
+ (createContainer): Added API documentation.
+ (createTreeCellEditor): Added API documentation.
+
+2005-08-19 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * lib/.cvsignore: Add META-INF, Makefile.deps and lists.
+
+2005-08-19 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * configure.ac: Generate native/jawt/Makefile.
+ * include/jawt.h: Import from libgcj.
+ * include/jawt_md.h: Likewise.
+ * native/Makefile.am (JAWTDIR): New variable.
+ * native/jawt: New directory.
+ * native/jawt/.cvsignore: New file.
+ * native/jawt/Makefile.am: Likewise.
+ * native/jawt/jawt.c: Import from libgcj.
+
+2005-08-19 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/tree/DefaultTreeModel.java
+ (setAsksAllowsChildren): Removed comment, unneeded.
+ (setRoot): Formatting.
+ (getIndexOfChild): Formatting.
+ (reload): Added API documentation.
+ (reload): Likewise.
+ (valueForPathChanged): Implemented.
+ (insertNodeInto): Implemented.
+ (removeNodeFromParent): Implemented.
+ (nodeChanged): Implemented.
+ (nodesWereInserted): Implemented.
+ (nodesWereRemoved): Implemented.
+ (nodesChanged): Implemented.
+ (nodeStructureChanged): Added API documentation.
+ (getPathToRoot): Implemented.
+ (getPathToRoot): Implemented.
+ (fireTreeNodesChanged): Added API documentation.
+
+2005-08-19 Roman Kennke <roman@kennke.org>
+
+ * java/awt/image/DirectColorModel.java
+ (createCompatibleWritableRaster): Added API documentation.
+
+2005-08-18 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * java/awt/Font.java (Font(String,Map)): Make package private.
+ * gnu/java/awt/ClasspathToolkit.java (getFont): Access
+ package-private Font.Font(String,Map) constructor using
+ reflection.
+
+2005-08-18 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/GLightweightPeer.java,
+ gnu/java/awt/peer/gtk/GtkComponentPeer.java,
+ gnu/java/awt/peer/gtk/GtkContainerPeer.java,
+ gnu/java/awt/peer/gtk/GtkFramePeer.java,
+ gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java,
+ gnu/java/awt/peer/gtk/GtkTextAreaPeer.java,
+ gnu/java/awt/peer/gtk/GtkTextFieldPeer.java,
+ gnu/java/awt/peer/gtk/GtkToolkit.java,
+ gnu/java/awt/peer/gtk/GtkWindowPeer.java,
+ gnu/java/awt/peer/qt/QtComponentPeer.java,
+ gnu/java/awt/peer/qt/QtContainerPeer.java,
+ gnu/java/awt/peer/qt/QtFramePeer.java,
+ gnu/java/awt/peer/qt/QtMenuComponentPeer.java,
+ gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java,
+ gnu/java/awt/peer/qt/QtTextAreaPeer.java,
+ gnu/java/awt/peer/qt/QtTextFieldPeer.java,
+ gnu/java/awt/peer/qt/QtWindowPeer.java,
+ java/awt/peer/ComponentPeer.java,
+ java/awt/peer/ContainerPeer.java, java/awt/peer/FramePeer.java,
+ java/awt/peer/MenuComponentPeer.java,
+ java/awt/peer/TextComponentPeer.java,
+ java/awt/peer/WindowPeer.java: Add new 1.5 methods.
+ * java/awt/Window.java (Window()): Initialize
+ graphicsConfiguration.
+ * java/awt/GraphicsConfiguration.java
+ (createCompatibleVolatileImage(int,int,int)): New method.
+ * java/awt/Font.java (Font(String,Map)): Add FIXME.
+ * gnu/java/awt/peer/gtk/GtkToolkit.java
+ (getLocalGraphicsEnvironment): Call new constructor.
+ * gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java (getToolkit):
+ Remove method.
+ * gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
+ (GdkGraphicsEnvironment(GtkToolkit)): Remove method.
+ (GdkGraphicsEnvironment()): New constructor.
+ (getToolkit): Remove method.
+ * gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java
+ (getToolkit): Remove method.
+ (createCompatibleVolatileImage): New method.
+ * gnu/java/awt/ClasspathToolkit.java (getFont): Add FIXME.
+
+2005-08-18 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/DefaultCellEditor.java
+ (getTreeCellEditorComponent): Implemented.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (isEditing): Implemented.
+ (mouseClicked): Moved code to mousePressed
+ (mousePressed): Code moved here from mouseClicked and
+ added in code to stop editing.
+ (selectPath): Default is changed to CONTIGUOUS_TREE_SELECTION
+ * javax/swing/tree/DefaultTreeSelectionModel.java
+ (DefaultTreeSelectionModel): Default is changed to CONTIGUOUS_TREE_SELECTION.
+
+2005-08-18 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/plaf/basic/BasicArrowButton.java:
+ Set default size to 12.
+ * javax/swing/plaf/basic/BasicScrollBarUI.java
+ (calculatePreferredSize): Don't restrict width and height to
+ a minimum of 20.
+
+2005-08-18 Keith Seitz <keiths@redhat.com>
+
+ * vm/reference/gnu/classpath/jdwp/VMIdManager.java: New file
+ with example implementation of ID-management for JDWP back-end.
+ * gnu/classpath/jdwp/id/JdwpIdFactory.java: Removed. Now part of
+ VMIdManager.
+
+2005-08-18 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (setHashColor): Implemented.
+ (getRowForPath): Implemented.
+
+2005-08-18 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/tree/DefaultTreeCellRenderer.java
+ (paint): Added check for null border.
+
+2005-08-18 Roman Kennke <roman@kennke.org>
+
+ * java/awt/FlowLayout.java
+ (setAlignment): Added comment explaining why we don't check
+ for illegal values here.
+
+2005-08-18 Roman Kennke <roman@kennke.org>
+
+ * java/awt/image/PixelGrabber.java
+ (startGrabbing): Replaced ImageConsumer.ABORTED with
+ ImageConsumer.IMAGEABORTED.
+
+2005-08-18 Roman Kennke <roman@kennke.org>
+
+ * java/awt/image/PixelGrabber.java
+ (constructors): Check if the ImageProducer is null and throw
+ a NPE if that is the case.
+ (startGrabbing): When an exception is thrown in the grabber thread,
+ exit gracefully and notify the waiting threads.
+ (imageComplete): Only call ip.removeConsumer() if ip is not null.
+
+2005-08-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/text/StringCharacterIterator.java
+ (StringCharacterIterator(String)): documented NullPointerException.
+
+2005-08-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/multi/MultiButtonUI.java: new file,
+ * javax/swing/plaf/multi/MultiColorChooserUI.java: new file,
+ * javax/swing/plaf/multi/MultiComboBoxUI.java: new file,
+ * javax/swing/plaf/multi/MultiDesktopIconUI.java: new file,
+ * javax/swing/plaf/multi/MultiDesktopPaneUI.java: new file,
+ * javax/swing/plaf/multi/MultiFileChooserUI.java: new file,
+ * javax/swing/plaf/multi/MultiInternalFrameUI.java: new file,
+ * javax/swing/plaf/multi/MultiLabelUI.java: new file,
+ * javax/swing/plaf/multi/MultiListUI.java: new file,
+ * javax/swing/plaf/multi/MultiLookAndFeel.java: new file,
+ * javax/swing/plaf/multi/MultiMenuBarUI.java: new file,
+ * javax/swing/plaf/multi/MultiMenuItemUI.java: new file,
+ * javax/swing/plaf/multi/MultiOptionPaneUI.java: new file,
+ * javax/swing/plaf/multi/MultiPanelUI.java: new file,
+ * javax/swing/plaf/multi/MultiPopupMenuUI.java: new file,
+ * javax/swing/plaf/multi/MultiProgressBarUI.java: new file,
+ * javax/swing/plaf/multi/MultiRootPaneUI.java: new file,
+ * javax/swing/plaf/multi/MultiScrollBarUI.java: new file,
+ * javax/swing/plaf/multi/MultiScrollPaneUI.java: new file,
+ * javax/swing/plaf/multi/MultiSeparatorUI.java: new file,
+ * javax/swing/plaf/multi/MultiSliderUI.java: new file,
+ * javax/swing/plaf/multi/MultiSpinnerUI.java: new file,
+ * javax/swing/plaf/multi/MultiSplitPaneUI.java: new file,
+ * javax/swing/plaf/multi/MultiTabbedPaneUI.java: new file,
+ * javax/swing/plaf/multi/MultiTableHeaderUI.java: new file,
+ * javax/swing/plaf/multi/MultiTableUI.java: new file,
+ * javax/swing/plaf/multi/MultiTextUI.java: new file,
+ * javax/swing/plaf/multi/MultiToolBarUI.java: new file,
+ * javax/swing/plaf/multi/MultiToolTipUI.java: new file,
+ * javax/swing/plaf/multi/MultiTreeUI.java: new file,
+ * javax/swing/plaf/multi/MultiViewportUI.java: new file,
+ * javax/swing/plaf/multi/package.html: new file.
+
+2005-08-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/util/Vector.java
+ (copyInto) fixed incorrect API description.
+
+2005-08-17 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c,
+ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c,
+ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c,
+ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c,
+ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c: Remove
+ JamVM deadlock workarounds.
+
+2005-08-17 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java,
+ gnu_java_awt_peer_gtk_GtkFramePeer.c (postConfigureEvent): Prevent
+ callback calling back into peers.
+ (setBounds): Likewise.
+ (setMenuBarWidthUnlocked): New method.
+ * native/jni/gtk-peer/gtkpeer.h (cp_gtk_filedialog_init_jni):
+ Declare function.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
+ (gtkInit): Call cp_gtk_filedialog_init_jni.
+ (loadSystemColors): Work around deadlock.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
+ (textcomponent_changed_cb): Don't release GDK lock.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
+ (item_activate_cb): Don't release GDK lock.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
+ (item_highlighted_cb): Don't release GDK lock.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+ (component_button_press_cb): Don't release GDK lock.
+ (component_button_release_cb): Likewise.
+ (component_motion_notify_cb): Likewise.
+ (component_enter_notify_cb): Likewise.
+ (component_leave_notify_cb): Likewise.
+ (component_expose_cb): Likewise.
+ (component_focus_in_cb): Likewise.
+ (component_focus_out_cb): Likewise.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
+ (block_expose_event_cb): Remove callback.
+ * gnu/java/awt/peer/gtk/GtkWindowPeer.java,
+ gnu_java_awt_peer_gtk_GtkWindowPeer.c (postConfigureEvent):
+ Prevent callback calling back into peers.
+ (setBounds): Likewise.
+ (nativeSetBoundsUnlocked): New method.
+ (setBoundsUnlocked): Likewise.
+ (nativeSetVisibleUnlocked): Likewise.
+ (setVisibleUnlocked): Likewise.
+ (window_delete_cb): Don't release GDK lock.
+ (window_destroy_cb): Likewise.
+ (window_show_cb): Likewise.
+ (window_active_state_change_cb): Likewise.
+ (window_focus_state_change_cb): Likewise.
+ (window_focus_in_cb): Likewise.
+ (window_focus_out_cb): Likewise.
+ (window_window_state_cb): Likewise.
+ (window_property_changed_cb): Likewise.
+ (realize_cb): Likewise.
+ * gnu/java/awt/peer/gtk/GtkToolkit.java (mainThread): New
+ variable.
+ * gnu/java/awt/peer/gtk/GtkFileDialogPeer.java,
+ gnu_java_awt_peer_gtk_GtkFileDialogPeer.c (setVisible): Prevent
+ callback calling back into peers.
+ (filename_filter_cb): Don't release GDK lock.
+ (handle_response_cb): Likewise.
+ (cp_gtk_filedialog_init_jni): New function.
+ * gnu/java/awt/peer/gtk/GtkCheckboxPeer.java (setState): Prevent
+ callback from calling back into peers.
+ (item_toggled_cb): Don't release GDK lock.
+ * gnu/java/awt/peer/gtk/GdkPixbufDecoder.java,
+ gnu_java_awt_peer_gtk_GdkPixbufDecoder.c (area_prepared_cb): Don't
+ release GDK lock.
+ (area_updated_cb): Likewise.
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java,
+ gnu_java_awt_peer_gtk_GdkGraphics2D.c (initStateUnlocked): New
+ method.
+ (cairoSurfaceSetFilterUnlocked): Likewise.
+ (initComponentGraphics2DUnlocked): Likewise.
+ (setTexturePixelsUnlocked): Likewise.
+ (setGradientUnlocked): Likewise.
+ (cairoSetMatrixUnlocked): Likewise.
+ (cairoSetRGBAColorUnlocked): Likewise.
+ (cairoSetLineWidthUnlocked): Likewise.
+ (cairoSetLineCapUnlocked): Likewise.
+ (cairoSetLineJoinUnlocked): Likewise.
+ (cairoSetDashUnlocked): Likewise.
+ (cairoSetMiterLimitUnlocked): Likewise.
+ (setPaintUnlocked): Likewise.
+ (setTransformUnlocked): Likewise.
+ (setStrokeUnlocked): Likewise.
+ (setColorUnlocked): Likewise.
+ (setBackgroundUnlocked): Likewise.
+ (setRenderingHintsUnlocked): Likewise.
+ (setFontUnlocked): Likewise.
+ (realize_cb): Don't release GDK lock. Call
+ initComponentGraphics2DUnlocked.
+ * gnu/java/awt/peer/gtk/GdkGraphics.java,
+ gnu_java_awt_peer_gtk_GdkGraphics.c (initStateUnlocked): New
+ method.
+ (initComponentGraphicsUnlocked): New method.
+ (realize_cb): Don't release GDK lock. Call
+ initComponentGraphicsUnlocked.
+ * include/gnu_java_awt_peer_gtk_GdkGraphics.h: Regenerate.
+ * include/gnu_java_awt_peer_gtk_GdkGraphics2D.h: Likewise.
+ * include/gnu_java_awt_peer_gtk_GtkFramePeer.h: Likewise.
+ * include/gnu_java_awt_peer_gtk_GtkWindowPeer.h: Likewise.
+
+2005-08-17 Tom Tromey <tromey@redhat.com>
+
+ * .project: Correctly omit jdwp from vm/reference.
+
+2005-08-17 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (viewToModel): Changed to match API spec.
+ * javax/swing/text/CompositeView.java
+ (viewToModel): Changed to match API spec.
+ * javax/swing/text/FieldView.java
+ (viewToModel): Changed to match API spec.
+ * javax/swing/text/GlyphView.java
+ (viewToModel): Changed to match API spec.
+ * javax/swing/text/IconView.java
+ (viewToModel): Changed to match API spec.
+ * javax/swing/text/PasswordView.java
+ (viewToModel): Changed to match API spec.
+ * javax/swing/text/PlainView.java
+ (viewToModel): Changed to match API spec.
+ * javax/swing/text/View.java
+ (viewToModel): Changed to match API spec.
+
+2005-08-17 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JList.java:
+ (indexToLocation): Implemented.
+ (getLastVisibleIndex): If the last index in the list is showing and
+ there is extra room at the bottom, return the last index, not -1.
+
+2005-08-17 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getCellLocation): Added in check if node is a leaf.
+ Shouldnt call getChildCount if a leaf. May cause NPE.
+ (paintRecursive): Likewise.
+ (paintControlIcons): Likewise.
+ (findNode): Likewise.
+ (getNextNode): Likewise.
+ (getPreviousNode): Likewise.
+ (getNextSibling): Likewise.
+ (getPreviousSibling): Likewise.
+
+2005-08-17 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/tree/DefaultTreeCellRenderer.java
+ (paint): paints the background and border of cell.
+
+2005-08-17 Roman Kennke <roman@kennke.org>
+
+ Reported by Ingo Proetel <proetel@aicas.com>
+ * java/awt/image/DirectColorModel.java
+ (createCompatibleWritableRaster): Added argument check.
+
+2005-08-17 Roman Kennke <roman@kennke.org>
+
+ * java/awt/FontMetrics.java
+ (charWidth(int)): Correctly map Unicode indices to char[] here.
+
+2005-08-17 Roman Kennke <roman@kennke.org>
+
+ * java/lang/Character.java
+ (toChars(int)): New JDK1.5 method.
+ (toChars(int, char[], int)): New JDK1.5 method.
+ (charCount): New JDK1.5 method.
+ (isSupplementaryCodePoint): New JDK1.5 method.
+ (isValidCodePoint): New JDK1.5 method.
+
+2005-08-17 Lillian Angel <langel@redhat.com>
+
+ * java/awt/FontMetrics.java
+ (charWidth): Reversed Roman's patch, was not compiling.
+ * javax/swing/tree/DefaultTreeCellRenderer.java
+ (getTreeCellRendererComponent): Set Opaque to true for
+ painting reasons.
+
+2005-08-17 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/awt/peer/qt/QtFramePeer.java (setIcon): Mark non-native
+ and add FIXME.
+ (setMaximizedBounds): Likewise.
+ * include/gnu_java_awt_peer_qt_QtFramePeer.h: Regenerated.
+ * native/jni/qt-peer/.cvsignore: New file.
+ * native/jni/qt-peer/Makefile.am (libqtpeer_la_SOURCES):
+ Remove eventmethods.h.
+
+2005-08-17 Mark Wielaard <mark@klomp.org>
+
+ * scripts/check_jni_methods.sh: Find JNI method declarations in
+ .cpp files. Check both GNU style functions (start of line) and
+ one-line like declarations. Use diff -U 0, not -0.
+
+2005-08-17 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/plaf/basic/BasicLabelUI.java
+ (paint): Don't paint the border here. If there is a border to
+ be painted, this is usually performed in JComponent.paint().
+
+2005-08-17 Roman Kennke <roman@kennke.org>
+
+ * java/awt/FontMetrics.java
+ (charWidth(int)): Correctly map Unicode indices to char[] here.
+
+2005-08-17 Roman Kennke <roman@kennke.org>
+
+ * java/awt/Component.java
+ This applies to various variants of the repaint() methods:
+ (repaint): If the component is not showing, forward repaint
+ request to the parent.
+
+2005-08-17 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/plaf/basic/BasicLabelUI.java
+ (paint): Don't fill the background here. If the label is opaque
+ then the background is filled in ComponentUI.update(), otherwise
+ it must not be touched.
+
+2005-08-17 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
+ (setComponentBounds): Don't post COMPONENT_RESIZED event.
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (setBoundsCallbackID): Remove variable.
+ (cp_gtk_window_init_jni): Don't initialize setBoundsCallbackID.
+ (setBoundsCallback): Remove method.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c
+ (setMenuBarPeer): Check if menubar is NULL.
+ (setMenuBarWidth): Likewise.
+ * java/awt/Window.java (dispatchEventImpl): Validate upon
+ receiving a COMPONENT_RESIZED event.
+ (setBoundsCallback): Remove method.
+ * include/gnu_java_awt_peer_gtk_GtkWindowPeer.h: Regenerate.
+ * gnu/java/awt/peer/gtk/GtkWindowPeer.java (setBoundsCallback):
+ Remove method declaration.
+ (postConfigureEvent): Separate handling of resizes and moves.
+ Call setSize and post COMPONENT_RESIZED event.
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java (postConfigureEvent):
+ Separate handling of resizes and moves. Call setSize.
+ * gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
+ (setComponentBounds): Call setSize and post COMPONENT_RESIZED
+ event.
+ * gnu/java/awt/peer/gtk/GtkContainerPeer.java (isValidating):
+ Remove field.
+
+2005-08-15 Dalibor Topic <robilad@kaffe.org>
+
+ * configure.ac: Added option to enable building qt peers.
+
+ * include/Makefile.am: Added qt peer headers.
+
+ * include/gnu_java_awt_peer_qt_MainQtThread.h,
+ include/gnu_java_awt_peer_qt_QMatrix.h,
+ include/gnu_java_awt_peer_qt_QPainterPath.h,
+ include/gnu_java_awt_peer_qt_QPen.h,
+ include/gnu_java_awt_peer_qt_QtAudioClip.h,
+ include/gnu_java_awt_peer_qt_QtButtonPeer.h,
+ include/gnu_java_awt_peer_qt_QtCanvasPeer.h,
+ include/gnu_java_awt_peer_qt_QtCheckboxPeer.h,
+ include/gnu_java_awt_peer_qt_QtChoicePeer.h,
+ include/gnu_java_awt_peer_qt_QtComponentPeer.h,
+ include/gnu_java_awt_peer_qt_QtContainerPeer.h,
+ include/gnu_java_awt_peer_qt_QtDialogPeer.h,
+ include/gnu_java_awt_peer_qt_QtEmbeddedWindowPeer.h,
+ include/gnu_java_awt_peer_qt_QtFileDialogPeer.h,
+ include/gnu_java_awt_peer_qt_QtFontMetrics.h,
+ include/gnu_java_awt_peer_qt_QtFontPeer.h,
+ include/gnu_java_awt_peer_qt_QtFramePeer.h,
+ include/gnu_java_awt_peer_qt_QtGraphics.h,
+ include/gnu_java_awt_peer_qt_QtGraphicsEnvironment.h,
+ include/gnu_java_awt_peer_qt_QtImage.h,
+ include/gnu_java_awt_peer_qt_QtLabelPeer.h,
+ include/gnu_java_awt_peer_qt_QtListPeer.h,
+ include/gnu_java_awt_peer_qt_QtMenuBarPeer.h,
+ include/gnu_java_awt_peer_qt_QtMenuComponentPeer.h,
+ include/gnu_java_awt_peer_qt_QtMenuItemPeer.h,
+ include/gnu_java_awt_peer_qt_QtMenuPeer.h,
+ include/gnu_java_awt_peer_qt_QtPanelPeer.h,
+ include/gnu_java_awt_peer_qt_QtPopupMenuPeer.h,
+ include/gnu_java_awt_peer_qt_QtScreenDevice.h,
+ include/gnu_java_awt_peer_qt_QtScrollPanePeer.h,
+ include/gnu_java_awt_peer_qt_QtScrollbarPeer.h,
+ include/gnu_java_awt_peer_qt_QtTextAreaPeer.h,
+ include/gnu_java_awt_peer_qt_QtTextFieldPeer.h,
+ include/gnu_java_awt_peer_qt_QtToolkit.h,
+ include/gnu_java_awt_peer_qt_QtVolatileImage.h,
+ include/gnu_java_awt_peer_qt_QtWindowPeer.h,
+ native/jni/qt-peer/Makefile.am:
+ New files.
+
+ * native/jni/Makefile.am: Handle qt peers.
+
+ * native/jni/qt-peer/slotcallbacks.moc.h: Removed. Now generated
+ on demand by moc.
+
+2005-08-16 Sven de Marothy <sven@physto.se>
+
+ * gnu/java/awt/peer/qt/QtButtonPeer.java
+ * gnu/java/awt/peer/qt/QtCheckboxPeer.java
+ * gnu/java/awt/peer/qt/QtChoicePeer.java
+ * gnu/java/awt/peer/qt/QtComponentGraphics.java
+ * gnu/java/awt/peer/qt/QtComponentPeer.java
+ * gnu/java/awt/peer/qt/QtContainerPeer.java
+ * gnu/java/awt/peer/qt/QtDialogPeer.java
+ * gnu/java/awt/peer/qt/QtFontPeer.java
+ * gnu/java/awt/peer/qt/QtFramePeer.java
+ * gnu/java/awt/peer/qt/QtGraphics.java
+ * gnu/java/awt/peer/qt/QtImage.java
+ * gnu/java/awt/peer/qt/QtImageGraphics.java
+ * gnu/java/awt/peer/qt/QtListPeer.java
+ * gnu/java/awt/peer/qt/QtMenuBarPeer.java
+ * gnu/java/awt/peer/qt/QtMenuItemPeer.java
+ * gnu/java/awt/peer/qt/QtMenuPeer.java
+ * gnu/java/awt/peer/qt/QtScrollbarPeer.java
+ * gnu/java/awt/peer/qt/QtTextAreaPeer.java
+ * gnu/java/awt/peer/qt/QtTextFieldPeer.java
+ * gnu/java/awt/peer/qt/QtToolkit.java
+ * gnu/java/awt/peer/qt/QtWindowPeer.java
+ * native/jni/qt-peer/keybindings.cpp
+ * native/jni/qt-peer/keybindings.h
+ * native/jni/qt-peer/qtbuttonpeer.cpp
+ * native/jni/qt-peer/qtcanvaspeer.cpp
+ * native/jni/qt-peer/qtcheckboxpeer.cpp
+ * native/jni/qt-peer/qtchoicepeer.cpp
+ * native/jni/qt-peer/qtcomponent.cpp
+ * native/jni/qt-peer/qtcomponentpeer.cpp
+ * native/jni/qt-peer/qtdialogpeer.cpp
+ * native/jni/qt-peer/qtframepeer.cpp
+ * native/jni/qt-peer/qtgraphics.cpp
+ * native/jni/qt-peer/qtimage.cpp
+ * native/jni/qt-peer/qtlabelpeer.cpp
+ * native/jni/qt-peer/qtlistpeer.cpp
+ * native/jni/qt-peer/qtmenupeer.cpp
+ * native/jni/qt-peer/qtpanelpeer.cpp
+ * native/jni/qt-peer/qtscrollbarpeer.cpp
+ * native/jni/qt-peer/qtscrollpanepeer.cpp
+ * native/jni/qt-peer/qttextareapeer.cpp
+ * native/jni/qt-peer/qttextfieldpeer.cpp
+ * native/jni/qt-peer/qtwindowpeer.cpp
+ * native/jni/qt-peer/slotcallbacks.cpp
+ * native/jni/qt-peer/slotcallbacks.h
+ Reindented, Transmogrified and Wielaardituded.
+ * gnu/java/awt/peer/qt/QtEmbeddedWindowPeer.java
+ * native/jni/qt-peer/eventmethods.h
+ * native/jni/qt-peer/qtembeddedwindowpeer.cpp
+ * native/jni/qt-peer/slotcallbacks.moc.h
+ New files
+ * native/jni/qt-peer/eventmethods.cpp
+ * native/jni/qt-peer/slotcallbacks.moc
+ Removed.
+
+2005-08-16 Tom Tromey <tromey@redhat.com>
+
+ * .project: Fixed typo. Added builder for native code.
+ * .externalToolBuilders/CompileNative.launch: New file.
+
+2005-08-16 Tom Tromey <tromey@redhat.com>
+
+ * .classpath: Ignore jdwp.
+ * .project: Added builder to create LocaleData.java.
+ * .externalToolBuilders/CreateLocaleData.launch: New file.
+ * examples/gnu/classpath/examples/jawt/DemoJAWT.java: Added package.
+
+2005-08-16 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/text/PasswordView.java
+ (drawUnselectedText): Fixed so the password is drawn correctly
+ in the text box and no * characters are drawn before anything
+ was typed.
+
+2005-08-16 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/awt/peer/gtk/GtkClipboard.java: Reimplemented.
+ * gnu/java/awt/peer/gtk/GtkClipboardNotifier.java: New class.
+ * gnu/java/awt/peer/gtk/GtkSelection.java: New class.
+ * gnu/java/awt/peer/gtk/GtkImage.java (GtkImage(Pointer)): New
+ constructor.
+ (createFromPixbuf): New private native method.
+ * gnu/java/awt/peer/gtk/GtkToolkit.java (systemClipboard): Removed.
+ (getSystemClipboard): Do security check and return
+ GtkClipboard.getInstance().
+ * include/Makefile.am: Add gnu_java_awt_peer_gtk_GtkSelection.h.
+ * include/gnu_java_awt_peer_gtk_GtkClipboard.h: Regenerated.
+ * include/gnu_java_awt_peer_gtk_GtkImage.h: Regenerated.
+ * include/gnu_java_awt_peer_gtk_GtkSelection.h: New header file.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c:
+ Reimplemented.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
+ (Java_gnu_java_awt_peer_gtk_GtkImage_createFromPixbuf): New
+
+2005-08-16 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ (ActionListenerProxy): Replaced type TableAction with parent type
+ ActionListener to avoid Semantic errors.
+
+2005-08-16 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicLookAndFeel.java:
+ (initComponentDefaults): Fixed typo.
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ (installKeyboardActions): Replaced calls to registerKeyboardAction with
+ additions to an explicit InputMap-ActionMap pair and then set this
+ pair as the parent pair to the JTable's. This matches the JDK where
+ the UI Input-Action pairs are the parents of the component's.
+ (ActionListenerProxy): New class.
+
+2005-08-16 Mark Wielaard <mark@klomp.org>
+
+ * examples/gnu/classpath/examples/datatransfer/Demo.java:
+ Document and implement ItemListener and FlavorListener.
+ (flavors): New field.
+ (details): New field.
+ (Demo): Add more space, add the flavors panel and flavor listener.
+ (createTextPanel): Smaller and wider.
+ (createFlavorsPanel): New private method.
+ (flavorsChanged): New public method.
+ (itemStateChanged): Likewise.
+ (ImageComponent.ImageComponent): Smaller default.
+ (ObjectComponent.ObjectComponent): Make wider.
+ (FlavorsComponent): New static class.
+ (FlavorDetailsComponent): Likewise.
+
+2005-08-16 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicLookAndFeel.java:
+ Changed font for PasswordField because textbox was
+ being drawn at an awkward height.
+ * javax/swing/text/PasswordView.java
+ (getPreferredSpan): Implemented
+ (modelToView): likewise.
+ (viewToModel): partially implemented.
+
+2005-08-16 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/awt/Component.java
+ (dispatchEventImpl): Always call peer.handleEvent().
+
+2005-08-16 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/awt/Container.java
+ (addImpl, remove): Only repaint if the container is showing.
+
+2005-08-16 Mark Wielaard <mark@klomp.org>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
+ (Java_gnu_java_awt_peer_gtk_GtkToolkit_nativeQueueEmpty): Removed.
+
+2005-08-15 Dalibor Topic <robilad@kaffe.org>
+
+ * native/jni/qt-peer/mainqtthread.cpp,
+ native/jni/qt-peer/qmatrix.cpp,
+ native/jni/qt-peer/qpainterpath.cpp,
+ native/jni/qt-peer/qpen.cpp,
+ native/jni/qt-peer/qtbuttonpeer.cpp,
+ native/jni/qt-peer/qtcanvaspeer.cpp,
+ native/jni/qt-peer/qtcheckboxpeer.cpp,
+ native/jni/qt-peer/qtchoicepeer.cpp,
+ native/jni/qt-peer/qtcomponentpeer.cpp,
+ native/jni/qt-peer/qtdialogpeer.cpp,
+ native/jni/qt-peer/qtfiledialogpeer.cpp,
+ native/jni/qt-peer/qtfontmetrics.cpp,
+ native/jni/qt-peer/qtfontpeer.cpp,
+ native/jni/qt-peer/qtframepeer.cpp,
+ native/jni/qt-peer/qtgraphics.cpp,
+ native/jni/qt-peer/qtimage.cpp,
+ native/jni/qt-peer/qtlabelpeer.cpp,
+ native/jni/qt-peer/qtlistpeer.cpp,
+ native/jni/qt-peer/qtmenubarpeer.cpp,
+ native/jni/qt-peer/qtmenucomponentpeer.cpp,
+ native/jni/qt-peer/qtmenuitempeer.cpp,
+ native/jni/qt-peer/qtmenupeer.cpp,
+ native/jni/qt-peer/qtpanelpeer.cpp,
+ native/jni/qt-peer/qtpopupmenupeer.cpp,
+ native/jni/qt-peer/qtscreendevice.cpp,
+ native/jni/qt-peer/qtscrollbarpeer.cpp,
+ native/jni/qt-peer/qtscrollpanepeer.cpp,
+ native/jni/qt-peer/qttextareapeer.cpp,
+ native/jni/qt-peer/qttextfieldpeer.cpp,
+ native/jni/qt-peer/qtvolatileimage.cpp,
+ native/jni/qt-peer/qtwindowpeer.cpp:
+ Include <assert.h>.
+
+2005-08-15 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JPasswordField.java
+ (getText): Fixed the length of the string to retrieve.
+
+2005-08-15 Sven de Marothy <sven@physto.se>
+
+ * java/awt/TextComponent.java
+ (select): Fix typo.
+
+2005-08-15 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JComponent.java:
+ (processKeyEvent): Added functionality for processing key events in
+ non-focused components using the WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
+ field.
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ (installKeyboardActions): Changed key bindings to be registered as
+ WHEN_ANCESTOR_OF_FOCUSED_COMPONENT rather than as WHEN_FOCUSED.
+ (TableAction.actionPerformed): If the key action is anything besides
+ "start editing" then we stop editing if we are doing so. Repaint the
+ table at the end of this method.
+
+2005-08-15 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JPasswordField.java
+ (echoCharIsSet): Fixed this to work according to API.
+ (getText): Implemented
+ (getText): Implemented
+ (getPassword): Implemented
+ (paramString): Implemented
+
+2005-08-15 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/ClasspathToolkit.java (nativeQueueEmpty): Remove
+ method.
+ (wakeNativeQueue): Likewise.
+ (iterateNativeQueue): Likewise.
+ * gnu/java/awt/peer/gtk/GtkToolkit.java (static): Start GTK main
+ thread.
+ (nativeQueueEmpty): Remove method.
+ (wakeNativeQueue): Likewise.
+ (iterateNativeQueue): Likewise.
+ (gtkMain): New method.
+ * include/gnu_java_awt_peer_gtk_GtkToolkit.h: Regenerate.
+ * java/awt/EventQueue.java: Remove references to ClasspathToolkit.
+ * java/awt/Frame.java (fireDummyEvent): Remove method.
+ Remove calls to fireDummyEvent.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
+ (dispose): Don't wake up main thread.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c: Remove
+ single-thread code.
+
+2005-08-15 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTree.java
+ (expandPath): called fireTreeWillExpand and fireTreeExpanded
+ since it is not required that the calling class fires these
+ events.
+ (collapsePath): Likewise.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (mouseClicked): Took out code that called fireTreeWillExpand/
+ fireTreeWillCollapse and fireTreeExpanded/fireTreeCollapsed.
+ (keyPressed): Likewise.
+
+2005-08-15 Roman Kennke <roman@kennke.org>
+
+ * java/awt/FlowLayout.java
+ (setAlignment): Removed check for illegal values. These values
+ are treated as LEFT alignment instead.
+ (layoutContainer): Treat unknown align values as LEFT in default
+ clause of if-else statement.
+
+2005-08-15 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkButtonPeer.java (handleEvent): Remove
+ method.
+ (postActionEvent): New method.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c:
+ Rename state_to_awt_mods cp_gtk_state_to_awt_mods.
+ * native/jni/gtk-peer/gtkpeer.h: Declare cp_gtk_state_to_awt_mods.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
+ (clicked_cb): New function.
+ (connectSignals): Connect clicked_cb callback to "clicked" signal.
+
+2005-08-14 Casey Marshall <csm@gnu.org>
+
+ * gnu/java/security/provider/DSAKeyPairGenerator.java
+ (initialize): set 'keysize' to 'modlen.'
+ (getDefaults): return 'true' for keysizes '768' and '1024.'
+
+2005-08-14 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * lib/Makefile.am (JAVAC): Disable ecj warning output.
+
+2005-08-14 Sven de Marothy <sven@physto.se>
+
+ * gnu/java/awt/ClasspathToolkit.java
+ (getScreenSize, getColorModel, getFontMetrics, getImage, createImage,
+ createImageProducer, registerImageIOSpis):
+ Remove redundant (overloaded) methods.
+ * gnu/java/awt/peer/gtk/GtkToolkit.java
+ (registerImageIOSpis): Move registration to static initializer.
+ * javax/imageio/spi/IIORegistry.java:
+ Remove call to Toolkit registration method.
+
+2005-08-13 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/awt/peer/gtk/GtkComponentPeer.java (repaintTimer): Make
+ field final.
+
+2005-08-14 Sven de Marothy <sven@physto.se>
+
+ * java/awt/Container.java
+ (addImpl): Call addNotify() only if the container has a peer.
+
+2005-08-13 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/io/ObjectInputStream.java
+ (readClassDescriptor): Don't cache caller's class loader.
+ (resolveClass): Don't cache caller's class loader and support
+ primitive types. Fixes bug #23377.
+
+2005-08-13 Mark Wielaard <mark@klomp.org>
+
+ * scripts/check_jni_methods.sh: Set and check for PROBLEM.
+
+2005-08-13 Mark Wielaard <mark@klomp.org>
+
+ * scripts/check_jni_methods.sh: Don't create temp files in source dir.
+ Don't override existing files. Fast fail on errors.
+
+2005-08-12 Aaron Luchko <aluchko@redhat.com>
+
+ * vm/reference/gnu/classpath/jdwp/VMFrame.java(getValue):
+ Fix typo in comment.
+
+2005-08-12 Aaron Luchko <aluchko@redhat.com>
+
+ * gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
+ (executeAllThreads): Use enumerate(Thread[]) instead of
+ enumerate(Thread[], true).
+ (runCommand): Throw NotImplementedException when command is not found.
+
+2005-08-12 Aaron Luchko <aluchko@redhat.com>
+
+ * gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java
+ (executeInvokeMethod): Change MethodInvoker to MethodResult.
+
+2005-08-12 Aaron Luchko <aluchko@redhat.com>
+
+ * gnu/classpath/jdwp/util/VariableTable.java: A class representing a
+ Variable Table for a method.
+ * gnu/classpath/jdwp/util/LineTable.java: A class representing a Line
+ Table for a method.
+
+2005-08-12 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkMenuBarPeer.java (addMenu(Menu)): New
+ method.
+ * gnu/java/awt/peer/gtk/GtkMenuPeer.java (addSeparator): Likewise.
+ * java/awt/peer/MenuBarPeer.java (addMenu): New method
+ declaration.
+ * java/awt/peer/MenuPeer.java (addSeparator): New method
+ declaration.
+
+2005-08-12 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkComponentPeer.java (setBounds): Get
+ frame insets directly from peer rather than from Window.getInsets.
+ (toString): New method.
+
+2005-08-12 Aaron Luchko <aluchko@redhat.com>
+
+ * gnu/classpath/jdwp/util/Location.java: New file to handle JDWP
+ locations.
+
+2005-08-12 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkButtonPeer.java,
+ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
+ (gtkWidgetGetPreferredDimensions): New method.
+ * gnu/java/awt/peer/gtk/GtkLabelPeer.java,
+ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c
+ (gtkWidgetGetPreferredDimensions): New method.
+ * include/gnu_java_awt_peer_gtk_GtkLabelPeer.h: Regenerate.
+ * include/gnu_java_awt_peer_gtk_GtkButtonPeer.h: Likewise.
+
+2005-08-12 Aaron Luchko <aluchko@redhat.com>
+
+ * gnu/classpath/jdwp/exception/JdwpInternalErrorException.java
+ (JdwpInternalErrorException): Added new constructor.
+ * gnu/classpath/jdwp/util/Value.java
+ (getUntaggedObj):
+ Changed InvalidFieldException to JdwpInternalErrorException.
+ (writeUntaggedValue): Likewise.
+ (writeTaggedValue): Likewise.
+ (writeValue): Likewise.
+
+2005-08-12 Aaron Luchko <aluchko@redhat.com>
+
+ * gnu/classpath/jdwp/processor/EventRequestCommandSet.java:
+ Implemented the EventRequest CommandSet.
+
+2005-08-12 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JTable.java:
+ (setValueAt): Do nothing if isCellEditable returns false.
+ (editCelLAt): Removed the Key Listener for the JTextField. Listening
+ for ESCAPE should be handled by the JTable itself. Note, this is not
+ implemented yet.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java:
+ (initComponentDefaults): Added several keybindings to JTable's
+ ancestorInputMap. These are all implemented.
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ (KeyHandler): Removed this class. Note that most of the code from the
+ keyPressed method now resides in the actionPerformed method of the
+ BasicTableUI.TableAction class.
+ (convertModifiers): New private method to convert from new InputEvent
+ modifier masks to the old style.
+ (installKeyboardActions): Implemented. Gets the key bindings from
+ the UIManager and registers them for the JTable.
+ (TableAction): New class. This is where the actions corresponding to
+ key presses resides.
+ (installListeners): Removed installation of KeyListener.
+
+2005-08-12 Aaron Luchko <aluchko@redhat.com>
+
+ * vm/reference/standard.omit: New file to omit jdwp reference classes
+ from build.
+
+2005-08-12 Aaron Luchko <aluchko@redhat.com>
+
+ * vm/reference/gnu/classpath/jdwp/VMFrame.java: Implemented reference
+ implementation of interface to VM for JDWP frame management.
+ * gnu/classpath/jdwp/processor/StackFrameCommandSet.java: Updated
+ import.
+ (executeGetValues): Use VMFrame instead of Frame.
+ (executeSetValues): Use VMFrame instead of Frame.
+ (executeThisObject): Use VMFrame instead of Frame.
+ * gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java:
+ Updated import.
+ (executeFrames): Changed getLoc() to getLocation() and use
+ VMFrame instead of Frame.
+
+2005-08-12 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getCellLocation): Added in a check to make sure the node has children.
+ Fixed loop to use post-increment.
+ (paintRecursive): Fixed loop to use post-increment.
+ (paintControlIcons): Likewise.
+ (getNextNode): Fixed check to make sure that node has children.
+ (getPreviousSibling): Added in check to make sure index is in correct
+ range.
+
+2005-08-12 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/awt/peer/qt/QtButtonPeer.java: Replace uses of
+ toolkit.eventQueue.postEvent() with QtToolkit.eventQueue.postEvent().
+ * gnu/java/awt/peer/qt/QtCheckboxPeer.java: Likewise.
+ * gnu/java/awt/peer/qt/QtChoicePeer.java: Likewise.
+ * gnu/java/awt/peer/qt/QtComponentPeer.java: Likewise and for
+ guiThread.QApplicationPointer and graphicsEnv.getScreenDevices().
+ * gnu/java/awt/peer/qt/QtMenuItemPeer.java: Likewise.
+ * gnu/java/awt/peer/qt/QtMenuPeer.java: Likewise.
+ * gnu/java/awt/peer/qt/QtScrollbarPeer.java: Likewise.
+ * gnu/java/security/PolicyFile.javai (refresh): Assign only outside
+ if statement.
+
+2005-08-12 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/text/GapContent.java
+ (insertString): Use replace() to actually insert content.
+ (remove): Use replace() to actually remove content.
+ (shiftGap): Repaired misplaced curly brace in if block of
+ boudary check.
+ (replace): Check for null argument for addItems.
+
+2005-08-12 Roman Kennke <roman@kennke.org>
+
+ Reported by: Ingo Proetel <proetel@aicas.com>
+ * java/net/URLClassLoader.java
+ (findClass): Added null check to avoid NullPointerException.
+
+2005-08-12 Roman Kennke <roman@kennke.org>
+
+ Reported by: Ingo Proetel <proetel@aicas.com>
+ * java/util/logging/Logger.java
+ This applies to a couple of log() methods:
+ (log): Added check if the specified level is actually enabled,
+ otherwise ignore logging request.
+
+2005-08-12 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicSplitPaneUI.java
+ * (getMinimumDividerLocation): Fixed to work similar to
+ getMaximumDividerLocation. Was not able to move divider
+ in both directions before.
+
+2005-08-12 Roman Kennke <roman@kennke.org>
+
+ * java/awt/Component.java
+ (reshape): Simplified repainting of parent.
+ (paint): Don't call peer.paint() here. The paint method is
+ exclusivly meant to be overridden by subclasses that wish to
+ perform custom painting and should do nothing by default.
+ (repaint): Use local variable in null pointer checks to avoid
+ NullPointerExceptions.
+ (imageUpdate): Slight formatting adjustments.
+ (dispatchEvent): Don't call peer.handleEvent() here, this must
+ be done in dispatchEventImpl().
+ (dispatchEventImpl): Dispatch PAINT and UPDATE events to the
+ peer.
+ * java/awt/Container.java
+ (paint): Don't call super.paint() here, this method does nothing
+ anyway. Visit only lightweight children.
+ (update): Instead of clearing the background only for top-level
+ containers, clear the background for all heavyweight containers.
+
+2005-08-12 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * examples/gnu/classpath/examples/jawt/DemoJAWT.c: New file.
+ * examples/gnu/classpath/examples/jawt/DemoJAWT.java: Likewise.
+ * examples/gnu/classpath/examples/jawt/Makefile: Likewise.
+
+2005-08-11 Mark Wielaard <mark@klomp.org>
+
+ * examples/gnu/classpath/examples/datatransfer/Demo.java:
+ New example.
+
+2005-08-11 Tom Tromey <tromey@redhat.com>
+
+ For PR classpath/23008:
+ * gnu/java/nio/charset/UTF_16Decoder.java (decodeLoop): Correctly
+ mask bytes when constructing characters.
+
+2005-08-11 Mark Wielaard <mark@klomp.org>
+
+ * native/jni/classpath/Makefile.am (EXTRA_DIST): Add classpath_jawt.h.
+ * include/gnu_java_awt_peer_qt_*: Removed.
+
+2005-08-11 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableInterceptor/IORInfoOperations.java,
+ org/omg/PortableInterceptor/IORInterceptor.java,
+ org/omg/PortableInterceptor/IORInterceptorOperations.java,
+ org/omg/PortableInterceptor/IORInfo.java: New files.
+
+2005-08-11 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTable
+ (rowAtPoint): Added in a check for null. Was getting NPE.
+ (columnAtPoint): Likewise.
+
+2005-08-11 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicViewportUI.java
+ (paintSimple): Changed to paint the portBounds from (0,0).
+
+2005-08-11 Tom Tromey <tromey@redhat.com>
+
+ * java/awt/image/ConvolveOp.java (filter): Defer numBands check
+ until after null check. PR classpath/22999.
+
+2005-08-11 Tom Tromey <tromey@redhat.com>
+
+ * java/util/Observable.java (addObserver): Throw
+ NullPointerException if necessary. PR classpath/23279.
+
+2005-08-11 Sven de Marothy <sven@physto.se>
+
+ * gnu/java/awt/peer/qt/QtMenuComponentPeer.java,
+ gnu/java/awt/peer/qt/QtGraphics.java,
+ gnu/java/awt/peer/qt/QtTextFieldPeer.java,
+ gnu/java/awt/peer/qt/QtFramePeer.java,
+ gnu/java/awt/peer/qt/QtPanelPeer.java,
+ gnu/java/awt/peer/qt/QtToolkit.java,
+ gnu/java/awt/peer/qt/QtWindowPeer.java,
+ gnu/java/awt/peer/qt/QtButtonPeer.java,
+ gnu/java/awt/peer/qt/QtImageGraphics.java,
+ gnu/java/awt/peer/qt/QtContainerPeer.java,
+ gnu/java/awt/peer/qt/QtComponentPeer.java,
+ gnu/java/awt/peer/qt/QtListPeer.java,
+ gnu/java/awt/peer/qt/QtChoicePeer.java,
+ gnu/java/awt/peer/qt/QtScrollPanePeer.java,
+ gnu/java/awt/peer/qt/MainQtThread.java,
+ gnu/java/awt/peer/qt/QtImage.java,
+ gnu/java/awt/peer/qt/NativeWrapper.java,
+ gnu/java/awt/peer/qt/QtCheckboxPeer.java,
+ gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java,
+ gnu/java/awt/peer/qt/QtTextAreaPeer.java,
+ gnu/java/awt/peer/qt/QtDialogPeer.java,
+ gnu/java/awt/peer/qt/QPen.java,
+ gnu/java/awt/peer/qt/QtCanvasPeer.java,
+ gnu/java/awt/peer/qt/QtLabelPeer.java,
+ gnu/java/awt/peer/qt/QtGraphicsEnvironment.java,
+ gnu/java/awt/peer/qt/QtImageConsumer.java,
+ gnu/java/awt/peer/qt/QtScrollbarPeer.java,
+ gnu/java/awt/peer/qt/QtFontMetrics.java,
+ gnu/java/awt/peer/qt/QtMenuBarPeer.java,
+ gnu/java/awt/peer/qt/QtFontPeer.java,
+ gnu/java/awt/peer/qt/QMatrix.java,
+ gnu/java/awt/peer/qt/QtVolatileImage.java,
+ gnu/java/awt/peer/qt/QPainterPath.java,
+ gnu/java/awt/peer/qt/QtComponentGraphics.java,
+ gnu/java/awt/peer/qt/QtScreenDevice.java,
+ gnu/java/awt/peer/qt/QtMenuPeer.java,
+ gnu/java/awt/peer/qt/QtAudioClip.java,
+ gnu/java/awt/peer/qt/QtPopupMenuPeer.java,
+ gnu/java/awt/peer/qt/QtFileDialogPeer.java,
+ gnu/java/awt/peer/qt/QtMenuItemPeer.java,
+ * native/jni/qt-peer/qpen.cpp,
+ native/jni/qt-peer/keybindings.cpp,
+ native/jni/qt-peer/qtcomponentpeer.cpp,
+ native/jni/qt-peer/buttonevent.h,
+ native/jni/qt-peer/qtdialogpeer.cpp,
+ native/jni/qt-peer/qtmenubarpeer.cpp,
+ native/jni/qt-peer/mainqtthread.cpp,
+ native/jni/qt-peer/qtpanelpeer.cpp,
+ native/jni/qt-peer/qmatrix.cpp,
+ native/jni/qt-peer/qtmenucomponentpeer.cpp,
+ native/jni/qt-peer/qtgraphics.cpp,
+ native/jni/qt-peer/qttoolkit.cpp,
+ native/jni/qt-peer/qtbuttonpeer.cpp,
+ native/jni/qt-peer/keybindings.h,
+ native/jni/qt-peer/qtvolatileimage.cpp,
+ native/jni/qt-peer/qtcomponent.h,
+ native/jni/qt-peer/slotcallbacks.cpp,
+ native/jni/qt-peer/qtpopupmenupeer.cpp,
+ native/jni/qt-peer/qtmenuitempeer.cpp,
+ native/jni/qt-peer/qtchoicepeer.cpp,
+ native/jni/qt-peer/nativewrapper.cpp,
+ native/jni/qt-peer/qtscreendevice.cpp,
+ native/jni/qt-peer/qtfontpeer.cpp,
+ native/jni/qt-peer/qpainterpath.cpp,
+ native/jni/qt-peer/qtstrings.h,
+ native/jni/qt-peer/qttextfieldpeer.cpp,
+ native/jni/qt-peer/qtimage.cpp,
+ native/jni/qt-peer/componentevent.h,
+ native/jni/qt-peer/qtwindowpeer.cpp,
+ native/jni/qt-peer/qtframepeer.cpp,
+ native/jni/qt-peer/qtscrollpanepeer.cpp,
+ native/jni/qt-peer/qtfontmetrics.cpp,
+ native/jni/qt-peer/qtlistpeer.cpp,
+ native/jni/qt-peer/mainthreadinterface.h
+ native/jni/qt-peer/slotcallbacks.h
+ native/jni/qt-peer/qtfiledialogpeer.cpp,
+ native/jni/qt-peer/eventmethods.cpp,
+ native/jni/qt-peer/qtimage.h,
+ native/jni/qt-peer/qtstrings.cpp,
+ native/jni/qt-peer/nativewrapper.h
+ native/jni/qt-peer/qtaudioclip.cpp,
+ native/jni/qt-peer/qtfont.h,
+ native/jni/qt-peer/qtscrollbarpeer.cpp,
+ native/jni/qt-peer/containers.h,
+ native/jni/qt-peer/qtcheckboxpeer.cpp,
+ native/jni/qt-peer/mainthreadinterface.cpp,
+ native/jni/qt-peer/componentevent.cpp,
+ native/jni/qt-peer/qttextareapeer.cpp,
+ native/jni/qt-peer/qtcomponent.cpp,
+ native/jni/qt-peer/qtmenupeer.cpp,
+ native/jni/qt-peer/qtlabelpeer.cpp,
+ native/jni/qt-peer/qtcanvaspeer.cpp,
+ native/jni/qt-peer/qtgraphics.h,
+ * include/gnu_java_awt_peer_qt_QtCheckboxPeer.h,
+ include/gnu_java_awt_peer_qt_QtToolkit.h,
+ include/gnu_java_awt_peer_qt_QtAudioClip.h,
+ include/gnu_java_awt_peer_qt_QtScreenDevice.h,
+ include/gnu_java_awt_peer_qt_QtTextFieldPeer.h,
+ include/gnu_java_awt_peer_qt_QtMenuItemPeer.h,
+ include/gnu_java_awt_peer_qt_QtButtonPeer.h,
+ include/gnu_java_awt_peer_qt_QtWindowPeer.h,
+ include/gnu_java_awt_peer_qt_QtDialogPeer.h,
+ include/gnu_java_awt_peer_qt_QtImage.h,
+ include/gnu_java_awt_peer_qt_QtMenuBarPeer.h,
+ include/gnu_java_awt_peer_qt_QtVolatileImage.h,
+ include/gnu_java_awt_peer_qt_QtFontPeer.h,
+ include/gnu_java_awt_peer_qt_QtChoicePeer.h,
+ include/gnu_java_awt_peer_qt_QtGraphics.h,
+ include/gnu_java_awt_peer_qt_QtComponentPeer.h,
+ include/gnu_java_awt_peer_qt_QtMenuPeer.h,
+ include/gnu_java_awt_peer_qt_QtTextAreaPeer.h,
+ include/gnu_java_awt_peer_qt_QPen.h,
+ include/gnu_java_awt_peer_qt_QtPanelPeer.h,
+ include/gnu_java_awt_peer_qt_QPainterPath.h,
+ include/gnu_java_awt_peer_qt_QtFontMetrics.h,
+ include/gnu_java_awt_peer_qt_QtScrollPanePeer.h,
+ include/gnu_java_awt_peer_qt_QtGraphicsEnvironment.h,
+ include/gnu_java_awt_peer_qt_QMatrix.h,
+ include/gnu_java_awt_peer_qt_QtLabelPeer.h,
+ include/gnu_java_awt_peer_qt_QtPopupMenuPeer.h,
+ include/gnu_java_awt_peer_qt_QtFramePeer.h,
+ include/gnu_java_awt_peer_qt_QtListPeer.h,
+ include/gnu_java_awt_peer_qt_QtScrollbarPeer.h,
+ include/gnu_java_awt_peer_qt_QtCanvasPeer.h,
+ include/gnu_java_awt_peer_qt_QtMenuComponentPeer.h,
+ include/gnu_java_awt_peer_qt_MainQtThread.h,
+ include/gnu_java_awt_peer_qt_QtFileDialogPeer.h,
+ include/gnu_java_awt_peer_qt_QtContainerPeer.h:
+ New files.
+
+2005-08-11 Tom Tromey <tromey@redhat.com>
+
+ For PR classpath/23238:
+ * lib/gen-classlist.sh.in: Use @SHELL@; invoke split-for-gcj.sh
+ with it.
+ * configure.ac (SH): Removed subst.
+
+2005-08-11 Andrew Haley <aph@redhat.com>
+
+ * lib/split-for-gcj.sh: Comment.
+
+2005-08-11 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicViewportUI.java
+ (paintSimple): This line was causing problems with the JTable viewport.
+ However, the scrollpane still needs to be fixed. It is still not
+ painting beyond the view's bounds.
+
+2005-08-10 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+
+ * lib/split-for-gcj.sh: Don't use unportable %{parameter%word}.
+ Don't use unportable !.
+
+2005-08-10 Tom Tromey <tromey@redhat.com>
+
+ * lib/gen-classlist.sh.in (GCJ): New subst.
+ Invoke split-for-gcj.sh if the results changed.
+ * lib/Makefile.am (CLEANFILES): Removed old entries.
+ (compile-classes): Don't run split-for-gcj.sh.
+
+2005-08-10 Aaron Luchko <aluchko@redhat.com>
+
+ * gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java:
+ Implemented the ThreadReference CommandSet.
+
+2005-08-10 Aaron Luchko <aluchko@redhat.com>
+
+ * gnu/classpath/jdwp/processor/ClassTypeCommandSet.java:
+ Implemented the ClassType CommandSet.
+ * gnu/classpath/jdwp/util/MethodResult.java: Class to wrap
+ around results of method executions.
+
+2005-08-10 Tom Tromey <tromey@redhat.com>
+
+ For PR classpath/22580:
+ * lib/Makefile.am (compile-classes): Made conditional on
+ FOUND_GCJ.
+ (JAVAC): Redefined when FOUND_GCJ.
+
+2005-08-10 Tom Tromey <tromey@redhat.com>
+
+ * lib/Makefile.am (JAVAC): Use $(SHELL) to invoke
+ split-for-gcj.sh. For PR classpath/23238.
+
+2005-08-10 Tom Tromey <tromey@redhat.com>
+
+ * lib/split-for-gcj.sh: Use 'while' loop to avoid length limits.
+
+2005-08-10 Andreas Tobler <toa@pop.agri.ch>
+
+ * native/jni/java-net/gnu_java_net_PlainSocketImpl.c: Include
+ target_native_file.h. PR classpath/22926.
+
+2005-08-10 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTree.java
+ (doExpandParents): Took out call to checkExpandParents.
+ (checkExpandParents): Helper method not needed. Caused problems since
+ fireTreeWillExpand was being called too many times. fireTreeWillExpand
+ is called from BasicTreeUI whenever a node is expanded.
+
+2005-08-10 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableInterceptor/Interceptor.java,
+ org/omg/PortableInterceptor/InterceptorOperations.java: New files.
+ * org/omg/DynamicAny/_DynAnyFactoryStub.java,
+ org/omg/DynamicAny/_DynAnyStub.java,
+ org/omg/DynamicAny/_DynArrayStub.java,
+ org/omg/DynamicAny/_DynEnumStub.java,
+ org/omg/DynamicAny/_DynFixedStub.java,
+ org/omg/DynamicAny/_DynStructStub.java,
+ org/omg/DynamicAny/_DynUnionStub.java,
+ org/omg/DynamicAny/_DynValueStub.java,
+ org/omg/DynamicAny/_DynSequenceStub.java: Added _opsClass field.
+
+2005-08-10 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java:
+ Formatted entire class.
+
+2005-08-10 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (mouseClicked): Called fireTreeWillExpand and fireTreeWillCollapse when
+ appropriate.
+ (keyPressed): Likewise.
+
+2005-08-10 Roman Kennke <roman@kennke.org>
+
+ * java/awt/Container.java
+ (paint): Call visitChildren with lightweightOnly == true.
+ (update): Only call paint if we are not in a toplevel container.
+
+2005-08-09 Aaron Luchko <aluchko@redhat.com>
+
+ * gnu/classpath/jdwp/processor/StackFrameCommandSet.java:
+ Implemented the StackFrame CommandSet.
+
+2005-08-09 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JTable.java:
+ (editingCancelled): Implemented.
+ (editCellAt): Added a KeyListener to our editor to listen for
+ the ESCAPE key and cancel editing upon receiving it.
+
+2005-08-09 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTable.java
+ (setRowHeight): Fixed condition on when to throw exception.
+ (setRowHeight): Parameters were mixed up.
+
+2005-08-09 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicLabelUI.java
+ (paint): Added in painting code for label border.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (paintControlIcons): Fixed location for control icons.
+ * javax/swing/plaf/metal/MetalLookAndFeel.java:
+ Added defaults for selection and non-selection border for
+ tree cells.
+ * javax/swing/tree/DefaultTreeCellRenderer.java
+ (getTreeCellRendererComponent): Set borders for node. Also,
+ made node transparent (not opaque), So JLabel draws icon,
+ text and border appropriately.
+
+2005-08-09 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicLabelUI.java
+ (paint): Added in code to paint background rect according to
+ API. Also, formatting changes.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (setCellRenderer): Fixed to changed renderer in JTree.
+ (uninstallDefaults): Line taken out because not needed.
+ (paintNode): Took out unneeded code because BasicLabelUI was fixed.
+ (paintRecursive): Fixed so lines are only drawn when parents have
+ children.
+
+2005-08-09 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/DefaultCellEditor.java:
+ (EditorDelegate.setValue): Implemented.
+ (EditorDelegate.getCellEditorValue): Implemented.
+ (EditorDelegate.isCellEditable): Implemented.
+ (EditorDelegate.shouldSelectCell): Implemented.
+ (EditorDelegate.stopCellEditing): Implemented.
+ (EditorDelegate.cancelCellEditing): Implemented.
+ (EditorDelegate.startCellEditing): Implemented.
+ (EditorDelegate.actionPerformed): Implemented.
+ (EditorDelegate.itemStateChanged): Implemented.
+ (EditorDelegate.fireEditingStopped): New implementation method.
+ (EditorDelegate.fireEditingCancelled): New implementation method.
+ (DefaultCellEditor): Implemented 3 constructors.
+ (getComponent): Implemented.
+ (getClickCountToStart): Implemented.
+ (setClickCountToStart): Implemented.
+ (getCellEditorValue): Implemented.
+ (isCellEditable): Implemented.
+ (shouldSelectCell): Implemented.
+ (cancelCellEditing): Implemented.
+ (getTableCellEditorComponent): Implemented.
+ * javax/swing/JTable.java:
+ (EditorUpdateTimer): New private class.
+ (editingStopped): Implemented.
+ (setValueAt): If the Object value is a Component, add it to the JTable
+ so it can obtain focus.
+ (editCellAt): Implemented.
+ (removeEditor): Implemented.
+ (prepareEditor): Implemented.
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ (KeyHandler.keyPressed): Added F2 "start editing" key action.
+ (MouseHandler.mousePressed): Added check to see if a new cell was
+ selected and we need to stop editing.
+ (paint): If the cell is a JTextField, paint its Caret as well.
+ * javax/swing/table/DefaultTableCellRenderer.java:
+ (getTableCellRendererComponent): If a JTextField is passed in, return
+ one. This is used for editing JTable cells.
+
+2005-08-09 Aaron Luchko <aluchko@redhat.com>
+
+ * gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java:
+ Implemented the ClassLoaderReference CommandSet.
+
+2005-08-09 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/tree/DefaultTreeModel.java: Fix copyright
+ boilerplate formatting.
+
+2005-08-09 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/tree/DefaultTreeModel.java:
+ Fixed formatting of class.
+
+2005-08-09 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #23255
+ * javax/swing/plaf/basic/BasicTreeUI.java:
+ Fixed entire class to use Objects as opposed to TreeNodes.
+ (getPathBounds): Changed root to Object
+ (getPathForRow): Likewise.
+ (getRowCount): Likewise.
+ (getPreferredSize): Changed root and nextNode to be of type
+ Object.
+ (isLeaf): Took out unnecessary code.
+ (keyPressed): Changed all TreeNodes to be of type Object.
+ (getCellLocation): Likewise.
+ (paintNode): Likewise.
+ (paintRecursive): Likewise.
+ (getParent): Implemented.
+ (findNode): Helper Implemented.
+ (getNextVisibleNode): Changed return and parameter type to Object.
+ (getPreviousVisibleNode): Likewise.
+ (getNextNode): Likewise.
+ (getPreviousNode): Likewise.
+ (getNextSibling): Likewise.
+ (getPreviousSibling): Likewise.
+ (getPathToRoot): Likewise.
+ (getLevel): Likewise.
+ * javax/swing/tree/DefaultTreeModel.java
+ (getIndexOfChild): Implemented.
+
+2005-08-09 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/CORBA/package.html: Documentation update.
+ * org/omg/DynamicAny/package.html: New file.
+
+2005-08-08 Casey Marshall <csm@gnu.org>
+
+ PR classpath/23120
+ * gnu/java/security/provider/DSAKeyPairGenerator.java
+ (<init>): made public; set default values.
+ (initialize): just call 'initialize(int,boolean,SecureRandom).'
+ (initialize): just call 'initialize(DSAParams,SecureRandom).'
+ (initialize): check all values for 'null' before overwriting.
+ (initialize): fill in defaults or generate new parameters here.
+ (generateKeyPair): don't create parameters; fill in 'random' if
+ 'null;' use 'random,' not a new Random object, when generating
+ random numbers.
+ (getDefaults): fix keysize check.
+
+ PR classpath/22990
+ * java/security/KeyPairGenerator.java (initialize): do nothing.
+
+2005-08-08 Tom Tromey <tromey@redhat.com>
+
+ PR classpath/23285:
+ * native/jni/classpath/classpath_jawt.h
+ (classpath_jawt_get_awt_version, classpath_jawt_lock,
+ classpath_jawt_unlock, classpath_jawt_create_lock,
+ classpath_jawt_destroy_lock): Use '(void)' in prototype.
+ * native/jni/gtk-peer/Makefile.am (libgtkpeer_la_SOURCES): Added
+ gtk_jawt.c.
+ * native/jni/gtk-peer/gtk_jawt.c: New file from libgcj.
+ (classpath_jawt_create_lock, classpath_jawt_destroy_lock): Use
+ cp_gtk_gdk_env.
+
+2005-08-08 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/DynamicAny/FieldNameHelper.java: New file.
+
+2005-08-08 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/DynamicAny/_DynAnyFactoryStub.java,
+ org/omg/DynamicAny/_DynAnyStub.java,
+ org/omg/DynamicAny/_DynArrayStub.java,
+ org/omg/DynamicAny/_DynEnumStub.java,
+ org/omg/DynamicAny/_DynFixedStub.java,
+ org/omg/DynamicAny/_DynStructStub.java,
+ org/omg/DynamicAny/_DynUnionStub.java,
+ org/omg/DynamicAny/_DynValueStub.java,
+ org/omg/DynamicAny/_DynSequenceStub.java: New files.
+
+2005-08-08 Lillian Angel <langel@redhat.com>
+
+ Fixes bug #23252
+ * javax/swing/JTree.java
+ (setModel): Changed to allow model to be null.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (setModel): Changed to depend on JTree functions
+ (getPathBounds): Fixed to work when model = null.
+ (getPathForRow): Likewise.
+ (getRowCount): Likewise.
+ (installListeners): Likewise.
+ (installUI): Likewise.
+ (paint): Likewise.
+ (getPreferredSize): Likewise.
+
+2005-08-08 Casey Marshall <csm@gnu.org>
+
+ Fixes bug #22914
+ * gnu/classpath/debug/Component.java (POLICY): new constant.
+ * gnu/java/security/PolicyFile.java (logger): new constant.
+ (DEBUG,debug,debug): removed.
+ (DEFAULT_POLICY): use 'SystemProperties' class to bypass security
+ check.
+ (DEFAULT_USER_POLICY): new constant.
+ (getPermissions): replace 'debug' calls with logger calls.
+ (refresh): add 'DEFAULT_USER_POLICY' to the initial list;
+ interpret 'java.security.policy' and 'policy.url' properties
+ properly; replace 'debug' calls with logger calls.
+ (parse): replace 'debug' calls with logger calls.
+
+2005-08-07 Casey Marshall <csm@gnu.org>
+
+ * javax/security/auth/x500/X500Principal.java
+ (encodeDer): use the right iterator for the inner loop.
+ (parseString): test for end of input.
+ (readAttributeType): provide detail message for exception.
+ (readAttributeValue): return the result on end of input;
+ read the next character while looping.
+ (putComponent): accept 'o' and 'ou' short names.
+
+2005-08-07 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/DynamicAny/AnySeqHelper.java,
+ org/omg/DynamicAny/NameDynAnyPairSeqHelper.java,
+ org/omg/DynamicAny/NameValuePairHelper.java,
+ org/omg/DynamicAny/NameDynAnyPairHelper.java,
+ org/omg/DynamicAny/NameValuePairSeqHelper.java,
+ org/omg/DynamicAny/DynAnySeqHelper.java,
+ gnu/CORBA/DynAnySeqHolder.java,
+ gnu/CORBA/NameDynAnyPairSeqHolder.java,
+ gnu/CORBA/NameDynAnyPairHolder.java,
+ gnu/CORBA/NameValuePairSeqHolder.java,
+ gnu/CORBA/NameValuePairHolder.java: New files.
+
+2005-08-07 Ito Kazumitsu <kaz@maczuka.gcd.org>
+
+ Fixes bug #22929
+ * java/net/NetworkInterface.java
+ (condense): New static private method.
+ (getNetworkInterfaces): Call condense().
+ (getByName, getByInetAddress): Call getNetworkInterfaces()
+ so that condensed result may be returned.
+ * vm/reference/java/net/VMNetworkInterface.java (getInterfaces):
+ Clarify return value in documentation.
+
+2005-08-07 Mark Wielaard <mark@klomp.org>
+
+ Fixes bug #22920
+ * java/net/DatagramSocket.java (DatagramSocket(SocketAddress)):
+ Use gnu.classpath.SystemProperties to get impl.prefix.
+
+2005-08-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/CDR/noHeaderInput.java,
+ gnu/CORBA/gnuValueHolder.java,
+ gnu/CORBA/DynAn/gnuDynAny.java,
+ gnu/CORBA/DynAn/gnuDynArray.java,
+ gnu/CORBA/DynAn/gnuDynSequence.java,
+ gnu/CORBA/DynAn/gnuDynValueBox.java,
+ gnu/CORBA/DynAn/abstractRecord.java,
+ gnu/CORBA/DynAn/gnuDynAnyFactory.java,
+ gnu/CORBA/DynAn/gnuDynValue.java,
+ gnu/CORBA/DynAn/gnuDynStruct.java,
+ gnu/CORBA/DynAn/anyDivideable.java,
+ gnu/CORBA/DynAn/anyUndivideable.java,
+ gnu/CORBA/DynAn/gnuDynEnum.java,
+ gnu/CORBA/DynAn/abstractDynAny.java,
+ gnu/CORBA/DynAn/gnuDynFixed.java,
+ gnu/CORBA/DynAn/valueChangedListener.java,
+ gnu/CORBA/DynAn/gnuDynUnion.java: New files.
+ * org/omg/DynamicAny/DynUnionOperations.java,
+ org/omg/DynamicAny/DynAnyOperations.java,
+ org/omg/DynamicAny/DynAnyFactoryOperations.java,
+ org/omg/DynamicAny/DynValueBox.java,
+ org/omg/DynamicAny/DynValueCommon.java,
+ org/omg/DynamicAny/DynAnyFactoryHelper.java,
+ gnu/CORBA/typeNamer.java,
+ gnu/CORBA/fixedTypeCode.java,
+ gnu/CORBA/CDR/Vio.java,
+ gnu/CORBA/CDR/cdrInput.java,
+ gnu/CORBA/CDR/cdrOutput.java,
+ gnu/CORBA/holderFactory.java,
+ gnu/CORBA/universalHolder.java,
+ gnu/CORBA/Poa/ORB_1_4.java,
+ gnu/CORBA/Restricted_ORB.java,
+ gnu/CORBA/gnuAny.java,
+ org/omg/CORBA/TypeCode.java
+ org/omg/CORBA/Any.java,
+ org/omg/CORBA/ORB.java,
+ org/omg/CORBA/ObjectHelper.java,
+ org/omg/CORBA/ObjectHolder.java,
+ org/omg/CORBA_2_3/portable/InputStream.java,
+ org/omg/CORBA_2_3/portable/OutputStream.java,
+ gnu/CORBA/DynAn/NameValuePairHolder.java: Rewritten.
+
+2005-08-06 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/io/ObjectInputStream.java
+ (readClassDescriptor): Removed bogus handling of primitive types.
+ (readFields.GetField.defaulted): Pass cause to exception.
+ (readFields.GetField.getField): Pass cause to exception.
+ (newObject, callReadMethod): Call initCause on exception.
+
+2005-08-06 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/lang/IllegalArgumentException.java,
+ java/lang/IllegalStateException.java,
+ java/lang/SecurityException.java,
+ java/lang/UnsupportedOperationException.java: Merged from generics
+ branch.
+
+2005-08-05 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java:
+ (getPathBounds): Changed to use TreeNode and not
+ DefaultMutableTreeNode.
+ (getPathForRow): Likewise.
+ (getRowCount): Likewise.
+ (getPreferredSize): Likewise.
+ (keyPressed): Likewise.
+ (paintNode): Likewise.
+ (getCellLocation): Likewise.
+ (paintRecursive): Likewise.
+ (paintControlIcons): Likewise.
+ (getNextVisibleNode): Likewise.
+ (getPreviousVisibleNode): Likewise.
+ (getNextNode): Implemented because not using DefaultMutableTreeNode.
+ (getPreviousNode): Implemented
+ (getNextSibling): Implemented
+ (getPreviousSibling): Implemented
+ (getPathToRoot): Implemented
+ (getLevel): Implemented
+
+2005-08-05 Mark Wielaard <mark@klomp.org>
+
+ * java/awt/datatransfer/FlavorEvent.java: New class.
+ * java/awt/datatransfer/FlavorListener.java: Likewise.
+ * java/awt/datatransfer/Clipboard.java (name): Made final.
+ (listeners): New final ArrayList field.
+ (setContents): Reimplemented.
+ (getAvailableDataFlavors): New method.
+ (isDataFlavorAvailable): Likewise.
+ (getData): Likewise.
+ (addFlavorListener): Likewise.
+ (removeFlavorListener): Likewise.
+ (getFlavorListeners): Likewise.
+ * java/awt/datatransfer/DataFlavor.java (javaFileListFlavor):
+ Construct with mime media-type application/x-java-file-list.
+ (DataFlavor(String mimeType, String humanPresentableName)): Call
+ constructor that uses given mimeType.
+ (getSubType): Reimplemented.
+ (getParameter): Handle 'vitual' humanPresentableName parameter.
+ (isMimeTypeEqual): Reimplement.
+ (isRepresentationClassRemote): Implement.
+ (toString): Add formatting.
+
+2005-08-05 Lillian Angel <langel@redhat.com>
+
+ * java/awt/GridBagLayout.java
+ (setConstraints): Removed checks in if statements because if the height
+ or width is less than 0, it should be updated to a positive number in
+ all cases.
+
+2005-08-05 Mark Wielaard <mark@klomp.org>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c: Include
+ jcl.h.
+ (createRawData): Removed unused variable method.
+ (getData): Removed unused variable field.
+ * native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c
+ (createRawData): Removed unused variable method.
+ (getData): Removed unused variable field.
+ * native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c
+ (createRawData): Removed unused variable method.
+ (getData): Removed unused variable field.
+ * native/jni/java-nio/java_nio_VMDirectByteBuffer.c
+ (Java_java_nio_VMDirectByteBuffer_init): Removed.
+ * vm/reference/java/nio/VMDirectByteBuffer.java (init): Removed.
+ * include/java_nio_VMDirectByteBuffer.h: Regenerated.
+
+2005-08-05 Roman Kennke <roman@kennke.org>
+
+ * java/awt/Container.java:
+ (preferredSize): Call getLayout() instead of directly referencing
+ the private field. This makes components work that override
+ getLayout().
+ (minimumSize): Call getLayout() instead of directly referencing
+ the private field. This makes components work that override
+ getLayout(). Use cached size if component is still valid.
+ (maximumSize): Call getLayout() instead of directly referencing
+ the private field. This makes components work that override
+ getLayout(). Use cached size if component is still valid.
+ (update): If we are a top-level-container, call super.update(),
+ otherwise directly call paint().
+ (visitChildren): Also visit children that are itself Containers.
+ * java/awt/Component.java
+ (update): Clear the background only for lightweight and top-level
+ components.
+
+2005-08-05 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicGraphicsUtils.java
+ (getPreferredButtonSize): Added horizontalAdjustment to width
+ to create gap at end of label text.
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (getPreferredSize): Removed "*2" since fix was moved to
+ BasicGraphicsUtils
+
+2005-08-05 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/text/DefaultCaret.java: Added API comments all
+ over.
+ * javax/swing/text/DefaultEditorKit.java: Added API comments
+ all over.
+
+2005-08-05 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/io/ObjectInputStream.java
+ (read(byte[],int,int)): Simplified and fixed bug 23236.
+
+2005-08-04 Aaron Luchko <aluchko@redhat.com>
+
+ * gnu/classpath/jdwp/processor/MethodCommandSet.java: Implemented
+ the Method CommandSet.
+
+2005-08-04 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (getPreferredSize): Multiplied defaultTextIconGap by 2,
+ so there is equal space around the MenuItem
+
+2005-08-04 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (paintIcon): Added in border painting code for MenuItem
+ * javax/swing/plaf/metal/MetalLookAndFeel.java:
+ Added in default for CheckBox border
+
+2005-08-04 Roman Kennke <roman@kennke.org>
+
+ * java/awt/BorderLayout.java: Reformatted this file to meet our
+ coding standards.
+
+2005-08-04 Roman Kennke <roman@kennke.org>
+
+ * java/awt/BorderLayout.java
+ (layoutContainer): Replaced getSize() call with getWidth() and
+ getHeight(). This avoids heap allocation and fixes a bug in
+ an application here.
+
+2005-08-04 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JCheckBox.java
+ (init): Moved these to ui
+ * javax/swing/plaf/basic/BasicCheckBoxUI.java
+ (installUI): initalized icons
+ * javax/swing/plaf/metal/MetalLookAndFeel.java:
+ Took out CheckBoxMenuItem defaults because did not
+ work as expected. For now it uses the BasicL&F's defaults.
+
+2005-08-04 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JList.java:
+ (getFirstVisibleIndex): Translate visible rectangle by one less pixel.
+ (getLastVisibleIndex): Likewise.
+
+2005-08-04 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JCheckBox.java
+ (init): Initialized icons. Was not working otherwise.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java:
+ Added in checkIcon for the CheckBox.
+ * javax/swing/plaf/metal/MetalLookAndFeel.java:
+ Added in checkIcon for CheckBox and defaults for
+ CheckBoxMenuItem.
+
+2005-08-03 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JCheckBoxMenuItem.java
+ (installUI): set the items visible. Fixes exceptions that are
+ thrown because item is not explicitly set visible.
+
+2005-08-03 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/plaf/basic/BasicViewportUI.java
+ (paintSimple): Corrected the clip that is used to draw the
+ viewport's content. This fixes scrolling in JScrollPane and
+ JViewport.
+
+2005-08-03 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicLookAndFeel.java:
+ Changed the fonts from Helvetica to Dialog.
+
+2005-08-03 Guilhem Lavaux <guilhem@kaffe.org>
+
+ * include/java_nio_VMDirectByteBuffer.h:
+ Regenerated.
+
+ * native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c
+ (getData): Fixed function call.
+
+ Reported by: Andreas Tobler <toa@pop.agri.ch>
+
+2005-08-03 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicIconFactory.java:
+ (getMenuItemCheckIcon): Implemented so a check mark is drawn when
+ the item is selected.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java:
+ Modified the checkbox defaults
+ * javax/swing/plaf/basic/BasicMenuItemUI.java:
+ (paintMenuItem): Changed to only draw check when item is selected.
+
+2005-08-03 Roman Kennke <roman@kennke.org>
+
+ * java/awt/FontMetrics.java
+ (charsWidth): Iterate to len + offset instead to len.
+
+2005-08-03 Guilhem Lavaux <guilhem@kaffe.org>
+
+ * native/jni/classpath/jcl.c
+ (JCL_NewRawDataObject): Fixed typo.
+
+2005-08-03 Guilhem Lavaux <guilhem@kaffe.org>
+
+ * gnu/classpath/Pointer.java,
+ gnu/classpath/Pointer32.java,
+ gnu/classpath/Pointer64.java,
+ gnu/classpath/RawData.java,
+ gnu/classpath/RawData32.java,
+ gnu/classpath/RawData64.java,
+ gnu/java/awt/peer/gtk/GtkImage.java,
+ gnu/java/nio/charset/iconv/IconvDecoder.java,
+ gnu/java/nio/charset/iconv/IconvEncoder.java,
+ java/nio/Buffer.java,
+ java/nio/DirectByteBufferImpl.java,
+ java/nio/MappedByteBufferImpl.java,
+ native/jni/classpath/jcl.c,
+ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c,
+ native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c,
+ native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c,
+ native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c,
+ native/jni/java-nio/java_nio_MappedByteBufferImpl.c,
+ native/jni/java-nio/java_nio_VMDirectByteBuffer.c,
+ vm/reference/java/nio/VMDirectByteBuffer.java: Renamed
+ references to gnu/classpath/RawData to gnu/classpath/Pointer.
+
+2005-08-03 Guilhem Lavaux <guilhem@kaffe.org>
+
+ * java-nio/gnu_java_nio_channels_FileChannelImpl.c
+ (mapImpl): Fixed typo.
+
+2005-08-03 Guilhem Lavaux <guilhem@kaffe.org>
+
+ * classpath/jcl.c
+ (JCl_NewRawDataObject): Added error handling.
+
+ * classpath/jcl.h
+ (jpointer): New integer type to represent a pointer.
+
+ * gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c,
+ java-nio/gnu_java_nio_channels_FileChannelImpl.c,
+ java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c,
+ java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c,
+ java-nio/java_nio_MappedByteBufferImpl.c,
+ java-nio/java_nio_VMDirectByteBuffer.c,
+ xmlj/xmlj_util.c: Use JCL functions instead of directly
+ accessing gnu/classpath/RawData.
+
+2005-08-03 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/text/AttributeSet.java: Added some API comments
+ to class description.
+ * javax/swing/text/BadLocationException.java: Added / fixed
+ API comments all over.
+ * javax/swing/text/Caret.java: Added API comments all over.
+
+2005-08-02 Roman Kennke <roman@kennke.org>
+
+ * java/awt/Component.java
+ (getBounds): Removed debug statements that accidentally slipped in.
+
+2005-08-02 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JTable.java:
+ (getCellRect): Height should be the row height, not the entire table
+ height.
+ (getRowHeight): New public method, part of API.
+ * javax/swing/JViewport.java:
+ (scrollRectToVisible): Fixed buggy scrolling conditions.
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ (KeyHandler.keyPressed): Implemented PAGE-UP, PAGE-DOWN, CTRL-PAGE-UP,
+ and CTRL-PAGE-DOWN key actions. Also added line to scroll the table
+ appropriately after changing the selection.
+ (KeyHandler.getFirstVisibleColumnIndex): New implementation method.
+ (KeyHandler.getLastVisibleColumnIndex): Likewise.
+ (KeyHandler.getFirstVisibleRowIndex): Likewise.
+ (KeyHandler.getLastVisibleRowIndex): Likewise.
+
+2005-08-02 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/text/AbstractDocument.java
+ (AbstractElement.AbstractElement): Create an empty AttributeSet
+ if the argument s == null.
+ (AbstractElement.getAttribute): Return the element itself instead
+ of the wrapped attributes.
+
+2005-08-02 Roman Kennke <roman@kennke.org>
+
+ * java/awt/Toolkit.java
+ (createCustomCursor): Added check for headless environment.
+ (getBestCursorSize): Added check for headless environment.
+
+2005-08-02 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/text/GapContent.java
+ (shiftGap): Changed to used '&&'. both indexes should be
+ greater than 0.
+
+2005-08-02 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/text/GapContent.java:
+ Formatting code.
+
+2005-08-02 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/text/GapContent.java
+ (shiftGap): Added in if statement to check if indexes are negative.
+ Does not work properly if they are.
+
+2005-08-02 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (RootView.viewToModel): New method.
+ * javax/swing/text/BoxView.java
+ (isBefore): New method. This is a stub method to implement the
+ new abstract method from CompositeView.
+ (isAfter): New method. This is a stub method to implement the
+ new abstract method from CompositeView.
+ (getViewAtPoint): New method. This is a stub method to implement the
+ new abstract method from CompositeView.
+ (childAllocation): New method. This is a stub method to implement the
+ new abstract method from CompositeView.
+ * javax/swing/text/ComponentView.java
+ (viewToModel): New method. This is a stub method to implement the
+ new abstract method from View.
+ * javax/swing/text/CompositeView.java
+ (loadChildren): Implemented new method.
+ (setParent): Implemented new method.
+ (getViewCount): Implemented new method.
+ (getView): Implemented new method.
+ (replace): Implemented new method.
+ (getChildAllocation): Implemented new method.
+ (modelToView(int, Shape, Position.Bias)): Implemented this method.
+ (modelToView(int, Position.Bias, int, Position.Bias, Shape):
+ Implemented new method.
+ (viewToModel): Implemented new method.
+ (getNextVisualPositionFrom): Implemented new method.
+ (getViewIndex): Implemented new method.
+ (isBefore): New abstract method.
+ (isAfter): New abstract method.
+ (getViewAtPoint): New abstract method.
+ (childAllocation): New abstract method.
+ (getViewAtPosition): Implemented new method.
+ (getViewIndexAtPosition): Implemented new method.
+ (getInsideAllocation): Implemented new method.
+ (setParagraphInsets): Implemented new method.
+ (setInsets): Implemented new method.
+ (getLeftInset): Implemented new method.
+ (getRightInset): Implemented new method.
+ (getTopInset): Implemented new method.
+ (getBottomInset): Implemented new method.
+ (getNextNorthSouthVisualPositionFrom): New method.
+ (getNextEastWestVisualPositionFrom): New method.
+ (flipEastAndWestAtEnds): Implemented new method.
+ * javax/swing/text/GlyphView.java
+ (viewToModel): New method. This is a stub method to implement the
+ new abstract method from View.
+ * javax/swing/text/IconView.java
+ (viewToModel): New method. This is a stub method to implement the
+ new abstract method from View.
+ * javax/swing/text/PlainView.java
+ (viewToModel): New method. This is a stub method to implement the
+ new abstract method from View.
+ * javax/swing/text/View.java
+ (viewToModel): New abstract method.
+
+2005-08-02 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/DynamicAny/DynValueCommon.java: Inherit from
+ DynValueOperations, DynAny, IDLEntity, org.omg.CORBA.Object,
+ Serializable.
+ * org/omg/DynamicAny/DynValueCommonOperations.java: Inherit from
+ DynAnyOperations.
+ * org/omg/DynamicAny/DynAnyHelper.java,
+ org/omg/DynamicAny/DynStructHelper.java,
+ org/omg/DynamicAny/DynUnionHelper.java,
+ org/omg/DynamicAny/DynValueHelper.java,
+ org/omg/DynamicAny/DynAnyFactoryHelper.java,
+ org/omg/DynamicAny/DynArrayHelper.java,
+ org/omg/DynamicAny/DynEnumHelper.java,
+ org/omg/DynamicAny/DynFixedHelper.java,
+ org/omg/DynamicAny/DynSequenceHelper.java: New files.
+
+2005-08-01 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * examples/README: Add GNULookAndFeel.java to the compile command.
+
+2005-08-01 Mark Wielaard <mark@klomp.org>
+
+ * examples/gnu/classpath/examples/swing/Demo.java (mkTreeWorld):
+ Remove double declaration of int i.
+
+2005-08-01 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * examples/gnu/classpath/examples/swing/Demo.java: Exit when
+ pressing 'Close' on the panel.
+
+2005-08-01 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * configure.ac (LIBVERSION): Check against darwin to set module
+ 'no' for it. Modules under darwin are not linkable.
+
+2005-08-01 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/text/AttributeSet.java: Added API comments all over.
+
+2005-08-01 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/text/AbstractDocument.java: Added API comments all over.
+
+2005-08-01 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/lang/ClassLoader.java
+ (defineClass(String,byte[],int,int,ProtectionDomain),
+ resolveClass, findSystemClass, setSigners, findLoadedClass):
+ Added call to checkInitialized().
+ (checkInitialized): New method.
+
+2005-08-01 Jeroen Frijters <jeroen@frijters.net>
+
+ * NEWS: Added info about VM interfaces changes.
+ * java/lang/Class.java
+ (forName(String), forName(String, boolean, ClassLoader)): Simplified
+ VM interface.
+ * java/lang/ClassLoader.java
+ (loadedClasses): Removed field.
+ (defineClass(String,byte[],int,int,ProtectionDomain)): Removed
+ code to add class to loadedClasses.
+ * vm/reference/java/lang/VMClass.java
+ (forName(String)): Removed method.
+ (forName(String,boolean,ClassLoader)): New method.
+ (initialize): Removed method.
+ (loadArrayClass): Removed method.
+ * vm/reference/java/lang/VMClassLoader.java
+ (USE_VM_CACHE): Removed field.
+ (findLoadedClass): Made native.
+
+2005-08-01 Mark Wielaard <mark@klomp.org>
+
+ Reported by Wolfgang Baer <WBaer@gmx.de>
+ * javax/swing/text/GapContent.java (shiftGap): Use new
+ CapContentPosition in binarySearch.
+ (shiftEnd): Likewise.
+
+2005-08-01 Mark Wielaard <mark@klomp.org>
+
+ * doc/www.gnu.org/bugs.wml: New file.
+ * doc/www.gnu.org/newsitems.txt: Add bugzilla entry.
+ * doc/www.gnu.org/events/events.wml: Correct Fosdem 2005 date.
+ * doc/www.gnu.org/include/layout.wml: Direct bug reports to bugs.html.
+
+2005-08-01 Jan Roehrich <jan@roehrich.info>
+
+ * javax.swing.plaf.basic.BasicTreeUI: Method drawCentered
+ added / corrected javadoc issues in paintHorizonalLine
+ and paintVerticalLine / fixed getRightChildIndent signature
+ (problem probably caused by copy/paste)
+
+2005-08-01 Jan Roehrich <jan@roehrich.info>
+
+ * javax.swing.plaf.basic.BasicTreeUI: paintVerticalLine and
+ paintHorizontalLine added.
+
+2005-07-31 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ org/omg/DynamicAny/DynValueOperations.java,
+ org/omg/DynamicAny/DynAnyFactory.java,
+ org/omg/DynamicAny/DynAnyFactoryOperations.java,
+ org/omg/DynamicAny/DynValue.java,
+ org/omg/DynamicAny/DynValueBox.java,
+ org/omg/DynamicAny/DynValueBoxOperations.java,
+ org/omg/DynamicAny/DynValueCommon.java,
+ org/omg/DynamicAny/DynValueCommonOperations.java: New files.
+
+2005-07-31 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/DynamicAny/DynFixedOperations.java,
+ org/omg/DynamicAny/DynEnum.java,
+ org/omg/DynamicAny/DynArrayOperations.java: Inherit from
+ DynAnyOperations.
+ * org/omg/DynamicAny/NameDynAnyPair.java: Inherit from
+ org.omg.CORBA.portable.IDLEntity.
+ * org/omg/DynamicAny/DynAnyOperations.java
+ (assign, current_component): Fixes in throws declaration.
+ * org/omg/DynamicAny/DynEnumOperations.java,
+ org/omg/DynamicAny/DynSequenceOperations.java,
+ org/omg/DynamicAny/DynStructOperations.java,
+ org/omg/DynamicAny/DynUnionOperations.java,
+ org/omg/DynamicAny/DynAny.java,
+ org/omg/DynamicAny/DynFixed.java,
+ org/omg/DynamicAny/DynSequence.java,
+ org/omg/DynamicAny/DynStruct.java,
+ org/omg/DynamicAny/DynUnion.java,
+ org/omg/DynamicAny/DynArray.java,
+ org/omg/DynamicAny/NameValuePair.java: Reformatted.
+
+2005-07-31 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/nio/FileLockImpl.java: Mark class final.
+ (ch): Removed field.
+ (valid): New field.
+ (FileLockImpl): Set valid to true.
+ (isValid): Test and set valid field.
+ (release): Release lock if it is still valid.
+ * java/nio/channels/FileLock.java: Mark all fields private final.
+ * native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c
+ (Java_gnu_java_nio_channels_FileChannelImpl_lock): Translate
+ Long.MAX_VALUE to zero for fcntl.
+ (Java_gnu_java_nio_channels_FileChannelImpl_unlock): Likewise.
+
+2005-07-31 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * scripts/eclipse-gnu.xml: Drop extends, implements,
+ throws into new line.
+
+2005-07-31 Jan Roehrich <jan@roehrich.info>
+
+ * javax.swing.plaf.basic.BasicTreeUI: fixed indentation.
+
+2005-07-30 Casey Marshall <csm@gnu.org>
+
+ * native/jni/java-nio/java_nio_MappedByteBuffer.c
+ (Java_java_nio_MappedByteBufferImpl_isLoadedImpl): cast argument 3
+ to 'mincore' to 'void *' to avoid warnings on GNU.
+
+2005-07-30 Casey Marshall <csm@gnu.org>
+
+ * native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c
+ (Java_gnu_java_nio_channels_FileChannelImpl_mapImpl):
+ eliminate various compiler warnings; mark 'buffer' as 'volatile;'
+ throw an exception if we can't get a constructor method ID.
+ * native/jni/java-nio/java_nio_MappedByteBufferImpl.c:
+ include 'stdlib.h.'
+ (get_raw_values): eliminate compiler warnings.
+ (Java_java_nio_MappedByteBufferImpl_isLoadedImpl): likewise.
+ * native/jni/java-nio/java_nio_VMDirectByteBuffer.c
+ (Java_java_nio_VMDirectByteBuffer_put__Lgnu_classpath_RawData_2I_3BII):
+ eliminate compiler warning.
+
+2005-07-29 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/text/StyledEditorKit.java: Added the remaining API
+ comments.
+
+2005-07-29 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/MenuSelectionManager.java
+ (isComponentPartOfCurrentMenu): Fixed to prevent NPE.
+ * javax/swing/plaf/basic/BasicMenuUI.java
+ (popupVisible): Likewise.
+
+2005-07-29 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/awt/event/MouseWheelEvent.java: fixed typo in API docs.
+
+2005-07-29 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/text/DefaultStyledDocument.java: Added
+ comments all over.
+ * javax/swing/text/StyledEditorKit: Likewise.
+
+2005-07-29 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTextField.java
+ (insertString): Added in check for null to resolve a NPE.
+ * javax/swing/text/GapContent.java
+ (getOffset): Added in check for mark = gapStart because
+ if mark = gapStart = 0, then a negative is returned. This was
+ not right.
+
+2005-07-29 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/plaf/basic/BasicEditorPaneUI.java: Added API
+ comments all over.
+ * javax/swing/plaf/basic/BasicTextUI.java: Likewise.
+
+2005-07-29 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/text/DefaultStyledDocument.java
+ (split): Moved throw statement into proper else clause.
+ * javax/swing/text/StyledEditorKit.java
+ (StyledViewFactory.create): Return the actual view instead of null.
+
+2005-07-29 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JTextPane.java: Added API comments all over.
+
+2005-07-29 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JTextPane.java
+ (constructor()): Implemented this constructor. Initialize the
+ EditorKit and set the Document to null.
+ (constructor(StyledDocument)): Implemented this constructor.
+ Initialize the EditorKit and Document.
+ (getUIClassID): Inlined the constant String.
+ (setDocument): Implemented this method.
+ (getStyledDocument): Likewise.
+ (setStyledDocument): Likewise.
+ (replaceSelection): Likewise.
+ (insertComponent): Clarified the TODO comment.
+ (insertIcon): Clarified the TODO comment.
+ (addStyle): Implemented this method.
+ (removeStyle): Likewise.
+ (getStyle): Likewise.
+ (getLogicalStyle): Likewise.
+ (setLogicalStyle): Likewise.
+ (getCharacterAttributes): Likewise.
+ (setCharacterAttributes): Likewise.
+ (getParagraphAttributes): Likewise.
+ (getInputAttributes): Likewise.
+ (getStyledEditorKit): Likewise.
+ (createDefaultEditorKit): Likewise.
+ (setEditorKit): Likewise.
+ * javax/swing/plaf/basic/BasicEditorPaneUI.java
+ (getEditorKit): Implemented this method.
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (RootView.getViewFactory): Ask the installed EditorKit for its
+ ViewFactory.
+ (RootView.setView): Set this as the parent of the installed real
+ root view.
+ (RootView.modelToView): Don't cast to PlainView here. Use View
+ instead.
+ (setView): Don't set the parent here. This is handled inside the
+ root view.
+
+2005-07-29 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/text/AbstractDocument.java
+ (createPosition): Delegate this call to the actual Content.
+ (LeafElement.constructor): Manage the start and end marks via
+ Position objects.
+ (LeafElement.getEndOffset): Use Position instead of static mark.
+ (LeafElement.getStartOffset): Use Position instead of static mark.
+ * javax/swing/text/DefaultStyledDocument.java
+ (ElementBuffer.change): New method. Performs structural changes
+ in the element tree that are necessary in order to change
+ text attributes.
+ (ElementBuffer.changeUpdate): New method. This is the method for
+ change().
+ (ElementBuffer.split): New package-private method. Splits an
+ element into two elements.
+ (setCharacterAttributes): Implemented this method. This sets
+ character attributes on a piece of content.
+ * javax/swing/text/GapContent.java
+ (GapContentPosition): New inner class. Implements the Position
+ interface for GapContent.
+ (constructor): Initialize the list that stores the Position objects.
+ (createPosition): Reimplemented. Now uses the GapContentPosition
+ class.
+ (shiftEnd): Update the stored positions.
+ (shiftGap): Update the stored positions.
+ * javax/swing/text/LabelView.java: New class.
+ * javax/swing/text/PlainDocument.java
+ (removeUpdate): Don't update the element positions, this should
+ now be handled by the Positions.
+
+2005-07-29 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/text/BoxView.java: New class.
+ * javax/swing/text/CompositeView.java: New class.
+ * javax/swing/text/FlowView.java: New class.
+ * javax/swing/text/GlyphView.java: New class.
+ * javax/swing/text/IconView.java: New class.
+ * javax/swing/text/ParagraphView.java: New class.
+ * javax/swing/text/StyledEditorKit.java
+ (UnderLineAction.constructor): Added TODO comment.
+ (UnderLineAction.actionPerformed): Implemented this method. This
+ toggles the underline attribute to a piece of content.
+ (ItalicAction.constructor): Added TODO comment.
+ (ItalicAction.actionPerformed): Implemented this method. This
+ toggles the italic attribute to a piece of content.
+ (BoldAction.constructor): Added TODO comment.
+ (BoldAction.actionPerformed): Implemented this method. This
+ toggles the bold attribute to a piece of content.
+ (AlignmentAction.constructor): Implemented this constructor.
+ (AlignmentAction.actionPerformed): Implemented this method. This
+ sets the alignment attribute for a piece of content.
+ (ForegroundAction.constructor): Implemented this constructor.
+ (ForegroundAction.actionPerformed): Implemented this method. This
+ sets the foreground attribute for a piece of content.
+ (FontSizeAction.constructor): Implemented this constructor.
+ (FontSizeAction.actionPerformed): Implemented this method. This
+ sets the font size attribute for a piece of content.
+ (FontFamilyAction.constructor): Implemented this constructor.
+ (FontFamilyAction.actionPerformed): Implemented this method. This
+ sets the font family attribute for a piece of content.
+ (StyledTextAction.constructor): Removed TODO comment.
+ (StyledTextAction.getEditor): Implemented this method.
+ (StyledTextAction.getStyledDocument): Implemented this method.
+ (StyledTextAction.getStyledEditorKit): Implemented this method.
+ (StyledTextAction.setCharacterAttributes): Implemented this method.
+ (StyledTextAction.setParagraphAttributes): Implemented this method.
+ (StyledViewFactory.constructor): Removed. This is not necessary here.
+ (StyledViewFactory.create): Implemented this method.
+ (AttributeTracker): Removed this inner class.
+ (CaretTracker): New inner class.
+ (CaretTracker.caretUpdate): Implemented this method. This meeps
+ track of the caret in a text component and updates some fields
+ of the StyledEditorKit.
+ (constructor): Implemented this constructor.
+ The inputAttributes are initialized here.
+ (clone): Implemented this method.
+ (getActions): Implemented this method.
+ (getInputAttributes): Implemented this method.
+ (getCharacterAttributeRun): Implemented this method.
+ (createDefaultDocument): Implemented this method.
+ (install): Implemented this method.
+ (deinstall): Implemented this method.
+ (getViewFactory): Implemented this method.
+ (createInputAttributes): Implemented this method.
+ * javax/swing/text/View.java
+ (modelToView(int, Shape, Position.Bias)): Added new abstract method.
+ (modelToView(int, Position.Bias, int, Position.Bias, Shape):
+ New method.
+
+2005-07-28 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JViewport.java:
+ (scrollRectToVisible): Consider the x and y position of the viewport
+ itself when scrolling down. This fixes an off-by-1-pixel problem.
+ * javax/swing/plaf/basic/BasicListUI.java:
+ (KeyHandler.keyPressed): Implemented PAGEUP, SHIFT-PAGEUP, PAGEDOWN,
+ and SHIFT-PAGEDOWN key actions.
+
+2005-07-28 Lillian Angel <langel@redhat.com>
+
+ * java/awt/GridBagLayout.java
+ (distributeSizeAndWeight): added in check, because OutOfBounds exception
+ was being raised.
+ * javax/swing/JTable.java
+ (setRowHeight): Added in, but not implemented.
+ * javax/swing/plaf/basic/BasicComboBoxEditor.java
+ (setItem): added in check, because NullPointerException was being
+ raised.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getPathBounds): Took out unneeded call.
+ (uninstallListeners): added in check, because NPE was being raised.
+ (installUI): took out unneeded call.
+ (paint): Likewise.
+ (getPreferredSize): Should not assume root is an instance of Default
+ MutableTreeNode. Changed to use TreeNode instead.
+ (getCellBounds): Should never return null
+ (getCellLocation): Took out unneeded call.
+
+2005-07-28 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicListUI.java:
+ (KeyHandler.keyPressed): Replaced calls to KeyEvent.isShiftDown() and
+ isControlDown() with comparisons of KeyEvent.getModifiers() and
+ InputEvent.SHIFT_MASK and CTRL_MASK.
+ (MouseInputHandler.mouseClicked): Reordered SHIFT and CTRL modifier
+ actions to correspond to JDK. Note the JDK simply ignores other
+ modifiers so isShiftDown() and isControlDown() are okay for mouse
+ input.
+
+2005-07-27 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/DynamicAny/DynUnion.java,
+ org/omg/DynamicAny/DynUnionOperations.java,
+ org/omg/DynamicAny/NameDynAnyPair.java,
+ org/omg/DynamicAny/NameValuePair.java,
+ org/omg/DynamicAny/DynAny.java,
+ org/omg/DynamicAny/DynAnyOperations.java,
+ org/omg/DynamicAny/DynArray.java,
+ org/omg/DynamicAny/DynArrayOperations.java,
+ org/omg/DynamicAny/DynEnum.java,
+ org/omg/DynamicAny/DynEnumOperations.java,
+ org/omg/DynamicAny/DynFixed.java,
+ org/omg/DynamicAny/DynFixedOperations.java,
+ org/omg/DynamicAny/DynSequence.java,
+ org/omg/DynamicAny/DynSequenceOperations.java,
+ org/omg/DynamicAny/DynStructOperations.java,
+ org/omg/DynamicAny/DynStruct.java: New files.
+
+2005-07-28 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JViewport.java:
+ (scrollRectToVisible): New method, overrides JComponent method as
+ intended.
+
+2005-07-28 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * native/jni/java-nio/java_nio_MappedByteBufferImpl.c
+ (get_raw_values): Add env to getObjectClass call for 64-bit case.
+
+2005-07-28 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/text/AttributedStringIterator.java: reformatted.
+
+2005-07-27 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicListUI.java:
+ (KeyHandler.keyPressed): Ensure the new lead selection index is visible
+ after making a change.
+ (MouseInputHandler.mouseClicked): Likewise.
+
+2005-07-27 Aaron Luchko <aluchko@redhat.com>
+
+ * gnu/classpath/jdwp/util/PacketProcessor.java: Implement
+ PrivilegedAction to allow privilaged operations.
+
+2005-07-27 Mark Wielaard <mark@klomp.org>
+
+ * doc/www.gnu.org/events/events.wml: Add old and upcomming events.
+
+2005-07-27 Aaron Luchko <aluchko@redhat.com>
+
+ * gnu/classpath/jdwp/util/Value.java: Class to read/write JDWP
+ untagged values and tagged values.
+ * gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java:
+ use new api for Values and IVirtualMachine and fix message in
+ exception.
+ * gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java:
+ use new api for Values and fix message in exception.
+
+2005-07-27 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableServer/POAHelper.java (type, insert, extract,
+ id, read, write): New methods.
+
+2005-07-27 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/text/AttributedString.java: added/edited API docs.
+
+2005-07-27 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/text/AttributedString.java: reformatted.
+
+2005-07-27 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JTextPane.java:
+ Reformatted file to match our coding style.
+
+2005-07-27 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JTextPane.java
+ (getCharacterAttributes): Return SimpleAttributeSet.EMPTY instead
+ of null.
+
+2005-07-27 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/plaf/basic/BasicPanelUI.java
+ (installDefaults): Install background color on JPanel.
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): Added background color for Panel.
+
+2005-07-27 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/text/AttributedCharacterIterator.java: API doc fixes.
+
+2005-07-27 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/text/html/parser/DocumentParser.java: reverted API fix.
+
+2005-07-27 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/DefaultBoundedRangeModel.java:
+ Fixed / added API comments for class description.
+ * javax/swing/DefaultButtonModel.java: Likewise.
+ * javax/swing/DefaultCellEditor.java: Likewise.
+ * javax/swing/DefaultComboBoxModel.java: Likewise.
+ * javax/swing/DefaultDesktopManager.java: Likewise.
+ * javax/swing/DefaultButtonModel.java: Likewise.
+ * javax/swing/DefaultFocusManager.java: Likewise.
+ * javax/swing/DefaultListCellRenderer.java: Likewise.
+ * javax/swing/DefaultListModel.java: Likewise.
+ * javax/swing/DefaultListSelectionModel.java: Likewise.
+ * javax/swing/DefaultSingleSelectionModel.java: Likewise.
+ * javax/swing/FocusManager.java: Likewise.
+ * javax/swing/GrayFilter.java: Likewise.
+ * javax/swing/ImageIcon.java: Likewise.
+ * javax/swing/InputMap.java: Likewise.
+ * javax/swing/InputVerifier.java: Likewise.
+ * javax/swing/InternalFrameFocusTraversalPolicy.java: Likewise.
+ * javax/swing/JApplet.java: Likewise.
+ * javax/swing/JCheckBox.java: Likewise.
+ * javax/swing/JCheckBoxMenuItem.java: Likewise.
+ * javax/swing/JColorChooser.java: Likewise.
+ * javax/swing/JComboBox.java: Likewise.
+ * javax/swing/JComponent.java: Likewise.
+
+2005-07-27 Roman Kennke <roman@kennke.org>
+
+ * java/util/Properties.java
+ (getPropertyInternal): Removed.
+ (getProperty(String)): Search for property here instead of
+ getProperty(String, String).
+ (getProperty(String,String)): Call getProperty(String).
+
+2005-07-27 Roman Kennke <roman@kennke.org>
+
+ * java/awt/MenuItem.java
+ (AccessibleAWTMenuItem.setCurrentAccessibleValue): Removed
+ duplicate code. Added this to make setEnabled unambiguous for
+ javac 1.3 compiler.
+
+2005-07-27 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/text/html/parser/DocumentParser.java: API doc fixes,
+ * javax/swing/text/html/parser/DTD.java: likewise,
+ * javax/swing/text/html/parser/DTDConstants.java: likewise,
+ * javax/swing/text/html/parser/Element.java: likewise,
+ * javax/swing/text/html/parser/Parser.java: likewise,
+ * javax/swing/text/html/parser/ParserDelegator.java: likewise.
+
+2005-07-27 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): added menu-related defaults.
+
+2005-07-26 Aaron Luchko <aluchko@redhat.com>
+
+ * gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java:
+ Implemented the ArrayReference CommandSet.
+
+2005-07-26 Aaron Luchko <aluchko@redhat.com>
+
+ * gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java:
+ Implemented the ThreadGroupReference CommandSet.
+
+2005-07-26 Tom Tromey <tromey@redhat.com>
+
+ PR classpath/22989:
+ * java/net/Inet4Address.java (isMCNodeLocal): Use super call.
+ (isMCOrgLocal): Likewise.
+
+2005-07-26 Tom Tromey <tromey@redhat.com>
+
+ * gnu/java/security/provider/PKIXCertPathValidatorImpl.java
+ (engineValidate): Fix sense of test. PR classpath/22991.
+
+2005-07-26 Tom Tromey <tromey@redhat.com>
+
+ PR classpath/22992:
+ * javax/security/sasl/Sasl.java (getSaslClientFactories): Fix
+ sense of test.
+ (getSaslServerFactories): Likewise.
+
+2005-07-26 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkComponentPeer.java (repaintTimer): Make
+ daemon thread.
+
+ * gnu/java/awt/peer/gtk/GdkGraphics.java,
+ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c: Add
+ static initializer.
+ (initStaticState): New method.
+ Add new global graphics reference state table and macros.
+ * include/gnu_java_awt_peer_gtk_GdkGraphics.h: Regenerate.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c: Use new
+ NSA_GET_G_PTR macro to retreive graphics objects.
+ * native/jni/gtk-peer/gtkpeer.h: Add new graphics state table and
+ macros.
+
+2005-07-26 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ (KeyHandler.keyPressed): Replaced calls to KeyEvent.isShiftDown() and
+ isControlDown() with mask comparisons of KeyEvent.getModifiers() and
+ InputEvent.SHIFT_MASK and CTRL_MASK. This makes it easier to ignore
+ invalid modifiers.
+
+2005-07-26 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ (KeyHandler.keyPressed): Implemented CTRL-SPACE key action.
+
+2005-07-26 Tom Tromey <tromey@redhat.com>
+
+ * java/security/cert/X509CertSelector.java (match): Convert sigId
+ to String before comparison. PR classpath/22987.
+
+2005-07-26 Tom Tromey <tromey@redhat.com>
+
+ * gnu/java/security/OID.java: Typo fix.
+
+2005-07-26 Tom Tromey <tromey@redhat.com>
+
+ * javax/security/auth/x500/X500Principal.java (getName): Don't
+ compare oid to String. PR classpath/22988.
+
+2005-07-26 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkComponentPeer.java (repaint): Reuse
+ repaint timer across repaint calls.
+
+2005-07-26 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/AbstractAction.java
+ Fixed / Added API doc comments for the class description.
+ * javax/swing/AbstractButton.java: Likewise.
+ * javax/swing/AbstractCellEditor.java: Likewise.
+ * javax/swing/AbstractListModel.java: Likewise.
+ * javax/swing/AbstractSpinnerModel.java: Likewise.
+ * javax/swing/ActionMap.java: Likewise.
+ * javax/swing/BorderFactory.java: Likewise.
+ * javax/swing/Box.java: Likewise.
+ * javax/swing/BoxLayout.java: Likewise.
+ * javax/swing/ButtonGroup.java: Likewise.
+ * javax/swing/CellRendererPane.java: Likewise.
+ * javax/swing/ComponentInputMap.java: Likewise.
+ * javax/swing/DebugGraphics.java: Likewise.
+
+2005-07-26 Mark Wielaard <mark@klomp.org>
+
+ * java/text/DateFormat.java (equals): Reimplement.
+
+2005-07-26 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (paint): Only call paintFocus if the button is actually focused.
+ (paintFocus): The default implementation in the BasicLookAndFeel
+ does nothing. I removed the code here.
+
+2005-07-26 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): Added new borders for MenuBar and MenuItem.
+
+2005-07-26 Roman Kennke <roman@kennke.org>
+
+ * java/util/Properties.java
+ (getPropertyInternal): New method. Avoids infinite recursion if
+ getProperty() methods are overridden in subclasses.
+ (getProperty(String)): Use getPropertyInternal to avoid recursion.
+ (getProperty(String,String)): Likewise.
+
+2005-07-26 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/plaf/basic/BasicScrollPaneUI.java
+ (getPreferredSize): Removed.
+ * javax/swing/plaf/basic/BasicTabbedPaneUI.java
+ (getPreferredSize): Removed.
+ * javax/swing/plaf/basic/BasicToolBarUI.java
+ (getPreferredSize): Removed.
+
+2005-07-26 Roman Kennke <roman@kennke.org>
+
+ * gnu/java/awt/AWTUtilities.java:
+ Fixed formatting of this file.
+
+2005-07-26 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java:
+ (MenuBarBorder): new inner class.
+
+2005-07-26 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java:
+ (MenuItemBorder): new inner class.
+
+2005-07-26 Mark Wielaard <mark@klomp.org>
+
+ * native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c
+ (Java_gnu_java_nio_channels_FileChannelImpl_init): Mark clazz as
+ unused. Remove unused variables constructor and obj.
+ (Java_gnu_java_nio_channels_FileChannelImpl_implCloseChannel): Retry
+ when interrupted.
+ (Java_gnu_java_nio_channels_FileChannelImpl_available): Likewise.
+
+2005-07-26 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/nio/channels/FileChannelImpl.java (lockCheck): New method.
+ (tryLock): Use lockCheck().
+ (lock): Likewise.
+
+2005-07-26 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * native/target/generic/target_generic_network.h
+ (TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_SO_TIMEOUT): Added
+ missing sys/time.h include.
+
+2005-07-26 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/nio/channels/FileChannelImpl.java (description):
+ New final field.
+ (FileChannelImpl): Set description.
+ (init): Likewise.
+ (toString): New method.
+ All methods add parameters when throwing IllegalArgumentException.
+ * native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c
+ (open): Add filename to FileNotFoundException.
+
+2005-07-26 Jeroen Frijters <jeroen@frijters.net>
+
+ * NEWS: Added comment about new VMProxy class.
+ * gnu/classpath/Configuration.java.in
+ (HAVE_NATIVE_GET_PROXY_CLASS): Removed.
+ (HAVE_NATIVE_GET_PROXY_DATA): Removed.
+ (HAVE_NATIVE_GENERATE_PROXY_CLASS): Removed.
+ * java/lang/reflect/Proxy.java
+ (getProxyClass): Changed to call VMProxy.
+ (getProxyClass0): Removed.
+ (getProxyData0): Removed.
+ (generateProxyClass0): Removed.
+ (ProxyData): Removed private modifier.
+ (POOL): Removed (was unused).
+ (INVOKESTATIC): Removed (was unused).
+ * vm/reference/java/lang/reflect/VMProxy.java: New file.
+
+2005-07-26 Jeroen Frijters <jeroen@frijters.net>
+
+ * NEWS: Added comment about new VM hook in VMClassLoader.
+
+2005-07-26 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/text/DateFormatter.java: API doc fixes,
+ * javax/swing/text/InternationalFormatter.java: likewise,
+ * javax/swing/text/JTextComponent.java: likewise.
+
+2005-07-26 Mark Wielaard <mark@klomp.org>
+
+ * examples/Makefile.am (clean-local): Use rm -rf.
+
+2005-07-26 Jeroen Frijters <jeroen@frijters.net>
+
+ * vm/reference/java/lang/VMClassLoader.java
+ (USE_VM_CACHE): Removed final modifier.
+
+2005-07-25 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkComponentPeer.java (repaint): Implement
+ timed repaint.
+ (updateCursorImmediately): Implement.
+ (RepaintTimerTask): New class.
+ * gnu/java/awt/peer/gtk/GtkImageConsumer.java (imageComplete):
+ Don't remove consumer if source is a MemoryImageSource.
+
+2005-07-25 Archie Cobbs <archie@dellroad.org>
+
+ * native/jni/classpath/native_state.c: add assertion for object type
+
+2005-07-25 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ (KeyHandler.advanceSingleSelection): New method. Helper method for
+ ENTER, SHIFT-ENTER, TAB, and SHIFT-TAB key events.
+ (KeyHandler.advanceMultipleSelection): Likewise, used when the table
+ has multiple selections at the time that ENTER or TAB was pressed.
+ (KeyHandler.keyPressed): Implemented TAB, SHIFT-TAB, and SHIFT-ENTER
+ and merged these with existing code for ENTER event, because of the
+ similarites.
+
+2005-07-25 Tom Tromey <tromey@redhat.com>
+
+ * java/text/CollationKey.java (equals): Use Arrays.equals.
+ PR classpath/22986.
+
+2005-07-25 Tom Tromey <tromey@redhat.com>
+
+ * java/util/Properties.java (load): Handle case where backslash
+ appears at EOF when reading the key. PR classpath/22994.
+
+2005-07-25 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (paint): moved code to paintNode
+ (getCellBounds): width increased, slightly short before
+ (paintNode): changed to paint node depending if icons exist
+
+2005-07-25 Guilhem Lavaux <guilhem@kaffe.org>
+
+ * native/jni/classpath/jcl.c,
+ native/jni/classpath/jcl.h
+ (JCL_NewRawDataObject): New function.
+ (JCL_GetRawData): New function.
+
+2005-07-25 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/Container.java:
+ (setFocusTraversalKeys): Instantiate focusTraversalKeys to an array of
+ size 4, not 3. This must have been a typo.
+
+2005-07-25 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/rmi/server/RMIClassLoader.java
+ (loadClass(String, String)): Use Class.forName() instead of
+ directly calling ClassLoader.loadClass(), to handle array
+ types correctly.
+
+2005-07-25 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JTable.java:
+ (selectAll): Store the lead selection indices and restore them after
+ selecting all cells.
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ (KeyHandler.keyPressed): Changed the criteria for "only one selection"
+ when the ENTER key is pressed to match the behavior of the JDK. Also
+ replaced direct code for CTRL-A with call to JTable.selectAll().
+
+2005-07-25 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/lang/ClassLoader.java
+ (loadedClasses): Set based on VMClassLoader.VM_USE_CACHE.
+ (defineClass): Modified to respect VMClassLoader.VM_USE_CACHE.
+ * vm/reference/java/lang/VMClassLoader.java
+ (VM_USE_CACHE): New field.
+
+2005-07-25 Roman Kennke <roman@kennke.org>
+
+ * gnu/java/awt/AWTUtilities.java:
+ Added methods from SwingUtilities so that AWT does not have to
+ depend on Swing.
+ * java/awt/Component.java:
+ Reverted my DEFAULT_FONT patch from yesterday. This does not
+ seem to work with the Gtk peers.
+ * java/awt/Container.java
+ (addImpl): Call addNotify() on the added child. Invalidate not
+ only the container but also the added child. Repaint the container.
+ (remove): Repaint the container.
+ (invalidate): Also invalidate the LayoutManager.
+ (invalidateTree): Call super.invalidate to invalidate the container
+ itself. Also invalidate the LayoutManager.
+ (setFont): Only set the font if the specified argument actually
+ differs from the current font.
+ (preferredSize): Optimized this method so the LayoutManager is only
+ called if the layout is invalid. Otherwise we return the preferred
+ size that has been stored during last validation/layout.
+ (getAlignmentX): Despite common belief, this method does _not_
+ call the LayoutManagers getAlignmentX in the JDK. So we also don't.
+ (getAlignmentY): Despite common belief, this method does _not_
+ call the LayoutManagers getAlignmentX in the JDK. So we also don't.
+ (dispatchEventImpl): Let the dispatcher decide if it is enabled
+ for the incoming event type.
+ (eventTypeEnabled): Enables only container events for containers.
+ (addNotifyContainerChildren): Coalesced two if statements into one.
+ Enable events on the dispatcher for this container.
+ (LightweightDispatcher): Made this class reentrant. Handle
+ events enabling/disabling here.
+
+2005-07-25 Roman Kennke <roman@kennke.org>
+
+ * gnu/java/nio/channels/FileChannelImpl.java
+ (static initializer): Init out, err and in here.
+ * native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c
+ (Java_gnu_java_nio_channels_FileChannelImpl_init): Moved init code
+ for in, out and err to Java code.
+
+2005-07-25 Mark Wielaard <mark@klomp.org>
+
+ * doc/www.gnu.org/faq.wml: Expand contribution assign answer.
+
+2005-07-25 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/awt/image/ConvolveOp.java:
+ (getKernel): return a clone of the kernel.
+
+2005-07-25 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/lang/ClassLoader.java
+ (findLoadedClass): Call VMClassLoader.findLoadedClass.
+ * vm/reference/java/lang/VMClassLoader.java
+ (findLoadedClass): New method.
+
+2005-07-23 Mark Wielaard <mark@klomp.org>
+
+ * lib/standard.omit: Don't omit gnu/javax/swing/plaf/gtk files.
+ * lib/Makefile.am (dist-hook): Don't remove standard.omit dirs.
+
+ * gnu/javax/swing/plaf/gtk/GtkBorders.java: Removed.
+ * gnu/javax/swing/plaf/gtk/GtkCheckBoxUI.java: Likewise.
+ * gnu/javax/swing/plaf/gtk/GtkIconFactory.java: Likewise.
+ * gnu/javax/swing/plaf/gtk/GtkLookAndFeel.java: Likewise.
+ * gnu/javax/swing/plaf/gtk/GtkRadioButtonUI.java: Likewise.
+ * gnu/javax/swing/plaf/gtk/GtkSliderUI.java: Likewise.
+ * gnu/javax/swing/plaf/gtk/README: Likewise.
+ * gnu/javax/swing/plaf/gtk/SliderTest.java: Likewise.
+
+2003-07-23 Casey Marshall <csm@gnu.org>
+
+ * configure.ac (AC_CHECK_HEADERS): add 'sys/mman.h'.
+ (AC_CHECK_FUNCS): add mmap and related functions.
+ * include/java_nio_VMDirectByteBuffer.h: regenerated.
+ * java/nio/DirectByteBufferImpl.java (put): new method.
+ * native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c
+ (ALIGN_DOWN): new macro.
+ (ALIGN_UP): new macro.
+ (Java_gnu_java_nio_channels_FileChannelImpl_mapImpl): implemented.
+ * native/jni/java-nio/java_nio_MappedByteBufferImpl.c: updated
+ copyright years.
+ (ALIGN_DOWN): new macro.
+ (ALIGN_UP): new macro.
+ (get_pagesize): new function.
+ (get_raw_values): new function.
+ (Java_java_nio_MappedByteBufferImpl_unmapImpl): implemented.
+ (Java_java_nio_MappedByteBufferImpl_isLoadedImpl): implemented.
+ (Java_java_nio_MappedByteBufferImpl_loadImpl): implemented.
+ (Java_java_nio_MappedByteBufferImpl_forceImpl): implemented.
+ * native/jni/java-nio/java_nio_VMDirectByteBuffer.c
+ (Java_java_nio_VMDirectByteBuffer_put): renamed to
+ 'Java_java_nio_VMDirectByteBuffer_put__Lgnu_classpath_RawData_2IB.'
+ (Java_java_nio_VMDirectByteBuffer_get__Lgnu_classpath_RawData_2I_3BII):
+ call 'ReleaseByteArrayElements' on the source byte array elements.
+ (Java_java_nio_VMDirectByteBuffer_put__Lgnu_classpath_RawData_2I_3BII):
+ new method.
+ * vm/reference/java/nio/VMDirectByteBuffer.java (put): new method.
+
+2005-07-23 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/BoundedRangeModel.java: added/updated API doc comments.
+
+2005-07-23 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/Icon.java: added API doc comments.
+
+2005-07-23 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/text/AttributedString.java: API doc fixes,
+ * java/text/ChoiceFormat.java: likewise,
+ * java/text/CollationElementIterator.java: likewise,
+ * java/text/CollationKey.java: likewise,
+ * java/text/Collator.java: likewise,
+ * java/text/DateFormat.java: likewise,
+ * java/text/DateFormatSymbols.java: likewise,
+ * java/text/DecimalFormatSymbols.java: likewise,
+ * java/text/MessageFormat.java: likewise,
+ * java/text/NumberFormat.java: likewise,
+ * java/text/ParseException.java: likewise,
+ * java/text/SimpleDateFormat.java: likewise,
+ * java/text/StringCharacterIterator.java: likewise.
+
+2005-07-23 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/ImageIcon.java: API doc fixes,
+ * javax/swing/JLayeredPane.java: likewise,
+ * javax/swing/JSplitPane.java: likewise,
+ * javax/swing/JTree.java: likewise,
+ * javax/swing/JViewport.java: likewise,
+ * javax/swing/RepaintManager.java: likewise,
+ * javax/swing/SizeRequirements.java: likewise,
+ * javax/swing/SortingFocusTraversalPolicy.java.
+
+2005-07-23 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableServer/ServantLocatorOperations.java,
+ org/omg/PortableServer/ServantActivatorOperations.java:
+ Inherit from ServantManagerOperations.
+ * org/omg/PortableServer/CurrentOperations.java:
+ Inherit from org.omg.CORBA.CurrentOperations.
+ org/omg/PortableServer/ForwardRequestHelper.java: New file.
+
+2005-07-23 Sven de Marothy <sven@physto.se>
+
+ * java/awt/List.java (List): Initialize selected[] to an empty array.
+
+2005-07-23 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * NEWS: Added entry about POA.
+
+2005-07-22 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableServer/RequestProcessingPolicyOperations.java,
+ org/omg/PortableServer/ServantRetentionPolicyOperations.java,
+ org/omg/PortableServer/ThreadPolicyOperations.java,
+ org/omg/PortableServer/IdAssignmentPolicyOperations.java,
+ org/omg/PortableServer/IdUniquenessPolicyOperations.java,
+ org/omg/PortableServer/ImplicitActivationPolicyOperations.java,
+ org/omg/PortableServer/LifespanPolicyOperations.java:
+ Inherit from PolicyOperations.
+
+2005-07-22 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ (KeyHandler.keyPressed): If row selection is not allowed in the table,
+ then consider all rows of a particular column selected when you get an
+ ENTER key event. This matches JDK behaviour and fixes an out of
+ bounds error. Also, wrapped lines at 80 chars.
+
+2005-07-22 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ (paint): Only highlight the border of a table cell if it is the most
+ recently updated cell.
+
+2005-07-22 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicListUI.java:
+ (paintCell): Fixed misnamed variable.
+
+2005-07-22 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/Poa/gnuPOA.java,
+ gnu/CORBA/Poa/gnuPOAManager.java,
+ gnu/CORBA/Poa/activeObjectMap.java,
+ gnu/CORBA/Poa/gnuAdapterActivator.java,
+ gnu/CORBA/Poa/gnuServantObject.java,
+ gnu/CORBA/Poa/servantDelegate.java,
+ gnu/CORBA/Poa/ORB_1_4.java,
+ gnu/CORBA/Poa/policySets.java,
+ gnu/CORBA/Poa/gnuPoaCurrent.java,
+ gnu/CORBA/Poa/LocalDelegate.java,
+ gnu/CORBA/Poa/dynImpHandler.java,
+ gnu/CORBA/Poa/LocalServerRequest.java,
+ gnu/CORBA/Poa/LocalRequest.java,
+ gnu/CORBA/Poa/ForwardedServant.java,
+ gnu/CORBA/Poa/gnuIdAssignmentPolicy.java,
+ gnu/CORBA/Poa/gnuRequestProcessingPolicy.java,
+ gnu/CORBA/Poa/gnuThreadPolicy.java,
+ gnu/CORBA/Poa/gnuLifespanPolicy.java,
+ gnu/CORBA/Poa/gnuIdUniquenessPolicy.java,
+ gnu/CORBA/Poa/gnuServantRetentionPolicy.java,
+ gnu/CORBA/Poa/gnuImplicitActivationPolicy.java,
+ gnu/CORBA/Poa/gnuForwardRequest.java,
+ gnu/CORBA/ForwardRequestHelper.java,
+ gnu/CORBA/Poa/vPolicy.java,
+ gnu/CORBA/Poa/ForwardRequestHolder.java,
+ org/omg/PortableServer/POA.java,
+ org/omg/PortableServer/POAManagerOperations.java,
+ org/omg/PortableServer/POAOperations.java,
+ org/omg/PortableServer/Servant.java,
+ org/omg/PortableServer/DynamicImplementation.java,
+ org/omg/PortableServer/ServantActivator.java,
+ org/omg/PortableServer/ServantActivatorOperations.java,
+ org/omg/PortableServer/ServantLocator.java,
+ org/omg/PortableServer/ServantLocatorOperations.java,
+ org/omg/PortableServer/ServantManager.java,
+ org/omg/PortableServer/Current.java,
+ org/omg/PortableServer/CurrentHelper.java,
+ org/omg/PortableServer/CurrentOperations.java,
+ org/omg/PortableServer/_ServantLocatorStub.java,
+ org/omg/PortableServer/portable/Delegate.java,
+ org/omg/PortableServer/ServantActivatorHelper.java,
+ org/omg/PortableServer/_ServantActivatorStub.java,
+ org/omg/PortableServer/ServantLocatorHelper.java,
+ org/omg/PortableServer/ServantActivatorPOA.java,
+ org/omg/PortableServer/ServantLocatorPOA.java,
+ org/omg/PortableServer/AdapterActivatorOperations.java,
+ org/omg/PortableServer/AdapterActivator.java,
+ org/omg/PortableServer/POAHelper.java,
+ org/omg/PortableServer/ServantManagerOperations.java,
+ org/omg/PortableServer/POAManager.java,
+ org/omg/PortableServer/package.html: New files.
+ * org/omg/CORBA/ORB.java: Documented POA features.
+ gnu/CORBA/gnuRequest.java (_releaseReply, equals): Mind that
+ the delegate can be null.
+ * gnu/CORBA/IOR_Delegate.java,
+ gnu/CORBA/Functional_ORB.java,
+ org/omg/CORBA/portable/ObjectImpl.java,
+ gnu/CORBA/Connected_objects.java: Rewritten.
+ * gnu/CORBA/Simple_delegate.java (is_equivalent): This method
+ is rewritten.
+ * gnu/CORBA/ServiceRequestAdapter.java: Added return value support.
+
+2005-07-22 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicListUI.java:
+ (paintCell): Set hasFocused to true if the cell is the lead selection
+ index and if the list has focus.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java:
+ (initComponentDefaults): Added List.focusCellHighlightBorder default.
+
+2005-07-22 Aaron Luchko <aluchko@redhat.com>
+
+ * gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java:
+ Implemented the ArrayType CommandSet.
+
+2005-07-22 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): Added defaults for ToggleButton.
+
+2005-07-22 Roman Kennke <roman@kennke.org>
+
+ * java/awt/Component.java
+ (setForeground): Fire PropertyChangeEvent after the foreground
+ has actually changed, instead of before.
+ (setBackground): Fire PropertyChangeEvent after the foreground
+ has actually changed, instead of before. Avoid one comparison
+ at the beginning of method.
+ (getBackground): If background is null and parent is null, return
+ null, instead of SystemColor.window. This is what it's supposed
+ to do.
+ (getFont): Avoid NPE by creating a local reference. Return
+ static final DEFAULT_FONT instead of creating a new font every time
+ we and our parents have no font set.
+ (setFont): Made check for font equality more precise.
+ (paramString): Added parent in paramString.
+
+2005-07-22 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JToggleButton.java
+ (ToggleButtonModel.setPressed): Fixed order in which events
+ get fired.
+
+2005-07-22 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/DefaultButtonModel.java
+ (setPressed): Changed order in which the events get fired. The
+ ActionEvent must be fired before the ChangeEvent gets fired.
+
+2005-07-22 Roman Kennke <roman@kennke.org>
+
+ * java/awt/Component.java
+ (show): Instead of invalidating the component, only invalidate
+ the parent, if there is one. Also repaint this parent.
+ Also, avoid NPEs by creating local references.
+ (hide): Instead of invalidating the component, only invalidate
+ the parent, if there is one. Also repaint this parent.
+ Also, avoid NPEs by creating local references.
+
+2005-07-22 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicButtonUI.java: API doc fixes,
+ * javax/swing/plaf/basic/BasicRadioButtonUI.java: likewise,
+ * javax/swing/plaf/basic/BasicTreeUI.java: likewise.
+
+2005-07-22 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalCheckBoxIcon.java: API doc fixes,
+ * javax/swing/plaf/metal/MetalIconFactory.java: likewise.
+
+2005-07-22 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/text/html/HTMLEditorKit.java: API doc fixes.
+
+2005-07-22 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/tree/AbstractLayoutCache.java: API doc fixes,
+ * javax/swing/tree/DefaultTreeCellRenderer.java: likewise,
+ * javax/swing/tree/DefaultTreeModel.java: likewise,
+ * javax/swing/tree/FixedHeightLayoutCache: likewise.
+
+2005-07-22 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/plaf/metal/MetalToggleButtonUI.java
+ (constructor): Initialize colors.
+ (getFocusColor): Fetches the focus property from the UIDefaults.
+ (getSelectColor): Fetches the select property from the UIDefaults.
+ (getDisabledTextColor): Fetches the disabledText property from the
+ UIDefaults.
+
+2005-07-21 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ (KeyHandler.updateSelection): Update the ListSelectionModels even if
+ rowSelectionAllowed or columnSelectionAllowed is false. This
+ complies with the JDK.
+ (KeyHandler.keyPressed): Implemented the ENTER key action.
+
+2005-07-21 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/BorderUIResource.java: API doc fixes,
+ * javax/swing/plaf/FileChooserUI.java: likewise,
+ * javax/swing/plaf/TextUI.java: likewise,
+ * javax/swing/plaf/UIResource.java: likewise.
+
+2005-07-21 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/event/EventListenerList.java: API doc fixes,
+ * javax/swing/event/MenuKeyEvent.java: likewise,
+ * javax/swing/event/TreeSelectionEvent.java: likewise.
+
+2005-07-21 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/border/AbstractBorder.java: API doc fixes,
+ * javax/swing/border/BevelBorder.java: likewise,
+ * javax/swing/border/EtchedBorder.java: likewise,
+ * javax/swing/border/LineBorder.java: likewise,
+ * javax/swing/border/SoftBevelBorder.java: likewise,
+ * javax/swing/border/TitledBorder.java: likewise.
+
+2005-07-21 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/plaf/metal/MetalButtonUI.java
+ (constructor): Initialize colors.
+ (getFocusColor): Fetches the focus property from the UIDefaults.
+ (getSelectColor): Fetches the select property from the UIDefaults.
+ (getDisabledTextColor): Fetches the disabledText property from the
+ UIDefaults.
+
+2005-07-21 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/text/GapContent.java
+ (replace): New method. Replaces a chunk of the buffer with
+ another chunk.
+
+2005-07-21 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/AbstractListModel.java: API doc fixes,
+ * javax/swing/BorderFactory.java: likewise,
+ * javax/swing/BoundedRangeModel.java: likewise,
+ * javax/swing/BoxLayout.java: likewise,
+ * javax/swing/CellRendererPane.java: likewise,
+ * javax/swing/ComponentInputMap.java: likewise,
+ * javax/swing/DefaultBoundedRangeModel.java: likewise,
+ * javax/swing/DefaultButtonModel.java: likewise,
+ * javax/swing/DefaultCellEditor.java: likewise,
+ * javax/swing/InputMap.java: likewise,
+ * javax/swing/JButton.java: likewise,
+ * javax/swing/JFrame.java: likewise,
+ * javax/swing/JLabel.java: likewise,
+ * javax/swing/JMenuBar.java: likewise,
+ * javax/swing/JPopupMenu.java: likewise,
+ * javax/swing/JScrollBar.java: likewise,
+ * javax/swing/JScrollPane.java: likewise,
+ * javax/swing/JSeparator.java: likewise,
+ * javax/swing/JSlider.java: likewise,
+ * javax/swing/JSpinner.java: likewise,
+ * javax/swing/JTextArea.java: likewise,
+ * javax/swing/JToggleButton.java: likewise,
+ * javax/swing/SpinnerListModel.java: likewise,
+ * javax/swing/Spring.java: likewise,
+ * javax/swing/SpringLayout.java: likewise.
+
+2005-07-21 Lillian Angel <langel@redhat.com>
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getPreferredSize): Changed to depend on visible nodes.
+ (mouseClicked): Fixed to keep track of last cell clicked, so expand/collapse
+ works properly by clicking 2 times on the same cell.
+
+2005-07-21 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JComponent.java
+ (putClientProperty): If value == null, remove the key from the
+ Hashtable, otherwise we would get an NPE here.
+
+2005-07-21 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicSliderUI.java:
+ (thumbHeight): removed,
+ (thumbWidth): removed,
+ (tickHeight): removed,
+ (installDefaults): deleted initialisation of thumbHeight, thumbWidth
+ and thumbRect,
+ (getPreferredHorizontalSize): changed source of thumb height and width,
+ (getPreferredVerticalSize): likewise,
+ (getMinimumHorizontalSize): reimplemented,
+ (getMinimumVerticalSize): reimplemented,
+ (getMinimumSize): reimplemented,
+ (getMaximumSize): reimplemented,
+ (calculateThumbSize): use getThumbSize(),
+ (calculateThumbLocation): use trackRect not contentRect,
+ (calculateTrackBuffer): use half the thumbRect,
+ (getThumbSize): use constant size,
+ (calculateTrackRect): move track down to middle of contentRect,
+ (getTickLength): return constant,
+ (paintTrack): removed unused local variables,
+ (paintTicks): apply a translation to g temporarily before calling
+ methods to draw ticks, add 0.5 to solve rounding problem,
+ (paintMinorTickForHorizSlider): modified to account for translation
+ already applied to g,
+ (paintMajorTickForHorizSlider): likewise,
+ (paintMinorTickForVertSlider): likewise,
+ (paintMajorTickForVertSlider): likewise,
+ (xPositionForValue): subtract 1 from width,
+ (yPositionForValue): likewise,
+ *javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): add slider defaults,
+ *javax/swing/plaf/metal/MetalSliderUI.java: implemented missing
+ methods,
+ * examples/gnu/classpath/examples/swing/Demo.java
+ (mkSliders): added minor ticks and labels.
+
+2005-07-21 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/AbstractButton.java
+ (init): Only set icon if the supplied icon is not null. Otherwise
+ we would override icons that are possibly set by the UI.
+ * javax/swing/plaf/basic/BasicIconFactory.java
+ (CheckBoxIcon): An new Icon implementation used for CheckBoxes
+ in the Basic L&F.
+ (RadioButtonIcon): An new Icon implementation used for
+ RadioButtons in the Basic L&F.
+ (getCheckBoxIcon): Now returns a (cached) instance of CheckBoxIcon
+ instead of the (wrong) inner icon implementation.
+ (getRadioButtonIcon): Now returns a (cached) instance of
+ RadioButtonIcon instead of the (wrong) inner icon implementation.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): Registered new icons for CheckBox and
+ RadioButton, using a LazyValue entry.
+ * javax/swing/plaf/basic/BasicRadioButtonUI.java
+ Added API documentation all over.
+ (installUI): Removed this method.
+ (installDefaults): New method. Installs the default icons if there
+ is no other icon set.
+ (getPropertyPrefix): New method. Returns the prefix that is used
+ to look up UIDefault entries.
+ (getDefaultIcon): Use propertyPrefix instead of hardcoded property.
+ (paint): New method. Override paint for customized painting
+ of RadioButtons.
+ * javax/swing/plaf/metal/MetalCheckBoxIcon.java
+ (drawCheck): Respect the x and y parameter.
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (RadioButtonIcon): An Icon implementation for Metal RadioButtons.
+ (getRadioButtonIcon): New method. Returns a shared instance of
+ RadioButtonIcon.
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): Register new icons for CheckBox and
+ RadioButton using a LazyValue entry.
+
+2005-07-21 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JOptionPane.java
+ (createInternalFrame): Look for a JDesktopPane first, then
+ look for a JLayeredPane as fallback. Set this JOptionPane as
+ contentPane for the found JDesktopPane. Make the InternalFrame
+ visible and appropriatly sized here.
+ (showInternalConfirmDialog): ALL VARIANTS OF THIS METHOD:
+ Adjusted call to startModel to only take one parameter.
+ (showInternalInputDialog): ALL VARIANTS OF THIS METHOD:
+ Adjusted call to startModel to only take one parameter.
+ (showInternalMessageDialog): ALL VARIANTS OF THIS METHOD:
+ Adjusted call to startModel to only take one parameter.
+ (showInternalOptionDialog): ALL VARIANTS OF THIS METHOD:
+ Adjusted call to startModel to only take one parameter.
+ (startModal): Now only takes one parameter. This method does no
+ longer add the JOptionPane to the contentPane of the InternalFrame,
+ set the size and make the InternalFrame visible. This is done in
+ createInternalFrame.
+
+2005-07-21 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/DefaultListSelectionModel.java: API doc fixes.
+
+2005-07-21 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/AbstractButton.java: API doc fixes all over.
+
+2005-07-21 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/UIDefaults.java
+ (getFont(Object, Locale)): matched argument name to API doc comment,
+ (getColor(Object, Locale)): likewise,
+ (getIcon(Object, Locale)): likewise,
+ (getBorder(Object, Locale)): likewise,
+ (getString(Object, Locale)): likewise,
+ (getInt(Object, Locale)): likewise,
+ (getBoolean(Object, Locale)): likewise,
+ (getInsets(Object, Locale)): likewise,
+ (getDimension(Object, Locale)): likewise.
+
+2005-07-21 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JComponent.java: API doc fixes all over.
+
+2005-07-21 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/net/URLClassLoader.java: reordered some API doc comments to
+ suppress Eclipse warnings, and fixed API doc link.
+
+2005-07-20 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/BorderLayout.java:
+ (layoutContainer): Removed addition of horizontal and vertical gaps
+ when there is no corresponding adjacent component.
+
+2005-07-20 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JTable:
+ (JTable): Set the lead selection index for each of the two lists
+ associated with this table to 0 (instead of -1). This complies with
+ JDK.
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ (KeyHandler.keyPressed): Implemented the following key actions (with
+ CTRL/SHIFT handling when appropriate): UP/DOWN/LEFT/RIGHT, HOME/END,
+ CTRL-A, CTRL-\, CTRL-/.
+
+2005-07-20 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicListUI.java:
+ (KeyHandler.keyPressed): Restore the lead selection index after doing
+ a "select all" operation.
+
+2005-07-20 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (keyPressed): Implemented some more VK_XXX and VK_KP_XXX events.
+
+2005-07-20 Aaron Luchko <aluchko@redhat.com>
+
+ * gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java:
+ Implemented the ClassObjectReference CommandSet.
+
+2005-07-20 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): Added value for InternalFrame.icon.
+ * javax/swing/plaf/basic/BasicInternalFrameUI.java
+ (installDefaults): Install icon from UIDefaults.
+
+2005-07-20 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/plaf/basic/BasicOptionPaneUI.java
+ (createSeparator): Return null here.
+ (installComponents): Don't add a separator in the OptionPane.
+
+2005-07-20 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (paint): Changed to paint children of root as roots if the
+ root is not visible, but the root path is expanded.
+ (getPathForRow): If the root is not visible, but expanded,
+ the first child should be considered row 0.
+ (getRowCount): Likewise.
+ (getPathBounds): Likewise.
+ (getCellLocation): If root is not visible, but expanded, the
+ level of each node is lowered by 1.
+ (paintRecursive): If root is not visible, but expanded, there should
+ be no indentation when the children are drawn. Also, there should be no
+ line drawn connecting the children. This makes it look like there are 2
+ independant trees (works same as JDK).
+
+2005-07-20 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/plaf/basic/BasicInternalFrameUI.java
+ (installUI): Moved titlePane.setOpaque() call into
+ BasicInternalFrameTitlePane's constructor.
+ * javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+ (constructor): Moved titlePane.setOpaque() call from
+ BasicInternalFrameUI.installUI into this constructor.
+
+2005-07-20 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JOptionPane.java
+ (createInternalFrame): Look up the nearest JLayeredPane instead
+ of JDesktopPane. This is in contrast to the specs but what the JDK
+ does and what makes sense.
+
+2005-07-20 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/SwingUtilities.java:
+ Made class description more concise.
+
+2005-07-20 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JButton.java:
+ Made class description more concise.
+
+2005-07-20 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JButton.java
+ (AccessibleJButton): Added accessibility support for JButton.
+ (getAccessibleContext): Implemented to return an AccessibleJButton.
+ * javax/swing/JLabel.java
+ (AccessibleJLabel): Added accessibility support for JLabel.
+ (getAccessibleContext): Implemented to return an AccessibleJLabel.
+
+2005-07-20 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JSlider.java
+ (setMinimum): fire PropertyChangeEvent for new value,
+ (setMaximum): likewise,
+ (setSnapToTicks): fire PropertyChangeEvent, not ChangeEvent,
+ (setPaintTrack): fire PropertyChangeEvent for new value,
+ (setPaintLabels): initialise label table.
+
+2005-07-20 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JLayeredPane.java:
+ Fixed and extended API documentation / class description.
+
+2005-07-20 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/Action.java:
+ Fixes the class description to be more concise.
+
+2005-07-20 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/text/AttributedCharacterIterator.java: fixed minor API doc
+ problems and 80 column wrapping;
+ * java/text/BreakIterator.java
+ (getCharacterInstance(Locale)): matched argument name to API docs,
+ (getLineInstance(Locale)): likewise,
+ (getSentenceInstance(Locale)): likewise,
+ (getWordInstance(Locale)): likewise,
+ and fixed minor API doc problems all over;
+ * java/text/CharacterIterator.java: fixed minor API doc problems.
+
+2005-07-19 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableServer/ForwardRequest.java: New file.
+
+2005-17-19 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/BasicTreeUI
+ (setModel): changed to call JTree's setModel
+ (setRootVisible): Likewise
+ (isRootVisible): Likewise
+ (getClosestPathForLocation): Implemented
+ (paint): took out translate, no need to.
+ (mouseClicked): clicking made smoother.
+
+2005-17-19 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/BasicTreeUI:
+ Moved several functions around for readability.
+ Some formatting in various places.
+ (paint): extended size of border drawn
+ (mouseClicked): checked if path was null
+ (getCellLocation): Now package-private.
+ (paintNode): Implemented, there is no need to paint the leaf and non
+ leaf separately. Works with custom icons.
+ (paintRecursive): Now package-private. Changed to paint with paintNode.
+ (paintControlIcons): Now package-private.
+ (hasControlIcons): Now package-private.
+
+2005-17-19 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JSlider.java
+ (createStandardLabels(int)): updated API docs,
+ (createStandardLabels(int, int)): throw IllegalArgumentException for
+ bad arguments.
+
+2005-17-18 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/BasicTreeUI
+ (getPathBounds): checked if path was null initially
+ (paint): no need to check for control icons
+ (paintLeaf): reseting of icon
+ (paintNonLeaf): resetting of icon
+ (paintControlIcons): cleaned up
+ (hasControlIcons): cleaned up
+ * javax/swing/tree/DefaultTreeCellRenderer
+ (getTreeCellRendererComponent): fixed to follow API
+
+2005-07-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JSlider.java:
+ (JSlider(int)): updated API docs,
+ (JSlider(int, int, int)): likewise,
+ (JSlider(BoundedRangeModel)): removed code that handles a null
+ argument, and updated API docs.
+
+2005-07-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JSlider.java: initialise snapToTicks to false.
+
+2005-07-18 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicMenuItemUI.java:
+ (paintMenuItem): Don't highlight background of a selected
+ JCheckboxMenuItem.
+ (paintText): Don't highlight text of a selected JCheckBoxMenuItem.
+
+2005-07-18 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JPopupMenu.java:
+ (insert): Resize the container to its preferred size when an item is
+ inserted.
+ (remove): Resize the container to its preferred size when an item is
+ removed.
+
+2005-07-18 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicMenuUI.java:
+ (getMaximumSize): Added check for this menu not being a top level menu.
+ If that's the case, return the maximum size as if it were a regular
+ JMenuItem.
+
+2005-07-18 Tom Tromey <tromey@redhat.com>
+
+ * lib/Makefile.gcj (%.stamp): Added -MP.
+
+2005-07-18 Tom Tromey <tromey@redhat.com>
+
+ * include/.cvsignore: Removed jni.h.
+
+2005-07-18 Tom Tromey <tromey@redhat.com>
+
+ * native/jni/classpath/classpath_jawt.h: Updated copyright
+ header.
+
+2005-07-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/imageio/stream/ImageInputStream.java: added import to fix
+ minor API doc problems.
+
+2005-07-18 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (paint): Only paint border if using MetalL&F
+ (mouseClicked): Check that control icons exist
+ (paintNonLeaf): Changed to paint icon depending on height
+ (hasControlIcons): Implemented to return true if control icons exist
+
+2005-07-18 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (paint): Implemented painting of border around selected path
+ (mouseClicked): Fixed clicking of icon
+
+2005-07-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): changed Slider.thumbWidth.
+ * javax/swing/plaf/basic/BasicSliderUI.java
+ (paintThumb): fixed thumb painting.
+
+2005-07-17 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableServer/ThreadPolicyValue.java,
+ org/omg/PortableServer/IdAssignmentPolicy.java,
+ org/omg/PortableServer/IdUniquenessPolicyOperations.java,
+ org/omg/PortableServer/IdAssignmentPolicyOperations.java,
+ org/omg/PortableServer/IdUniquenessPolicy.java,
+ org/omg/PortableServer/ImplicitActivationPolicyOperations.java,
+ org/omg/PortableServer/LifespanPolicyOperations.java,
+ org/omg/PortableServer/LifespanPolicy.java,
+ org/omg/PortableServer/ImplicitActivationPolicy.java,
+ org/omg/PortableServer/ServantRetentionPolicy.java,
+ org/omg/PortableServer/RequestProcessingPolicy.java,
+ org/omg/PortableServer/ServantRetentionPolicyOperations.java,
+ org/omg/PortableServer/ThreadPolicyOperations.java,
+ org/omg/PortableServer/RequestProcessingPolicyOperations.java,
+ org/omg/PortableServer/ThreadPolicy.java: New files.
+
2005-07-15 Lillian Angel <langel@redhat.com>
* javax/swing/plaf/basic/BasicTreeUI.java
(mouseClicked): Implemented clicking on control icons.
diff --git a/libjava/classpath/ChangeLog.gcj b/libjava/classpath/ChangeLog.gcj
index 813715a..bc2bbb5 100644
--- a/libjava/classpath/ChangeLog.gcj
+++ b/libjava/classpath/ChangeLog.gcj
@@ -1,3 +1,7 @@
+2005-09-23 Tom Tromey <tromey@redhat.com>
+
+ Imported Classpath 0.18.
+
2005-08-23 Tom Tromey <tromey@redhat.com>
* configure: Rebuilt.
diff --git a/libjava/classpath/INSTALL b/libjava/classpath/INSTALL
index b9cadee..9151507 100644
--- a/libjava/classpath/INSTALL
+++ b/libjava/classpath/INSTALL
@@ -1,4 +1,4 @@
-Installing GNU Classpath - Last updated: January 6, 2005
+Installing GNU Classpath - Last updated: August 31, 2005
First, this is a development release only! Unless you are interested in
active development and debugging, or just like running random alpha code,
@@ -28,11 +28,12 @@ Suggested Software
For building the Java bytecode (.class files), one of these
compilers are required. You can select which compiler using
- --with-jikes, --with-gcj or --with-kjc as argument to
+ --with-jikes, --with-gcj, --with-ecj or --with-kjc as argument to
configure; the present default is gcj.
- GCJ 3.3+ (part of the GNU GCC package).
- IBM jikes 1.19+.
+ - Eclipse Compiler for Java 3.1+
- The kjc compiler is supported with configure but we have
been unable to successfully compile with it.
@@ -48,7 +49,18 @@ Suggested Software
For building the Cairo GdkGraphics2D backend you need at least
Cairo 0.5.0.
- For building the xmlj JAXP implementation (dsabled by default, use
+ For building the Qt AWT peer JNI native libraries you have to
+ specify --enable-qt-peer and need the following library:
+
+ - Qt 4.0.1
+
+ Please note that at the moment most operating systems do not
+ ship Qt4 by default. We recommend using GNU Classpath' Qt4
+ support only for its developers and bug reporters. See
+ http://developer.classpath.org/mediation/ClasspathShowcase
+ for details on how to get it to work.
+
+ For building the xmlj JAXP implementation (disabled by default, use
configure --enable-xmlj) you need the following installed:
- The XML C library for Gnome (libxml2)
http://www.xmlsoft.org/
@@ -74,6 +86,11 @@ gives a complete list.
--enable-jni compile JNI source default=yes
--enable-gtk-peer compile GTK native peers default=yes
--enable-gtk-cairo compile cairo based Graphics2D default=no
+ --enable-qt-peer compile Qt4 native peers default=no
+ --enable-default-toolkit
+ fully qualified class name of default AWT toolkit
+ default=no
+ --enable-xmlj compile native libxml/xslt library default=no
--enable-load-library enable to use JNI native methods default=yes
--with-jikes to compile the class library using jikes
the default is to use gcj
@@ -83,7 +100,7 @@ gives a complete list.
any compiler warning into a compilation failure
default=no
--enable-xmlj compile native libxml/xslt library default=no
- --with-gjdoc generate documentation using gjdoc default=no
+ --with-gjdoc generate documentation using gjdoc default=no
--with-jay Regenerate the parsers with jay must be given the
path to the jay executable
diff --git a/libjava/classpath/Makefile.am b/libjava/classpath/Makefile.am
index 6cc0754..24813e3 100644
--- a/libjava/classpath/Makefile.am
+++ b/libjava/classpath/Makefile.am
@@ -4,6 +4,7 @@
SUBDIRS = lib doc external include native resource scripts $(EXAMPLESDIR)
DIST_SUBDIRS = lib doc external include native resource scripts examples
+## GCJ LOCAL: we need an extra -I here.
ACLOCAL_AMFLAGS = -I m4 -I ../..
native: lib
diff --git a/libjava/classpath/Makefile.in b/libjava/classpath/Makefile.in
index fd9f5b7..e62746e 100644
--- a/libjava/classpath/Makefile.in
+++ b/libjava/classpath/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -107,8 +107,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -170,6 +176,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -181,12 +188,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -208,10 +216,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -316,13 +327,7 @@ uninstall-info-am:
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
- @failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+ @set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -334,7 +339,7 @@ $(RECURSIVE_TARGETS):
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@@ -342,13 +347,7 @@ $(RECURSIVE_TARGETS):
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
- @failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+ @set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@@ -369,7 +368,7 @@ maintainer-clean-recursive:
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -444,7 +443,7 @@ distclean-tags:
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
- $(mkdir_p) $(distdir)/../.. $(distdir)/gnu/classpath $(distdir)/lib $(distdir)/m4 $(distdir)/scripts
+ $(mkdir_p) $(distdir)/../.. $(distdir)/examples $(distdir)/gnu/classpath $(distdir)/lib $(distdir)/m4 $(distdir)/scripts
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
diff --git a/libjava/classpath/NEWS b/libjava/classpath/NEWS
index 55cb064..4d91852 100644
--- a/libjava/classpath/NEWS
+++ b/libjava/classpath/NEWS
@@ -1,3 +1,86 @@
+New in release 0.18 (Sep 6, 2005)
+
+* GNU JAWT implementation, the AWT Native Interface, which allows direct
+ access to native screen resources from within a Canvas's paint method.
+ GNU Classpath Examples comes with a Demo, see examples/README.
+* awt.datatransfer updated to 1.5 with supports for FlavorEvents.
+ The gtk+ awt peers now allow copy/paste of text, images, uris/files
+ and serialized objects with other applications and tracking
+ clipboard change events with gtk+ 2.6 (for gtk+ 2.4 only text and
+ serialized objects are supported). A GNU Classpath Examples
+ datatransfer Demo was added to show the new functionality.
+* org.omg.PortableInterceptor and related functionality in other packages
+ is now implemented:
+ - The sever and client interceptors work as required since 1.4.
+ - The IOR interceptor works as needed for 1.5.
+* The org.omg.DynamicAny package is completed and passes the prepared tests.
+* The Portable Object Adapter should now support the output of the
+ recent IDL to java compilers. These compilers now generate servants and
+ not CORBA objects as before, making the output depended on the existing
+ POA implementation. Completing POA means that such code can already be
+ tried to run on Classpath. Our POA is tested for the following usager
+ scenarios:
+ - POA converts servant to the CORBA object.
+ - Servant provides to the CORBA object.
+ - POA activates new CORBA object with the given Object Id (byte array)
+ that is later accessible for the servant.
+ - During the first call, the ServantActivator provides servant for this
+ and all subsequent calls on the current object.
+ - During each call, the ServantLocator provides servant for this call
+ only.
+ - ServantLocator or ServantActivator forwards call to another server.
+ - POA has a single servant, responsible for all objects.
+ - POA has a default servant, but some objects are explicitly connected
+ to they specific servants.
+ The POA is verified using tests from the former cost.omg.org.
+* The javax.swing.plaf.multi.* package is now implemented.
+* Editing and several key actions for JTree and JTable were implemented.
+* Lots of icons and look and feel improvements for Free Swing basic and
+ metal themes were added. Try running the GNU Classpath Swing Demo in
+ examples (gnu.classpath.examples.swing.Demo) with:
+ -Dswing.defaultlaf=javax.swing.plaf.basic.BasicLookAndFeel
+ -Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel
+* Start of styled text capabilites for java.swing.text.
+* NIO FileChannel.map implementation, fast bulk put implementation for
+ DirectByteBuffer (speeds up this method 10x).
+* Split gtk+ awt peers event handling in two threads and improve gdk lock
+ handling (solves several AWT lock ups).
+* Speed up awt Image loading.
+* Updated TimeZone data against Olson tzdata2005l.
+* Make zip and jar UTF-8 "clean".
+* "native" code builds and compiles (warning free) on Darwin and Solaris.
+
+Runtime interface changes:
+
+* All native resource "pointers" in the VM interface classes are now exposed
+ as gnu.classpath.Pointer objects. This might impact runtimes that
+ optimize and support java.nio.DirectByteBuffers. Creating these classes
+ and accessing the contents as void * pointers for the native reference JNI
+ implementation is done through the JCL_NewRawDataObject and JCL_GetRawData
+ functions.
+* Simplified the Class/VMClass interface.
+* Removed loadedClasses map from ClassLoader. It's now the VMs responsibility
+ to manage the list of defined and loaded classes for each class loader.
+* Moved native methods from java.lang.reflect.Proxy to VMProxy.
+* Added hook to VMClassLoader to allow VM to do class caching.
+
+New Untested/Disabled Features:
+
+ The following new features are included, but not ready for production
+ yet. They are explicitly disabled and not supported. But if you want
+ to help with the development of these new features we are interested
+ in feedback. You will have to explicitly enable them to try them out
+ (and they will most likely contain bugs). If you are interested in any
+ of these then please join the mailing-list and follow development in
+ CVS.
+
+* QT4 AWT peers, enable by giving configure --enable-qt-peer.
+* JDWP framework, enable by deleting the jdwp references from
+ lib/standard.omit and vm/reference/standard.omit. No default
+ implementation is provided. Work is being done on gcj/gij integration.
+* StAX java.xml.stream, enable by deleting the gnu.xml.stream and
+ java.xml.stream references in lib/standard.omit.
+
New in release 0.17 (Jul 15, 2005)
* gnu.xml fix for nodes created outside a namespace context.
diff --git a/libjava/classpath/README b/libjava/classpath/README
index 535014f..27e22dc 100644
--- a/libjava/classpath/README
+++ b/libjava/classpath/README
@@ -1,4 +1,4 @@
-GNU Classpath README - Last updated: Jul 9, 2004
+GNU Classpath README - Last updated: August 31, 2005
GNU Classpath, Essential Libraries for Java is a project to create a
free software implementation of the core class libraries for the java
@@ -55,7 +55,8 @@ some of which synchronizes with the Classpath CVS head every couple of weeks:
* IKVM.NET (http://www.ikvm.net/)
* JC (http://jcvm.sourceforge.net/)
* JNode (http://jnode.sourceforge.net/)
- * SableVM (http://www.sablevm.org)
+ * MysaifuVM (http://www2s.biglobe.ne.jp/~dat/java/project/jvm/)
+ * SableVM (http://www.sablevm.org)
See for a more complete list of GNU Classpath based projects the
GNU Classpath website: http://www.gnu.org/software/classpath/stories.html
diff --git a/libjava/classpath/aclocal.m4 b/libjava/classpath/aclocal.m4
index f99df43..8723094 100644
--- a/libjava/classpath/aclocal.m4
+++ b/libjava/classpath/aclocal.m4
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.9.5 -*- Autoconf -*-
+# generated automatically by aclocal 1.9.3 -*- Autoconf -*-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+# Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -11,11 +11,23 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
-# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# -*- Autoconf -*-
+# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+# Generated from amversion.in; do not edit by hand.
+
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
@@ -28,15 +40,26 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
# Call AM_AUTOMAKE_VERSION so it can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
- [AM_AUTOMAKE_VERSION([1.9.5])])
+ [AM_AUTOMAKE_VERSION([1.9.3])])
-# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+# AM_AUX_DIR_EXPAND
-# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
@@ -83,16 +106,26 @@ AC_PREREQ([2.50])dnl
am_aux_dir=`cd $ac_aux_dir && pwd`
])
-# AM_CONDITIONAL -*- Autoconf -*-
+# AM_CONDITIONAL -*- Autoconf -*-
-# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# Copyright (C) 1997, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
-# serial 7
+# serial 6
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
@@ -116,15 +149,26 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
+# serial 7 -*- Autoconf -*-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-# serial 8
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
@@ -133,6 +177,7 @@ fi])])
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
@@ -272,16 +317,27 @@ AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])
])
-# Generate code to set up dependency tracking. -*- Autoconf -*-
+# Generate code to set up dependency tracking. -*- Autoconf -*-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+# Free Software Foundation, Inc.
+
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
-#serial 3
+#serial 2
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
@@ -340,19 +396,30 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
-# Do all the work for Automake. -*- Autoconf -*-
+# Do all the work for Automake. -*- Autoconf -*-
+
+# This macro actually does too much some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-# serial 12
+# This program 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.
-# This macro actually does too much. Some checks are only needed if
-# your package does certain things. But this isn't really a big deal.
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 11
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
@@ -454,27 +521,51 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
-# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
+
+# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
install_sh=${install_sh-"$am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
-# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# -*- Autoconf -*-
+# Copyright (C) 2003 Free Software Foundation, Inc.
-# serial 2
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 1
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
@@ -489,17 +580,28 @@ fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
-# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
+# Add --enable-maintainer-mode option to configure.
# From Jim Meyering
-# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004
# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-# serial 4
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 3
AC_DEFUN([AM_MAINTAINER_MODE],
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
@@ -518,15 +620,26 @@ AC_DEFUN([AM_MAINTAINER_MODE],
AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
-# Check to see how 'make' treats includes. -*- Autoconf -*-
+# Check to see how 'make' treats includes. -*- Autoconf -*-
-# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
-# serial 3
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 2
# AM_MAKE_INCLUDE()
# -----------------
@@ -570,16 +683,27 @@ AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
-# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+# -*- Autoconf -*-
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-# serial 4
+# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 3
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
@@ -605,16 +729,27 @@ else
fi
])
-# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
# AM_PROG_MKDIR_P
# ---------------
# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
-#
+
+# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
# created by `make install' are always world readable, even if the
# installer happens to have an overly restrictive umask (e.g. 077).
@@ -668,15 +803,26 @@ else
fi
AC_SUBST([mkdir_p])])
-# Helper functions for option handling. -*- Autoconf -*-
+# Helper functions for option handling. -*- Autoconf -*-
-# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
-# serial 3
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 2
# _AM_MANGLE_OPTION(NAME)
# -----------------------
@@ -701,11 +847,22 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
-# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# Copyright (C) 2001, 2003 Free Software Foundation, Inc. -*- Autoconf -*-
+
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
# AM_RUN_LOG(COMMAND)
# -------------------
@@ -718,16 +875,28 @@ AC_DEFUN([AM_RUN_LOG],
echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
(exit $ac_status); }])
-# Check to make sure that the build environment is sane. -*- Autoconf -*-
-
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
-# Free Software Foundation, Inc.
#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# Check to make sure that the build environment is sane.
+#
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc.
+
+# This program 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.
-# serial 4
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 3
# AM_SANITY_CHECK
# ---------------
@@ -770,14 +939,25 @@ Check your system clock])
fi
AC_MSG_RESULT(yes)])
-# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
# AM_PROG_INSTALL_STRIP
-# ---------------------
+
+# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
# One issue with vendor `install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
@@ -800,13 +980,25 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Check how to create a tarball. -*- Autoconf -*-
-# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# Copyright (C) 2004 Free Software Foundation, Inc.
+
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 1
-# serial 2
# _AM_PROG_TAR(FORMAT)
# --------------------
diff --git a/libjava/classpath/autogen.sh b/libjava/classpath/autogen.sh
index 644b155..e20cc38 100755
--- a/libjava/classpath/autogen.sh
+++ b/libjava/classpath/autogen.sh
@@ -12,16 +12,9 @@ FILE=java/lang/Object.java
DIE=0
-case `uname -s` in
-Darwin)
- LIBTOOLIZE=glibtoolize
- ;;
-*)
- LIBTOOLIZE=libtoolize
- ;;
-esac
-
-have_libtool=true
+LIBTOOLIZE=libtoolize
+
+have_libtool=false
if ${LIBTOOLIZE} --version < /dev/null > /dev/null 2>&1 ; then
libtool_version=`${LIBTOOLIZE} --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
case $libtool_version in
@@ -35,6 +28,9 @@ if $have_libtool ; then : ; else
echo "You must have libtool 1.5 installed to compile $PROJECT."
echo "Install the appropriate package for your distribution,"
echo "or get the source tarball at http://ftp.gnu.org/gnu/libtool/"
+ echo "For Darwin you need the latest stable (1.5.18) to support"
+ echo "Frameworks linking. Also, you have to point ACLOCAL_FLAGS"
+ echo "to this libtool/share/aclocal."
DIE=1
fi
diff --git a/libjava/classpath/configure b/libjava/classpath/configure
index b42c613..0760964 100755
--- a/libjava/classpath/configure
+++ b/libjava/classpath/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for GNU Classpath 0.17+cvs.
+# Generated by GNU Autoconf 2.59 for GNU Classpath 0.18.
#
# Report bugs to <classpath@gnu.org>.
#
@@ -269,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='GNU Classpath'
PACKAGE_TARNAME='classpath'
-PACKAGE_VERSION='0.17+cvs'
-PACKAGE_STRING='GNU Classpath 0.17+cvs'
+PACKAGE_VERSION='0.18'
+PACKAGE_STRING='GNU Classpath 0.18'
PACKAGE_BUGREPORT='classpath@gnu.org'
ac_unique_file="java/lang/System.java"
@@ -312,7 +312,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os LIBVERSION CLASSPATH_MODULE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CREATE_JNI_LIBRARIES_TRUE CREATE_JNI_LIBRARIES_FALSE CREATE_CORE_JNI_LIBRARIES_TRUE CREATE_CORE_JNI_LIBRARIES_FALSE default_toolkit CREATE_XMLJ_LIBRARY_TRUE CREATE_XMLJ_LIBRARY_FALSE CREATE_GTK_PEER_LIBRARIES_TRUE CREATE_GTK_PEER_LIBRARIES_FALSE GTK_CAIRO_ENABLED GTK_CAIRO_TRUE GTK_CAIRO_FALSE CREATE_JNI_HEADERS_TRUE CREATE_JNI_HEADERS_FALSE LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE RANLIB ac_ct_RANLIB LIBTOOL CPP EGREP LIBICONV LTLIBICONV WARNING_CFLAGS STRICT_WARNING_CFLAGS ERROR_CFLAGS PKG_CONFIG XML_CFLAGS XML_LIBS XSLT_CFLAGS XSLT_LIBS X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS GTK_CFLAGS GTK_LIBS CAIRO_CFLAGS CAIRO_LIBS PANGOFT2_CFLAGS PANGOFT2_LIBS USER_JAVAH USER_SPECIFIED_JAVAH_TRUE USER_SPECIFIED_JAVAH_FALSE CLASSPATH_INCLUDES GCJ JIKES JIKESENCODING KJC GCJX ECJ FOUND_GCJ_TRUE FOUND_GCJ_FALSE FOUND_JIKES_TRUE FOUND_JIKES_FALSE FOUND_ECJ_TRUE FOUND_ECJ_FALSE FOUND_KJC_TRUE FOUND_KJC_FALSE FOUND_GCJX_TRUE FOUND_GCJX_FALSE USER_CLASSLIB USER_SPECIFIED_CLASSLIB_TRUE USER_SPECIFIED_CLASSLIB_FALSE vm_classes MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBDEBUG INIT_LOAD_LIBRARY JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION REMOVE SH MKDIR CP DATE FIND ZIP INSTALL_GLIBJ_ZIP_TRUE INSTALL_GLIBJ_ZIP_FALSE INSTALL_CLASS_FILES_TRUE INSTALL_CLASS_FILES_FALSE BUILD_CLASS_FILES_TRUE BUILD_CLASS_FILES_FALSE EXAMPLESDIR GJDOC CREATE_API_DOCS_TRUE CREATE_API_DOCS_FALSE JAY JAY_SKELETON REGEN_PARSERS_TRUE REGEN_PARSERS_FALSE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os LIBVERSION CLASSPATH_MODULE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CREATE_JNI_LIBRARIES_TRUE CREATE_JNI_LIBRARIES_FALSE CREATE_CORE_JNI_LIBRARIES_TRUE CREATE_CORE_JNI_LIBRARIES_FALSE default_toolkit CREATE_XMLJ_LIBRARY_TRUE CREATE_XMLJ_LIBRARY_FALSE CREATE_GTK_PEER_LIBRARIES_TRUE CREATE_GTK_PEER_LIBRARIES_FALSE GTK_CAIRO_ENABLED GTK_CAIRO_TRUE GTK_CAIRO_FALSE CREATE_QT_PEER_LIBRARIES_TRUE CREATE_QT_PEER_LIBRARIES_FALSE CREATE_JNI_HEADERS_TRUE CREATE_JNI_HEADERS_FALSE LN_S CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE RANLIB ac_ct_RANLIB LIBTOOL CXXCPP CPP EGREP LIBICONV LTLIBICONV WARNING_CFLAGS STRICT_WARNING_CFLAGS ERROR_CFLAGS PKG_CONFIG XML_CFLAGS XML_LIBS XSLT_CFLAGS XSLT_LIBS X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS GTK_CFLAGS GTK_LIBS QT_CFLAGS QT_LIBS MOC CAIRO_CFLAGS CAIRO_LIBS PANGOFT2_CFLAGS PANGOFT2_LIBS USER_JAVAH USER_SPECIFIED_JAVAH_TRUE USER_SPECIFIED_JAVAH_FALSE CLASSPATH_INCLUDES GCJ JIKES JIKESENCODING KJC GCJX ECJ FOUND_GCJ_TRUE FOUND_GCJ_FALSE FOUND_JIKES_TRUE FOUND_JIKES_FALSE FOUND_ECJ_TRUE FOUND_ECJ_FALSE FOUND_KJC_TRUE FOUND_KJC_FALSE FOUND_GCJX_TRUE FOUND_GCJX_FALSE USER_CLASSLIB USER_SPECIFIED_CLASSLIB_TRUE USER_SPECIFIED_CLASSLIB_FALSE vm_classes MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBDEBUG INIT_LOAD_LIBRARY JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION REMOVE MKDIR CP DATE FIND ZIP INSTALL_GLIBJ_ZIP_TRUE INSTALL_GLIBJ_ZIP_FALSE INSTALL_CLASS_FILES_TRUE INSTALL_CLASS_FILES_FALSE BUILD_CLASS_FILES_TRUE BUILD_CLASS_FILES_FALSE EXAMPLESDIR GJDOC CREATE_API_DOCS_TRUE CREATE_API_DOCS_FALSE JAY JAY_SKELETON REGEN_PARSERS_TRUE REGEN_PARSERS_FALSE LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -753,14 +753,14 @@ ac_env_target_alias_set=${target_alias+set}
ac_env_target_alias_value=$target_alias
ac_cv_env_target_alias_set=${target_alias+set}
ac_cv_env_target_alias_value=$target_alias
-ac_env_CC_set=${CC+set}
-ac_env_CC_value=$CC
-ac_cv_env_CC_set=${CC+set}
-ac_cv_env_CC_value=$CC
-ac_env_CFLAGS_set=${CFLAGS+set}
-ac_env_CFLAGS_value=$CFLAGS
-ac_cv_env_CFLAGS_set=${CFLAGS+set}
-ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_CXX_set=${CXX+set}
+ac_env_CXX_value=$CXX
+ac_cv_env_CXX_set=${CXX+set}
+ac_cv_env_CXX_value=$CXX
+ac_env_CXXFLAGS_set=${CXXFLAGS+set}
+ac_env_CXXFLAGS_value=$CXXFLAGS
+ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set}
+ac_cv_env_CXXFLAGS_value=$CXXFLAGS
ac_env_LDFLAGS_set=${LDFLAGS+set}
ac_env_LDFLAGS_value=$LDFLAGS
ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
@@ -769,6 +769,18 @@ ac_env_CPPFLAGS_set=${CPPFLAGS+set}
ac_env_CPPFLAGS_value=$CPPFLAGS
ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_CXXCPP_set=${CXXCPP+set}
+ac_env_CXXCPP_value=$CXXCPP
+ac_cv_env_CXXCPP_set=${CXXCPP+set}
+ac_cv_env_CXXCPP_value=$CXXCPP
ac_env_CPP_set=${CPP+set}
ac_env_CPP_value=$CPP
ac_cv_env_CPP_set=${CPP+set}
@@ -781,7 +793,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures GNU Classpath 0.17+cvs to adapt to many kinds of systems.
+\`configure' configures GNU Classpath 0.18 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -852,7 +864,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of GNU Classpath 0.17+cvs:";;
+ short | recursive ) echo "Configuration of GNU Classpath 0.18:";;
esac
cat <<\_ACEOF
@@ -872,12 +884,14 @@ Optional Features:
--enable-gtk-cairo build the cairo Graphics2D implementation on GTK
default=no
+ --enable-qt-peer compile Qt4 native peers (disabled by --disable-jni)
+ default=no
--enable-regen-headers automatically regenerate JNI headers default=no
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
--enable-static=PKGS build static libraries default=no
--enable-shared=PKGS build shared libraries default=yes
--enable-fast-install=PKGS optimize for fast installation default=yes
- --disable-dependency-tracking speeds up one-time build
- --enable-dependency-tracking do not reject slow dependency extractors
--disable-libtool-lock avoid locking (might break parallel builds)
--disable-rpath do not hardcode runtime library paths
--enable-maintainer-mode enable make rules and dependencies not useful
@@ -914,12 +928,15 @@ Optional Packages:
path to the jay executable
Some influential environment variables:
- CC C compiler command
- CFLAGS C compiler flags
+ CXX C++ compiler command
+ CXXFLAGS C++ compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
headers in a nonstandard directory <include dir>
+ CC C compiler command
+ CFLAGS C compiler flags
+ CXXCPP C++ preprocessor
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
@@ -1021,7 +1038,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-GNU Classpath configure 0.17+cvs
+GNU Classpath configure 0.18
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1035,7 +1052,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by GNU Classpath $as_me 0.17+cvs, which was
+It was created by GNU Classpath $as_me 0.18, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@@ -1485,7 +1502,16 @@ if expr ${target_cpu} : '.*86' > /dev/null; then target_cpu=x86; fi
LIBVERSION="0:0:0"
-CLASSPATH_MODULE="-module -version-info ${LIBVERSION} -no-undefined"
+case "$host_os" in
+ darwin*)
+ cp_module=""
+ ;;
+ *)
+ cp_module="-module"
+ ;;
+esac
+
+CLASSPATH_MODULE="${cp_module} -version-info ${LIBVERSION} -no-undefined"
@@ -1771,7 +1797,7 @@ fi
# Define the identity of the package.
PACKAGE='classpath'
- VERSION='0.17+cvs'
+ VERSION='0.18'
cat >>confdefs.h <<_ACEOF
@@ -2135,6 +2161,28 @@ else
fi
+# Check whether --enable-qt-peer or --disable-qt-peer was given.
+if test "${enable_qt_peer+set}" = set; then
+ enableval="$enable_qt_peer"
+ case "${enableval}" in
+ yes) COMPILE_QT_PEER=yes ;;
+ no) COMPILE_QT_PEER=no ;;
+ *) COMPILE_QT_PEER=yes ;;
+ esac
+else
+ COMPILE_QT_PEER=no
+fi;
+
+
+if test "x${COMPILE_QT_PEER}" = xyes; then
+ CREATE_QT_PEER_LIBRARIES_TRUE=
+ CREATE_QT_PEER_LIBRARIES_FALSE='#'
+else
+ CREATE_QT_PEER_LIBRARIES_TRUE='#'
+ CREATE_QT_PEER_LIBRARIES_FALSE=
+fi
+
+
# Check whether --enable-regen-headers or --disable-regen-headers was given.
if test "${enable_regen_headers+set}" = set; then
enableval="$enable_regen_headers"
@@ -2248,72 +2296,561 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-# Check whether --enable-static or --disable-static was given.
-if test "${enable_static+set}" = set; then
- enableval="$enable_static"
- p=${PACKAGE-default}
-case $enableval in
-yes) enable_static=yes ;;
-no) enable_static=no ;;
-*)
- enable_static=no
- # Look at the argument we got. We use all the common list separators.
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
- for pkg in $enableval; do
- if test "X$pkg" = "X$p"; then
- enable_static=yes
- fi
- done
- IFS="$ac_save_ifs"
- ;;
-esac
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CXX+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- enable_static=no
-fi;
-# Check whether --enable-shared or --disable-shared was given.
-if test "${enable_shared+set}" = set; then
- enableval="$enable_shared"
- p=${PACKAGE-default}
-case $enableval in
-yes) enable_shared=yes ;;
-no) enable_shared=no ;;
-*)
- enable_shared=no
- # Look at the argument we got. We use all the common list separators.
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
- for pkg in $enableval; do
- if test "X$pkg" = "X$p"; then
- enable_shared=yes
- fi
+ if test -n "$CXX"; then
+ ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+ echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$CXX" && break
done
- IFS="$ac_save_ifs"
- ;;
-esac
+fi
+if test -z "$CXX"; then
+ ac_ct_CXX=$CXX
+ for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- enable_shared=yes
-fi;
-# Check whether --enable-fast-install or --disable-fast-install was given.
-if test "${enable_fast_install+set}" = set; then
- enableval="$enable_fast_install"
- p=${PACKAGE-default}
-case $enableval in
-yes) enable_fast_install=yes ;;
-no) enable_fast_install=no ;;
-*)
- enable_fast_install=no
- # Look at the argument we got. We use all the common list separators.
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
- for pkg in $enableval; do
- if test "X$pkg" = "X$p"; then
- enable_fast_install=yes
+ if test -n "$ac_ct_CXX"; then
+ ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CXX="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$ac_ct_CXX" && break
+done
+test -n "$ac_ct_CXX" || ac_ct_CXX="g++"
+
+ CXX=$ac_ct_CXX
+fi
+
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+ "checking for C++ compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C++ compiler default output file name" >&5
+echo $ECHO_N "checking for C++ compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+ ;;
+ conftest.$ac_ext )
+ # This is the source file.
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool,
+ # but it would be cool to find out if it's true. Does anybody
+ # maintain Libtool? --akim.
+ export ac_cv_exeext
+ break;;
+ * )
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C++ compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C++ compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C++ compiler works" >&5
+echo $ECHO_N "checking whether the C++ compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C++ compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C++ compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
fi
- done
- IFS="$ac_save_ifs"
- ;;
-esac
+ fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
else
- enable_fast_install=yes
-fi;
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6
+GXX=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+CXXFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cxx_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cxx_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6
+if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+ if test "$GXX" = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-g"
+ fi
+else
+ if test "$GXX" = yes; then
+ CXXFLAGS="-O2"
+ else
+ CXXFLAGS=
+ fi
+fi
+for ac_declaration in \
+ '' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
DEPDIR="${am__leading_dot}deps"
ac_config_commands="$ac_config_commands depfiles"
@@ -2379,6 +2916,182 @@ fi
+
+depcc="$CXX" am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CXX_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CXX_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+
+
+if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+ am__fastdepCXX_TRUE=
+ am__fastdepCXX_FALSE='#'
+else
+ am__fastdepCXX_TRUE='#'
+ am__fastdepCXX_FALSE=
+fi
+
+
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+ enableval="$enable_static"
+ p=${PACKAGE-default}
+case $enableval in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_static=no
+fi;
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+ enableval="$enable_shared"
+ p=${PACKAGE-default}
+case $enableval in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_shared=yes
+fi;
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+ enableval="$enable_fast_install"
+ p=${PACKAGE-default}
+case $enableval in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_fast_install=yes
+fi;
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2714,207 +3427,6 @@ ac_compiler=`set X $ac_compile; echo $2`
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.exe b.out"
-# Try to create an executable without -o first, disregard a.out.
-# It will help us diagnose broken compilers, and finding out an intuition
-# of exeext.
-echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
-ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
- (eval $ac_link_default) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # Find the output, starting from the most likely. This scheme is
-# not robust to junk in `.', hence go to wildcards (a.*) only as a last
-# resort.
-
-# Be careful to initialize this variable, since it used to be cached.
-# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
-ac_cv_exeext=
-# b.out is created by i960 compilers.
-for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
-do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
- ;;
- conftest.$ac_ext )
- # This is the source file.
- ;;
- [ab].out )
- # We found the default executable, but exeext='' is most
- # certainly right.
- break;;
- *.* )
- ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- # FIXME: I believe we export ac_cv_exeext for Libtool,
- # but it would be cool to find out if it's true. Does anybody
- # maintain Libtool? --akim.
- export ac_cv_exeext
- break;;
- * )
- break;;
- esac
-done
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }
-fi
-
-ac_exeext=$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6
-
-# Check the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
- if { ac_try='./$ac_file'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- cross_compiling=no
- else
- if test "$cross_compiling" = maybe; then
- cross_compiling=yes
- else
- { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
- fi
- fi
-fi
-echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-
-rm -f a.out a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-# Check the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6
-
-echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
-for ac_file in conftest.exe conftest conftest.*; do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
- *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- export ac_cv_exeext
- break;;
- * ) break;;
- esac
-done
-else
- { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
-if test "${ac_cv_objext+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.o conftest.obj
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
- *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
- break;;
- esac
-done
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
if test "${ac_cv_c_compiler_gnu+set}" = set; then
@@ -4137,7 +4649,7 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
case $host in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 4140 "configure"' > conftest.$ac_ext
+ echo '#line 4652 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -4418,6 +4930,260 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
# clobbered by the next message.
exec 5>>./config.log
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
+echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6
+if test -z "$CXXCPP"; then
+ if test "${ac_cv_prog_CXXCPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CXXCPP needs to be expanded
+ for CXXCPP in "$CXX -E" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_cxx_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_cxx_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CXXCPP=$CXXCPP
+
+fi
+ CXXCPP=$ac_cv_prog_CXXCPP
+else
+ ac_cv_prog_CXXCPP=$CXXCPP
+fi
+echo "$as_me:$LINENO: result: $CXXCPP" >&5
+echo "${ECHO_T}$CXXCPP" >&6
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_cxx_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_cxx_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh"
+lt_save_CC="$CC"
+lt_save_CFLAGS="$CFLAGS"
+AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" \
+file_magic_cmd="$file_magic_cmd" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
+--build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \
+|| { { echo "$as_me:$LINENO: error: libtool tag configuration failed" >&5
+echo "$as_me: error: libtool tag configuration failed" >&2;}
+ { (exit 1); exit 1; }; }
+CC="$lt_save_CC"
+CFLAGS="$lt_save_CFLAGS"
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+
@@ -6049,13 +6815,15 @@ done
+
for ac_header in unistd.h sys/types.h sys/config.h sys/ioctl.h \
asm/ioctls.h \
inttypes.h stdint.h utime.h sys/utime.h sys/filio.h \
sys/time.h \
sys/select.h \
crt_externs.h \
- fcntl.h
+ fcntl.h \
+ sys/mman.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -6316,6 +7084,13 @@ rm -f conftest*
+
+
+
+
+
+
+
for ac_func in ftruncate fsync select \
gethostname socket strerror fork pipe execve open close \
lseek fstat read write htonl memset htons connect \
@@ -6323,7 +7098,8 @@ for ac_func in ftruncate fsync select \
recvfrom send sendto setsockopt getsockopt time mktime \
localtime_r \
strerror_r \
- fcntl
+ fcntl \
+ mmap munmap mincore msync madvise getpagesize sysconf
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -9588,6 +10364,197 @@ echo "$as_me: error: Library requirements (gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 gd
fi
+ if test "x${COMPILE_QT_PEER}" = xyes; then
+
+ succeeded=no
+
+ if test -z "$PKG_CONFIG"; then
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
+ ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+
+if test -n "$PKG_CONFIG"; then
+ echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
+echo "${ECHO_T}$PKG_CONFIG" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ fi
+
+ if test "$PKG_CONFIG" = "no" ; then
+ echo "*** The pkg-config script could not be found. Make sure it is"
+ echo "*** in your path, or set the PKG_CONFIG environment variable"
+ echo "*** to the full path to pkg-config."
+ echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
+ else
+ PKG_CONFIG_MIN_VERSION=0.9.0
+ if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+ echo "$as_me:$LINENO: checking for QtGui >= 4.0.1" >&5
+echo $ECHO_N "checking for QtGui >= 4.0.1... $ECHO_C" >&6
+
+ if $PKG_CONFIG --exists "QtGui >= 4.0.1" ; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ succeeded=yes
+
+ echo "$as_me:$LINENO: checking QT_CFLAGS" >&5
+echo $ECHO_N "checking QT_CFLAGS... $ECHO_C" >&6
+ QT_CFLAGS=`$PKG_CONFIG --cflags "QtGui >= 4.0.1"`
+ echo "$as_me:$LINENO: result: $QT_CFLAGS" >&5
+echo "${ECHO_T}$QT_CFLAGS" >&6
+
+ echo "$as_me:$LINENO: checking QT_LIBS" >&5
+echo $ECHO_N "checking QT_LIBS... $ECHO_C" >&6
+ QT_LIBS=`$PKG_CONFIG --libs "QtGui >= 4.0.1"`
+ echo "$as_me:$LINENO: result: $QT_LIBS" >&5
+echo "${ECHO_T}$QT_LIBS" >&6
+ else
+ QT_CFLAGS=""
+ QT_LIBS=""
+ ## If we have a custom action on failure, don't print errors, but
+ ## do set a variable so people can do so.
+ QT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "QtGui >= 4.0.1"`
+ echo $QT_PKG_ERRORS
+ fi
+
+
+
+ else
+ echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+ echo "*** See http://www.freedesktop.org/software/pkgconfig"
+ fi
+ fi
+
+ if test $succeeded = yes; then
+ :
+ else
+ { { echo "$as_me:$LINENO: error: Library requirements (QtGui >= 4.0.1) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
+echo "$as_me: error: Library requirements (QtGui >= 4.0.1) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+ QT_INCLUDE_DIR=$($PKG_CONFIG --variable=includedir QtGui)
+ EXTRA_QT_INCLUDE_DIR="$QT_INCLUDE_DIR/Qt"
+ as_ac_File=`echo "ac_cv_file_$QT_INCLUDE_DIR/QWidget" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $QT_INCLUDE_DIR/QWidget" >&5
+echo $ECHO_N "checking for $QT_INCLUDE_DIR/QWidget... $ECHO_C" >&6
+if eval "test \"\${$as_ac_File+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ test "$cross_compiling" = yes &&
+ { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+ { (exit 1); exit 1; }; }
+if test -r "$QT_INCLUDE_DIR/QWidget"; then
+ eval "$as_ac_File=yes"
+else
+ eval "$as_ac_File=no"
+fi
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+ { echo "$as_me:$LINENO: No extra QT_INCLUDE_DIR needed" >&5
+echo "$as_me: No extra QT_INCLUDE_DIR needed" >&6;}
+else
+ as_ac_File=`echo "ac_cv_file_$EXTRA_QT_INCLUDE_DIR/QWidget" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $EXTRA_QT_INCLUDE_DIR/QWidget" >&5
+echo $ECHO_N "checking for $EXTRA_QT_INCLUDE_DIR/QWidget... $ECHO_C" >&6
+if eval "test \"\${$as_ac_File+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ test "$cross_compiling" = yes &&
+ { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+ { (exit 1); exit 1; }; }
+if test -r "$EXTRA_QT_INCLUDE_DIR/QWidget"; then
+ eval "$as_ac_File=yes"
+else
+ eval "$as_ac_File=no"
+fi
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+ QT_CFLAGS="$QT_CFLAGS -I$EXTRA_QT_INCLUDE_DIR"
+else
+ { echo "$as_me:$LINENO: WARNING: QWidget not found" >&5
+echo "$as_me: WARNING: QWidget not found" >&2;}
+fi
+
+fi
+
+ { echo "$as_me:$LINENO: Set QT_CFLAGS... $QT_CFLAGS" >&5
+echo "$as_me: Set QT_CFLAGS... $QT_CFLAGS" >&6;}
+ # Extract the first word of "moc", so it can be a program name with args.
+set dummy moc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_MOC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$MOC"; then
+ ac_cv_prog_MOC="$MOC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_MOC="moc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+MOC=$ac_cv_prog_MOC
+if test -n "$MOC"; then
+ echo "$as_me:$LINENO: result: $MOC" >&5
+echo "${ECHO_T}$MOC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
+
+ fi
+
if test "x${enable_gtk_cairo}" = xyes; then
succeeded=no
@@ -11977,45 +12944,6 @@ fi;
REMOVE=""
-# Extract the first word of "sh", so it can be a program name with args.
-set dummy sh; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_SH+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- case $SH in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_SH="$SH" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_SH="$as_dir/$ac_word$ac_exec_ext"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
- ;;
-esac
-fi
-SH=$ac_cv_path_SH
-
-if test -n "$SH"; then
- echo "$as_me:$LINENO: result: $SH" >&5
-echo "${ECHO_T}$SH" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
# Extract the first word of "mkdir", so it can be a program name with args.
set dummy mkdir; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
@@ -12175,13 +13103,7 @@ fi
-
-# Check whether --with-glibj or --without-glibj was given.
-if test "${with_glibj+set}" = set; then
- withval="$with_glibj"
-
- if test "x${withval}" = xyes || test "x${withval}" = xzip; then
- # Extract the first word of "zip", so it can be a program name with args.
+ # Extract the first word of "zip", so it can be a program name with args.
set dummy zip; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
@@ -12220,62 +13142,31 @@ else
echo "${ECHO_T}no" >&6
fi
+
+# Check whether --with-glibj or --without-glibj was given.
+if test "${with_glibj+set}" = set; then
+ withval="$with_glibj"
+
+ if test "x${withval}" = xyes || test "x${withval}" = xzip; then
install_class_files=no
build_class_files=yes
+ use_zip=yes
elif test "x${withval}" = xboth; then
- # Extract the first word of "zip", so it can be a program name with args.
-set dummy zip; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_ZIP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- case $ZIP in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_ZIP="$ZIP" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_ZIP="$as_dir/$ac_word$ac_exec_ext"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
- ;;
-esac
-fi
-ZIP=$ac_cv_path_ZIP
-
-if test -n "$ZIP"; then
- echo "$as_me:$LINENO: result: $ZIP" >&5
-echo "${ECHO_T}$ZIP" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
install_class_files=yes
build_class_files=yes
+ use_zip=yes
elif test "x${withval}" = xflat; then
- ZIP=
install_class_files=yes
build_class_files=yes
+ use_zip=no
elif test "x${withval}" = xno || test "x${withval}" = xnone; then
- ZIP=
install_class_files=no
build_class_files=no
+ use_zip=no
elif test "x${withval}" = xbuild; then
- ZIP=
install_class_files=no
build_class_files=yes
+ use_zip=no
else
{ { echo "$as_me:$LINENO: error: unknown value given to --with-glibj" >&5
echo "$as_me: error: unknown value given to --with-glibj" >&2;}
@@ -12284,51 +13175,13 @@ echo "$as_me: error: unknown value given to --with-glibj" >&2;}
else
- # Extract the first word of "zip", so it can be a program name with args.
-set dummy zip; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_ZIP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- case $ZIP in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_ZIP="$ZIP" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_ZIP="$as_dir/$ac_word$ac_exec_ext"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
- ;;
-esac
-fi
-ZIP=$ac_cv_path_ZIP
-
-if test -n "$ZIP"; then
- echo "$as_me:$LINENO: result: $ZIP" >&5
-echo "${ECHO_T}$ZIP" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
install_class_files=no
+ use_zip=yes
fi;
-if test "x${ZIP}" != x; then
+if test "x${use_zip}" = xyes; then
INSTALL_GLIBJ_ZIP_TRUE=
INSTALL_GLIBJ_ZIP_FALSE='#'
else
@@ -12370,7 +13223,7 @@ echo "$as_me: error: bad value ${enableval} for --enable-examples" >&2;}
else
EXAMPLESDIR="examples"
fi;
- if test "x${ZIP}" = x && test "x${install_class_files}" = xno; then
+ if test "x${use_zip}" = xno && test "x${install_class_files}" = xno; then
EXAMPLESDIR=""
fi
@@ -12600,7 +13453,7 @@ echo "$as_me: error: bad value ${enableval} for --enable-portable-native-sync" >
esac
fi;
- ac_config_files="$ac_config_files Makefile doc/Makefile doc/api/Makefile external/Makefile external/sax/Makefile external/w3c_dom/Makefile gnu/classpath/Configuration.java include/Makefile native/Makefile native/fdlibm/Makefile native/jni/Makefile native/jni/classpath/Makefile native/jni/java-io/Makefile native/jni/java-lang/Makefile native/jni/java-net/Makefile native/jni/java-nio/Makefile native/jni/java-util/Makefile native/jni/gtk-peer/Makefile native/jni/xmlj/Makefile native/target/Makefile native/target/Linux/Makefile native/target/generic/Makefile resource/Makefile scripts/Makefile scripts/classpath.spec lib/Makefile lib/gen-classlist.sh examples/Makefile"
+ ac_config_files="$ac_config_files Makefile doc/Makefile doc/api/Makefile external/Makefile external/sax/Makefile external/w3c_dom/Makefile gnu/classpath/Configuration.java include/Makefile native/Makefile native/fdlibm/Makefile native/jawt/Makefile native/jni/Makefile native/jni/classpath/Makefile native/jni/java-io/Makefile native/jni/java-lang/Makefile native/jni/java-net/Makefile native/jni/java-nio/Makefile native/jni/java-util/Makefile native/jni/gtk-peer/Makefile native/jni/qt-peer/Makefile native/jni/xmlj/Makefile native/target/Makefile native/target/Linux/Makefile native/target/generic/Makefile resource/Makefile scripts/Makefile scripts/classpath.spec lib/Makefile lib/gen-classlist.sh examples/Makefile examples/Makefile.jawt"
ac_config_commands="$ac_config_commands gen-classlist"
@@ -12730,6 +13583,13 @@ echo "$as_me: error: conditional \"GTK_CAIRO\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${CREATE_QT_PEER_LIBRARIES_TRUE}" && test -z "${CREATE_QT_PEER_LIBRARIES_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"CREATE_QT_PEER_LIBRARIES\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"CREATE_QT_PEER_LIBRARIES\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
if test -z "${CREATE_JNI_HEADERS_TRUE}" && test -z "${CREATE_JNI_HEADERS_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"CREATE_JNI_HEADERS\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -12744,6 +13604,13 @@ echo "$as_me: error: conditional \"AMDEP\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -13141,7 +14008,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
-This file was extended by GNU Classpath $as_me 0.17+cvs, which was
+This file was extended by GNU Classpath $as_me 0.18, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -13207,7 +14074,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-GNU Classpath config.status 0.17+cvs
+GNU Classpath config.status 0.18
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
@@ -13327,6 +14194,7 @@ do
"include/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
"native/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/Makefile" ;;
"native/fdlibm/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/fdlibm/Makefile" ;;
+ "native/jawt/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/jawt/Makefile" ;;
"native/jni/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/jni/Makefile" ;;
"native/jni/classpath/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/jni/classpath/Makefile" ;;
"native/jni/java-io/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/jni/java-io/Makefile" ;;
@@ -13335,6 +14203,7 @@ do
"native/jni/java-nio/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/jni/java-nio/Makefile" ;;
"native/jni/java-util/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/jni/java-util/Makefile" ;;
"native/jni/gtk-peer/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/jni/gtk-peer/Makefile" ;;
+ "native/jni/qt-peer/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/jni/qt-peer/Makefile" ;;
"native/jni/xmlj/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/jni/xmlj/Makefile" ;;
"native/target/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/target/Makefile" ;;
"native/target/Linux/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/target/Linux/Makefile" ;;
@@ -13345,6 +14214,7 @@ do
"lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;;
"lib/gen-classlist.sh" ) CONFIG_FILES="$CONFIG_FILES lib/gen-classlist.sh" ;;
"examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
+ "examples/Makefile.jawt" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile.jawt" ;;
"$ac_config_links_1" ) CONFIG_LINKS="$CONFIG_LINKS $ac_config_links_1" ;;
"depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"gen-classlist" ) CONFIG_COMMANDS="$CONFIG_COMMANDS gen-classlist" ;;
@@ -13483,14 +14353,16 @@ s,@CREATE_GTK_PEER_LIBRARIES_FALSE@,$CREATE_GTK_PEER_LIBRARIES_FALSE,;t t
s,@GTK_CAIRO_ENABLED@,$GTK_CAIRO_ENABLED,;t t
s,@GTK_CAIRO_TRUE@,$GTK_CAIRO_TRUE,;t t
s,@GTK_CAIRO_FALSE@,$GTK_CAIRO_FALSE,;t t
+s,@CREATE_QT_PEER_LIBRARIES_TRUE@,$CREATE_QT_PEER_LIBRARIES_TRUE,;t t
+s,@CREATE_QT_PEER_LIBRARIES_FALSE@,$CREATE_QT_PEER_LIBRARIES_FALSE,;t t
s,@CREATE_JNI_HEADERS_TRUE@,$CREATE_JNI_HEADERS_TRUE,;t t
s,@CREATE_JNI_HEADERS_FALSE@,$CREATE_JNI_HEADERS_FALSE,;t t
s,@LN_S@,$LN_S,;t t
-s,@CC@,$CC,;t t
-s,@CFLAGS@,$CFLAGS,;t t
+s,@CXX@,$CXX,;t t
+s,@CXXFLAGS@,$CXXFLAGS,;t t
s,@LDFLAGS@,$LDFLAGS,;t t
s,@CPPFLAGS@,$CPPFLAGS,;t t
-s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@ac_ct_CXX@,$ac_ct_CXX,;t t
s,@EXEEXT@,$EXEEXT,;t t
s,@OBJEXT@,$OBJEXT,;t t
s,@DEPDIR@,$DEPDIR,;t t
@@ -13499,12 +14371,19 @@ s,@am__quote@,$am__quote,;t t
s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t
s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
+s,@CXXDEPMODE@,$CXXDEPMODE,;t t
+s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t
+s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
s,@CCDEPMODE@,$CCDEPMODE,;t t
s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
s,@RANLIB@,$RANLIB,;t t
s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
s,@LIBTOOL@,$LIBTOOL,;t t
+s,@CXXCPP@,$CXXCPP,;t t
s,@CPP@,$CPP,;t t
s,@EGREP@,$EGREP,;t t
s,@LIBICONV@,$LIBICONV,;t t
@@ -13523,6 +14402,9 @@ s,@X_LIBS@,$X_LIBS,;t t
s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t
s,@GTK_CFLAGS@,$GTK_CFLAGS,;t t
s,@GTK_LIBS@,$GTK_LIBS,;t t
+s,@QT_CFLAGS@,$QT_CFLAGS,;t t
+s,@QT_LIBS@,$QT_LIBS,;t t
+s,@MOC@,$MOC,;t t
s,@CAIRO_CFLAGS@,$CAIRO_CFLAGS,;t t
s,@CAIRO_LIBS@,$CAIRO_LIBS,;t t
s,@PANGOFT2_CFLAGS@,$PANGOFT2_CFLAGS,;t t
@@ -13558,7 +14440,6 @@ s,@LIBDEBUG@,$LIBDEBUG,;t t
s,@INIT_LOAD_LIBRARY@,$INIT_LOAD_LIBRARY,;t t
s,@JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@,$JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION,;t t
s,@REMOVE@,$REMOVE,;t t
-s,@SH@,$SH,;t t
s,@MKDIR@,$MKDIR,;t t
s,@CP@,$CP,;t t
s,@DATE@,$DATE,;t t
diff --git a/libjava/classpath/configure.ac b/libjava/classpath/configure.ac
index 1e92a56..96b425b 100644
--- a/libjava/classpath/configure.ac
+++ b/libjava/classpath/configure.ac
@@ -6,7 +6,7 @@ dnl -----------------------------------------------------------
dnl define([AC_CACHE_LOAD], )dnl
dnl define([AC_CACHE_SAVE], )dnl
-AC_INIT([GNU Classpath],[0.17+cvs],[classpath@gnu.org],[classpath])
+AC_INIT([GNU Classpath],[0.18],[classpath@gnu.org],[classpath])
AC_CONFIG_SRCDIR(java/lang/System.java)
AC_CANONICAL_TARGET
@@ -21,7 +21,16 @@ dnl We will not track/change lib version until we reach version 1.0
dnl at which time we'll have to be more anal about such things
dnl -----------------------------------------------------------
AC_SUBST(LIBVERSION, "0:0:0")
-CLASSPATH_MODULE="-module -version-info ${LIBVERSION} -no-undefined"
+case "$host_os" in
+ darwin*)
+ cp_module=""
+ ;;
+ *)
+ cp_module="-module"
+ ;;
+esac
+
+CLASSPATH_MODULE="${cp_module} -version-info ${LIBVERSION} -no-undefined"
AC_SUBST(CLASSPATH_MODULE)
AC_PREREQ(2.59)
@@ -129,6 +138,19 @@ fi
AM_CONDITIONAL(GTK_CAIRO, test "x${GTK_CAIRO_ENABLED}" = xtrue)
dnl -----------------------------------------------------------
+dnl Qt native peer (disabled by default)
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([qt-peer],
+ [AS_HELP_STRING(--enable-qt-peer,compile Qt4 native peers (disabled by --disable-jni) [default=no])],
+ [case "${enableval}" in
+ yes) COMPILE_QT_PEER=yes ;;
+ no) COMPILE_QT_PEER=no ;;
+ *) COMPILE_QT_PEER=yes ;;
+ esac],
+ [COMPILE_QT_PEER=no])
+AM_CONDITIONAL(CREATE_QT_PEER_LIBRARIES, test "x${COMPILE_QT_PEER}" = xyes)
+
+dnl -----------------------------------------------------------
dnl Regenerate headers at build time (disabled by default)
dnl -----------------------------------------------------------
AC_ARG_ENABLE([regen-headers],
@@ -147,7 +169,7 @@ AC_PROG_INSTALL
dnl -----------------------------------------------------------
dnl Checks for programs.
dnl -----------------------------------------------------------
-dnl AC_PROG_CXX
+AC_PROG_CXX
dnl Initialize libtool
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
@@ -175,7 +197,8 @@ if test "x${COMPILE_JNI}" = xyes; then
sys/time.h \
sys/select.h \
crt_externs.h \
- fcntl.h])
+ fcntl.h \
+ sys/mman.h])
AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
@@ -189,7 +212,8 @@ if test "x${COMPILE_JNI}" = xyes; then
recvfrom send sendto setsockopt getsockopt time mktime \
localtime_r \
strerror_r \
- fcntl])
+ fcntl \
+ mmap munmap mincore msync madvise getpagesize sysconf])
AC_HEADER_TIME
AC_STRUCT_TM
@@ -271,6 +295,24 @@ if test "x${COMPILE_JNI}" = xyes; then
AC_SUBST(GTK_LIBS)
fi
+ dnl Check for AWT related Qt4
+ if test "x${COMPILE_QT_PEER}" = xyes; then
+ PKG_CHECK_MODULES(QT, QtGui >= 4.0.1)
+ dnl Check needed because in some cases the QtGui includedir
+ dnl doesn't contain the subsystem dir.
+ QT_INCLUDE_DIR=$($PKG_CONFIG --variable=includedir QtGui)
+ EXTRA_QT_INCLUDE_DIR="$QT_INCLUDE_DIR/Qt"
+ AC_CHECK_FILE([$QT_INCLUDE_DIR/QWidget],
+ AC_MSG_NOTICE([No extra QT_INCLUDE_DIR needed]),
+ AC_CHECK_FILE([$EXTRA_QT_INCLUDE_DIR/QWidget],
+ QT_CFLAGS="$QT_CFLAGS -I$EXTRA_QT_INCLUDE_DIR",
+ AC_MSG_WARN([QWidget not found])))
+ AC_MSG_NOTICE([Set QT_CFLAGS... $QT_CFLAGS])
+ AC_CHECK_PROG(MOC, [moc], [moc])
+ AC_SUBST(QT_CFLAGS)
+ AC_SUBST(QT_LIBS)
+ fi
+
if test "x${enable_gtk_cairo}" = xyes; then
PKG_CHECK_MODULES(CAIRO, cairo >= 0.5.0)
PKG_CHECK_MODULES(PANGOFT2, pangoft2)
@@ -380,7 +422,6 @@ AC_SUBST(REMOVE)
dnl -----------------------------------------------------------
dnl This is probably useless.
dnl -----------------------------------------------------------
-AC_PATH_PROG(SH, sh)
AC_PATH_PROG(MKDIR, mkdir)
AC_PATH_PROG(CP, cp)
AC_PATH_PROG(DATE, date)
@@ -437,6 +478,7 @@ gnu/classpath/Configuration.java
include/Makefile
native/Makefile
native/fdlibm/Makefile
+native/jawt/Makefile
native/jni/Makefile
native/jni/classpath/Makefile
native/jni/java-io/Makefile
@@ -445,6 +487,7 @@ native/jni/java-net/Makefile
native/jni/java-nio/Makefile
native/jni/java-util/Makefile
native/jni/gtk-peer/Makefile
+native/jni/qt-peer/Makefile
native/jni/xmlj/Makefile
native/target/Makefile
native/target/Linux/Makefile
@@ -454,6 +497,7 @@ scripts/Makefile
scripts/classpath.spec
lib/Makefile
lib/gen-classlist.sh
-examples/Makefile])
+examples/Makefile
+examples/Makefile.jawt])
AC_CONFIG_COMMANDS([gen-classlist],[chmod 755 lib/gen-classlist.sh])
AC_OUTPUT
diff --git a/libjava/classpath/doc/Makefile.in b/libjava/classpath/doc/Makefile.in
index 255b2ac..7c96cf9 100644
--- a/libjava/classpath/doc/Makefile.in
+++ b/libjava/classpath/doc/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -91,8 +91,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -154,6 +160,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -165,12 +172,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -192,10 +200,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -287,13 +298,7 @@ uninstall-info-am:
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
- @failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+ @set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -305,7 +310,7 @@ $(RECURSIVE_TARGETS):
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@@ -313,13 +318,7 @@ $(RECURSIVE_TARGETS):
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
- @failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+ @set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@@ -340,7 +339,7 @@ maintainer-clean-recursive:
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
diff --git a/libjava/classpath/doc/README.jaxp b/libjava/classpath/doc/README.jaxp
index e067299..12fd052 100644
--- a/libjava/classpath/doc/README.jaxp
+++ b/libjava/classpath/doc/README.jaxp
@@ -17,6 +17,7 @@ PACKAGES
. gnu.xml.xpath.* ... JAXP XPath implementation
. gnu.xml.transform.* ... JAXP XSL transformer implementation
. gnu.xml.pipeline.* ... SAX2 event pipeline support
+. gnu.xml.stream.* ... StAX pull parser implementation
. gnu.xml.util.* ... various XML utility classes
. gnu.xml.libxmlj.dom.* ... libxmlj DOM Level 3 Core and XPath
. gnu.xml.libxmlj.sax.* ... libxmlj SAX parser
@@ -133,6 +134,11 @@ To enable the various GNU JAXP factories, set the following system properties
GNU XSL transformer:
-Djavax.xml.transform.TransformerFactory=gnu.xml.transform.TransformerFactoryImpl
+ GNU StAX:
+ -Djavax.xml.stream.XMLEventFactory=gnu.xml.stream.XMLEventFactoryImpl
+ -Djavax.xml.stream.XMLInputFactory=gnu.xml.stream.XMLInputFactoryImpl
+ -Djavax.xml.stream.XMLOutputFactory=gnu.xml.stream.XMLOutputFactoryImpl
+
libxmlj SAX:
-Djavax.xml.parsers.SAXParserFactory=gnu.xml.libxmlj.sax.GnomeSAXParserFactory
diff --git a/libjava/classpath/doc/api/Makefile.am b/libjava/classpath/doc/api/Makefile.am
index 3e36c3b..9f7e808 100644
--- a/libjava/classpath/doc/api/Makefile.am
+++ b/libjava/classpath/doc/api/Makefile.am
@@ -6,6 +6,7 @@ sourcepath = $(top_builddir):$(top_srcdir):$(top_srcdir)/vm/reference:$(top_srcd
classpathbox = "<span class='logo'><a href='http://www.gnu.org/software/classpath' target='_top'>GNU Classpath</a> ($(VERSION))"
+if CREATE_API_DOCS
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/api
@list='$(htmllist)'; for p in $$list; do \
@@ -26,6 +27,7 @@ uninstall-local:
rm -f $(DESTDIR)$(pkgdatadir)/api/$$f; \
fi; \
done
+endif
html: create_html
diff --git a/libjava/classpath/doc/api/Makefile.in b/libjava/classpath/doc/api/Makefile.in
index 00a8555..303c008 100644
--- a/libjava/classpath/doc/api/Makefile.in
+++ b/libjava/classpath/doc/api/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -84,8 +84,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -147,6 +153,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -158,12 +165,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -185,10 +193,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -335,6 +346,8 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
+@CREATE_API_DOCS_FALSE@uninstall-local:
+@CREATE_API_DOCS_FALSE@install-data-local:
clean: clean-am
clean-am: clean-generic clean-libtool clean-local mostlyclean-am
@@ -391,26 +404,26 @@ uninstall-am: uninstall-info-am uninstall-local
uninstall-local
-install-data-local:
- $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/api
- @list='$(htmllist)'; for p in $$list; do \
- f="`echo $$p | sed -e 's|^.*/||'`"; \
- if test -f "$$p"; then \
- echo " $(INSTALL_DATA) $$p $(DESTDIR)$(pkgdatadir)/api/$$f"; \
- $(INSTALL_DATA) $$p $(DESTDIR)$(pkgdatadir)/api/$$f; \
- elif test -d "$$p"; then \
- $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/api/$$f; \
- fi; \
- done
-
-uninstall-local:
- @list='$(htmllist)'; for p in $$list; do \
- f="`echo $$p | sed -e 's|^.*/||'`"; \
- if test -f "$$p"; then \
- echo " rm -f $(DESTDIR)$(pkgdatadir)/api/$$f"; \
- rm -f $(DESTDIR)$(pkgdatadir)/api/$$f; \
- fi; \
- done
+@CREATE_API_DOCS_TRUE@install-data-local:
+@CREATE_API_DOCS_TRUE@ $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/api
+@CREATE_API_DOCS_TRUE@ @list='$(htmllist)'; for p in $$list; do \
+@CREATE_API_DOCS_TRUE@ f="`echo $$p | sed -e 's|^.*/||'`"; \
+@CREATE_API_DOCS_TRUE@ if test -f "$$p"; then \
+@CREATE_API_DOCS_TRUE@ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(pkgdatadir)/api/$$f"; \
+@CREATE_API_DOCS_TRUE@ $(INSTALL_DATA) $$p $(DESTDIR)$(pkgdatadir)/api/$$f; \
+@CREATE_API_DOCS_TRUE@ elif test -d "$$p"; then \
+@CREATE_API_DOCS_TRUE@ $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/api/$$f; \
+@CREATE_API_DOCS_TRUE@ fi; \
+@CREATE_API_DOCS_TRUE@ done
+
+@CREATE_API_DOCS_TRUE@uninstall-local:
+@CREATE_API_DOCS_TRUE@ @list='$(htmllist)'; for p in $$list; do \
+@CREATE_API_DOCS_TRUE@ f="`echo $$p | sed -e 's|^.*/||'`"; \
+@CREATE_API_DOCS_TRUE@ if test -f "$$p"; then \
+@CREATE_API_DOCS_TRUE@ echo " rm -f $(DESTDIR)$(pkgdatadir)/api/$$f"; \
+@CREATE_API_DOCS_TRUE@ rm -f $(DESTDIR)$(pkgdatadir)/api/$$f; \
+@CREATE_API_DOCS_TRUE@ fi; \
+@CREATE_API_DOCS_TRUE@ done
html: create_html
diff --git a/libjava/classpath/doc/www.gnu.org/events/events.wml b/libjava/classpath/doc/www.gnu.org/events/events.wml
index fcb3de9..873d4fa 100644
--- a/libjava/classpath/doc/www.gnu.org/events/events.wml
+++ b/libjava/classpath/doc/www.gnu.org/events/events.wml
@@ -9,17 +9,59 @@
<boxitem>
<strong>Upcoming Events:</strong><br>
<ul>
-none
+<li>[1-5 Aug 2005] <a href="http://conferences.oreillynet.com/os2005/">OSCON</a>, Portland, Oregon - USA
+<ul>
+<li><a href="http://conferences.oreillynet.com/cs/os2005/view/e_sess/6730">The State of Free JVMs</a>
+Tom Tromey</li>
+</ul>
</ul>
</boxitem>
<boxitem>
<strong>Past Events:</strong><br>
<ul>
-<li>[26+27 Feb. 2004] FOSDEM'05 in Brussels, Belgium. [<createlink name="Escape The Java Trap!" url="events/escape_fosdem05.html">]
-<li>[14+15 Oct. 2003] Linux Kongress '03 in Saarbr&uuml;cken, Germany.
+
+<li>
+[29-31 May 2005] <a href="http://2005.guadec.org/">Guadec</a>, Stuttgart - Germany
+<ul>
+<li><a href="http://2005.guadec.org/schedule/gnometalks.html#eclipseyou">The Eclipse IDE and you</a>
+Ben Konrath and Andrew Overholt
+(<a href="http://overholt.ca/eclipse/GUADEC2005-EclipseIDE.pdf">slides</a>)</li>
+<li><a href="http://2005.guadec.org/schedule/gnometalks.html#javagnome">Eclipse, Java-GNOME, and GCJ</a>
+Andrew Cowie and Ben Konrath</li>
+</ul>
+<p>
+<li>
+[1-4 Jun. 2005] <a href="http://fisl.softwarelivre.org/6.0/">6th International Free Software Forum</a> (fisl), Porto Alegre/RS, Brazil
+<ul>
+<li><a href="http://fisl.softwarelivre.org/papers/pub/programacao/360">Encontro Javali: Escape the Java Trap: GNU Classpath and Kaffe</a>
+Dalibor Topic and Mark Wielaard
+(<a href="http://www.klomp.org/mark/classpath/GNUClasspathKaffe/">slides</a>)</li>
+</ul>
+<p>
+<li>
+[22-25 Jun 2005] <a href="http://www.linuxtag.org/">LinuxTag</a>, Karlsruhe - Germany
+<ul>
+<li><a href="http://www.linuxtag.org/vcc/details.pl?id=162">GNU Classpath</a>
+Robert Schuster (in German)
+(<a href="http://www.inf.fu-berlin.de/%7Erschuste/GNUClasspath-LinuxTag2005-English.pdf">slides</a>)</li>
+<li><a href="http://www.linuxtag.org/vcc/details.pl?id=166">GCJ and Classpath: A Free Implementation of the Java programming language</a>
+Andrew Haley (in English)
+(<a href="http://people.redhat.com/~aph/linuxtag.tar.gz">slides</a>)</li>
+</ul>
+<p>
+<li>[26+27 Feb. 2005] FOSDEM'05 in Brussels, Belgium. [<createlink name="Escape The Java Trap!" url="events/escape_fosdem05.html">]
+<p>
<li>[21+22 Feb. 2004] FOSDEM'04 in Brussels, Belgium. [<createlink name="report" url="events/fosdem04.html">]
+<p>
<li>[14+15 Oct. 2003] Linux Kongress '03 in Saarbr&uuml;cken, Germany.
+<ul>
+<li>Hacking on the VM Interface: GNU Classpath workshop, Mark Wielaard
+(<a href="http://www.klomp.org/mark/classpath/slides/gnu_classpath_workshop.html">slides</a>).
+<li>Agile2D: implementing Graphics2D over OpenGL, Jean-Daniel Fekete
+(<a href="http://www.klomp.org/mark/classpath/Agile2D.pdf">slides</a>).
+</ul>
+
</ul>
<br><br><br>
</boxitem>
diff --git a/libjava/classpath/doc/www.gnu.org/faq/faq.wml b/libjava/classpath/doc/www.gnu.org/faq/faq.wml
index 25c6dd1..67ae91f 100644
--- a/libjava/classpath/doc/www.gnu.org/faq/faq.wml
+++ b/libjava/classpath/doc/www.gnu.org/faq/faq.wml
@@ -304,6 +304,28 @@ be a bit picky about getting signatures from all contributors. Please do
not see this as a personal offence.
<p>Giving the copyright to the FSF also gives us a clear paper trail where changes come from, which confirms our clean-room status.
+</p>
+
+<p>
+The assignment contract commits the foundation to setting distribution terms
+that permit free redistribution.
+</p>
+
+<p>
+The assignment contract we normally use has a clause that permits you to
+use your code in proprietary programs, on 30 days' notice.
+(The 30 days' notice is there because, through a legal technicality,
+it would improve our position in a suit against a hoarder.)
+Although we believe that proprietary software is wrong, we include this
+clause because it would serve no purpose to ask you to promise not to do
+it. You're giving us a gift in the first place.
+</p>
+
+<p>
+You don't need to invoke this clause in order to distribute
+copies as free software under the GNU GPL, since everyone is
+allowed to do that.
+</p>
<p>See also <a href="http://www.gnu.org/licenses/why-assign.html">http://www.gnu.org/licenses/why-assign.html</a>.
</p>
diff --git a/libjava/classpath/doc/www.gnu.org/include/layout.wml b/libjava/classpath/doc/www.gnu.org/include/layout.wml
index 61cf0bc..a828492 100644
--- a/libjava/classpath/doc/www.gnu.org/include/layout.wml
+++ b/libjava/classpath/doc/www.gnu.org/include/layout.wml
@@ -105,7 +105,7 @@
<menutitle>Savannah</menutitle>
<menuitem><createlink name="Project Home" url="http://savannah.gnu.org/projects/classpath/"></menuitem>
-<menuitem><createlink name="Bug Reports" url="http://savannah.gnu.org/bugs/?group=classpath"></menuitem>
+<menuitem><createlink name="Bug Reports" url="bugs.html"></menuitem>
<!--
<menuitem><createlink name="Support" url="http://savannah.gnu.org/support/?group=classpath"></menuitem>
<menuitem><createlink name="Patches" url="http://savannah.gnu.org/patch/?group=classpath"></menuitem>
diff --git a/libjava/classpath/doc/www.gnu.org/newsitems.txt b/libjava/classpath/doc/www.gnu.org/newsitems.txt
index 815a60f..b4976df 100644
--- a/libjava/classpath/doc/www.gnu.org/newsitems.txt
+++ b/libjava/classpath/doc/www.gnu.org/newsitems.txt
@@ -1,3 +1,13 @@
+<newsitem date="03 Aug 2005">
+<createlink name="Generics Branch Merge Announcement"
+ url="http://lists.gnu.org/archive/html/classpath/2005-08/msg00002.html">
+</newsitem>
+
+<newsitem date="01 Aug 2005">
+<createlink name="Bugs moved to bugzilla"
+ url="bugs.html">
+</newsitem>
+
<newsitem date="15 Jul 2005">
<createlink name="GNU Classpath 0.17"
url="announce/20050715.html">
diff --git a/libjava/classpath/examples/.cvsignore b/libjava/classpath/examples/.cvsignore
index 3b4de9f..5563799 100644
--- a/libjava/classpath/examples/.cvsignore
+++ b/libjava/classpath/examples/.cvsignore
@@ -1,2 +1,3 @@
Makefile
examples.zip
+Makefile.jawt
diff --git a/libjava/classpath/examples/Makefile.am b/libjava/classpath/examples/Makefile.am
index 74abc11..b7eeacb 100644
--- a/libjava/classpath/examples/Makefile.am
+++ b/libjava/classpath/examples/Makefile.am
@@ -22,6 +22,9 @@ endif
# All our example java source files
EXAMPLE_JAVA_FILES = $(srcdir)/gnu/classpath/examples/*/*.java
+# The example C source files
+EXAMPLE_C_FILES = $(srcdir)/gnu/classpath/examples/*/*.c
+
# The zip files with classes we want to produce.
EXAMPLE_ZIP = examples.zip
@@ -31,6 +34,9 @@ BUILT_SOURCES = $(EXAMPLE_ZIP)
# the png icons we use in some of the examples.
EXAMPLE_ICONS = $(srcdir)/gnu/classpath/examples/icons/*.png
+# All the files we find "interesting"
+ALL_EXAMPLE_FILES = $(EXAMPLE_JAVA_FILES) $(EXAMPLE_C_FILES) $(EXAMPLE_ICONS)
+
# Some architecture independent data to be installed.
example_DATA = $(EXAMPLE_ZIP) README
@@ -41,7 +47,7 @@ exampledir = $(pkgdatadir)/examples
# (Be careful to strip off the srcdir part of the path when installing.)
install-data-local:
srcdir_cnt=`echo $(srcdir) | wc -c`; \
- for file in $(EXAMPLE_JAVA_FILES) $(EXAMPLE_ICONS); do \
+ for file in $(ALL_EXAMPLE_FILES); do \
f=`echo $$file | cut -c$$srcdir_cnt-`; \
fdir=`dirname $$f`; \
if test ! -d $(DESTDIR)/$(pkgdatadir)/examples/$$fdir; then \
@@ -51,20 +57,24 @@ install-data-local:
echo "$(INSTALL_DATA) $$file $(DESTDIR)/$(pkgdatadir)/examples/$$f"; \
$(INSTALL_DATA) $$file $(DESTDIR)/$(pkgdatadir)/examples/$$f; \
done
+ echo "$(INSTALL_DATA) Makefile.jawt $(DESTDIR)/$(pkgdatadir)/examples/"
+ $(INSTALL_DATA) Makefile.jawt $(DESTDIR)/$(pkgdatadir)/examples/
uninstall-local:
srcdir_cnt=`echo $(srcdir) | wc -c`; \
- for file in $(EXAMPLE_JAVA_FILES) $(EXAMPLE_ICONS); do \
+ for file in $(ALL_EXAMPLE_FILES); do \
f=`echo $$file | cut -c$$srcdir_cnt-`; \
echo "rm -f $(DESTDIR)/$(pkgdatadir)/examples/$$f"; \
rm -f $(DESTDIR)/$(pkgdatadir)/examples/$$f; \
done
+ echo "rm -f $(DESTDIR)/$(pkgdatadir)/examples/Makefile.jawt"
+ rm -f $(DESTDIR)/$(pkgdatadir)/examples/Makefile.jawt
# Make sure everything is included in the distribution.
-EXTRA_DIST = README
+EXTRA_DIST = README Makefile.jawt.in
dist-hook:
srcdir_cnt=`echo $(srcdir) | wc -c`; \
- for file in $(EXAMPLE_JAVA_FILES) $(EXAMPLE_ICONS); do \
+ for file in $(ALL_EXAMPLE_FILES); do \
f=`echo $$file | cut -c$$srcdir_cnt-`; \
fdir=`dirname $$f`; \
if test ! -d $(distdir)/$$fdir; then \
@@ -87,4 +97,4 @@ $(EXAMPLE_ZIP): $(EXAMPLE_JAVA_FILES)
# Zip file be gone! (and make sure the classes are gone too)
clean-local:
- rm -f $(EXAMPLE_ZIP) classes
+ rm -rf $(EXAMPLE_ZIP) classes
diff --git a/libjava/classpath/examples/Makefile.in b/libjava/classpath/examples/Makefile.in
index 9d64920..92c0858 100644
--- a/libjava/classpath/examples/Makefile.in
+++ b/libjava/classpath/examples/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -38,7 +38,8 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = examples
-DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/Makefile.jawt.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
@@ -49,7 +50,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/include/config.h
-CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_FILES = Makefile.jawt
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
@@ -92,8 +93,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -155,6 +162,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -166,12 +174,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -193,10 +202,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -246,6 +258,9 @@ vm_classes = @vm_classes@
# All our example java source files
EXAMPLE_JAVA_FILES = $(srcdir)/gnu/classpath/examples/*/*.java
+# The example C source files
+EXAMPLE_C_FILES = $(srcdir)/gnu/classpath/examples/*/*.c
+
# The zip files with classes we want to produce.
EXAMPLE_ZIP = examples.zip
@@ -255,6 +270,9 @@ BUILT_SOURCES = $(EXAMPLE_ZIP)
# the png icons we use in some of the examples.
EXAMPLE_ICONS = $(srcdir)/gnu/classpath/examples/icons/*.png
+# All the files we find "interesting"
+ALL_EXAMPLE_FILES = $(EXAMPLE_JAVA_FILES) $(EXAMPLE_C_FILES) $(EXAMPLE_ICONS)
+
# Some architecture independent data to be installed.
example_DATA = $(EXAMPLE_ZIP) README
@@ -262,7 +280,7 @@ example_DATA = $(EXAMPLE_ZIP) README
exampledir = $(pkgdatadir)/examples
# Make sure everything is included in the distribution.
-EXTRA_DIST = README
+EXTRA_DIST = README Makefile.jawt.in
all: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -296,6 +314,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+Makefile.jawt: $(top_builddir)/config.status $(srcdir)/Makefile.jawt.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
@@ -458,7 +478,7 @@ uninstall-am: uninstall-exampleDATA uninstall-info-am uninstall-local
# (Be careful to strip off the srcdir part of the path when installing.)
install-data-local:
srcdir_cnt=`echo $(srcdir) | wc -c`; \
- for file in $(EXAMPLE_JAVA_FILES) $(EXAMPLE_ICONS); do \
+ for file in $(ALL_EXAMPLE_FILES); do \
f=`echo $$file | cut -c$$srcdir_cnt-`; \
fdir=`dirname $$f`; \
if test ! -d $(DESTDIR)/$(pkgdatadir)/examples/$$fdir; then \
@@ -468,17 +488,21 @@ install-data-local:
echo "$(INSTALL_DATA) $$file $(DESTDIR)/$(pkgdatadir)/examples/$$f"; \
$(INSTALL_DATA) $$file $(DESTDIR)/$(pkgdatadir)/examples/$$f; \
done
+ echo "$(INSTALL_DATA) Makefile.jawt $(DESTDIR)/$(pkgdatadir)/examples/"
+ $(INSTALL_DATA) Makefile.jawt $(DESTDIR)/$(pkgdatadir)/examples/
uninstall-local:
srcdir_cnt=`echo $(srcdir) | wc -c`; \
- for file in $(EXAMPLE_JAVA_FILES) $(EXAMPLE_ICONS); do \
+ for file in $(ALL_EXAMPLE_FILES); do \
f=`echo $$file | cut -c$$srcdir_cnt-`; \
echo "rm -f $(DESTDIR)/$(pkgdatadir)/examples/$$f"; \
rm -f $(DESTDIR)/$(pkgdatadir)/examples/$$f; \
done
+ echo "rm -f $(DESTDIR)/$(pkgdatadir)/examples/Makefile.jawt"
+ rm -f $(DESTDIR)/$(pkgdatadir)/examples/Makefile.jawt
dist-hook:
srcdir_cnt=`echo $(srcdir) | wc -c`; \
- for file in $(EXAMPLE_JAVA_FILES) $(EXAMPLE_ICONS); do \
+ for file in $(ALL_EXAMPLE_FILES); do \
f=`echo $$file | cut -c$$srcdir_cnt-`; \
fdir=`dirname $$f`; \
if test ! -d $(distdir)/$$fdir; then \
@@ -501,7 +525,7 @@ $(EXAMPLE_ZIP): $(EXAMPLE_JAVA_FILES)
# Zip file be gone! (and make sure the classes are gone too)
clean-local:
- rm -f $(EXAMPLE_ZIP) classes
+ rm -rf $(EXAMPLE_ZIP) classes
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/libjava/classpath/examples/README b/libjava/classpath/examples/README
index d850c2c..7276773 100644
--- a/libjava/classpath/examples/README
+++ b/libjava/classpath/examples/README
@@ -7,7 +7,8 @@ class Demo which contains a main() method to run that particular example.
The examples can be compiled and run with gcj as follows:
gcj -o swingdemo --main=gnu.classpath.examples.swing.Demo \
- gnu/classpath/examples/swing/Demo.java
+ gnu/classpath/examples/swing/Demo.java \
+ gnu/classpath/examples/swing/GNULookAndFeel.java
./swingdemo
Or with a traditional byte code interpreter like:
@@ -22,6 +23,29 @@ run as follows:
kaffe -classpath examples.zip gnu.classpath.examples.awt.Demo
kaffe -classpath examples.zip gnu.classpath.examples.swing.Demo
+The jawt Demo needs some extra support library that currently needs to be
+build by hand. The following assumes GNU Classpath was installed in
+/usr/local/classpath, if you installed it somewhere else then adjust the
+-I and -L paths accordingly. The included Makefile.jawt is setup this way.
+
+You can invoke it with:
+
+ make -f Makefile.jawt
+
+Or you can compile by hand as follows:
+
+ gcj -C gnu/classpath/examples/jawt/DemoJAWT.java
+ gcjh -jni gnu.classpath.examples.jawt.DemoJAWT -o DemoJAWT.h
+ gcc -g -O0 -Wall -I. -I/usr/X11R6/include -L. -L/usr/X11R6/lib \
+ -I/usr/local/classpath/include -L/usr/local/classpath/lib/classpath \
+ -lX11 -ljawtgnu -shared -o libDemoJAWT.so \
+ gnu/classpath/examples/jawt/DemoJAWT.c
+
+You can then run the example as follows:
+
+ export LD_LIBRARY_PATH=.:/usr/local/classpath/lib/classpath
+ jamvm gnu.classpath.examples.jawt.DemoJAWT
+
All example code is distributed under the GNU General Public License (GPL).
The example icons used in some of the examples come from gnome-icon-theme
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/Demo.java b/libjava/classpath/examples/gnu/classpath/examples/swing/Demo.java
index 4471be1..e8c428b 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/swing/Demo.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/Demo.java
@@ -141,6 +141,8 @@ public class Demo
preferences.add(new JCheckBoxMenuItem("Check Spelling",
stockIcon("spell-check")));
preferences.add(new JCheckBoxMenuItem("World Peace"));
+ preferences.add(new JSeparator());
+ preferences.add(new JRadioButtonMenuItem("Radio Button"));
edit.add(preferences);
JMenu examples = new JMenu("Examples");
@@ -493,6 +495,7 @@ public class Demo
final JTree tree = new JTree(root);
tree.setLargeModel(true);
+ tree.setEditable(true);
DefaultTreeSelectionModel dtsm = new DefaultTreeSelectionModel();
dtsm.setSelectionMode(DefaultTreeSelectionModel.SINGLE_TREE_SELECTION);
tree.setSelectionModel(dtsm);
@@ -501,7 +504,6 @@ public class Demo
JButton add = mkButton("add element");
add.addActionListener(new ActionListener()
{
- int i = 0;
public void actionPerformed(ActionEvent e)
{
for (int i = 0; i < tree.getRowCount(); i++)
@@ -641,6 +643,29 @@ public class Demo
return panel;
}
+ static JPanel mkTabWorld()
+ {
+ JPanel panel = new JPanel(new GridLayout(2, 2));
+ panel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
+ JTabbedPane tabs1 = new JTabbedPane(SwingConstants.TOP);
+ tabs1.add("Top Item 1", new JButton("Button"));
+ tabs1.add("Top Item 2", new JButton("Button"));
+ JTabbedPane tabs2 = new JTabbedPane(SwingConstants.LEFT);
+ tabs2.add("Left Item 1", new JButton("Button"));
+ tabs2.add("Left Item 2", new JButton("Button"));
+ JTabbedPane tabs3 = new JTabbedPane(SwingConstants.BOTTOM);
+ tabs3.add("Bottom Item 1", new JButton("Button"));
+ tabs3.add("Bottom Item 2", new JButton("Button"));
+ JTabbedPane tabs4 = new JTabbedPane(SwingConstants.RIGHT);
+ tabs4.add("Right Item 1", new JButton("Button"));
+ tabs4.add("Right Item 2", new JButton("Button"));
+ panel.add(tabs1);
+ panel.add(tabs2);
+ panel.add(tabs3);
+ panel.add(tabs4);
+ return panel;
+ }
+
static JTabbedPane mkTabbedPane()
{
JTabbedPane tabs = new JTabbedPane();
@@ -649,6 +674,7 @@ public class Demo
tabs.add("List world!", mkListWorld());
tabs.add("Desktop world!", mkDesktopWorld());
tabs.add("Tree world!", mkTreeWorld());
+ tabs.add("Tab world!", mkTabWorld());
return tabs;
}
@@ -658,6 +684,8 @@ public class Demo
slider.setPaintTrack(true);
slider.setPaintTicks(true);
slider.setMajorTickSpacing(30);
+ slider.setMinorTickSpacing(5);
+ slider.setPaintLabels(true);
slider.setInverted(false);
JProgressBar progress = new JProgressBar();
BoundedRangeModel model = new DefaultBoundedRangeModel(10, 1, 0, 100);
@@ -1063,7 +1091,13 @@ public class Demo
JButton exitDisposer = mkDisposerButton(frame);
panel.add(exitDisposer);
-
+ exitDisposer.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ System.exit(1);
+ }
+ });
return panel;
}
diff --git a/libjava/classpath/external/Makefile.in b/libjava/classpath/external/Makefile.in
index 219e18f..ed7986b 100644
--- a/libjava/classpath/external/Makefile.in
+++ b/libjava/classpath/external/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -91,8 +91,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -154,6 +160,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -165,12 +172,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -192,10 +200,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -287,13 +298,7 @@ uninstall-info-am:
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
- @failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+ @set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -305,7 +310,7 @@ $(RECURSIVE_TARGETS):
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@@ -313,13 +318,7 @@ $(RECURSIVE_TARGETS):
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
- @failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+ @set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@@ -340,7 +339,7 @@ maintainer-clean-recursive:
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
diff --git a/libjava/classpath/external/sax/Makefile.in b/libjava/classpath/external/sax/Makefile.in
index abbfdbf..e763412 100644
--- a/libjava/classpath/external/sax/Makefile.in
+++ b/libjava/classpath/external/sax/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -82,8 +82,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -145,6 +151,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -156,12 +163,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -183,10 +191,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
diff --git a/libjava/classpath/external/w3c_dom/Makefile.in b/libjava/classpath/external/w3c_dom/Makefile.in
index beba05e..5392c64 100644
--- a/libjava/classpath/external/w3c_dom/Makefile.in
+++ b/libjava/classpath/external/w3c_dom/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -82,8 +82,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -145,6 +151,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -156,12 +163,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -183,10 +191,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
diff --git a/libjava/classpath/gnu/CORBA/CDR/Vio.java b/libjava/classpath/gnu/CORBA/CDR/Vio.java
index 8f17bd2..0a37132 100644
--- a/libjava/classpath/gnu/CORBA/CDR/Vio.java
+++ b/libjava/classpath/gnu/CORBA/CDR/Vio.java
@@ -46,6 +46,7 @@ import org.omg.CORBA.DataOutputStream;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.NO_IMPLEMENT;
import org.omg.CORBA.StringSeqHelper;
+import org.omg.CORBA.portable.BoxedValueHelper;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.Streamable;
@@ -55,6 +56,8 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.Serializable;
+import java.lang.reflect.Method;
+
/**
* A specialised class for reading and writing the value types.
*
@@ -222,7 +225,7 @@ public abstract class Vio
throw new MARSHAL("Unable to instantiate the value type");
else
{
- read_instance(input, ox, value_tag);
+ read_instance(input, ox, value_tag, null);
return (Serializable) ox;
}
}
@@ -285,7 +288,7 @@ public abstract class Vio
}
}
- read_instance(input, ox, value_tag);
+ read_instance(input, ox, value_tag, null);
return (Serializable) ox;
}
catch (Exception ex)
@@ -301,17 +304,22 @@ public abstract class Vio
* an instance.
*
* @param input a stream to read from.
- * @param value_instance an instance of the value.
+ *
+ * @param value_instance an pre-created instance of the value. If the
+ * helper is not null, this parameter is ignored an should be null.
+ *
+ * @param helper a helper to create an instance and read the object-
+ * specific part of the record. If the value_instance is used instead,
+ * this parameter should be null.
*
* @return the loaded value.
*
* @throws MARSHAL if the reading has failed due any reason.
*/
- public static Serializable read(InputStream input, Serializable value_instance)
+ public static Object read(InputStream input, Object value_instance,
+ Object helper
+ )
{
- // Explicitly prevent the stream from closing as we may need
- // to read the subsequent bytes as well. Stream may be auto-closed
- // in its finalizer.
try
{
int value_tag = input.read_long();
@@ -345,8 +353,9 @@ public abstract class Vio
}
}
- read_instance(input, value_instance, value_tag);
- return (Serializable) value_instance;
+ value_instance =
+ read_instance(input, value_instance, value_tag, helper);
+ return value_instance;
}
catch (Exception ex)
{
@@ -355,18 +364,43 @@ public abstract class Vio
}
/**
+ * Read using provided boxed value helper. This method expects
+ * the full value type header, followed by contents, that are
+ * delegated to the provided helper. It handles null.
+ *
+ * @param input the stream to read from.
+ * @param helper the helper that reads the type-specific part of
+ * the content.
+ *
+ * @return the value, created by the helper, or null if the
+ * header indicates that null was previously written.
+ */
+ public static Serializable read(InputStream input, Object helper)
+ {
+ return (Serializable) read(input, null, helper);
+ }
+
+ /**
* Fill in the instance fields by the data from the input stream.
* The method assumes that the value header, if any, is already
* behind. The information from the stream is stored into the
* passed ox parameter.
*
* @param input an input stream to read from.
- * @param value a value type object, must be either Streamable or
- * CustomMarshal.
+ *
+ * @param value a pre-instantiated value type object, must be either
+ * Streamable or CustomMarshal. If the helper is used, this parameter
+ * is ignored and should be null.
+ *
+ * @param value_tag the tag that must be read previously.
+ * @param helper the helper for read object specific part; may be
+ * null to read in using other methods.
+ *
+ * @return the value that was read.
*/
- public static void read_instance(InputStream input, Object value,
- int value_tag
- )
+ private static Object read_instance(InputStream input, Object value,
+ int value_tag, Object helper
+ )
{
try
{
@@ -377,7 +411,7 @@ public abstract class Vio
// Read all chunks.
int chunk_size = input.read_long();
- if (chunk_size <= 0)
+ if (chunk_size < 0)
throw new MARSHAL("Invalid first chunk size " + chunk_size);
byte[] r = new byte[ chunk_size ];
@@ -412,12 +446,29 @@ public abstract class Vio
// More than one chunk was present.
// Add the last chunk.
bout.write(r, 0, n);
- input = new cdrBufInput(bout.toByteArray());
+ input = new noHeaderInput(bout.toByteArray());
}
else
{
// Only one chunk was present.
- input = new cdrBufInput(r);
+ input = new noHeaderInput(r);
+ }
+ }
+ else
+ {
+ if (input instanceof cdrBufInput)
+ {
+ // Highly probable case.
+ input =
+ new noHeaderInput(((cdrBufInput) input).buffer.getBuffer());
+ }
+ else
+ {
+ cdrBufOutput bout = new cdrBufOutput();
+ int c;
+ while ((c = input.read()) >= 0)
+ bout.write((byte) c);
+ input = new noHeaderInput(bout.buffer.toByteArray());
}
}
}
@@ -447,12 +498,17 @@ public abstract class Vio
{
((Streamable) value)._read(input);
}
+ else if (helper instanceof BoxedValueHelper)
+ value = ((BoxedValueHelper) helper).read_value(input);
+ else if (helper instanceof ValueFactory)
+ value =
+ ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input);
else
// Stating the interfaces that the USER should use.
throw new MARSHAL("The " + value.getClass().getName() +
- " must implement either StreamableValue or CustomValue."
- );
+ " must implement either StreamableValue or CustomValue."
+ );
// The negative end of state marker is expected from OMG standard.
// If the chunking is used, this marker is already extracted.
@@ -462,6 +518,8 @@ public abstract class Vio
if (eor >= 0)
throw new MARSHAL("End of state marker has an invalid value " + eor);
}
+
+ return value;
}
/**
@@ -504,8 +562,8 @@ public abstract class Vio
* @throws MARSHAL if the writing failed due any reason.
*/
public static void write(OutputStream output, Serializable value,
- Class substitute
- )
+ Class substitute
+ )
{
// Write null if this is a null value.
if (value == null)
@@ -527,7 +585,35 @@ public abstract class Vio
if (value == null)
output.write_long(vt_NULL);
else
- write_instance(output, value, id);
+ write_instance(output, value, id, null);
+ }
+
+ /**
+ * Write standard value type header, followed by contents, produced
+ * by the boxed value helper.
+ *
+ * @param output the stream to write to.
+ * @param value the value to write, can be null.
+ * @param helper the helper that writes the value content if it is
+ * not null.
+ */
+ public static void write(OutputStream output, Serializable value,
+ Object helper
+ )
+ {
+ if (value == null)
+ output.write_long(vt_NULL);
+ else
+ {
+ String id;
+
+ if (helper instanceof BoxedValueHelper)
+ id = ((BoxedValueHelper) helper).get_id();
+ else
+ id = "";
+
+ write_instance(output, value, id, helper);
+ }
}
/**
@@ -537,10 +623,12 @@ public abstract class Vio
* @param output an output stream to write into.
* @param value a value to write.
* @param id a value repository id.
+ * @param helper a helper, writing object - specifica part. Can be null
+ * if the value should be written unsing other methods.
*/
private static void write_instance(OutputStream output, Serializable value,
- String id
- )
+ String id, Object helper
+ )
{
// This implementation always writes a single repository id.
// It never writes multiple repository ids and currently does not use
@@ -563,6 +651,11 @@ public abstract class Vio
output.write_long(value_tag);
output.write_string(id);
+ if (helper instanceof BoxedValueHelper)
+ {
+ ((BoxedValueHelper) helper).write_value(outObj, value);
+ }
+ else
// User defince write method is present.
if (value instanceof CustomMarshal)
{
@@ -580,11 +673,36 @@ public abstract class Vio
((Streamable) value)._write(outObj);
}
else
+ {
+ // Try to find helper via class loader.
+ boolean ok = false;
+ try
+ {
+ Class helperClass = Class.forName(ObjectCreator.toHelperName(id));
+
+ // It will be the helper for the encapsulated boxed value, not the
+ // for the global boxed value type itself.
+ Method write =
+ helperClass.getMethod("write",
+ new Class[]
+ {
+ org.omg.CORBA.portable.OutputStream.class, value.getClass()
+ }
+ );
+ write.invoke(null, new Object[] { outObj, value });
+ ok = true;
+ }
+ catch (Exception ex)
+ {
+ ok = false;
+ }
- // Stating the interfaces that the USER should use.
- throw new MARSHAL("The " + value.getClass().getName() +
- " must implement either StreamableValue or CustomValue."
- );
+ // Stating the interfaces that the USER should use.
+ if (!ok)
+ throw new MARSHAL("The " + value.getClass().getName() +
+ " must implement either StreamableValue" + " or CustomValue."
+ );
+ }
if (USE_CHUNKING)
{
@@ -611,8 +729,7 @@ public abstract class Vio
*
* @throws NO_IMPLEMENT, always.
*/
- private static void incorrect_plug_in(Throwable ex)
- throws NO_IMPLEMENT
+ static void incorrect_plug_in(Throwable ex) throws NO_IMPLEMENT
{
NO_IMPLEMENT no = new NO_IMPLEMENT("Incorrect CORBA plug-in");
no.initCause(ex);
@@ -629,10 +746,11 @@ public abstract class Vio
private static final void checkTag(int value_tag)
{
if ((value_tag < 0x7fffff00 || value_tag > 0x7fffffff) &&
- value_tag != vt_NULL && value_tag != vt_INDIRECTION
- )
+ value_tag != vt_NULL &&
+ value_tag != vt_INDIRECTION
+ )
throw new MARSHAL("Invalid value record, unsupported header tag: " +
- value_tag
- );
+ value_tag
+ );
}
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/CDR/cdrInput.java b/libjava/classpath/gnu/CORBA/CDR/cdrInput.java
index 859f93a..69f9c8c 100644
--- a/libjava/classpath/gnu/CORBA/CDR/cdrInput.java
+++ b/libjava/classpath/gnu/CORBA/CDR/cdrInput.java
@@ -1180,7 +1180,8 @@ public abstract class cdrInput
}
// Discard the null terminator and, if needed, the endian marker.
- return new String(s, p, n - nt - p);
+ String r = new String(s, p, n - nt - p);
+ return r;
}
catch (EOFException ex)
{
diff --git a/libjava/classpath/gnu/CORBA/CDR/cdrOutput.java b/libjava/classpath/gnu/CORBA/CDR/cdrOutput.java
index 86ca3b1..85f341c 100644
--- a/libjava/classpath/gnu/CORBA/CDR/cdrOutput.java
+++ b/libjava/classpath/gnu/CORBA/CDR/cdrOutput.java
@@ -41,6 +41,7 @@ package gnu.CORBA.CDR;
import gnu.CORBA.BigDecimalHelper;
import gnu.CORBA.GIOP.CharSets_OSF;
import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.Poa.gnuServantObject;
import gnu.CORBA.IOR;
import gnu.CORBA.Simple_delegate;
import gnu.CORBA.TypeCodeHelper;
@@ -99,7 +100,7 @@ public abstract class cdrOutput
/**
* The GIOP version.
*/
- protected Version giop = new Version(1, 0);
+ protected Version giop = new Version(1, 2);
/**
* The code set information.
@@ -327,6 +328,15 @@ public abstract class cdrOutput
IOR.write_null(this);
return;
}
+ else if (x instanceof gnuServantObject)
+ {
+ // The ORB may be different if several ORBs coexist
+ // in the same machine.
+ gnuServantObject g = (gnuServantObject) x;
+ IOR ior = g.orb.getLocalIor(x);
+ ior._write_no_endian(this);
+ return;
+ }
else if (x instanceof ObjectImpl)
{
Delegate d = ((ObjectImpl) x)._get_delegate();
diff --git a/libjava/classpath/gnu/CORBA/Connected_objects.java b/libjava/classpath/gnu/CORBA/Connected_objects.java
index 30d15e7..b7eefb1 100644
--- a/libjava/classpath/gnu/CORBA/Connected_objects.java
+++ b/libjava/classpath/gnu/CORBA/Connected_objects.java
@@ -60,11 +60,14 @@ public class Connected_objects
/**
* Create an initialised instance.
*/
- cObject(org.omg.CORBA.Object _object, int _port, byte[] _key)
+ cObject(org.omg.CORBA.Object _object, int _port, byte[] _key,
+ java.lang.Object an_identity
+ )
{
object = _object;
port = _port;
key = _key;
+ identity = an_identity;
}
/**
@@ -82,6 +85,12 @@ public class Connected_objects
*/
public final byte[] key;
+ /**
+ * The shared serving identity (usually POA) or null if no such
+ * applicable.
+ */
+ public final java.lang.Object identity;
+
public boolean equals(java.lang.Object other)
{
if (other instanceof cObject)
@@ -118,17 +127,23 @@ public class Connected_objects
*/
public cObject getKey(org.omg.CORBA.Object stored_object)
{
- Map.Entry item;
- Iterator iter = objects.entrySet().iterator();
- cObject ref;
-
- while (iter.hasNext())
+ synchronized (objects)
{
- item = (Map.Entry) iter.next();
- ref = (cObject) item.getValue();
- if (stored_object.equals(ref.object))
- return ref;
+ Map.Entry item;
+ Iterator iter = objects.entrySet().iterator();
+ cObject ref;
+
+ while (iter.hasNext())
+ {
+ item = (Map.Entry) iter.next();
+ ref = (cObject) item.getValue();
+ if (stored_object.equals(ref.object) ||
+ stored_object._is_equivalent(ref.object)
+ )
+ return ref;
+ }
}
+
return null;
}
@@ -144,7 +159,7 @@ public class Connected_objects
*/
public cObject add(org.omg.CORBA.Object object, int port)
{
- return add(generateObjectKey(object), object, port);
+ return add(generateObjectKey(object), object, port, null);
}
/**
@@ -155,10 +170,15 @@ public class Connected_objects
* @param port the port, on that the ORB will be listening on the
* remote invocations.
*/
- public cObject add(byte[] key, org.omg.CORBA.Object object, int port)
+ public cObject add(byte[] key, org.omg.CORBA.Object object, int port,
+ java.lang.Object identity
+ )
{
- cObject rec = new cObject(object, port, key);
- objects.put(key, rec);
+ cObject rec = new cObject(object, port, key, identity);
+ synchronized (objects)
+ {
+ objects.put(key, rec);
+ }
return rec;
}
@@ -171,12 +191,14 @@ public class Connected_objects
*/
public cObject get(byte[] key)
{
- return (cObject) objects.get(key);
+ synchronized (objects)
+ {
+ return (cObject) objects.get(key);
+ }
}
/**
* Get the map entry set.
- * @return
*/
public Set entrySet()
{
@@ -190,9 +212,12 @@ public class Connected_objects
*/
public void remove(org.omg.CORBA.Object object)
{
- cObject ref = getKey(object);
- if (ref != null)
- objects.remove(ref.key);
+ synchronized (objects)
+ {
+ cObject ref = getKey(object);
+ if (ref != null)
+ objects.remove(ref.key);
+ }
}
/**
diff --git a/libjava/classpath/gnu/CORBA/DynAn/NameValuePairHolder.java b/libjava/classpath/gnu/CORBA/DynAn/NameValuePairHolder.java
index 7afc81c..2558f53 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/NameValuePairHolder.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/NameValuePairHolder.java
@@ -46,9 +46,8 @@ import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.Streamable;
/**
- * The name-value pair holder. The {@link NameValuePair} has no standard
- * holder defined, but it is needed to store the {@link NameValuePair} into
- * {@link Any}.
+ * The name-value pair holder. The {@link NameValuePair} has no standard holder
+ * defined, but it is needed to store the {@link NameValuePair} into {@link Any}.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
@@ -92,4 +91,4 @@ public class NameValuePairHolder
{
NameValuePairHelper.write(output, value);
}
-}
+} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/ExceptionCreator.java b/libjava/classpath/gnu/CORBA/ExceptionCreator.java
index 536053c..8b75205 100644
--- a/libjava/classpath/gnu/CORBA/ExceptionCreator.java
+++ b/libjava/classpath/gnu/CORBA/ExceptionCreator.java
@@ -145,14 +145,11 @@ public class ExceptionCreator
{
try
{
- String holder = toHelperName(idl);
-
- System.out.println("Helper " + holder);
-
- Class holderClass = Class.forName(holder);
+ String helper = toHelperName(idl);
+ Class helperClass = Class.forName(helper);
Method read =
- holderClass.getMethod("read",
+ helperClass.getMethod("read",
new Class[]
{
org.omg.CORBA.portable.InputStream.class
diff --git a/libjava/classpath/gnu/CORBA/Functional_ORB.java b/libjava/classpath/gnu/CORBA/Functional_ORB.java
index 7395f31..1565b2c 100644
--- a/libjava/classpath/gnu/CORBA/Functional_ORB.java
+++ b/libjava/classpath/gnu/CORBA/Functional_ORB.java
@@ -1,4 +1,4 @@
-/* FunctionalORB.java --
+/* Functional_ORB.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,24 +40,28 @@ package gnu.CORBA;
import gnu.CORBA.CDR.cdrBufInput;
import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.GIOP.CloseMessage;
import gnu.CORBA.GIOP.ErrorMessage;
import gnu.CORBA.GIOP.MessageHeader;
import gnu.CORBA.GIOP.ReplyHeader;
import gnu.CORBA.GIOP.RequestHeader;
-import gnu.CORBA.GIOP.CloseMessage;
+import gnu.CORBA.NamingService.NameParser;
import gnu.CORBA.NamingService.NamingServiceTransient;
+import gnu.CORBA.Poa.gnuForwardRequest;
-import org.omg.CORBA.BAD_INV_ORDER;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.DATA_CONVERSION;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.NO_RESOURCES;
import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.Object;
import org.omg.CORBA.ORBPackage.InvalidName;
import org.omg.CORBA.Request;
import org.omg.CORBA.SystemException;
import org.omg.CORBA.UNKNOWN;
+import org.omg.CORBA.WrongTransaction;
import org.omg.CORBA.portable.Delegate;
import org.omg.CORBA.portable.InvokeHandler;
import org.omg.CORBA.portable.ObjectImpl;
@@ -78,6 +82,7 @@ import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Enumeration;
+import java.util.Hashtable;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
@@ -87,26 +92,25 @@ import java.util.TreeMap;
/**
* The ORB implementation, capable to handle remote invocations on the
- * registered object.
+ * registered object. This class implements all features, required till the jdk
+ * 1.3 inclusive, but does not support the POA that appears since 1.4. The POA
+ * is supported by {@link gnu.CORBA.Poa.ORB_1_4}.
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class Functional_ORB
- extends Restricted_ORB
+public class Functional_ORB extends Restricted_ORB
{
/**
- * A server, responsible for listening on requests on some
- * local port. The ORB may listen on multiple ports and process
- * the requests in separate threads. Normally the server takes
- * one port per object being served.
+ * A server, responsible for listening on requests on some local port. The ORB
+ * may listen on multiple ports and process the requests in separate threads.
+ * Normally the server takes one port per object being served.
*/
- class portServer
- extends Thread
+ class portServer extends Thread
{
/**
* The number of the currently running parallel threads.
*/
- private int running_threads;
+ int running_threads;
/**
* The port on that this portServer is listening for requests.
@@ -119,8 +123,7 @@ public class Functional_ORB
ServerSocket service;
/**
- * True if the serving node must shutdown due
- * call of the close_now().
+ * True if the serving node must shutdown due call of the close_now().
*/
boolean terminated;
@@ -133,9 +136,8 @@ public class Functional_ORB
}
/**
- * Enter the serving loop (get request/process it).
- * All portServer normally terminate thy threads when
- * the Functional_ORB.running is set to false.
+ * Enter the serving loop (get request/process it). All portServer normally
+ * terminate thy threads when the Functional_ORB.running is set to false.
*/
public void run()
{
@@ -155,7 +157,7 @@ public class Functional_ORB
{
try
{
- serve(this, service);
+ tick();
}
catch (SocketException ex)
{
@@ -180,6 +182,16 @@ public class Functional_ORB
}
/**
+ * Perform a single serving step.
+ *
+ * @throws java.lang.Exception
+ */
+ void tick() throws Exception
+ {
+ serve(this, service);
+ }
+
+ /**
* Forcibly close the server socket and mark this port as free.
*/
public void close_now()
@@ -206,14 +218,41 @@ public class Functional_ORB
}
/**
- * The default value where the first instance of this ORB will start
- * looking for a free port.
+ * A server, responsible for listening on requests on some local port and
+ * serving multiple requests (probably to the different objects) on the same
+ * thread.
+ */
+ class sharedPortServer extends portServer
+ {
+ /**
+ * Create a new portServer, serving on specific port.
+ */
+ sharedPortServer(int _port)
+ {
+ super(_port);
+ }
+
+ /**
+ * Perform a single serving step.
+ *
+ * @throws java.lang.Exception
+ */
+ void tick() throws Exception
+ {
+ Socket request = service.accept();
+ serveStep(request, false);
+ }
+ }
+
+ /**
+ * The default value where the first instance of this ORB will start looking
+ * for a free port.
*/
public static int DEFAULT_INITIAL_PORT = 1126;
/**
- * The property of port, on that this ORB is listening for requests from clients.
- * This class supports one port per ORB only.
+ * The property of port, on that this ORB is listening for requests from
+ * clients. This class supports one port per ORB only.
*/
public static final String LISTEN_ON = "gnu.classpath.CORBA.ListenOn";
@@ -223,12 +262,14 @@ public class Functional_ORB
public static final String REFERENCE = "org.omg.CORBA.ORBInitRef";
/**
- * The property, defining the port on that the default name service is running.
+ * The property, defining the port on that the default name service is
+ * running.
*/
public static final String NS_PORT = "org.omg.CORBA.ORBInitialPort";
/**
- * The property, defining the host on that the default name service is running.
+ * The property, defining the host on that the default name service is
+ * running.
*/
public static final String NS_HOST = "org.omg.CORBA.ORBInitialHost";
@@ -238,24 +279,25 @@ public class Functional_ORB
public static final String NAME_SERVICE = "NameService";
/**
- * The if the client has once opened a socket, it should start sending
- * the message header in a given time. Otherwise the server will close the
- * socket. This prevents server hang when the client opens the socket,
- * but does not send any message, usually due crash on the client side.
+ * The if the client has once opened a socket, it should start sending the
+ * message header in a given time. Otherwise the server will close the socket.
+ * This prevents server hang when the client opens the socket, but does not
+ * send any message, usually due crash on the client side.
*/
public static String START_READING_MESSAGE =
"gnu.classpath.CORBA.TOUT_START_READING_MESSAGE";
/**
- * If the client has started to send the request message, the socket time
- * out changes to the specified value.
+ * If the client has started to send the request message, the socket time out
+ * changes to the specified value.
*/
- public static String WHILE_READING = "gnu.classpath.CORBA.TOUT_WHILE_READING";
+ public static String WHILE_READING =
+ "gnu.classpath.CORBA.TOUT_WHILE_READING";
/**
- * If the message body is received, the time out changes to the
- * specifice value. This must be longer, as includes time, required to
- * process the received task. We make it 40 minutes.
+ * If the message body is received, the time out changes to the specifice
+ * value. This must be longer, as includes time, required to process the
+ * received task. We make it 40 minutes.
*/
public static String AFTER_RECEIVING =
"gnu.classpath.CORBA.TOUT_AFTER_RECEIVING";
@@ -266,60 +308,59 @@ public class Functional_ORB
public final String LOCAL_HOST;
/**
- * The if the client has once opened a socket, it should start sending
- * the message header in a given time. Otherwise the server will close the
- * socket. This prevents server hang when the client opens the socket,
- * but does not send any message, usually due crash on the client side.
+ * The if the client has once opened a socket, it should start sending the
+ * message header in a given time. Otherwise the server will close the socket.
+ * This prevents server hang when the client opens the socket, but does not
+ * send any message, usually due crash on the client side.
*/
private int TOUT_START_READING_MESSAGE = 20 * 1000;
// (Here and below, we use * to make the meaning of the constant clearler).
/**
- * If the client has started to send the request message, the socket time
- * out changes to the specified value.
+ * If the client has started to send the request message, the socket time out
+ * changes to the specified value.
*/
private int TOUT_WHILE_READING = 2 * 60 * 1000;
/**
- * If the message body is received, the time out changes to the
- * specifice value. This must be longer, as includes time, required to
- * process the received task. We make it 40 minutes.
+ * If the message body is received, the time out changes to the specifice
+ * value. This must be longer, as includes time, required to process the
+ * received task. We make it 40 minutes.
*/
private int TOUT_AFTER_RECEIVING = 40 * 60 * 1000;
/**
- * Some clients tend to submit multiple requests over the
- * same socket. The server waits for the next request on
- * the same socket for the duration, specified
- * below. In additions, the request of this implementation also
- * waits for the same duration before closing the socket.
- * The default time is seven seconds.
+ * Some clients tend to submit multiple requests over the same socket. The
+ * server waits for the next request on the same socket for the duration,
+ * specified below. In additions, the request of this implementation also
+ * waits for the same duration before closing the socket. The default time is
+ * seven seconds.
*/
public static int TANDEM_REQUESTS = 7000;
/**
* The map of the already conncted objects.
*/
- protected final Connected_objects connected_objects = new Connected_objects();
+ protected final Connected_objects connected_objects =
+ new Connected_objects();
/**
- * The maximal CORBA version, supported by this ORB. The default value
- * 0 means that the ORB will not check the request version while trying
- * to respond.
+ * The maximal CORBA version, supported by this ORB. The default value 0 means
+ * that the ORB will not check the request version while trying to respond.
*/
protected Version max_version;
/**
- * Setting this value to false causes the ORB to shutdown after the
- * latest serving operation is complete.
+ * Setting this value to false causes the ORB to shutdown after the latest
+ * serving operation is complete.
*/
protected boolean running;
/**
* The map of the initial references.
*/
- private Map initial_references = new TreeMap();
+ protected Map initial_references = new TreeMap();
/**
* The currently active portServers.
@@ -332,12 +373,12 @@ public class Functional_ORB
private String ns_host;
/**
- * Probably free port, under that the ORB will try listening for
- * remote requests first. When the new object is connected, this
- * port is used first, then it is incremented by 1, etc. If the given
- * port is not available, up to 20 subsequent values are tried and then
- * the parameterless server socket contructor is called. The constant is
- * shared between multiple instances of this ORB.
+ * Probably free port, under that the ORB will try listening for remote
+ * requests first. When the new object is connected, this port is used first,
+ * then it is incremented by 1, etc. If the given port is not available, up to
+ * 20 subsequent values are tried and then the parameterless server socket
+ * contructor is called. The constant is shared between multiple instances of
+ * this ORB.
*/
private static int Port = DEFAULT_INITIAL_PORT;
@@ -345,6 +386,11 @@ public class Functional_ORB
* The port, on that the name service is expected to be running.
*/
private int ns_port = 900;
+
+ /**
+ * The name parser.
+ */
+ NameParser nameParser = new NameParser();
/**
* The instance, stored in this field, handles the asynchronous dynamic
@@ -358,10 +404,14 @@ public class Functional_ORB
protected LinkedList freed_ports = new LinkedList();
/**
- * The maximal allowed number of the currently running parallel
- * threads per object. For security reasons, this is made private and
- * unchangeable. After exceeding this limit, the NO_RESOURCES
- * is thrown back to the client.
+ * Maps a single-threaded POAs to they sharedPortServants.
+ */
+ protected Hashtable identities = new Hashtable();
+
+ /**
+ * The maximal allowed number of the currently running parallel threads per
+ * object. For security reasons, this is made private and unchangeable. After
+ * exceeding this limit, the NO_RESOURCES is thrown back to the client.
*/
private int MAX_RUNNING_THREADS = 256;
@@ -385,20 +435,19 @@ public class Functional_ORB
}
/**
- * If the max version is assigned, the orb replies with the error
- * message if the request version is above the supported 1.2 version.
- * This behavior is recommended by OMG, but not all implementations
- * respond that error message by re-sending the request, encoded in the older
- * version.
- */
+ * If the max version is assigned, the orb replies with the error message if
+ * the request version is above the supported 1.2 version. This behavior is
+ * recommended by OMG, but not all implementations respond that error message
+ * by re-sending the request, encoded in the older version.
+ */
public void setMaxVersion(Version max_supported)
{
max_version = max_supported;
}
/**
- * Get the maximal supported GIOP version or null if the version is
- * not checked.
+ * Get the maximal supported GIOP version or null if the version is not
+ * checked.
*/
public Version getMaxVersion()
{
@@ -406,17 +455,15 @@ public class Functional_ORB
}
/**
- * Get the currently free port, starting from the initially set port
- * and going up max 20 steps, then trying to bind into any free
- * address.
+ * Get the currently free port, starting from the initially set port and going
+ * up max 20 steps, then trying to bind into any free address.
*
* @return the currently available free port.
*
- * @throws NO_RESOURCES if the server socked cannot be opened on the
- * local host.
+ * @throws NO_RESOURCES if the server socked cannot be opened on the local
+ * host.
*/
- public int getFreePort()
- throws BAD_OPERATION
+ public int getFreePort() throws BAD_OPERATION
{
ServerSocket s;
int a_port;
@@ -473,12 +520,11 @@ public class Functional_ORB
}
/**
- * Set the port, on that the server is listening for the client requests.
- * If only one object is connected to the orb, the server will be
- * try listening on this port first. It the port is busy, or if more
- * objects are connected, the subsequent object will receive a larger
- * port values, skipping unavailable ports, if required. The change
- * applies globally.
+ * Set the port, on that the server is listening for the client requests. If
+ * only one object is connected to the orb, the server will be try listening
+ * on this port first. It the port is busy, or if more objects are connected,
+ * the subsequent object will receive a larger port values, skipping
+ * unavailable ports, if required. The change applies globally.
*
* @param a_Port a port, on that the server is listening for requests.
*/
@@ -488,14 +534,13 @@ public class Functional_ORB
}
/**
- * Connect the given CORBA object to this ORB. After the object is
- * connected, it starts receiving remote invocations via this ORB.
+ * Connect the given CORBA object to this ORB. After the object is connected,
+ * it starts receiving remote invocations via this ORB.
*
- * The ORB tries to connect the object to the port, that has been
- * previously set by {@link setPort(int)}. On failure, it tries
- * 20 subsequent larger values and then calls the parameterless
- * server socked constructor to get any free local port.
- * If this fails, the {@link NO_RESOURCES} is thrown.
+ * The ORB tries to connect the object to the port, that has been previously
+ * set by {@link setPort(int)}. On failure, it tries 20 subsequent larger
+ * values and then calls the parameterless server socked constructor to get
+ * any free local port. If this fails, the {@link NO_RESOURCES} is thrown.
*
* @param object the object, must implement the {@link InvokeHandler})
* interface.
@@ -515,19 +560,18 @@ public class Functional_ORB
}
/**
- * Connect the given CORBA object to this ORB, explicitly specifying
- * the object key.
+ * Connect the given CORBA object to this ORB, explicitly specifying the
+ * object key.
*
- * The ORB tries to connect the object to the port, that has been
- * previously set by {@link setPort(int)}. On failure, it tries
- * 20 subsequent larger values and then calls the parameterless
- * server socked constructor to get any free local port.
- * If this fails, the {@link NO_RESOURCES} is thrown.
+ * The ORB tries to connect the object to the port, that has been previously
+ * set by {@link setPort(int)}. On failure, it tries 20 subsequent larger
+ * values and then calls the parameterless server socked constructor to get
+ * any free local port. If this fails, the {@link NO_RESOURCES} is thrown.
*
* @param object the object, must implement the {@link InvokeHandler})
* interface.
- * @param key the object key, usually used to identify the object from
- * remote side.
+ * @param key the object key, usually used to identify the object from remote
+ * side.
*
* @throws BAD_PARAM if the object does not implement the
* {@link InvokeHandler}).
@@ -536,7 +580,8 @@ public class Functional_ORB
{
int a_port = getFreePort();
- Connected_objects.cObject ref = connected_objects.add(key, object, a_port);
+ Connected_objects.cObject ref =
+ connected_objects.add(key, object, a_port, null);
IOR ior = createIOR(ref);
prepareObject(object, ior);
if (running)
@@ -544,11 +589,56 @@ public class Functional_ORB
}
/**
+ * Connect the given CORBA object to this ORB, explicitly specifying the
+ * object key and the identity of the thread (and port), where the object must
+ * be served. The identity is normally the POA.
+ *
+ * The new port server will be started only if there is no one already running
+ * for the same identity. Otherwise, the task of the existing port server will
+ * be widened, including duty to serve the given object. All objects,
+ * connected to a single identity by this method, will process they requests
+ * subsequently in the same thread. The method is used when the expected
+ * number of the objects is too large to have a single port and thread per
+ * object. This method is used by POAs, having a single thread policy.
+ *
+ * @param object the object, must implement the {@link InvokeHandler})
+ * interface.
+ * @param key the object key, usually used to identify the object from remote
+ * side.
+ * @param port the port, where the object must be connected.
+ *
+ * @throws BAD_PARAM if the object does not implement the
+ * {@link InvokeHandler}).
+ */
+ public void connect_1_thread(org.omg.CORBA.Object object, byte[] key,
+ java.lang.Object identity
+ )
+ {
+ sharedPortServer shared = (sharedPortServer) identities.get(identity);
+ if (shared == null)
+ {
+ int a_port = getFreePort();
+ shared = new sharedPortServer(a_port);
+ identities.put(identity, shared);
+ if (running)
+ {
+ portServers.add(shared);
+ shared.start();
+ }
+ }
+
+ Connected_objects.cObject ref =
+ connected_objects.add(key, object, shared.s_port, identity);
+ IOR ior = createIOR(ref);
+ prepareObject(object, ior);
+ }
+
+ /**
* Start the service on the given port of this IOR.
*
* @param ior the ior (only Internet.port is used).
*/
- private void startService(IOR ior)
+ public void startService(IOR ior)
{
portServer p = new portServer(ior.Internet.port);
portServers.add(p);
@@ -560,23 +650,22 @@ public class Functional_ORB
*/
public void destroy()
{
- super.destroy();
-
portServer p;
for (int i = 0; i < portServers.size(); i++)
{
p = (portServer) portServers.get(i);
p.close_now();
}
+ super.destroy();
}
/**
- * Disconnect the given CORBA object from this ORB. The object will be
- * no longer receiving the remote invocations. In response to the
- * remote invocation on this object, the ORB will send the
- * exception {@link OBJECT_NOT_EXIST}. The object, however, is not
- * destroyed and can receive the local invocations.
-
+ * Disconnect the given CORBA object from this ORB. The object will be no
+ * longer receiving the remote invocations. In response to the remote
+ * invocation on this object, the ORB will send the exception
+ * {@link OBJECT_NOT_EXIST}. The object, however, is not destroyed and can
+ * receive the local invocations.
+ *
* @param object the object to disconnect.
*/
public void disconnect(org.omg.CORBA.Object object)
@@ -599,8 +688,6 @@ public class Functional_ORB
// object implementation.
if (rmKey == null)
rmKey = connected_objects.getKey(object);
-
- // Disconnect the object on any success.
if (rmKey != null)
{
// Find and stop the corresponding portServer.
@@ -609,7 +696,7 @@ public class Functional_ORB
for (int i = 0; i < portServers.size(); i++)
{
p = (portServer) portServers.get(i);
- if (p.s_port == rmKey.port)
+ if (p.s_port == rmKey.port && !(p instanceof sharedPortServer))
{
p.close_now();
freed_ports.addFirst(new Integer(rmKey.port));
@@ -621,12 +708,47 @@ public class Functional_ORB
}
/**
+ * Notifies ORB that the shared service indentity (usually POA) is destroyed.
+ * The matching shared port server is terminated and the identity table entry
+ * is deleted. If this identity is not known for this ORB, the method returns
+ * without action.
+ *
+ * @param identity the identity that has been destroyed.
+ */
+ public void identityDestroyed(java.lang.Object identity)
+ {
+ if (identity == null)
+ return;
+
+ sharedPortServer ise = (sharedPortServer) identities.get(identity);
+ if (ise != null)
+ {
+ synchronized (connected_objects)
+ {
+ ise.close_now();
+ identities.remove(identity);
+
+ Connected_objects.cObject obj;
+ Map.Entry m;
+ Iterator iter = connected_objects.entrySet().iterator();
+ while (iter.hasNext())
+ {
+ m = (Map.Entry) iter.next();
+ obj = (Connected_objects.cObject) m.getValue();
+ if (obj.identity == identity)
+ iter.remove();
+ }
+ }
+ }
+ }
+
+ /**
* Find the local object, connected to this ORB.
*
* @param ior the ior of the potentially local object.
*
- * @return the local object, represented by the given IOR,
- * or null if this is not a local connected object.
+ * @return the local object, represented by the given IOR, or null if this is
+ * not a local connected object.
*/
public org.omg.CORBA.Object find_local_object(IOR ior)
{
@@ -655,26 +777,26 @@ public class Functional_ORB
Iterator iter = initial_references.keySet().iterator();
while (iter.hasNext())
- refs [ p++ ] = (String) iter.next();
-
+ {
+ refs [ p++ ] = (String) iter.next();
+ }
return refs;
}
/**
- * Get the IOR reference string for the given object.
- * The string embeds information about the object
- * repository Id, its access key and the server internet
- * address and port. With this information, the object
- * can be found by another ORB, possibly located on remote
- * computer.
+ * Get the IOR reference string for the given object. The string embeds
+ * information about the object repository Id, its access key and the server
+ * internet address and port. With this information, the object can be found
+ * by another ORB, possibly located on remote computer.
*
* @param the CORBA object
* @return the object IOR representation.
*
- * @throws BAD_PARAM if the object has not been previously
- * connected to this ORB.
- * @throws BAD_OPERATION in the unlikely case if the local host
- * address cannot be resolved.
+ * @throws BAD_PARAM if the object has not been previously connected to this
+ * ORB.
+ *
+ * @throws BAD_OPERATION in the unlikely case if the local host address cannot
+ * be resolved.
*
* @see string_to_object(String)
*/
@@ -693,8 +815,8 @@ public class Functional_ORB
if (rec == null)
throw new BAD_PARAM("The object " + forObject +
- " has not been previously connected to this ORB"
- );
+ " has not been previously connected to this ORB"
+ );
IOR ior = createIOR(rec);
@@ -702,17 +824,28 @@ public class Functional_ORB
}
/**
- * Find and return the easily accessible CORBA object, addressed
- * by name.
+ * Get the local IOR for the given object, null if the object is not local.
+ */
+ public IOR getLocalIor(org.omg.CORBA.Object forObject)
+ {
+ Connected_objects.cObject rec = connected_objects.getKey(forObject);
+ if (rec == null)
+ return null;
+ else
+ return createIOR(rec);
+ }
+
+ /**
+ * Find and return the easily accessible CORBA object, addressed by name.
*
* @param name the object name.
* @return the object
*
- * @throws org.omg.CORBA.ORBPackage.InvalidName if the given name
- * is not associated with the known object.
+ * @throws org.omg.CORBA.ORBPackage.InvalidName if the given name is not
+ * associated with the known object.
*/
public org.omg.CORBA.Object resolve_initial_references(String name)
- throws InvalidName
+ throws InvalidName
{
org.omg.CORBA.Object object = null;
try
@@ -738,9 +871,8 @@ public class Functional_ORB
}
/**
- * Start the ORBs main working cycle
- * (receive invocation - invoke on the local object - send response -
- * wait for another invocation).
+ * Start the ORBs main working cycle (receive invocation - invoke on the local
+ * object - send response - wait for another invocation).
*
* The method only returns after calling {@link #shutdown(boolean)}.
*/
@@ -758,27 +890,37 @@ public class Functional_ORB
m = (Map.Entry) iter.next();
obj = (Connected_objects.cObject) m.getValue();
- portServer subserver = new portServer(obj.port);
- portServers.add(subserver);
+ portServer subserver;
- // Reuse the current thread for the last portServer.
- if (!iter.hasNext())
+ if (obj.identity == null)
{
- // Discard the iterator, eliminating lock checks.
- iter = null;
- subserver.run();
- return;
+ subserver = new portServer(obj.port);
+ portServers.add(subserver);
}
else
- subserver.start();
+ subserver = (portServer) identities.get(obj.identity);
+
+ if (!subserver.isAlive())
+ {
+ // Reuse the current thread for the last portServer.
+ if (!iter.hasNext())
+ {
+ // Discard the iterator, eliminating lock checks.
+ iter = null;
+ subserver.run();
+ return;
+ }
+ else
+ subserver.start();
+ }
}
}
/**
* Shutdown the ORB server.
*
- * @param wait_for_completion if true, the current thread is
- * suspended until the shutdown process is complete.
+ * @param wait_for_completion if true, the current thread is suspended until
+ * the shutdown process is complete.
*/
public void shutdown(boolean wait_for_completion)
{
@@ -796,19 +938,26 @@ public class Functional_ORB
}
/**
- * Find and return the CORBA object, addressed by the given
- * IOR string representation. The object can (an usually is)
- * located on a remote computer, possibly running a different
- * (not necessary java) CORBA implementation.
- *
+ * Find and return the CORBA object, addressed by the given IOR string
+ * representation. The object can (an usually is) located on a remote
+ * computer, possibly running a different (not necessary java) CORBA
+ * implementation.
+ *
* @param ior the object IOR representation string.
- *
+ *
* @return the found CORBA object.
* @see object_to_string(org.omg.CORBA.Object)
*/
public org.omg.CORBA.Object string_to_object(String an_ior)
{
- IOR ior = IOR.parse(an_ior);
+ return nameParser.corbaloc(an_ior, this);
+ }
+
+ /**
+ * Convert ior reference to CORBA object.
+ */
+ public org.omg.CORBA.Object ior_to_object(IOR ior)
+ {
org.omg.CORBA.Object object = find_local_object(ior);
if (object == null)
{
@@ -816,9 +965,7 @@ public class Functional_ORB
try
{
if (impl._get_delegate() == null)
- {
- impl._set_delegate(new IOR_Delegate(this, ior));
- }
+ impl._set_delegate(new IOR_Delegate(this, ior));
}
catch (BAD_OPERATION ex)
{
@@ -828,21 +975,19 @@ public class Functional_ORB
}
object = impl;
- connected_objects.add(ior.key, impl, ior.Internet.port);
+ connected_objects.add(ior.key, impl, ior.Internet.port, null);
}
return object;
}
/**
- * Get the default naming service for the case when there no
- * NameService entries.
+ * Get the default naming service for the case when there no NameService
+ * entries.
*/
protected org.omg.CORBA.Object getDefaultNameService()
{
if (initial_references.containsKey(NAME_SERVICE))
- {
- return (org.omg.CORBA.Object) initial_references.get(NAME_SERVICE);
- }
+ return (org.omg.CORBA.Object) initial_references.get(NAME_SERVICE);
IOR ior = new IOR();
ior.Id = NamingContextExtHelper.id();
@@ -857,8 +1002,8 @@ public class Functional_ORB
}
/**
- * Find and return the object, that must be previously connected
- * to this ORB. Return null if no such object is available.
+ * Find and return the object, that must be previously connected to this ORB.
+ * Return null if no such object is available.
*
* @param key the object key.
*
@@ -877,8 +1022,7 @@ public class Functional_ORB
* @param app the current applet.
*
* @param props application specific properties, passed as the second
- * parameter in {@link #init(Applet, Properties)}.
- * Can be <code>null</code>.
+ * parameter in {@link #init(Applet, Properties)}. Can be <code>null</code>.
*/
protected void set_parameters(Applet app, Properties props)
{
@@ -891,27 +1035,23 @@ public class Functional_ORB
{
if (para [ i ] [ 0 ].equals(LISTEN_ON))
Port = Integer.parseInt(para [ i ] [ 1 ]);
-
if (para [ i ] [ 0 ].equals(REFERENCE))
{
- StringTokenizer st = new StringTokenizer(para [ i ] [ 1 ], "=");
+ StringTokenizer st =
+ new StringTokenizer(para [ i ] [ 1 ], "=");
initial_references.put(st.nextToken(),
- string_to_object(st.nextToken())
- );
+ string_to_object(st.nextToken())
+ );
}
if (para [ i ] [ 0 ].equals(NS_HOST))
ns_host = para [ i ] [ 1 ];
-
if (para [ i ] [ 0 ].equals(START_READING_MESSAGE))
TOUT_START_READING_MESSAGE = Integer.parseInt(para [ i ] [ 1 ]);
-
if (para [ i ] [ 0 ].equals(WHILE_READING))
TOUT_WHILE_READING = Integer.parseInt(para [ i ] [ 1 ]);
-
if (para [ i ] [ 0 ].equals(AFTER_RECEIVING))
TOUT_AFTER_RECEIVING = Integer.parseInt(para [ i ] [ 1 ]);
-
try
{
if (para [ i ] [ 0 ].equals(NS_PORT))
@@ -921,9 +1061,9 @@ public class Functional_ORB
{
BAD_PARAM bad =
new BAD_PARAM("Invalid " + NS_PORT +
- "property, unable to parse '" +
- props.getProperty(NS_PORT) + "'"
- );
+ "property, unable to parse '" +
+ props.getProperty(NS_PORT) + "'"
+ );
bad.initCause(ex);
throw bad;
}
@@ -935,52 +1075,54 @@ public class Functional_ORB
* Set the ORB parameters. This method is normally called from
* {@link #init(String[], Properties)}.
*
- * @param para the parameters, that were passed as the parameters
- * to the <code>main(String[] args)</code> method of the current standalone
+ * @param para the parameters, that were passed as the parameters to the
+ * <code>main(String[] args)</code> method of the current standalone
* application.
*
- * @param props application specific properties that were passed
- * as a second parameter in {@link init(String[], Properties)}).
- * Can be <code>null</code>.
+ * @param props application specific properties that were passed as a second
+ * parameter in {@link init(String[], Properties)}). Can be <code>null</code>.
*/
protected void set_parameters(String[] para, Properties props)
{
if (para.length > 1)
- for (int i = 0; i < para.length - 1; i++)
- {
- if (para [ i ].endsWith("ListenOn"))
- Port = Integer.parseInt(para [ i + 1 ]);
-
- if (para [ i ].endsWith("ORBInitRef"))
- {
- StringTokenizer st = new StringTokenizer(para [ i + 1 ], "=");
- initial_references.put(st.nextToken(),
- string_to_object(st.nextToken())
- );
- }
-
- if (para [ i ].endsWith("ORBInitialHost"))
- ns_host = para [ i + 1 ];
+ {
+ for (int i = 0; i < para.length - 1; i++)
+ {
+ if (para [ i ].endsWith("ListenOn"))
+ Port = Integer.parseInt(para [ i + 1 ]);
+ if (para [ i ].endsWith("ORBInitRef"))
+ {
+ StringTokenizer st = new StringTokenizer(para [ i + 1 ], "=");
+ initial_references.put(st.nextToken(),
+ string_to_object(st.nextToken())
+ );
+ }
- try
- {
- if (para [ i ].endsWith("ORBInitialPort"))
- ns_port = Integer.parseInt(para [ i + 1 ]);
- }
- catch (NumberFormatException ex)
- {
- throw new BAD_PARAM("Invalid " + para [ i ] +
- "parameter, unable to parse '" +
- props.getProperty(para [ i + 1 ]) + "'"
- );
- }
- }
+ if (para [ i ].endsWith("ORBInitialHost"))
+ ns_host = para [ i + 1 ];
+ try
+ {
+ if (para [ i ].endsWith("ORBInitialPort"))
+ ns_port = Integer.parseInt(para [ i + 1 ]);
+ }
+ catch (NumberFormatException ex)
+ {
+ throw new BAD_PARAM("Invalid " + para [ i ] +
+ "parameter, unable to parse '" +
+ props.getProperty(para [ i + 1 ]) + "'"
+ );
+ }
+ }
+ }
useProperties(props);
}
- private IOR createIOR(Connected_objects.cObject ref)
- throws BAD_OPERATION
+ /**
+ * Create IOR for the given object references.
+ */
+ protected IOR createIOR(Connected_objects.cObject ref)
+ throws BAD_OPERATION
{
IOR ior = new IOR();
ior.key = ref.key;
@@ -994,7 +1136,6 @@ public class Functional_ORB
}
if (ior.Id == null)
ior.Id = ref.object.getClass().getName();
-
try
{
ior.Internet.host = InetAddress.getLocalHost().getHostAddress();
@@ -1016,12 +1157,13 @@ public class Functional_ORB
* {@link InvokeHandler}).
*/
private void prepareObject(org.omg.CORBA.Object object, IOR ior)
- throws BAD_PARAM
+ throws BAD_PARAM
{
- if (!(object instanceof InvokeHandler))
- throw new BAD_PARAM(object.getClass().getName() +
- " does not implement InvokeHandler. "
- );
+ /*
+ * if (!(object instanceof InvokeHandler)) throw new
+ * BAD_PARAM(object.getClass().getName() + " does not implement
+ * InvokeHandler. " );
+ */
// If no delegate is set, set the default delegate.
if (object instanceof ObjectImpl)
@@ -1030,9 +1172,7 @@ public class Functional_ORB
try
{
if (impl._get_delegate() == null)
- {
- impl._set_delegate(new Simple_delegate(this, ior));
- }
+ impl._set_delegate(new Simple_delegate(this, ior));
}
catch (BAD_OPERATION ex)
{
@@ -1048,20 +1188,17 @@ public class Functional_ORB
* @param net_out the stream to write response into
* @param msh_request the request message header
* @param rh_request the request header
- * @param handler the invocation handler that has been used to
- * invoke the operation
- * @param sysEx the system exception, thrown during the invocation,
- * null if none.
+ * @param handler the invocation handler that has been used to invoke the
+ * operation
+ * @param sysEx the system exception, thrown during the invocation, null if
+ * none.
*
* @throws IOException
*/
private void respond_to_client(OutputStream net_out,
- MessageHeader msh_request,
- RequestHeader rh_request,
- bufferedResponseHandler handler,
- SystemException sysEx
- )
- throws IOException
+ MessageHeader msh_request, RequestHeader rh_request,
+ bufferedResponseHandler handler, SystemException sysEx
+ ) throws IOException
{
// Set the reply header properties.
ReplyHeader reply = handler.reply_header;
@@ -1072,17 +1209,23 @@ public class Functional_ORB
reply.reply_status = ReplyHeader.USER_EXCEPTION;
else
reply.reply_status = ReplyHeader.NO_EXCEPTION;
-
reply.request_id = rh_request.request_id;
- cdrBufOutput out = new cdrBufOutput(50 + handler.getBuffer().buffer.size());
+ cdrBufOutput out =
+ new cdrBufOutput(50 + handler.getBuffer().buffer.size());
out.setOrb(this);
out.setOffset(msh_request.getHeaderSize());
reply.write(out);
- // Write the reply data from the handler.
+ if (msh_request.version.since_inclusive(1, 2))
+ {
+ out.align(8);
+
+ // Write the reply data from the handler. The handler data already
+ // include the necessary heading zeroes for alignment.
+ }
handler.getBuffer().buffer.writeTo(out);
MessageHeader msh_reply = new MessageHeader();
@@ -1098,19 +1241,53 @@ public class Functional_ORB
}
/**
+ * Forward request to another target, as indicated by the passed exception.
+ */
+ private void forward_request(OutputStream net_out,
+ MessageHeader msh_request, RequestHeader rh_request, gnuForwardRequest info
+ ) throws IOException
+ {
+ MessageHeader msh_forward = new MessageHeader();
+ msh_forward.version = msh_request.version;
+
+ ReplyHeader rh_forward = msh_forward.create_reply_header();
+ msh_forward.message_type = MessageHeader.REPLY;
+ rh_forward.reply_status = info.forwarding_code;
+ rh_forward.request_id = rh_request.request_id;
+
+ // The forwarding code is either LOCATION_FORWARD or LOCATION_FORWARD_PERM.
+ cdrBufOutput out = new cdrBufOutput();
+ out.setOrb(this);
+ out.setOffset(msh_forward.getHeaderSize());
+
+ rh_forward.write(out);
+
+ if (msh_forward.version.since_inclusive(1, 2))
+ out.align(8);
+ out.write_Object(info.forward_reference);
+
+ msh_forward.message_size = out.buffer.size();
+
+ // Write the forwarding instruction.
+ msh_forward.write(net_out);
+ out.buffer.writeTo(net_out);
+ net_out.flush();
+ }
+
+ /**
* Contains a single servicing task.
*
- * Normally, each task matches a single remote invocation.
- * However under frequent tandem submissions the same
- * task may span over several invocations.
+ * Normally, each task matches a single remote invocation. However under
+ * frequent tandem submissions the same task may span over several
+ * invocations.
*
* @param serverSocket the ORB server socket.
*
* @throws MARSHAL
* @throws IOException
*/
- private void serve(final portServer p, ServerSocket serverSocket)
- throws MARSHAL, IOException
+ void serve(final portServer p, ServerSocket serverSocket)
+ throws MARSHAL, IOException
{
final Socket service;
service = serverSocket.accept();
@@ -1148,15 +1325,15 @@ public class Functional_ORB
/**
* A single servicing step, when the client socket is alrady open.
*
- * Normally, each task matches a single remote invocation.
- * However under frequent tandem submissions the same
- * task may span over several invocations.
+ * Normally, each task matches a single remote invocation. However under
+ * frequent tandem submissions the same task may span over several
+ * invocations.
*
* @param service the opened client socket.
- * @param no_resources if true, the "NO RESOURCES" exception
- * is thrown to the client.
+ * @param no_resources if true, the "NO RESOURCES" exception is thrown to the
+ * client.
*/
- private void serveStep(Socket service, boolean no_resources)
+ void serveStep(Socket service, boolean no_resources)
{
try
{
@@ -1179,15 +1356,17 @@ public class Functional_ORB
}
if (max_version != null)
- if (!msh_request.version.until_inclusive(max_version.major,
- max_version.minor
- )
- )
- {
- OutputStream out = service.getOutputStream();
- new ErrorMessage(max_version).write(out);
- return;
- }
+ {
+ if (!msh_request.version.until_inclusive(max_version.major,
+ max_version.minor
+ )
+ )
+ {
+ OutputStream out = service.getOutputStream();
+ new ErrorMessage(max_version).write(out);
+ return;
+ }
+ }
byte[] r = new byte[ msh_request.message_size ];
@@ -1221,9 +1400,12 @@ public class Functional_ORB
// in 1.2 and higher, align the current position at
// 8 octet boundary.
if (msh_request.version.since_inclusive(1, 2))
- cin.align(8);
+ {
+ cin.align(8);
+
+ // find the target object.
+ }
- // find the target object.
InvokeHandler target =
(InvokeHandler) find_connected_object(rh_request.object_key);
@@ -1234,7 +1416,9 @@ public class Functional_ORB
// TODO log errors about not existing objects and methods.
bufferedResponseHandler handler =
- new bufferedResponseHandler(this, msh_request, rh_reply);
+ new bufferedResponseHandler(this, msh_request, rh_reply,
+ rh_request
+ );
SystemException sysEx = null;
@@ -1246,6 +1430,18 @@ public class Functional_ORB
throw new OBJECT_NOT_EXIST();
target._invoke(rh_request.operation, cin, handler);
}
+ catch (gnuForwardRequest forwarded)
+ {
+ OutputStream sou = service.getOutputStream();
+ forward_request(sou, msh_request, rh_request, forwarded);
+ if (service != null && !service.isClosed())
+ {
+ // Wait for the subsequent invocations on the
+ // same socket for the TANDEM_REQUEST duration.
+ service.setSoTimeout(TANDEM_REQUESTS);
+ continue Serving;
+ }
+ }
catch (SystemException ex)
{
sysEx = ex;
@@ -1256,8 +1452,11 @@ public class Functional_ORB
}
catch (Exception except)
{
+ except.printStackTrace();
sysEx =
- new UNKNOWN("Unknown", 2, CompletionStatus.COMPLETED_MAYBE);
+ new UNKNOWN("Unknown", 2,
+ CompletionStatus.COMPLETED_MAYBE
+ );
org.omg.CORBA.portable.OutputStream ech =
handler.createExceptionReply();
@@ -1270,28 +1469,26 @@ public class Functional_ORB
{
OutputStream sou = service.getOutputStream();
respond_to_client(sou, msh_request, rh_request, handler,
- sysEx
- );
+ sysEx
+ );
}
}
else if (msh_request.message_type == MessageHeader.CLOSE_CONNECTION ||
- msh_request.message_type == MessageHeader.MESSAGE_ERROR
- )
+ msh_request.message_type == MessageHeader.MESSAGE_ERROR
+ )
{
CloseMessage.close(service.getOutputStream());
service.close();
return;
}
- else
- ;
+ ;
// TODO log error: "Not a request message."
if (service != null && !service.isClosed())
- {
- // Wait for the subsequent invocations on the
- // same socket for the TANDEM_REQUEST duration.
- service.setSoTimeout(TANDEM_REQUESTS);
- }
+
+ // Wait for the subsequent invocations on the
+ // same socket for the TANDEM_REQUEST duration.
+ service.setSoTimeout(TANDEM_REQUESTS);
else
return;
}
@@ -1315,23 +1512,18 @@ public class Functional_ORB
{
if (props.containsKey(LISTEN_ON))
Port = Integer.parseInt(props.getProperty(LISTEN_ON));
-
if (props.containsKey(NS_HOST))
ns_host = props.getProperty(NS_HOST);
-
try
{
if (props.containsKey(NS_PORT))
ns_port = Integer.parseInt(props.getProperty(NS_PORT));
-
if (props.containsKey(START_READING_MESSAGE))
TOUT_START_READING_MESSAGE =
Integer.parseInt(props.getProperty(START_READING_MESSAGE));
-
if (props.containsKey(WHILE_READING))
TOUT_WHILE_READING =
Integer.parseInt(props.getProperty(WHILE_READING));
-
if (props.containsKey(AFTER_RECEIVING))
TOUT_AFTER_RECEIVING =
Integer.parseInt(props.getProperty(AFTER_RECEIVING));
@@ -1339,9 +1531,9 @@ public class Functional_ORB
catch (NumberFormatException ex)
{
throw new BAD_PARAM("Invalid " + NS_PORT +
- "property, unable to parse '" +
- props.getProperty(NS_PORT) + "'"
- );
+ "property, unable to parse '" + props.getProperty(NS_PORT) +
+ "'"
+ );
}
Enumeration en = props.elements();
@@ -1350,33 +1542,31 @@ public class Functional_ORB
String item = (String) en.nextElement();
if (item.equals(REFERENCE))
initial_references.put(item,
- string_to_object(props.getProperty(item))
- );
+ string_to_object(props.getProperty(item))
+ );
}
}
}
/**
- * Get the next instance with a response being received. If all currently
- * sent responses not yet processed, this method pauses till at least one of
- * them is complete. If there are no requests currently sent, the method
- * pauses till some request is submitted and the response is received.
- * This strategy is identical to the one accepted by Suns 1.4 ORB
- * implementation.
+ * Get the next instance with a response being received. If all currently sent
+ * responses not yet processed, this method pauses till at least one of them
+ * is complete. If there are no requests currently sent, the method pauses
+ * till some request is submitted and the response is received. This strategy
+ * is identical to the one accepted by Suns 1.4 ORB implementation.
*
- * The returned response is removed from the list of the currently
- * submitted responses and is never returned again.
+ * The returned response is removed from the list of the currently submitted
+ * responses and is never returned again.
*
* @return the previously sent request that now contains the received
* response.
*
* @throws WrongTransaction If the method was called from the transaction
- * scope different than the one, used to send the request. The exception
- * can be raised only if the request is implicitly associated with some
- * particular transaction.
+ * scope different than the one, used to send the request. The exception can
+ * be raised only if the request is implicitly associated with some particular
+ * transaction.
*/
- public Request get_next_response()
- throws org.omg.CORBA.WrongTransaction
+ public Request get_next_response() throws org.omg.CORBA.WrongTransaction
{
return asynchron.get_next_response();
}
@@ -1385,8 +1575,8 @@ public class Functional_ORB
* Find if any of the requests that have been previously sent with
* {@link #send_multiple_requests_deferred}, have a response yet.
*
- * @return true if there is at least one response to the previously
- * sent request, false otherwise.
+ * @return true if there is at least one response to the previously sent
+ * request, false otherwise.
*/
public boolean poll_next_response()
{
@@ -1394,12 +1584,12 @@ public class Functional_ORB
}
/**
- * Send multiple prepared requests expecting to get a reply. All requests
- * are send in parallel, each in its own separate thread. When the
- * reply arrives, it is stored in the agreed fields of the corresponing
- * request data structure. If this method is called repeatedly,
- * the new requests are added to the set of the currently sent requests,
- * but the old set is not discarded.
+ * Send multiple prepared requests expecting to get a reply. All requests are
+ * send in parallel, each in its own separate thread. When the reply arrives,
+ * it is stored in the agreed fields of the corresponing request data
+ * structure. If this method is called repeatedly, the new requests are added
+ * to the set of the currently sent requests, but the old set is not
+ * discarded.
*
* @param requests the prepared array of requests.
*
@@ -1414,8 +1604,8 @@ public class Functional_ORB
/**
* Send multiple prepared requests one way, do not caring about the answer.
- * The messages, containing requests, will be marked, indicating that
- * the sender is not expecting to get a reply.
+ * The messages, containing requests, will be marked, indicating that the
+ * sender is not expecting to get a reply.
*
* @param requests the prepared array of requests.
*
@@ -1429,8 +1619,7 @@ public class Functional_ORB
/**
* Set the flag, forcing all server threads to terminate.
*/
- protected void finalize()
- throws java.lang.Throwable
+ protected void finalize() throws java.lang.Throwable
{
running = false;
super.finalize();
diff --git a/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java b/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java
index 1e0e154..f0f4093 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java
@@ -41,13 +41,13 @@ package gnu.CORBA.GIOP;
import gnu.CORBA.CDR.cdrInput;
import gnu.CORBA.CDR.cdrOutput;
-
/**
* The header of the standard reply.
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public abstract class ReplyHeader
+ extends contextSupportingHeader
{
/**
* Reply status, if no exception occured.
@@ -65,9 +65,8 @@ public abstract class ReplyHeader
public static final int SYSTEM_EXCEPTION = 2;
/**
- * Reply status, if the client ORB must re - send
- * the request to another destination. The body
- * contains IOR.
+ * Reply status, if the client ORB must re - send the request to another
+ * destination. The body contains IOR.
*/
public static final int LOCATION_FORWARD = 3;
@@ -84,16 +83,6 @@ public abstract class ReplyHeader
public static final int NEEDS_ADDRESSING_MODE = 5;
/**
- * Empty array, indicating that no service context is available.
- */
- protected static final ServiceContext[] NO_CONTEXT = new ServiceContext[ 0 ];
-
- /**
- * The ORB service data.
- */
- public ServiceContext[] service_context = NO_CONTEXT;
-
- /**
* The status of this reply, holds one of the reply status constants.
*/
public int reply_status;
@@ -110,19 +99,19 @@ public abstract class ReplyHeader
{
switch (reply_status)
{
- case NO_EXCEPTION :
+ case NO_EXCEPTION:
return "ok";
- case USER_EXCEPTION :
+ case USER_EXCEPTION:
return "user exception";
- case SYSTEM_EXCEPTION :
+ case SYSTEM_EXCEPTION:
return "system exception";
- case LOCATION_FORWARD :
+ case LOCATION_FORWARD:
return "moved";
- default :
+ default:
return null;
}
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java b/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java
index f2de4e2..17cccb8 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java
@@ -41,7 +41,6 @@ package gnu.CORBA.GIOP;
import gnu.CORBA.CDR.cdrInput;
import gnu.CORBA.CDR.cdrOutput;
-
import org.omg.CORBA.portable.IDLEntity;
/**
@@ -50,13 +49,13 @@ import org.omg.CORBA.portable.IDLEntity;
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public abstract class RequestHeader
+ extends contextSupportingHeader
implements IDLEntity
{
/**
- * The currently free request id. This field is incremented
- * each time the new request header is constructed. To facilitate
- * error detection, the first free id is equal to 0x01234567
- * (19088743).
+ * The currently free request id. This field is incremented each time the new
+ * request header is constructed. To facilitate error detection, the first
+ * free id is equal to 0x01234567 (19088743).
*/
private static int freeId = 0x01234567;
@@ -71,23 +70,17 @@ public abstract class RequestHeader
public byte[] object_key;
/**
- * A value identifying the requesting principal.
- * Initialised into a single zero byte.
+ * A value identifying the requesting principal. Initialised into a single
+ * zero byte.
*
* @deprecated by CORBA 2.2.
*/
public byte[] requesting_principal;
/**
- * Contains the ORB service data being passed. Initialised as the
- * zero size array by default.
- */
- public ServiceContext[] service_context = new ServiceContext[ 0 ];
-
- /**
- * This is used to associate the reply message with the
- * previous request message. Initialised each time by the
- * different value, increasing form 1 to Integer.MAX_VALUE.
+ * This is used to associate the reply message with the previous request
+ * message. Initialised each time by the different value, increasing form 1 to
+ * Integer.MAX_VALUE.
*/
public int request_id = getNextId();
@@ -97,10 +90,9 @@ public abstract class RequestHeader
protected boolean response_expected = true;
/**
- * Get next free request id. The value of the free request
- * id starts from 0x02345678, it is incremented each time this
- * function is called and is reset to 1 after reaching
- * Integer.MAX_VALUE.
+ * Get next free request id. The value of the free request id starts from
+ * 0x02345678, it is incremented each time this function is called and is
+ * reset to 1 after reaching Integer.MAX_VALUE.
*
* @return the next free request id.
*/
@@ -126,15 +118,15 @@ public abstract class RequestHeader
public abstract boolean isResponseExpected();
/**
- * Converts an byte array into hexadecimal string values.
- * Used in various toString() methods.
+ * Converts an byte array into hexadecimal string values. Used in various
+ * toString() methods.
*/
public String bytes(byte[] array)
{
StringBuffer b = new StringBuffer();
for (int i = 0; i < array.length; i++)
{
- b.append(Integer.toHexString(array [ i ] & 0xFF));
+ b.append(Integer.toHexString(array[i] & 0xFF));
b.append(" ");
}
return b.toString();
@@ -158,4 +150,5 @@ public abstract class RequestHeader
* @param out a stream to write into.
*/
public abstract void write(cdrOutput out);
+
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java b/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java
index 7e44bdce..29a8ea8 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java
@@ -41,7 +41,9 @@ package gnu.CORBA.GIOP;
import gnu.CORBA.CDR.cdrInput;
import gnu.CORBA.CDR.cdrOutput;
-
+import org.omg.CORBA.BAD_INV_ORDER;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.portable.IDLEntity;
/**
@@ -53,16 +55,40 @@ public class ServiceContext
implements IDLEntity
{
/**
- * The context data.
+ * Use serialVersionUID for interoperability.
*/
- public byte[] context_data;
+ private static final long serialVersionUID = 1;
/**
- * The context id.
+ * The context id (for instance, 0x1 for code sets context). At the moment of
+ * writing, the OMG defines 16 standard values and provides rules to register
+ * the vendor specific context ids. The range 0-4095 is reserved for the
+ * future standard OMG contexts.
*/
public int context_id;
/**
+ * The context_data.
+ */
+ public byte[] context_data;
+
+ /**
+ * Crete unitialised instance.
+ */
+ public ServiceContext()
+ {
+ }
+
+ /**
+ * Create from omg context.
+ */
+ public ServiceContext(org.omg.IOP.ServiceContext from)
+ {
+ context_id = from.context_id;
+ context_data = from.context_data;
+ }
+
+ /**
* Read the context values from the stream.
*
* @param istream a stream to read from.
@@ -73,13 +99,13 @@ public class ServiceContext
switch (id)
{
- case cxCodeSet.ID :
+ case cxCodeSet.ID:
cxCodeSet codeset = new cxCodeSet();
codeset.readContext(istream);
return codeset;
- default :
+ default:
ServiceContext ctx = new ServiceContext();
ctx.context_id = id;
@@ -94,9 +120,9 @@ public class ServiceContext
public static ServiceContext[] readSequence(cdrInput istream)
{
int size = istream.read_long();
- ServiceContext[] value = new gnu.CORBA.GIOP.ServiceContext[ size ];
+ ServiceContext[] value = new gnu.CORBA.GIOP.ServiceContext[size];
for (int i = 0; i < value.length; i++)
- value [ i ] = read(istream);
+ value[i] = read(istream);
return value;
}
@@ -118,7 +144,99 @@ public class ServiceContext
{
ostream.write_long(value.length);
for (int i = 0; i < value.length; i++)
- value [ i ].write(ostream);
+ value[i].write(ostream);
+ }
+
+ /**
+ * Add context to the given array of contexts.
+ */
+ public static void add(org.omg.IOP.ServiceContext[] cx,
+ org.omg.IOP.ServiceContext service_context, boolean replace)
+ {
+ int exists = -1;
+
+ for (int i = 0; i < cx.length; i++)
+ if (cx[i].context_id == service_context.context_id)
+ exists = i;
+
+ if (exists < 0)
+ {
+ // Add context.
+ org.omg.IOP.ServiceContext[] n = new org.omg.IOP.ServiceContext[cx.length + 1];
+ for (int i = 0; i < cx.length; i++)
+ n[i] = cx[i];
+ n[cx.length] = service_context;
+ }
+ else
+ {
+ // Replace context.
+ if (!replace)
+ throw new BAD_INV_ORDER("Repetetive setting of the context "
+ + service_context.context_id, 15,
+ CompletionStatus.COMPLETED_NO);
+ else
+ cx[exists] = service_context;
+ }
+ }
+
+ /**
+ * Add context to the given array of contexts.
+ */
+ public static ServiceContext[] add(ServiceContext[] cx,
+ org.omg.IOP.ServiceContext service_context, boolean replace)
+ {
+ int exists = -1;
+
+ for (int i = 0; i < cx.length; i++)
+ if (cx[i].context_id == service_context.context_id)
+ exists = i;
+
+ if (exists < 0)
+ {
+ // Add context.
+ ServiceContext[] n = new ServiceContext[cx.length + 1];
+ for (int i = 0; i < cx.length; i++)
+ n[i] = cx[i];
+ n[cx.length] = new ServiceContext(service_context);
+ return n;
+ }
+ else
+ {
+ // Replace context.
+ if (!replace)
+ throw new BAD_INV_ORDER("Repetetive setting of the context "
+ + service_context.context_id, 15,
+ CompletionStatus.COMPLETED_NO);
+ else
+ cx[exists] = new ServiceContext(service_context);
+ return cx;
+ }
+ }
+
+
+ /**
+ * Find context with the given name in the context array.
+ */
+ public static org.omg.IOP.ServiceContext findContext(int ctx_name,
+ org.omg.IOP.ServiceContext[] cx)
+ {
+ for (int i = 0; i < cx.length; i++)
+ if (cx[i].context_id == ctx_name)
+ return cx[i];
+ throw new BAD_PARAM("No context with id " + ctx_name);
+ }
+
+ /**
+ * Find context with the given name in the context array,
+ * converting into org.omg.IOP.ServiceContext.
+ */
+ public static org.omg.IOP.ServiceContext findContext(int ctx_name,
+ ServiceContext[] cx)
+ {
+ for (int i = 0; i < cx.length; i++)
+ if (cx[i].context_id == ctx_name)
+ return new org.omg.IOP.ServiceContext(ctx_name, cx[i].context_data);
+ throw new BAD_PARAM("No context with id " + ctx_name);
}
/**
@@ -126,6 +244,6 @@ public class ServiceContext
*/
public String toString()
{
- return "ctx "+context_id+", size "+context_data.length;
+ return "ctx " + context_id + ", size " + context_data.length;
}
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java b/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java
index ffa45c3..7ede4e5 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java
@@ -40,11 +40,11 @@ package gnu.CORBA.GIOP.v1_0;
import gnu.CORBA.CDR.cdrInput;
import gnu.CORBA.CDR.cdrOutput;
-
-import org.omg.CORBA.portable.IDLEntity;
import gnu.CORBA.GIOP.ServiceContext;
import gnu.CORBA.GIOP.cxCodeSet;
+import org.omg.CORBA.portable.IDLEntity;
+
/**
* The GIOP 1.0 request message.
*
diff --git a/libjava/classpath/gnu/CORBA/IOR.java b/libjava/classpath/gnu/CORBA/IOR.java
index cedbce4..02e94aa 100644
--- a/libjava/classpath/gnu/CORBA/IOR.java
+++ b/libjava/classpath/gnu/CORBA/IOR.java
@@ -47,22 +47,29 @@ import gnu.CORBA.GIOP.cxCodeSet;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.ULongSeqHelper;
+import org.omg.IOP.TAG_INTERNET_IOP;
+import org.omg.IOP.TAG_MULTIPLE_COMPONENTS;
+import org.omg.IOP.TaggedComponent;
+import org.omg.IOP.TaggedComponentHelper;
+import org.omg.IOP.TaggedProfile;
+import org.omg.IOP.TaggedProfileHelper;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.util.ArrayList;
/**
- * The implementaton of the Interoperable Object Reference (IOR).
- * IOR can be compared with the Internet address for a web page,
- * it provides means to locate the CORBA service on the web.
- * IOR contains the host address, port number, the object identifier
- * (key) inside the server, the communication protocol version,
- * supported charsets and so on.
+ * The implementaton of the Interoperable Object Reference (IOR). IOR can be
+ * compared with the Internet address for a web page, it provides means to
+ * locate the CORBA service on the web. IOR contains the host address, port
+ * number, the object identifier (key) inside the server, the communication
+ * protocol version, supported charsets and so on.
*
- * Ths class provides method for encoding and
- * decoding the IOR information from/to the stringified references,
- * usually returned by {@link org.omg.CORBA.ORB#String object_to_string()}.
+ * Ths class provides method for encoding and decoding the IOR information
+ * from/to the stringified references, usually returned by
+ * {@link org.omg.CORBA.ORB#String object_to_string()}.
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*
@@ -72,10 +79,22 @@ import java.io.IOException;
public class IOR
{
/**
- * The code sets profile.
+ * The code sets tagged component, normally part of the Internet profile. This
+ * compone consists of the two componenets itself.
*/
public static class CodeSets_profile
{
+ public CodeSets_profile()
+ {
+ int[] supported = CharSets_OSF.getSupportedCharSets();
+
+ narrow.native_set = CharSets_OSF.NATIVE_CHARACTER;
+ narrow.conversion = supported;
+
+ wide.native_set = CharSets_OSF.NATIVE_WIDE_CHARACTER;
+ wide.conversion = supported;
+ }
+
/**
* The code set component.
*/
@@ -112,7 +131,7 @@ public class IOR
b.append(" conversion ");
for (int i = 0; i < conversion.length; i++)
{
- b.append(name(conversion [ i ]));
+ b.append(name(conversion[i]));
b.append(' ');
}
}
@@ -131,8 +150,8 @@ public class IOR
private String name(int set)
{
- return "0x" + Integer.toHexString(set) + " (" +
- CharSets_OSF.getName(set) + ") ";
+ return "0x" + Integer.toHexString(set) + " ("
+ + CharSets_OSF.getName(set) + ") ";
}
}
@@ -201,7 +220,7 @@ public class IOR
/**
* The internet profile.
*/
- public static class Internet_profile
+ public class Internet_profile
{
/**
* The agreed tag for the Internet profile.
@@ -224,6 +243,18 @@ public class IOR
public int port;
/**
+ * The code sets component in the internet profile of this IOR. This is not
+ * a separate profile.
+ */
+ public CodeSets_profile CodeSets = new CodeSets_profile();
+
+ /**
+ * Reserved for all components of this profile, this array holds the
+ * components other than code set components.
+ */
+ ArrayList components = new ArrayList();
+
+ /**
* Return the human readable representation.
*/
public String toString()
@@ -235,22 +266,63 @@ public class IOR
b.append(" (v");
b.append(version);
b.append(")");
+ if (components.size() > 0)
+ b.append(" " + components.size() + " extra components.");
return b.toString();
}
+
+ /**
+ * Write the internet profile (except the heading tag.
+ */
+ public void write(cdrOutput out)
+ {
+ try
+ {
+ // Need to write the Internet profile into the separate
+ // stream as we must know the size in advance.
+ cdrOutput b = out.createEncapsulation();
+
+ version.write(b);
+ b.write_string(host);
+
+ b.write_ushort((short) (port & 0xFFFF));
+
+ // Write the object key.
+ b.write_long(key.length);
+ b.write(key);
+
+ // Number of the tagged components.
+ b.write_long(1 + components.size());
+
+ b.write_long(CodeSets_profile.TAG_CODE_SETS);
+ CodeSets.write(b);
+
+ TaggedComponent t;
+
+ for (int i = 0; i < components.size(); i++)
+ {
+ t = (TaggedComponent) components.get(i);
+ TaggedComponentHelper.write(b, t);
+ }
+
+ b.close();
+ }
+ catch (Exception e)
+ {
+ MARSHAL m = new MARSHAL("Unable to write Internet profile.");
+ m.initCause(e);
+ throw m;
+ }
+ }
}
/**
- * The standard minor code, indicating that the string to object
- * converstio has failed due non specific reasons.
+ * The standard minor code, indicating that the string to object converstio
+ * has failed due non specific reasons.
*/
public static final int FAILED = 10;
/**
- * The code sets profile of this IOR.
- */
- public CodeSets_profile CodeSets = new CodeSets_profile();
-
- /**
* The internet profile of this IOR.
*/
public Internet_profile Internet = new Internet_profile();
@@ -261,45 +333,35 @@ public class IOR
public String Id;
/**
- * The additional tagged components, encapsulated in
- * the byte arrays. They are only supported by the
- * later versions, than currently implemented.
+ * The object key.
*/
- public byte[][] extra;
+ public byte[] key;
/**
- * The object key.
+ * All tagged profiles of this IOR, except the separately defined Internet
+ * profile.
*/
- public byte[] key;
+ ArrayList profiles = new ArrayList();
/**
- * True if the profile was encoded using the Big Endian or
- * the encoding is not known.
+ * True if the profile was encoded using the Big Endian or the encoding is not
+ * known.
*
* false if it was encoded using the Little Endian.
*/
public boolean Big_Endian = true;
/**
- * Create an empty instance, initialising the code sets to default
- * values.
+ * Create an empty instance, initialising the code sets to default values.
*/
public IOR()
{
- int[] supported = CharSets_OSF.getSupportedCharSets();
-
- CodeSets.narrow.native_set = CharSets_OSF.NATIVE_CHARACTER;
- CodeSets.narrow.conversion = supported;
-
- CodeSets.wide.native_set = CharSets_OSF.NATIVE_WIDE_CHARACTER;
- CodeSets.wide.conversion = supported;
}
/**
* Parse the provided stringifed reference.
*
- * @param stringified_reference, in the form of
- * IOR:nnnnnn.....
+ * @param stringified_reference, in the form of IOR:nnnnnn.....
*
* @return the parsed IOR
*
@@ -308,14 +370,13 @@ public class IOR
* TODO corballoc and other alternative formats.
*/
public static IOR parse(String stringified_reference)
- throws BAD_PARAM
+ throws BAD_PARAM
{
try
{
if (!stringified_reference.startsWith("IOR:"))
throw new BAD_PARAM("The string refernce must start with IOR:",
- FAILED, CompletionStatus.COMPLETED_NO
- );
+ FAILED, CompletionStatus.COMPLETED_NO);
IOR r = new IOR();
@@ -340,8 +401,7 @@ public class IOR
{
ex.printStackTrace();
throw new BAD_PARAM(ex + " while parsing " + stringified_reference,
- FAILED, CompletionStatus.COMPLETED_NO
- );
+ FAILED, CompletionStatus.COMPLETED_NO);
}
}
@@ -352,7 +412,7 @@ public class IOR
* @throws IOException if the stream throws it.
*/
public void _read(cdrInput c)
- throws IOException, BAD_PARAM
+ throws IOException, BAD_PARAM
{
int endian;
@@ -366,23 +426,21 @@ public class IOR
}
/**
- * Read the IOR from the provided input stream, not reading
- * the endian data at the beginning of the stream. The IOR is
- * thansferred in this form in
+ * Read the IOR from the provided input stream, not reading the endian data at
+ * the beginning of the stream. The IOR is thansferred in this form in
* {@link write_Object(org.omg.CORBA.Object)}.
*
* If the stream contains a null value, the Id and Internet fields become
- * equal to null. Otherwise Id contains some string (possibly
- * empty).
+ * equal to null. Otherwise Id contains some string (possibly empty).
*
- * Id is checked for null in cdrInput that then returns
- * null instead of object.
+ * Id is checked for null in cdrInput that then returns null instead of
+ * object.
*
* @param c a stream to read from.
* @throws IOException if the stream throws it.
*/
public void _read_no_endian(cdrInput c)
- throws IOException, BAD_PARAM
+ throws IOException, BAD_PARAM
{
Id = c.read_string();
@@ -407,9 +465,7 @@ public class IOR
Internet.host = profile.read_string();
Internet.port = profile.gnu_read_ushort();
- int lk = profile.read_long();
- key = new byte[ lk ];
- profile.read(key);
+ key = profile.read_sequence();
// Read tagged components.
int n_components = 0;
@@ -425,7 +481,16 @@ public class IOR
if (ctag == CodeSets_profile.TAG_CODE_SETS)
{
- CodeSets.read(profile);
+ Internet.CodeSets.read(profile);
+ }
+ else
+ {
+ // Construct a generic component for codesets
+ // profile.
+ TaggedComponent pc = new TaggedComponent();
+ pc.tag = ctag;
+ pc.component_data = profile.read_sequence();
+ Internet.components.add(pc);
}
}
}
@@ -434,12 +499,21 @@ public class IOR
ex.printStackTrace();
}
}
+ else
+ {
+ // Construct a generic profile.
+ TaggedProfile p = new TaggedProfile();
+ p.tag = tag;
+ p.profile_data = profile.buffer.getBuffer();
+
+ profiles.add(p);
+ }
}
}
/**
- * Write this IOR record to the provided CDR stream.
- * This procedure writes the zero (Big Endian) marker first.
+ * Write this IOR record to the provided CDR stream. This procedure writes the
+ * zero (Big Endian) marker first.
*/
public void _write(cdrOutput out)
{
@@ -451,8 +525,8 @@ public class IOR
/**
* Write a null value to the CDR output stream.
*
- * The null value is written as defined in OMG specification
- * (zero length string, followed by an empty set of profiles).
+ * The null value is written as defined in OMG specification (zero length
+ * string, followed by an empty set of profiles).
*/
public static void write_null(cdrOutput out)
{
@@ -464,47 +538,27 @@ public class IOR
}
/**
- * Write this IOR record to the provided CDR stream. The procedure
- * writed data in Big Endian, but does NOT add any endian marker
- * to the beginning.
+ * Write this IOR record to the provided CDR stream. The procedure writed data
+ * in Big Endian, but does NOT add any endian marker to the beginning.
*/
public void _write_no_endian(cdrOutput out)
{
- try
- {
- // Write repository id.
- out.write_string(Id);
-
- // Always one profile.
- out.write_long(1);
-
- // It is the Internet profile.
- out.write_long(Internet_profile.TAG_INTERNET_IOP);
+ // Write repository id.
+ out.write_string(Id);
- // Need to write the Internet profile into the separate
- // stream as we must know the size in advance.
- cdrOutput b = out.createEncapsulation();
+ out.write_long(1 + profiles.size());
- Internet.version.write(b);
- b.write_string(Internet.host);
+ // Write the Internet profile.
+ out.write_long(Internet_profile.TAG_INTERNET_IOP);
+ Internet.write(out);
- b.write_ushort((short) (Internet.port & 0xFFFF));
+ // Write other profiles.
+ TaggedProfile tp;
- // Write the object key.
- b.write_long(key.length);
- b.write(key);
-
- // One tagged component.
- b.write_long(1);
-
- b.write_long(CodeSets_profile.TAG_CODE_SETS);
- CodeSets.write(b);
-
- b.close();
- }
- catch (IOException ex)
+ for (int i = 0; i < profiles.size(); i++)
{
- Unexpected.error(ex);
+ tp = (TaggedProfile) profiles.get(i);
+ TaggedProfileHelper.write(out, tp);
}
}
@@ -525,11 +579,11 @@ public class IOR
for (int i = 0; i < key.length; i++)
{
- b.append(Integer.toHexString(key [ i ] & 0xFF));
+ b.append(Integer.toHexString(key[i] & 0xFF));
}
b.append(" ");
- b.append(CodeSets);
+ b.append(Internet.CodeSets);
return b.toString();
}
@@ -552,7 +606,7 @@ public class IOR
for (int i = 0; i < binary.length; i++)
{
- s = Integer.toHexString(binary [ i ] & 0xFF);
+ s = Integer.toHexString(binary[i] & 0xFF);
if (s.length() == 1)
b.append('0');
b.append(s);
@@ -560,4 +614,105 @@ public class IOR
return b.toString();
}
+
+ /**
+ * Adds a service-specific component to the IOR profile. The specified
+ * component will be included in all profiles, present in the IOR.
+ *
+ * @param tagged_component a tagged component being added.
+ */
+ public void add_ior_component(TaggedComponent tagged_component)
+ {
+ // Add to the Internet profile.
+ Internet.components.add(tagged_component);
+
+ // Add to others.
+ for (int i = 0; i < profiles.size(); i++)
+ {
+ TaggedProfile profile = (TaggedProfile) profiles.get(i);
+ addComponentTo(profile, tagged_component);
+ }
+ }
+
+ /**
+ * Adds a service-specific component to the IOR profile.
+ *
+ * @param tagged_component a tagged component being added.
+ *
+ * @param profile_id the IOR profile to that the component must be added. The
+ * 0 value ({@link org.omg.IOP.TAG_INTERNET_IOP#value}) adds to the Internet
+ * profile where host and port are stored by default.
+ */
+ public void add_ior_component_to_profile(TaggedComponent tagged_component,
+ int profile_id)
+ {
+ if (profile_id == TAG_INTERNET_IOP.value)
+ // Add to the Internet profile
+ Internet.components.add(tagged_component);
+ else
+ {
+ // Add to others.
+ for (int i = 0; i < profiles.size(); i++)
+ {
+ TaggedProfile profile = (TaggedProfile) profiles.get(i);
+ if (profile.tag == profile_id)
+ addComponentTo(profile, tagged_component);
+ }
+ }
+ }
+
+ /**
+ * Add given component to the given profile that is NOT an Internet profile.
+ *
+ * @param profile the profile, where the component should be added.
+ * @param component the component to add.
+ */
+ private static void addComponentTo(TaggedProfile profile,
+ TaggedComponent component)
+ {
+ if (profile.tag == TAG_MULTIPLE_COMPONENTS.value)
+ {
+ TaggedComponent[] present;
+ if (profile.profile_data.length > 0)
+ {
+ cdrBufInput in = new cdrBufInput(profile.profile_data);
+
+ present = new TaggedComponent[in.read_long()];
+
+ for (int i = 0; i < present.length; i++)
+ {
+ present[i] = TaggedComponentHelper.read(in);
+ }
+ }
+ else
+ present = new TaggedComponent[0];
+
+ cdrBufOutput out = new cdrBufOutput(profile.profile_data.length
+ + component.component_data.length
+ + 8);
+
+ // Write new amount of components.
+ out.write_long(present.length + 1);
+
+ // Write other components.
+ for (int i = 0; i < present.length; i++)
+ TaggedComponentHelper.write(out, present[i]);
+
+ // Write the passed component.
+ TaggedComponentHelper.write(out, component);
+
+ try
+ {
+ out.close();
+ }
+ catch (IOException e)
+ {
+ throw new Unexpected(e);
+ }
+ profile.profile_data = out.buffer.toByteArray();
+ }
+ else
+ // The future supported tagged profiles should be added here.
+ throw new BAD_PARAM("Unsupported profile type " + profile.tag);
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/IOR_Delegate.java b/libjava/classpath/gnu/CORBA/IOR_Delegate.java
index b06f630..3b64eb5 100644
--- a/libjava/classpath/gnu/CORBA/IOR_Delegate.java
+++ b/libjava/classpath/gnu/CORBA/IOR_Delegate.java
@@ -40,7 +40,9 @@ package gnu.CORBA;
import gnu.CORBA.CDR.cdrBufInput;
import gnu.CORBA.GIOP.ReplyHeader;
+import gnu.CORBA.Poa.activeObjectMap;
+import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.Context;
import org.omg.CORBA.ContextList;
import org.omg.CORBA.ExceptionList;
@@ -53,6 +55,7 @@ import org.omg.CORBA.portable.ApplicationException;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.RemarshalException;
+import org.omg.PortableInterceptor.ForwardRequest;
import java.io.IOException;
@@ -67,10 +70,20 @@ import java.net.Socket;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class IOR_Delegate
- extends Simple_delegate
+public class IOR_Delegate extends Simple_delegate
{
/**
+ * True if the current IOR does not map into the local servant. If false, the
+ * IOR is either local or should be checked.
+ */
+ boolean remote_ior;
+
+ /**
+ * If not null, this field contains data about the local servant.
+ */
+ activeObjectMap.Obj local_ior;
+
+ /**
* Contructs an instance of object using the given IOR.
*/
public IOR_Delegate(ORB an_orb, IOR an_ior)
@@ -92,11 +105,10 @@ public class IOR_Delegate
* @return the created request.
*/
public Request create_request(org.omg.CORBA.Object target, Context context,
- String operation, NVList parameters,
- NamedValue returns
- )
+ String operation, NVList parameters, NamedValue returns
+ )
{
- gnuRequest request = new gnuRequest();
+ gnuRequest request = getRequestInstance(target);
request.setIor(getIor());
request.set_target(target);
@@ -122,12 +134,11 @@ public class IOR_Delegate
* @return the created request.
*/
public Request create_request(org.omg.CORBA.Object target, Context context,
- String operation, NVList parameters,
- NamedValue returns, ExceptionList exceptions,
- ContextList ctx_list
- )
+ String operation, NVList parameters, NamedValue returns,
+ ExceptionList exceptions, ContextList ctx_list
+ )
{
- gnuRequest request = new gnuRequest();
+ gnuRequest request = getRequestInstance(target);
request.setIor(ior);
request.set_target(target);
@@ -144,100 +155,219 @@ public class IOR_Delegate
}
/**
- * Invoke operation on the given object, writing parameters to the given
- * output stream.
+ * Get the instance of request.
+ */
+ protected gnuRequest getRequestInstance(org.omg.CORBA.Object target)
+ {
+ return new gnuRequest();
+ }
+
+ /**
+ * Invoke operation on the given object, als handling temproray and permanent
+ * redirections. The ReplyHeader.LOCATION_FORWARD will cause to resend the
+ * request to the new direction. The ReplyHeader.LOCATION_FORWARD_PERM will
+ * cause additionally to remember the new location by this delegate, so
+ * subsequent calls will be immediately delivered to the new target.
*
* @param target the target object.
* @param output the output stream, previously returned by
* {@link #request(org.omg.CORBA.Object, String, boolean)}.
*
- * @return the input stream, to read the response from or null for a
- * one-way request.
+ * @return the input stream, to read the response from or null for a one-way
+ * request.
*
* @throws SystemException if the SystemException has been thrown on the
- * remote side (the exact type and the minor code matches the data of
- * the remote exception that has been thrown).
+ * remote side (the exact type and the minor code matches the data of the
+ * remote exception that has been thrown).
*
* @throws org.omg.CORBA.portable.ApplicationException as specified.
* @throws org.omg.CORBA.portable.RemarshalException as specified.
*/
public InputStream invoke(org.omg.CORBA.Object target, OutputStream output)
- throws ApplicationException, RemarshalException
+ throws ApplicationException, RemarshalException
{
streamRequest request = (streamRequest) output;
- if (request.response_expected)
+ Forwardings:
+ while (true)
{
- binaryReply response = request.request.submit();
-
- // Read reply header.
- ReplyHeader rh = response.header.create_reply_header();
- cdrBufInput input = response.getStream();
- input.setOrb(orb);
- rh.read(input);
-
- boolean moved_permanently = false;
-
- switch (rh.reply_status)
+ try
{
- case ReplyHeader.NO_EXCEPTION :
- if (response.header.version.since_inclusive(1, 2))
- input.align(8);
- return input;
-
- case ReplyHeader.SYSTEM_EXCEPTION :
- if (response.header.version.since_inclusive(1, 2))
- input.align(8);
- throw ObjectCreator.readSystemException(input);
-
- case ReplyHeader.USER_EXCEPTION :
- if (response.header.version.since_inclusive(1, 2))
- input.align(8);
- input.mark(2000);
-
- String uxId = input.read_string();
- input.reset();
-
- throw new ApplicationException(uxId, input);
-
- case ReplyHeader.LOCATION_FORWARD_PERM :
- moved_permanently = true;
-
- case ReplyHeader.LOCATION_FORWARD :
- if (response.header.version.since_inclusive(1, 2))
- input.align(8);
-
- IOR forwarded = new IOR();
- try
- {
- forwarded._read_no_endian(input);
- }
- catch (IOException ex)
- {
- MARSHAL t = new MARSHAL("Cant read forwarding info");
- t.initCause(ex);
- throw t;
- }
-
- request.request.setIor(forwarded);
-
- // If the object has moved permanently, its IOR is replaced.
- if (moved_permanently)
- setIor(forwarded);
-
- return invoke(target, request);
-
- default :
- throw new MARSHAL("Unknow reply status: " + rh.reply_status);
+ if (request.response_expected)
+ {
+ binaryReply response = request.request.submit();
+
+ // Read reply header.
+ ReplyHeader rh = response.header.create_reply_header();
+ cdrBufInput input = response.getStream();
+ input.setOrb(orb);
+ rh.read(input);
+ request.request.m_rph = rh;
+
+ boolean moved_permanently = false;
+
+ switch (rh.reply_status)
+ {
+ case ReplyHeader.NO_EXCEPTION :
+ if (request.request.m_interceptor != null)
+ request.request.m_interceptor.
+ receive_reply(request.request.m_info);
+ if (response.header.version.since_inclusive(1, 2))
+ input.align(8);
+ return input;
+
+ case ReplyHeader.SYSTEM_EXCEPTION :
+ if (response.header.version.since_inclusive(1, 2))
+ input.align(8);
+ showException(request, input);
+
+ throw ObjectCreator.readSystemException(input);
+
+ case ReplyHeader.USER_EXCEPTION :
+ if (response.header.version.since_inclusive(1, 2))
+ input.align(8);
+ showException(request, input);
+
+ throw new ApplicationException(request.
+ request.m_exception_id, input
+ );
+
+ case ReplyHeader.LOCATION_FORWARD_PERM :
+ moved_permanently = true;
+
+ case ReplyHeader.LOCATION_FORWARD :
+ if (response.header.version.since_inclusive(1, 2))
+ input.align(8);
+
+ IOR forwarded = new IOR();
+ try
+ {
+ forwarded._read_no_endian(input);
+ }
+ catch (IOException ex)
+ {
+ MARSHAL t =
+ new MARSHAL("Cant read forwarding info", 5102,
+ CompletionStatus.COMPLETED_NO
+ );
+ t.initCause(ex);
+ throw t;
+ }
+
+ gnuRequest prev = request.request;
+ gnuRequest r = getRequestInstance(target);
+
+ r.m_interceptor = prev.m_interceptor;
+ r.m_slots = prev.m_slots;
+
+ r.m_args = prev.m_args;
+ r.m_context = prev.m_context;
+ r.m_context_list = prev.m_context_list;
+ r.m_environment = prev.m_environment;
+ r.m_exceptions = prev.m_exceptions;
+ r.m_operation = prev.m_operation;
+ r.m_parameter_buffer = prev.m_parameter_buffer;
+ r.m_parameter_buffer.request = r;
+ r.m_result = prev.m_result;
+ r.m_target = prev.m_target;
+ r.oneWay = prev.oneWay;
+ r.m_forward_ior = forwarded;
+
+ if (r.m_interceptor != null)
+ r.m_interceptor.receive_other(r.m_info);
+
+ r.setIor(forwarded);
+
+ IOR_contructed_object it =
+ new IOR_contructed_object(orb, forwarded);
+
+ r.m_target = it;
+
+ request.request = r;
+
+ IOR prev_ior = getIor();
+
+ setIor(forwarded);
+
+ try
+ {
+ return invoke(it, request);
+ }
+ finally
+ {
+ if (!moved_permanently)
+ setIor(prev_ior);
+ }
+
+ default :
+ throw new MARSHAL("Unknow reply status: " +
+ rh.reply_status, 8000 + rh.reply_status,
+ CompletionStatus.COMPLETED_NO
+ );
+ }
+ }
+ else
+ {
+ request.request.send_oneway();
+ return null;
+ }
+ }
+ catch (ForwardRequest forwarded)
+ {
+ ForwardRequest fw = forwarded;
+ Forwarding2:
+ while (true)
+ {
+ try
+ {
+ gnuRequest prev = request.request;
+ gnuRequest r = getRequestInstance(target);
+
+ r.m_interceptor = prev.m_interceptor;
+ r.m_args = prev.m_args;
+ r.m_context = prev.m_context;
+ r.m_context_list = prev.m_context_list;
+ r.m_environment = prev.m_environment;
+ r.m_exceptions = prev.m_exceptions;
+ r.m_operation = prev.m_operation;
+ r.m_parameter_buffer = prev.m_parameter_buffer;
+ r.m_parameter_buffer.request = r;
+ r.m_result = prev.m_result;
+ r.m_target = prev.m_target;
+ r.oneWay = prev.oneWay;
+
+ r.m_forwarding_target = fw.forward;
+
+ if (r.m_interceptor != null)
+ r.m_interceptor.receive_other(r.m_info);
+
+ r.m_target = fw.forward;
+ request.request = r;
+ break Forwarding2;
+ }
+ catch (ForwardRequest e)
+ {
+ forwarded = e;
+ }
+ }
}
- }
- else
- {
- request.request.send_oneway();
- return null;
}
}
/**
+ * Show exception to interceptor.
+ */
+ void showException(streamRequest request, cdrBufInput input)
+ throws ForwardRequest
+ {
+ input.mark(2048);
+ request.request.m_exception_id = input.read_string();
+ input.reset();
+
+ if (request.request.m_interceptor != null)
+ request.request.m_interceptor.receive_exception(request.request.m_info);
+ }
+
+ /**
* Create a request to invoke the method of this CORBA object.
*
* @param target the CORBA object, to that this operation must be applied.
@@ -247,7 +377,7 @@ public class IOR_Delegate
*/
public Request request(org.omg.CORBA.Object target, String operation)
{
- gnuRequest request = new gnuRequest();
+ gnuRequest request = getRequestInstance(target);
request.setIor(ior);
request.set_target(target);
@@ -269,27 +399,28 @@ public class IOR_Delegate
* @return the stream where the method arguments should be written.
*/
public OutputStream request(org.omg.CORBA.Object target, String operation,
- boolean response_expected
- )
+ boolean response_expected
+ )
{
- gnuRequest request = new gnuRequest();
+ gnuRequest request = getRequestInstance(target);
request.setIor(ior);
request.set_target(target);
request.setOperation(operation);
- request.getParameterStream().response_expected = response_expected;
+ streamRequest out = request.getParameterStream();
+ out.response_expected = response_expected;
request.setORB(orb);
- return request.getParameterStream();
+ return out;
}
/**
- * If there is an opened cache socket to access this object, close
- * that socket.
+ * If there is an opened cache socket to access this object, close that
+ * socket.
*
- * @param target The target is not used, this delegate requires a
- * single instance per object.
+ * @param target The target is not used, this delegate requires a single
+ * instance per object.
*/
public void release(org.omg.CORBA.Object target)
{
@@ -308,4 +439,28 @@ public class IOR_Delegate
// do nothing, then.
}
}
+
+ /**
+ * Reset the remote_ior flag, forcing to check if the object is local on the
+ * next getRequestInstance call.
+ */
+ public void setIor(IOR an_ior)
+ {
+ super.setIor(an_ior);
+ remote_ior = false;
+ local_ior = null;
+ }
+
+ /**
+ * Checks if the ior is local so far it is easy.
+ */
+ public boolean is_local(org.omg.CORBA.Object self)
+ {
+ if (remote_ior)
+ return false;
+ else if (local_ior != null)
+ return true;
+ else
+ return super.is_local(self);
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java b/libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java
index fda46ad..e46bed7 100644
--- a/libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java
+++ b/libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package gnu.CORBA.NamingService;
import gnu.CORBA.Functional_ORB;
+import gnu.CORBA.IOR;
import org.omg.CosNaming.NamingContextExt;
@@ -47,15 +48,14 @@ import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
/**
- * The server for the gnu classpath naming service. This is an executable
- * class that must be started to launch the GNU Classpath CORBA
- * transient naming service.
- *
+ * The server for the gnu classpath naming service. This is an executable class
+ * that must be started to launch the GNU Classpath CORBA transient naming
+ * service.
+ *
* GNU Classpath currently works with this naming service and is also
- * interoperable with the Sun Microsystems naming services from
- * releases 1.3 and 1.4, both transient <i>tnameserv</i> and persistent
- * <i>orbd</i>.
- *
+ * interoperable with the Sun Microsystems naming services from releases 1.3 and
+ * 1.4, both transient <i>tnameserv</i> and persistent <i>orbd</i>.
+ *
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class NamingServiceTransient
@@ -67,9 +67,9 @@ public class NamingServiceTransient
public static final int PORT = 900;
/**
- * Get the object key for the naming service. The default
- * key is the string "NameService" in ASCII.
- *
+ * Get the object key for the naming service. The default key is the string
+ * "NameService" in ASCII.
+ *
* @return the byte array.
*/
public static byte[] getDefaultKey()
@@ -85,15 +85,14 @@ public class NamingServiceTransient
}
/**
- * Start the naming service on the current host at the given port.
- * The parameter -org.omg.CORBA.ORBInitialPort NNN or
- * -ORBInitialPort NNN, if present, specifies the port, on that
- * the service must be started. If this key is not specified,
- * the service starts at the port 900.
- *
- * The parameter -ior FILE_NAME, if present, forces to store the ior string
- * of this naming service to the specified file.
- *
+ * Start the naming service on the current host at the given port. The
+ * parameter -org.omg.CORBA.ORBInitialPort NNN or -ORBInitialPort NNN, if
+ * present, specifies the port, on that the service must be started. If this
+ * key is not specified, the service starts at the port 900.
+ *
+ * The parameter -ior FILE_NAME, if present, forces to store the ior string of
+ * this naming service to the specified file.
+ *
* @param args the parameter string.
*/
public static void main(String[] args)
@@ -108,21 +107,24 @@ public class NamingServiceTransient
if (args.length > 1)
for (int i = 0; i < args.length - 1; i++)
{
- if (args [ i ].endsWith("ORBInitialPort"))
- port = Integer.parseInt(args [ i + 1 ]);
+ if (args[i].endsWith("ORBInitialPort"))
+ port = Integer.parseInt(args[i + 1]);
- if (args [ i ].equals("-ior"))
- iorf = args [ i + 1 ];
+ if (args[i].equals("-ior"))
+ iorf = args[i + 1];
}
Functional_ORB.setPort(port);
// Create the servant and register it with the ORB
NamingContextExt namer = new Ext(new TransientContext());
- orb.connect(namer, getDefaultKey());
+
+ // Case with the key "NameService".
+ orb.connect(namer, "NameService".getBytes());
// Storing the IOR reference.
String ior = orb.object_to_string(namer);
+ IOR iorr = IOR.parse(ior);
if (iorf != null)
{
FileOutputStream f = new FileOutputStream(iorf);
@@ -131,22 +133,23 @@ public class NamingServiceTransient
p.close();
}
- System.out.println("GNU Classpath, transient naming service. " +
- "Copyright (C) 2005 Free Software Foundation\n" +
- "This tool comes with ABSOLUTELY NO WARRANTY. " +
- "This is free software, and you are\nwelcome to " +
- "redistribute it under conditions, defined in " +
- "GNU Classpath license.\n\n" + ior
- );
+ System.out.println("GNU Classpath transient naming service "
+ + "started at " + iorr.Internet.host + ":" + iorr.Internet.port
+ + " key 'NameService'.\n\n"
+ + "Copyright (C) 2005 Free Software Foundation\n"
+ + "This tool comes with ABSOLUTELY NO WARRANTY. "
+ + "This is free software, and you are\nwelcome to "
+ + "redistribute it under conditions, defined in "
+ + "GNU Classpath license.\n\n" + ior);
new Thread()
+ {
+ public void run()
{
- public void run()
- {
- // Wait for invocations from clients.
- orb.run();
- }
- }.start();
+ // Wait for invocations from clients.
+ orb.run();
+ }
+ }.start();
}
catch (Exception e)
{
@@ -154,7 +157,8 @@ public class NamingServiceTransient
e.printStackTrace(System.out);
}
- // Restore the default value for allocating ports for the subsequent objects.
+ // Restore the default value for allocating ports for the subsequent
+ // objects.
Functional_ORB.setPort(Functional_ORB.DEFAULT_INITIAL_PORT);
}
}
diff --git a/libjava/classpath/gnu/CORBA/ObjectCreator.java b/libjava/classpath/gnu/CORBA/ObjectCreator.java
index b99c46b..81c1d06 100644
--- a/libjava/classpath/gnu/CORBA/ObjectCreator.java
+++ b/libjava/classpath/gnu/CORBA/ObjectCreator.java
@@ -1,4 +1,4 @@
-/* ExceptionCreator.java --
+/* ObjectCreator.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,10 +38,15 @@ exception statement from your version. */
package gnu.CORBA;
+import gnu.CORBA.CDR.cdrBufOutput;
+
+import org.omg.CORBA.Any;
import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.CompletionStatusHelper;
import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.StructMember;
import org.omg.CORBA.SystemException;
+import org.omg.CORBA.TCKind;
import org.omg.CORBA.UNKNOWN;
import org.omg.CORBA.UserException;
import org.omg.CORBA.portable.InputStream;
@@ -51,9 +56,8 @@ import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
/**
- * Creates java objects from the agreed IDL names for the simple
- * case when the CORBA object is directly mapped into the locally
- * defined java class.
+ * Creates java objects from the agreed IDL names for the simple case when the
+ * CORBA object is directly mapped into the locally defined java class.
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
@@ -70,20 +74,17 @@ public class ObjectCreator
public static final String JAVA_PREFIX = "org.omg.";
/**
- * The prefix for classes that are placed instide the
- * gnu.CORBA namespace.
+ * The prefix for classes that are placed instide the gnu.CORBA namespace.
*/
public static final String CLASSPATH_PREFIX = "gnu.CORBA.";
/**
- * Try to instantiate an object with the given IDL name.
- * The object must be mapped to the local java class.
- * The omg.org domain must be mapped into the object in either
- * org/omg or gnu/CORBA namespace.
+ * Try to instantiate an object with the given IDL name. The object must be
+ * mapped to the local java class. The omg.org domain must be mapped into the
+ * object in either org/omg or gnu/CORBA namespace.
*
* @param IDL name
- * @return instantiated object instance or null if no such
- * available.
+ * @return instantiated object instance or null if no such available.
*/
public static java.lang.Object createObject(String idl, String suffix)
{
@@ -109,16 +110,15 @@ public class ObjectCreator
/**
* Create the system exception with the given idl name.
*
- * @param idl the exception IDL name, must match the syntax
- * "IDL:<class/name>:1.0".
+ * @param idl the exception IDL name, must match the syntax "IDL:<class/name>:1.0".
* @param minor the exception minor code.
* @param completed the exception completion status.
*
* @return the created exception.
*/
public static SystemException createSystemException(String idl, int minor,
- CompletionStatus completed
- )
+ CompletionStatus completed
+ )
{
try
{
@@ -127,20 +127,18 @@ public class ObjectCreator
Constructor constructor =
exClass.getConstructor(new Class[]
- {
- String.class, int.class,
- CompletionStatus.class
- }
- );
+ {
+ String.class, int.class, CompletionStatus.class
+ }
+ );
Object exception =
constructor.newInstance(new Object[]
- {
- " Remote exception " + idl + ", minor " +
- minor + ", " + completed + ".",
- new Integer(minor), completed
- }
- );
+ {
+ " Remote exception " + idl + ", minor " + minor + ", " +
+ completed + ".", new Integer(minor), completed
+ }
+ );
return (SystemException) exception;
}
@@ -153,9 +151,10 @@ public class ObjectCreator
/**
* Read the system exception from the given stream.
+ *
* @param input the CDR stream to read from.
- * @return the exception that has been stored in the stream
- * (IDL name, minor code and completion status).
+ * @return the exception that has been stored in the stream (IDL name, minor
+ * code and completion status).
*/
public static SystemException readSystemException(InputStream input)
{
@@ -170,8 +169,8 @@ public class ObjectCreator
}
/**
- * Reads the user exception, having the given Id, from the
- * input stream. The id is expected to be in the form like
+ * Reads the user exception, having the given Id, from the input stream. The
+ * id is expected to be in the form like
* 'IDL:test/org/omg/CORBA/ORB/communication/ourUserException:1.0'
*
* @param idl the exception idl name.
@@ -189,11 +188,8 @@ public class ObjectCreator
Method read =
helperClass.getMethod("read",
- new Class[]
- {
- org.omg.CORBA.portable.InputStream.class
- }
- );
+ new Class[] { org.omg.CORBA.portable.InputStream.class }
+ );
return (UserException) read.invoke(null, new Object[] { input });
}
@@ -236,8 +232,8 @@ public class ObjectCreator
* @param ex an exception to write.
*/
public static void writeSystemException(OutputStream output,
- SystemException ex
- )
+ SystemException ex
+ )
{
String exIDL = toIDL(ex.getClass().getName());
output.write_string(exIDL);
@@ -266,14 +262,14 @@ public class ObjectCreator
}
/**
- * Converts the given IDL name to class name and tries to load the
- * matching class. The OMG prefix (omg.org) is replaced by
- * the java prefix org.omg. No other prefixes are added.
+ * Converts the given IDL name to class name and tries to load the matching
+ * class. The OMG prefix (omg.org) is replaced by the java prefix org.omg. No
+ * other prefixes are added.
*
* @param IDL the idl name.
*
- * TODO Cache the returned classes, avoiding these string manipulations
- * each time the conversion is required.
+ * TODO Cache the returned classes, avoiding these string manipulations each
+ * time the conversion is required.
*
* @return the matching class or null if no such is available.
*/
@@ -301,10 +297,10 @@ public class ObjectCreator
}
/**
- * Converts the given IDL name to class name, tries to load the
- * matching class and create an object instance with parameterless
- * constructor. The OMG prefix (omg.org) is replaced by
- * the java prefix org.omg. No other prefixes are added.
+ * Converts the given IDL name to class name, tries to load the matching class
+ * and create an object instance with parameterless constructor. The OMG
+ * prefix (omg.org) is replaced by the java prefix org.omg. No other prefixes
+ * are added.
*
* @param IDL the idl name.
*
@@ -341,8 +337,111 @@ public class ObjectCreator
cn = OMG_PREFIX + cn.substring(JAVA_PREFIX.length()).replace('.', '/');
else if (cn.startsWith(CLASSPATH_PREFIX))
cn =
- OMG_PREFIX + cn.substring(CLASSPATH_PREFIX.length()).replace('.', '/');
+ OMG_PREFIX +
+ cn.substring(CLASSPATH_PREFIX.length()).replace('.', '/');
return "IDL:" + cn + ":1.0";
}
+
+ /**
+ * Insert the passed parameter into the given Any, assuming that the helper
+ * class is available. The helper class must have the "Helper" suffix and be
+ * in the same package as the class of the object being inserted.
+ *
+ * @param into the target to insert.
+ *
+ * @param object the object to insert. It can be any object as far as the
+ * corresponding helper is provided.
+ *
+ * @return true on success, false otherwise.
+ */
+ public static boolean insertWithHelper(Any into, Object object)
+ {
+ try
+ {
+ String helperClassName = object.getClass().getName() + "Helper";
+ Class helperClass = Class.forName(helperClassName);
+
+ Method insert =
+ helperClass.getMethod("insert",
+ new Class[] { Any.class, object.getClass() }
+ );
+
+ insert.invoke(null, new Object[] { into, object });
+
+ return true;
+ }
+ catch (Exception exc)
+ {
+ // Failed due some reason.
+ return false;
+ }
+ }
+
+ /**
+ * Insert the system exception into the given Any.
+ */
+ public static boolean insertSysException(Any into, SystemException exception)
+ {
+ try
+ {
+ cdrBufOutput output = new cdrBufOutput();
+
+ String m_exception_id = toIDL(exception.getClass().getName());
+ output.write_string(m_exception_id);
+ output.write_ulong(exception.minor);
+ CompletionStatusHelper.write(output, exception.completed);
+
+ String name = getDefaultName(m_exception_id);
+
+ universalHolder h = new universalHolder(output);
+
+ into.insert_Streamable(h);
+
+ recordTypeCode r = new recordTypeCode(TCKind.tk_except);
+ r.setId(m_exception_id);
+ r.setName(name);
+ into.type(r);
+
+ return true;
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ return false;
+ }
+ }
+
+ /**
+ * Get the type name from the IDL string.
+ */
+ public static String getDefaultName(String idl)
+ {
+ int f1 = idl.lastIndexOf("/");
+ int p1 = (f1 < 0) ? 0 : f1;
+ int p2 = idl.indexOf(":", p1);
+ if (p2 < 0)
+ p2 = idl.length();
+
+ String name = idl.substring(f1 + 1, p2);
+ return name;
+ }
+
+ /**
+ * Insert this exception into the given Any. On failure, insert the UNKNOWN
+ * exception.
+ */
+ public static void insertException(Any into, Throwable exception)
+ {
+ boolean ok = false;
+ if (exception instanceof SystemException)
+ ok = insertSysException(into, (SystemException) exception);
+ else if (exception instanceof UserException)
+ ok = insertWithHelper(into, exception);
+
+ if (!ok)
+ ok = insertSysException(into, new UNKNOWN());
+ if (!ok)
+ throw new InternalError("Exception wrapping broken");
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/Restricted_ORB.java b/libjava/classpath/gnu/CORBA/Restricted_ORB.java
index 801154e..247cd20 100644
--- a/libjava/classpath/gnu/CORBA/Restricted_ORB.java
+++ b/libjava/classpath/gnu/CORBA/Restricted_ORB.java
@@ -58,6 +58,9 @@ import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.UnionMember;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.ValueFactory;
+import org.omg.PortableInterceptor.ClientRequestInterceptorOperations;
+import org.omg.PortableInterceptor.IORInterceptorOperations;
+import org.omg.PortableInterceptor.ServerRequestInterceptorOperations;
import java.applet.Applet;
@@ -66,22 +69,20 @@ import java.util.Properties;
/**
* This class implements so-called Singleton ORB, a highly restricted version
- * that cannot communicate over network. This ORB is provided
- * for the potentially malicious applets with heavy security restrictions.
- * It, however, supports some basic features that might be needed even
- * when the network access is not granted.
+ * that cannot communicate over network. This ORB is provided for the
+ * potentially malicious applets with heavy security restrictions. It, however,
+ * supports some basic features that might be needed even when the network
+ * access is not granted.
*
- * This ORB can only create typecodes,
- * {@link Any}, {@link ContextList}, {@link NVList} and
- * {@link org.omg.CORBA.portable.OutputStream} that writes to an
- * internal buffer.
+ * This ORB can only create typecodes, {@link Any}, {@link ContextList},
+ * {@link NVList} and {@link org.omg.CORBA.portable.OutputStream} that writes to
+ * an internal buffer.
*
* All other methods throw the {@link NO_IMPLEMENT} exception.
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class Restricted_ORB
- extends org.omg.CORBA_2_3.ORB
+public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
{
/**
* The singleton instance of this ORB.
@@ -89,13 +90,41 @@ public class Restricted_ORB
public static final ORB Singleton = new Restricted_ORB();
/**
+ * The cumulated listener for all IOR interceptors. Interceptors are used by
+ * {@link gnu.CORBA.Poa.ORB_1_4}.
+ */
+ public IORInterceptorOperations iIor;
+
+ /**
+ * The cumulated listener for all server request interceptors. Interceptors
+ * are used by {@link gnu.CORBA.Poa.ORB_1_4}.
+ */
+ public ServerRequestInterceptorOperations iServer;
+
+ /**
+ * The cumulated listener for all client request interceptros. Interceptors
+ * are used by {@link gnu.CORBA.Poa.ORB_1_4}.
+ */
+ public ClientRequestInterceptorOperations iClient;
+
+ /**
+ * The required size of the interceptor slot array.
+ */
+ public int icSlotSize = 0;
+
+ /**
* The value factories.
*/
protected Hashtable factories = new Hashtable();
/**
- * Create a new instance of the RestrictedORB. This is used
- * in derived classes only.
+ * The policy factories.
+ */
+ protected Hashtable policyFactories = new Hashtable();
+
+ /**
+ * Create a new instance of the RestrictedORB. This is used in derived classes
+ * only.
*/
protected Restricted_ORB()
{
@@ -159,8 +188,8 @@ public class Restricted_ORB
/** {@inheritDoc} */
public TypeCode create_exception_tc(String id, String name,
- StructMember[] members
- )
+ StructMember[] members
+ )
{
recordTypeCode r = new recordTypeCode(TCKind.tk_except);
r.setId(id);
@@ -224,8 +253,8 @@ public class Restricted_ORB
/** {@inheritDoc} */
public TypeCode create_struct_tc(String id, String name,
- StructMember[] members
- )
+ StructMember[] members
+ )
{
recordTypeCode r = new recordTypeCode(TCKind.tk_struct);
r.setId(id);
@@ -240,13 +269,15 @@ public class Restricted_ORB
}
/** {@inheritDoc} */
- public TypeCode create_union_tc(String id, String name, TypeCode type,
- UnionMember[] members
- )
+ public TypeCode create_union_tc(String id, String name,
+ TypeCode discriminator_type, UnionMember[] members
+ )
{
recordTypeCode r = new recordTypeCode(TCKind.tk_union);
r.setId(id);
r.setName(name);
+ r.setDiscriminator_type(discriminator_type);
+ r.setDefaultIndex(0);
for (int i = 0; i < members.length; i++)
{
@@ -274,8 +305,8 @@ public class Restricted_ORB
catch (BadKind ex)
{
throw new BAD_PARAM("This is not a primitive type code: " +
- tcKind.value()
- );
+ tcKind.value()
+ );
}
}
@@ -304,13 +335,13 @@ public class Restricted_ORB
/**
* This method is not allowed for a RestrictedORB.
*
- * @throws InvalidName never in this class, but it is thrown
- * in the derived classes.
+ * @throws InvalidName never in this class, but it is thrown in the derived
+ * classes.
*
* @throws NO_IMPLEMENT, always.
*/
public org.omg.CORBA.Object resolve_initial_references(String name)
- throws InvalidName
+ throws InvalidName
{
no();
throw new InternalError();
@@ -366,8 +397,8 @@ public class Restricted_ORB
}
/**
- * Throws an exception, stating that the given method is not supported
- * by the Restricted ORB.
+ * Throws an exception, stating that the given method is not supported by the
+ * Restricted ORB.
*/
private final void no()
{
@@ -381,8 +412,7 @@ public class Restricted_ORB
*
* @throws NO_IMPLEMENT, always.
*/
- public Request get_next_response()
- throws org.omg.CORBA.WrongTransaction
+ public Request get_next_response() throws org.omg.CORBA.WrongTransaction
{
no();
throw new InternalError();
@@ -423,8 +453,8 @@ public class Restricted_ORB
* Register the value factory under the given repository id.
*/
public ValueFactory register_value_factory(String repository_id,
- ValueFactory factory
- )
+ ValueFactory factory
+ )
{
factories.put(repository_id, factory);
return factory;
@@ -440,9 +470,9 @@ public class Restricted_ORB
/**
* Look for the value factory for the value, having the given repository id.
- * The implementation checks for the registered value factories first.
- * If none found, it tries to load and instantiate the class, mathing the
- * given naming convention. If this faild, null is returned.
+ * The implementation checks for the registered value factories first. If none
+ * found, it tries to load and instantiate the class, mathing the given naming
+ * convention. If this faild, null is returned.
*
* @param repository_id a repository id.
*
@@ -452,12 +482,43 @@ public class Restricted_ORB
{
ValueFactory f = (ValueFactory) factories.get(repository_id);
if (f != null)
- return f;
+ {
+ return f;
+ }
- f = (ValueFactory) ObjectCreator.createObject(repository_id, "DefaultFactory");
+ f = (ValueFactory) ObjectCreator.createObject(repository_id,
+ "DefaultFactory"
+ );
if (f != null)
- factories.put(repository_id, f);
-
+ {
+ factories.put(repository_id, f);
+ }
return f;
}
+
+ /**
+ * Destroy the interceptors, if they are present.
+ */
+ public void destroy()
+ {
+ if (iIor != null)
+ {
+ iIor.destroy();
+ iIor = null;
+ }
+
+ if (iServer != null)
+ {
+ iServer.destroy();
+ iServer = null;
+ }
+
+ if (iClient != null)
+ {
+ iClient.destroy();
+ iClient = null;
+ }
+
+ super.destroy();
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java b/libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java
index 0b69881..7f40fc8 100644
--- a/libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java
+++ b/libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java
@@ -53,10 +53,11 @@ import org.omg.CORBA.portable.ResponseHandler;
import org.omg.CORBA.portable.Streamable;
/**
- * This class exists to handle obsolete invocation style using
- * ServerRequest.
- *
- * @deprecated The method {@link ObjectImpl#_invoke} is much faster.
+ * This class supports invocation using ServerRequest. When possible,
+ * it is better to use the {@link ObjectImpl#_invoke} rather than
+ * working via ServerRequest. However since 1.4 the ServerRequest is
+ * involved into POA machinery making this type of call is sometimes
+ * inavoidable.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
@@ -86,13 +87,13 @@ public class ServiceRequestAdapter
}
/**
- * The old style invocation using the currently deprecated server
- * request class.
+ * Make an invocation.
*
* @param request a server request, containg the invocation information.
* @param target the invocation target
- * @param result the result holder with the set suitable streamable to read
- * the result or null for void.
+ * @param result the result holder with the set suitable streamable.
+ * Using this parameter only increase the performance. It can be
+ * null if the return type is void or unknown.
*/
public static void invoke(ServerRequest request, InvokeHandler target,
Streamable result
@@ -133,12 +134,20 @@ public class ServiceRequestAdapter
else
{
if (result != null)
- {
- result._read(in);
- gnuAny r = new gnuAny();
- r.insert_Streamable(result);
- request.set_result(r);
- };
+ {
+ // Use the holder for the return value, if provided.
+ result._read(in);
+
+ gnuAny r = new gnuAny();
+ r.insert_Streamable(result);
+ request.set_result(r);
+ }
+ else
+ {
+ // Use the universal holder otherwise.
+ gnuAny r = new gnuAny();
+ r.insert_Streamable(new streamReadyHolder(in));
+ }
// Unpack the arguments
for (int i = 0; i < args.count(); i++)
diff --git a/libjava/classpath/gnu/CORBA/Simple_delegate.java b/libjava/classpath/gnu/CORBA/Simple_delegate.java
index d0b2ad2..5eabc7d 100644
--- a/libjava/classpath/gnu/CORBA/Simple_delegate.java
+++ b/libjava/classpath/gnu/CORBA/Simple_delegate.java
@@ -195,13 +195,40 @@ public class Simple_delegate
}
/**
- * Only returns true if the objects are equal ('==').
+ * Returns true if the objects are the same of have
+ * the same delegate set. All objects in this implementation
+ * have a separate delegate.
*/
public boolean is_equivalent(org.omg.CORBA.Object target,
org.omg.CORBA.Object other
)
{
- return target == other;
+ if (target == other)
+ return true;
+ if ((target instanceof ObjectImpl) && other instanceof ObjectImpl)
+ {
+ try
+ {
+ org.omg.CORBA.portable.Delegate a =
+ ((ObjectImpl) target)._get_delegate();
+ org.omg.CORBA.portable.Delegate b =
+ ((ObjectImpl) other)._get_delegate();
+ if (a == b)
+ {
+ return true;
+ }
+ if (a != null && b != null)
+ {
+ return a.equals(b);
+ }
+ }
+ catch (Exception ex)
+ {
+ // Unable to get one of the delegates.
+ return false;
+ }
+ }
+ return false;
}
/**
@@ -246,4 +273,4 @@ public class Simple_delegate
{
throw new InternalError();
}
-}
+} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/SocketRepository.java b/libjava/classpath/gnu/CORBA/SocketRepository.java
index 70bcead..a6b9920 100644
--- a/libjava/classpath/gnu/CORBA/SocketRepository.java
+++ b/libjava/classpath/gnu/CORBA/SocketRepository.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package gnu.CORBA;
import java.net.Socket;
+import java.net.SocketException;
import java.util.HashMap;
@@ -70,16 +71,18 @@ public class SocketRepository
/**
* Get a socket.
- *
+ *
* @param key a socket key.
- *
- * @return an opened socket for reuse, null if no such
- * available or it is closed.
+ *
+ * @return an opened socket for reuse, null if no such available or it is
+ * closed.
*/
public static Socket get_socket(Object key)
{
Socket s = (Socket) sockets.get(key);
- if (s != null && s.isClosed())
+ if (s == null)
+ return null;
+ else if (s.isClosed())
{
sockets.remove(key);
return null;
@@ -87,6 +90,15 @@ public class SocketRepository
else
{
sockets.remove(key);
+ try
+ {
+ // Set one minute time out that will be changed later.
+ s.setSoTimeout(60*1000);
+ }
+ catch (SocketException e)
+ {
+ s = null;
+ }
return s;
}
}
diff --git a/libjava/classpath/gnu/CORBA/bufferedResponseHandler.java b/libjava/classpath/gnu/CORBA/bufferedResponseHandler.java
index e7f00ba..0fe945c 100644
--- a/libjava/classpath/gnu/CORBA/bufferedResponseHandler.java
+++ b/libjava/classpath/gnu/CORBA/bufferedResponseHandler.java
@@ -41,6 +41,7 @@ package gnu.CORBA;
import gnu.CORBA.CDR.cdrBufOutput;
import gnu.CORBA.GIOP.MessageHeader;
import gnu.CORBA.GIOP.ReplyHeader;
+import gnu.CORBA.GIOP.RequestHeader;
import gnu.CORBA.GIOP.cxCodeSet;
import org.omg.CORBA.ORB;
@@ -48,31 +49,33 @@ import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.ResponseHandler;
/**
- * Provides the CDR output streams for writing the response to the given
- * buffer.
+ * Provides the CDR output streams for writing the response to the given buffer.
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-class bufferedResponseHandler
+public class bufferedResponseHandler
implements ResponseHandler
{
/**
- * The message header.
- * This field is used to compute the size and alignments.
+ * The message header. This field is used to compute the size and alignments.
* It is, however, never directly written to the buffer stream.
*/
- final MessageHeader message_header;
+ public final MessageHeader message_header;
/**
* The associated orb.
*/
- final ORB orb;
+ public final ORB orb;
/**
- * The reply header. This field is used to compute the size and alignments.
- * It is, however, never directly written to the buffer stream.
+ * The reply header.
+ */
+ public final ReplyHeader reply_header;
+
+ /**
+ * The request header.
*/
- final ReplyHeader reply_header;
+ public final RequestHeader request_header;
/**
* True if the stream was obtained by invoking {@link #createExceptionReply()},
@@ -86,28 +89,27 @@ class bufferedResponseHandler
private cdrBufOutput buffer;
/**
- * Create a new buffered response handler that uses the given message
- * headers. The headers are used to compute sizes and check the versions.
- * They are not written into a stream inside this class.
+ * Create a new buffered response handler that uses the given message headers.
+ * The headers are used to compute sizes and check the versions. They are not
+ * written into a stream inside this class.
*
* @param m_header a message header.
* @param r_header a reply header.
*/
bufferedResponseHandler(ORB an_orb, MessageHeader m_header,
- ReplyHeader r_header
- )
+ ReplyHeader r_header, RequestHeader rq_header)
{
message_header = m_header;
reply_header = r_header;
+ request_header = rq_header;
orb = an_orb;
prepareStream();
}
/**
- * Get an output stream for providing details about the exception.
- * Before returning the stream, the handler automatically writes
- * the message header and the reply about exception header,
- * but not the message header.
+ * Get an output stream for providing details about the exception. Before
+ * returning the stream, the handler automatically writes the message header
+ * and the reply about exception header, but not the message header.
*
* @return the stream to write exception details into.
*/
@@ -121,8 +123,8 @@ class bufferedResponseHandler
/**
* Get an output stream for writing a regular reply (not an exception).
*
- * Before returning the stream, the handler automatically writes
- * the regular reply header, but not the message header.
+ * Before returning the stream, the handler automatically writes the regular
+ * reply header, but not the message header.
*
* @return the output stream for writing a regular reply.
*/
@@ -135,27 +137,26 @@ class bufferedResponseHandler
}
/**
- * Get the buffer, normally containing the written reply.
- * The reply includes the reply header (or the exception header)
- * but does not include the message header.
+ * Get the buffer, normally containing the written reply. The reply includes
+ * the reply header (or the exception header) but does not include the message
+ * header.
*
- * The stream buffer can also be empty if no data have been written
- * into streams, returned by {@link #createReply()} or
+ * The stream buffer can also be empty if no data have been written into
+ * streams, returned by {@link #createReply()} or
* {@link #createExceptionReply()}.
*
* @return the CDR output stream, containing the written output.
*/
- cdrBufOutput getBuffer()
+ public cdrBufOutput getBuffer()
{
return buffer;
}
/**
- * True if the stream was obtained by invoking
- * {@link #createExceptionReply()}, false otherwise
- * (usually no-exception reply).
+ * True if the stream was obtained by invoking {@link #createExceptionReply()},
+ * false otherwise (usually no-exception reply).
*/
- boolean isExceptionReply()
+ public boolean isExceptionReply()
{
return exceptionReply;
}
@@ -167,21 +168,22 @@ class bufferedResponseHandler
{
buffer = new cdrBufOutput();
buffer.setOrb(orb);
- buffer.setOffset(message_header.getHeaderSize());
-
- // Get the position after the reply header would be written.
- reply_header.write(buffer);
+ buffer.setVersion(message_header.version);
+ buffer.setCodeSet(cxCodeSet.find(reply_header.service_context));
- int new_offset = message_header.getHeaderSize() + buffer.buffer.size();
+ // Since 1.2, the data section is always aligned on the 8 byte boundary.
+ // In older versions, it is necessary to set the offset correctly.
+ if (message_header.version.until_inclusive(1, 1))
+ {
+ buffer.setOffset(message_header.getHeaderSize());
- buffer.buffer.reset();
- buffer.setOffset(new_offset);
+ // Get the position after the reply header would be written.
+ reply_header.write(buffer);
- if (message_header.version.since_inclusive(1, 2))
- buffer.align(8);
+ int new_offset = message_header.getHeaderSize() + buffer.buffer.size();
- buffer.setVersion(message_header.version);
-
- buffer.setCodeSet(cxCodeSet.find(reply_header.service_context));
+ buffer.buffer.reset();
+ buffer.setOffset(new_offset);
+ }
}
}
diff --git a/libjava/classpath/gnu/CORBA/fixedTypeCode.java b/libjava/classpath/gnu/CORBA/fixedTypeCode.java
index ec88c22..eb61041 100644
--- a/libjava/classpath/gnu/CORBA/fixedTypeCode.java
+++ b/libjava/classpath/gnu/CORBA/fixedTypeCode.java
@@ -109,16 +109,12 @@ public class fixedTypeCode
return number.unscaledValue().abs().toString().length();
}
- public boolean equals(Object other)
+ /**
+ * Compare with other type code for equality.
+ */
+ public boolean equal(TypeCode other)
{
- if (other == this)
- {
- return true;
- }
- if (!(other instanceof TypeCode))
- {
- return false;
- }
+ if (other == this) return true;
try
{
TypeCode that = (TypeCode) other;
diff --git a/libjava/classpath/gnu/CORBA/gnuAny.java b/libjava/classpath/gnu/CORBA/gnuAny.java
index a48c50d..7e5ef33 100644
--- a/libjava/classpath/gnu/CORBA/gnuAny.java
+++ b/libjava/classpath/gnu/CORBA/gnuAny.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package gnu.CORBA;
+import gnu.CORBA.CDR.Vio;
import gnu.CORBA.CDR.cdrBufInput;
import gnu.CORBA.CDR.cdrBufOutput;
@@ -63,6 +64,7 @@ import org.omg.CORBA.TypeCode;
import org.omg.CORBA.TypeCodeHolder;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.ValueBaseHolder;
+import org.omg.CORBA.portable.BoxedValueHelper;
import org.omg.CORBA.portable.Streamable;
import java.io.IOException;
@@ -499,20 +501,33 @@ public class gnuAny
}
/** {@inheritDoc} */
- public void insert_Value(Serializable x, TypeCode typecode)
+ public void insert_Value(Serializable x, TypeCode c_typecode)
{
- type(typecode);
- insert_Value(x);
+ if (typecode != null && typecode.kind() == TCKind.tk_value_box)
+ {
+ has = new gnuValueHolder(x, typecode);
+ }
+ else
+ {
+ type(typecode);
+ insert_Value(x);
+ }
}
/** {@inheritDoc} */
public void insert_Value(Serializable x)
{
- resetTypes();
- if (has instanceof ValueBaseHolder)
- ((ValueBaseHolder) has).value = x;
+ if (typecode != null && typecode.kind() == TCKind.tk_value_box)
+ {
+ has = new gnuValueHolder(x, typecode);
+ }
else
- has = new ValueBaseHolder(x);
+ {
+ if (has instanceof ValueBaseHolder)
+ ((ValueBaseHolder) has).value = x;
+ else
+ has = new ValueBaseHolder(x);
+ }
}
/**
@@ -748,15 +763,38 @@ public class gnuAny
}
}
type(a_type);
- has._read(input);
- }
- catch (BadKind ex)
- {
- throw new MARSHAL("Bad kind: " + ex.getMessage());
+
+ if (!(has instanceof universalHolder) &&
+ (kind == TCKind._tk_value_box))
+ {
+ // The streamable only contains operations for
+ // reading the value, not the value header.
+ Field vField = has.getClass().getField("value");
+
+ BoxedValueHelper helper;
+
+ try
+ {
+ Class helperClass =
+ Class.forName(ObjectCreator.toHelperName(a_type.id()));
+ helper = (BoxedValueHelper) helperClass.newInstance();
+ }
+ catch (Exception ex)
+ {
+ helper = null;
+ }
+
+ Object content = Vio.read(input, helper);
+ vField.set(has, content);
+ }
+ else
+ has._read(input);
}
- catch (IOException ex)
+ catch (Exception ex)
{
- throw new MARSHAL("IO exception: " + ex.getMessage());
+ MARSHAL m = new MARSHAL();
+ m.initCause(ex);
+ throw m;
}
}
@@ -790,6 +828,12 @@ public class gnuAny
{
if (has != null)
has._write(output);
+ else
+ // These kinds support null.
+ if (xKind == TCKind._tk_null || xKind == TCKind._tk_objref ||
+ xKind == TCKind._tk_value || xKind == TCKind._tk_value_box
+ )
+ output.write_long(0);
}
/**
@@ -806,16 +850,26 @@ public class gnuAny
if (xKind >= 0)
{
if (xKind != kind)
- throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) +
- " when stored " + typeNamer.nameIt(xKind)
- );
+ if (!(
+ xKind == TCKind._tk_alias &&
+ has._type().kind().value() == kind
+ )
+ )
+ throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) +
+ " when stored " + typeNamer.nameIt(xKind)
+ );
}
else
{
if (type().kind().value() != kind)
- throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) +
- " stored " + typeNamer.nameIt(type())
- );
+ if (!(
+ type().kind().value() == TCKind._tk_alias &&
+ has._type().kind().value() == kind
+ )
+ )
+ throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) +
+ " stored " + typeNamer.nameIt(type())
+ );
}
}
diff --git a/libjava/classpath/gnu/CORBA/gnuCodecFactory.java b/libjava/classpath/gnu/CORBA/gnuCodecFactory.java
index 8b71baf..067de49 100644
--- a/libjava/classpath/gnu/CORBA/gnuCodecFactory.java
+++ b/libjava/classpath/gnu/CORBA/gnuCodecFactory.java
@@ -38,12 +38,12 @@ exception statement from your version. */
package gnu.CORBA;
-import org.omg.CORBA.*;
import org.omg.CORBA.LocalObject;
-import org.omg.IOP.*;
+import org.omg.CORBA.ORB;
import org.omg.IOP.Codec;
import org.omg.IOP.CodecFactory;
import org.omg.IOP.CodecFactoryPackage.UnknownEncoding;
+import org.omg.IOP.ENCODING_CDR_ENCAPS;
import org.omg.IOP.Encoding;
/**
@@ -52,9 +52,7 @@ import org.omg.IOP.Encoding;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class gnuCodecFactory
- extends LocalObject
- implements CodecFactory
+public class gnuCodecFactory extends LocalObject implements CodecFactory
{
/**
* The associated ORB.
@@ -78,18 +76,15 @@ public class gnuCodecFactory
*
* @throws UnknownEncoding if the encoding is not a ENCODING_CDR_ENCAPS.
*/
- public Codec create_codec(Encoding for_encoding)
- throws UnknownEncoding
+ public Codec create_codec(Encoding for_encoding) throws UnknownEncoding
{
if (for_encoding.format != ENCODING_CDR_ENCAPS.value)
throw new UnknownEncoding("Only ENCODING_CDR_ENCAPS is " +
- "supported by this factory."
- );
+ "supported by this factory."
+ );
return new cdrEncapsCodec(orb,
- new Version(for_encoding.major_version,
- for_encoding.minor_version
- )
- );
+ new Version(for_encoding.major_version, for_encoding.minor_version)
+ );
}
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/gnuRequest.java b/libjava/classpath/gnu/CORBA/gnuRequest.java
index a47410e..7d756ed 100644
--- a/libjava/classpath/gnu/CORBA/gnuRequest.java
+++ b/libjava/classpath/gnu/CORBA/gnuRequest.java
@@ -40,32 +40,47 @@ package gnu.CORBA;
import gnu.CORBA.CDR.cdrBufInput;
import gnu.CORBA.CDR.cdrBufOutput;
-import gnu.CORBA.GIOP.CloseMessage;
import gnu.CORBA.GIOP.MessageHeader;
import gnu.CORBA.GIOP.ReplyHeader;
import gnu.CORBA.GIOP.RequestHeader;
import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.Interceptor.gnuClientRequestInfo;
+import gnu.CORBA.Poa.ORB_1_4;
import org.omg.CORBA.ARG_IN;
import org.omg.CORBA.ARG_INOUT;
import org.omg.CORBA.ARG_OUT;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_INV_ORDER;
+import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.Bounds;
+import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.Context;
import org.omg.CORBA.ContextList;
import org.omg.CORBA.Environment;
import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.INV_POLICY;
import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.NO_IMPLEMENT;
import org.omg.CORBA.NO_RESOURCES;
import org.omg.CORBA.NVList;
import org.omg.CORBA.NamedValue;
import org.omg.CORBA.ORB;
+import org.omg.CORBA.Policy;
import org.omg.CORBA.Request;
import org.omg.CORBA.SystemException;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.UnknownUserException;
-import org.omg.CORBA.UserException;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.IOP.ServiceContext;
+import org.omg.IOP.TAG_CODE_SETS;
+import org.omg.IOP.TAG_INTERNET_IOP;
+import org.omg.IOP.TaggedComponent;
+import org.omg.IOP.TaggedProfile;
+import org.omg.PortableInterceptor.ClientRequestInfo;
+import org.omg.PortableInterceptor.ClientRequestInterceptorOperations;
+import org.omg.PortableInterceptor.ForwardRequest;
+import org.omg.PortableInterceptor.InvalidSlot;
import java.io.IOException;
import java.io.InputStream;
@@ -74,14 +89,14 @@ import java.io.OutputStream;
import java.net.BindException;
import java.net.Socket;
+import java.util.ArrayList;
+
/**
* The implementation of the CORBA request.
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class gnuRequest
- extends Request
- implements Cloneable
+public class gnuRequest extends Request implements Cloneable
{
/**
* The maximal supported GIOP version.
@@ -89,25 +104,34 @@ public class gnuRequest
public static Version MAX_SUPPORTED = new Version(1, 2);
/**
- * The initial pause that the Request makes when
- * the required port is not available.
+ * The initial pause that the Request makes when the required port is not
+ * available.
*/
public static int PAUSE_INITIAL = 50;
/**
- * The number of repretetive attempts to get a required
- * port, if it is not immediately available.
+ * The number of repretetive attempts to get a required port, if it is not
+ * immediately available.
*/
public static int PAUSE_STEPS = 12;
/**
- * The maximal pausing interval between two repetetive attempts.
- * The interval doubles after each unsuccessful attempt, but
- * will not exceed this value.
+ * The maximal pausing interval between two repetetive attempts. The interval
+ * doubles after each unsuccessful attempt, but will not exceed this value.
*/
public static int PAUSE_MAX = 1000;
/**
+ * The interceptor, listening the major request submission points.
+ */
+ ClientRequestInterceptorOperations m_interceptor;
+
+ /**
+ * The request info, used by interceptor.
+ */
+ ClientRequestInfo m_info = new gnuClientRequestInfo(this);
+
+ /**
* The empty byte array.
*/
private static final binaryReply EMPTY =
@@ -124,14 +148,13 @@ public class gnuRequest
protected ContextList m_context_list;
/**
- * The request environment for holding the exception
- * the has possibly been thrown by the method being invoked.
+ * The request environment for holding the exception the has possibly been
+ * thrown by the method being invoked.
*/
protected Environment m_environment = new gnuEnvironment();
/**
- * The list of all exceptions that can be thrown by the
- * method being invoked.
+ * The list of all exceptions that can be thrown by the method being invoked.
*/
protected ExceptionList m_exceptions = new gnuExceptionList();
@@ -141,6 +164,16 @@ public class gnuRequest
protected NamedValue m_result = new gnuNamedValue();
/**
+ * The exception id, received from the server, null if none.
+ */
+ protected String m_exception_id;
+
+ /**
+ * The thrown system exception.
+ */
+ protected SystemException m_sys_ex;
+
+ /**
* The invocation target.
*/
protected org.omg.CORBA.Object m_target;
@@ -151,20 +184,32 @@ public class gnuRequest
protected String m_operation;
/**
- * The flag, indicating that the request has been sent
- * and the result is already received.
+ * This field temporary remembers the value of the forwarded ior reference. If
+ * it is not null, the request was forwarded and the effective target is not
+ * the same as the default target.
+ */
+ public IOR m_forward_ior;
+
+ /**
+ * Is set when object, and not IOR is directly available.
+ */
+ public org.omg.CORBA.Object m_forwarding_target;
+
+ /**
+ * The flag, indicating that the request has been sent and the result is
+ * already received.
*/
protected boolean complete;
/**
- * The flag, indicating that the response to this request must be
- * ignored (used with {@link #send_oneway()}).
+ * The flag, indicating that the response to this request must be ignored
+ * (used with {@link #send_oneway()}).
*/
protected boolean oneWay;
/**
- * The flag, indicating that the request has been sent
- * and no result is yet received.
+ * The flag, indicating that the request has been sent and no result is yet
+ * received.
*/
protected boolean running;
@@ -174,12 +219,27 @@ public class gnuRequest
protected gnuNVList m_args = new gnuNVList();
/**
- * The request arguments in the case when they are directly written into
- * the parameter buffer.
+ * The request arguments in the case when they are directly written into the
+ * parameter buffer.
*/
protected streamRequest m_parameter_buffer;
/**
+ * The array of slots.
+ */
+ protected Any[] m_slots;
+
+ /**
+ * The request header currently in use.
+ */
+ protected RequestHeader m_rqh;
+
+ /**
+ * The reply header currently in use.
+ */
+ protected ReplyHeader m_rph;
+
+ /**
* The IOR of the target.
*/
private IOR ior;
@@ -192,17 +252,16 @@ public class gnuRequest
/**
* The encoding, used to send the message.
*
- * The default encoding is inherited from the set IOR
- * (that string reference can be encoded in either Big or
- * Little endian). If the IOR encoding is not known
- * (for example, by obtaining the reference from the naming
- * service), the Big Endian is used.
+ * The default encoding is inherited from the set IOR (that string reference
+ * can be encoded in either Big or Little endian). If the IOR encoding is not
+ * known (for example, by obtaining the reference from the naming service),
+ * the Big Endian is used.
*/
private boolean Big_endian = true;
/**
- * Set the IOR data, sufficient to find the invocation target.
- * This also sets default endian encoding for invocations.
+ * Set the IOR data, sufficient to find the invocation target. This also sets
+ * default endian encoding for invocations.
*
* @see IOR.parse(String)
*/
@@ -213,6 +272,11 @@ public class gnuRequest
}
/**
+ * Used when redirecting request to another target.
+ */
+ gnuRequest redirected;
+
+ /**
* Get the IOR data, sufficient to find the invocation target.
*
* @return the IOR data.
@@ -228,18 +292,26 @@ public class gnuRequest
public void setORB(ORB an_orb)
{
orb = an_orb;
+
+ // Take the interceptor from the ORB.
+ if (orb instanceof Restricted_ORB)
+ m_interceptor = ((Restricted_ORB) orb).iClient;
+
+ if (m_interceptor != null && orb instanceof ORB_1_4)
+ {
+ m_slots = ((ORB_1_4) orb).ic_current.clone_slots();
+ }
}
/**
- * Set the encoding that will be used to send the message.
- * The default encoding is inherited from the set IOR
- * (that string reference can be encoded in either Big or
- * Little endian). If the IOR encoding is not known
- * (for example, by obtaining the reference from the naming
- * service), the Big Endian is used.
+ * Set the encoding that will be used to send the message. The default
+ * encoding is inherited from the set IOR (that string reference can be
+ * encoded in either Big or Little endian). If the IOR encoding is not known
+ * (for example, by obtaining the reference from the naming service), the Big
+ * Endian is used.
*
- * @param use_big_endian true to use the Big Endian, false
- * to use the Little Endian encoding.
+ * @param use_big_endian true to use the Big Endian, false to use the Little
+ * Endian encoding.
*/
public void setBigEndian(boolean use_big_endian)
{
@@ -257,17 +329,32 @@ public class gnuRequest
}
/**
- * Get the parameter stream, where the invocation arguments should
- * be written if they are written into the stream directly.
+ * Get the parameter stream, where the invocation arguments should be written
+ * if they are written into the stream directly.
*/
public streamRequest getParameterStream()
{
m_parameter_buffer = new streamRequest();
m_parameter_buffer.request = this;
m_parameter_buffer.setVersion(ior.Internet.version);
- m_parameter_buffer.setCodeSet(cxCodeSet.negotiate(ior.CodeSets));
+ m_parameter_buffer.setCodeSet(cxCodeSet.negotiate(ior.Internet.CodeSets));
m_parameter_buffer.setOrb(orb);
m_parameter_buffer.setBigEndian(Big_endian);
+
+ // For the old iiop versions, it is important to set the size
+ // correctly.
+ if (ior.Internet.version.until_inclusive(1, 1))
+ {
+ cdrBufOutput measure = new cdrBufOutput();
+ measure.setOffset(12);
+ if (m_rqh == null)
+ m_rqh = new gnu.CORBA.GIOP.v1_0.RequestHeader();
+ m_rqh.operation = m_operation;
+ m_rqh.object_key = ior.key;
+ m_rqh.write(measure);
+ m_parameter_buffer.setOffset(12 + measure.buffer.size());
+ }
+
return m_parameter_buffer;
}
@@ -380,33 +467,29 @@ public class gnuRequest
}
/** {@inheritDoc} */
- public void get_response()
- throws org.omg.CORBA.WrongTransaction
+ public void get_response() throws org.omg.CORBA.WrongTransaction
{
/**
- * The response is ready after it is received.
- * FIXME implement context checks and any other functionality,
- * if required.
+ * The response is ready after it is received. FIXME implement context
+ * checks and any other functionality, if required.
*/
}
/**
- * Submit the request, suspending the current thread until the
- * answer is received.
+ * Submit the request, suspending the current thread until the answer is
+ * received.
*
- * This implementation requires to set the IOR property
- * ({@link #setIOR(IOR)} before calling this method.
+ * This implementation requires to set the IOR property ({@link #setIOR(IOR)}
+ * before calling this method.
*
- * @throws BAD_INV_ORDER, minor code 0, if the IOR has not been
- * previously set.
+ * @throws BAD_INV_ORDER, minor code 0, if the IOR has not been previously
+ * set.
*
- * @throws SystemException if this exception has been thrown on
- * remote side. The exact exception type and the minor code are
- * the same as they have been for the exception, thrown on remoted
- * side.
+ * @throws SystemException if this exception has been thrown on remote side.
+ * The exact exception type and the minor code are the same as they have been
+ * for the exception, thrown on remoted side.
*/
- public synchronized void invoke()
- throws BAD_INV_ORDER
+ public synchronized void invoke() throws BAD_INV_ORDER
{
waitWhileBusy();
complete = false;
@@ -417,7 +500,32 @@ public class gnuRequest
try
{
- p_invoke();
+ Forwardings:
+ while (true)
+ {
+ try
+ {
+ p_invoke();
+ break Forwardings;
+ }
+ catch (ForwardRequest e)
+ {
+ try
+ {
+ ObjectImpl impl = (ObjectImpl) e.forward;
+ Simple_delegate delegate =
+ (Simple_delegate) impl._get_delegate();
+ ior = delegate.getIor();
+ }
+ catch (Exception ex)
+ {
+ BAD_PARAM bad =
+ new BAD_PARAM("Unsupported forwarding target");
+ bad.initCause(ex);
+ throw bad;
+ }
+ }
+ }
}
finally
{
@@ -452,7 +560,8 @@ public class gnuRequest
return m_result;
}
- /** {@inheritDoc}
+ /**
+ * {@inheritDoc}
*
*/
public Any return_value()
@@ -474,9 +583,8 @@ public class gnuRequest
}
/**
- * Send a request and forget about it, not waiting for a response.
- * This can be done also for methods that normally are expected
- * to return some values.
+ * Send a request and forget about it, not waiting for a response. This can be
+ * done also for methods that normally are expected to return some values.
*
* TODO It is generally recommended to reuse the threads. Reuse?
*/
@@ -495,9 +603,8 @@ public class gnuRequest
}
/**
- * Set the argument list.
- * This field is initialised as empty non null instance by default,
- * so the method is only used in cases when the direct replacement
+ * Set the argument list. This field is initialised as empty non null instance
+ * by default, so the method is only used in cases when the direct replacement
* is desired.
*
* @param a_args the argument list.
@@ -525,8 +632,8 @@ public class gnuRequest
}
/**
- * Set the context list that is later returned by the
- * method {@link #contexts()}.
+ * Set the context list that is later returned by the method
+ * {@link #contexts()}.
*
* @param a_context_list a new context list.
*/
@@ -536,10 +643,9 @@ public class gnuRequest
}
/**
- * Set the exception container.
- * This field is initialised as empty non null instance by default,
- * so the method is only used in cases when the direct replacement
- * is desired.
+ * Set the exception container. This field is initialised as empty non null
+ * instance by default, so the method is only used in cases when the direct
+ * replacement is desired.
*
* @param a_environment the new exception container.
*/
@@ -549,10 +655,9 @@ public class gnuRequest
}
/**
- * Set the list of exceptions.
- * This field is initialised as empty non null instance by default,
- * so the method is only used in cases when the direct replacement
- * is desired.
+ * Set the list of exceptions. This field is initialised as empty non null
+ * instance by default, so the method is only used in cases when the direct
+ * replacement is desired.
*
* @param a_exceptions a list of exceptions.
*/
@@ -572,10 +677,9 @@ public class gnuRequest
}
/**
- * Set the named value, returned as result.
- * This field is initialised as empty non null instance by default,
- * so the method is only used in cases when the direct replacement
- * is desired.
+ * Set the named value, returned as result. This field is initialised as empty
+ * non null instance by default, so the method is only used in cases when the
+ * direct replacement is desired.
*
* @param a_result the result keeper.
*/
@@ -585,8 +689,8 @@ public class gnuRequest
}
/**
- * Set the type of the named value, returned as a result.
- * Instantiates a new instance of the result value.
+ * Set the type of the named value, returned as a result. Instantiates a new
+ * instance of the result value.
*/
public void set_return_type(TypeCode returns)
{
@@ -608,17 +712,16 @@ public class gnuRequest
}
/**
- * Do the actual invocation.
- * This implementation requires to set the IOR property
- * ({@link #setIOR(IOR)} before calling this method.
+ * Do the actual invocation. This implementation requires to set the IOR
+ * property ({@link #setIOR(IOR)} before calling this method.
*
- * @throws BAD_INV_ORDER, minor code 0, if the IOR has not been
- * previously set or if the direct argument addition is mixed with
- * the direct argument writing into the output stream.
+ * @throws BAD_INV_ORDER, minor code 0, if the IOR has not been previously set
+ * or if the direct argument addition is mixed with the direct argument
+ * writing into the output stream.
*
* @return the server response in binary form.
*/
- public synchronized binaryReply submit()
+ public synchronized binaryReply submit() throws ForwardRequest
{
gnu.CORBA.GIOP.MessageHeader header = new gnu.CORBA.GIOP.MessageHeader();
@@ -629,32 +732,36 @@ public class gnuRequest
header.version = useVersion(ior.Internet.version);
RequestHeader rh = header.create_request_header();
-
- rh.object_key = ior.key;
rh.operation = m_operation;
+ rh.object_key = ior.key;
+
+ // Update interceptor.
+ m_rqh = rh;
+
+ if (m_interceptor != null)
+ m_interceptor.send_request(m_info);
// Prepare the submission.
cdrBufOutput request_part = new cdrBufOutput();
request_part.setOffset(header.getHeaderSize());
request_part.setVersion(header.version);
- request_part.setCodeSet(cxCodeSet.negotiate(ior.CodeSets));
+ request_part.setCodeSet(cxCodeSet.negotiate(ior.Internet.CodeSets));
request_part.setOrb(orb);
request_part.setBigEndian(header.isBigEndian());
// This also sets the stream encoding to the encoding, specified
// in the header.
rh.write(request_part);
-
+
if (m_args != null && m_args.count() > 0)
{
write_parameters(header, request_part);
if (m_parameter_buffer != null)
throw new BAD_INV_ORDER("Please either add parameters or " +
- "write them into stream, but not both " +
- "at once."
- );
+ "write them into stream, but not both " + "at once."
+ );
}
if (m_parameter_buffer != null)
@@ -710,8 +817,8 @@ public class gnuRequest
if (socket == null)
throw new NO_RESOURCES(ior.Internet.host + ":" + ior.Internet.port +
- " in use"
- );
+ " in use"
+ );
socket.setKeepAlive(true);
OutputStream socketOutput = socket.getOutputStream();
@@ -745,8 +852,9 @@ public class gnuRequest
{
MARSHAL m =
new MARSHAL("Unable to open a socket at " + ior.Internet.host + ":" +
- ior.Internet.port
- );
+ ior.Internet.port, 10000 + ior.Internet.port,
+ CompletionStatus.COMPLETED_NO
+ );
m.initCause(io_ex);
throw m;
}
@@ -776,9 +884,9 @@ public class gnuRequest
}
/**
- * Get the used version. Normally, it is better to respond using the
- * same version as it is specified in IOR, but not above the maximal
- * supported version.
+ * Get the used version. Normally, it is better to respond using the same
+ * version as it is specified in IOR, but not above the maximal supported
+ * version.
*/
public Version useVersion(Version desired)
{
@@ -790,12 +898,11 @@ public class gnuRequest
/**
* Wait while the response to request, submitted using
- * {@link #send_deferred()} or {@link #invoke()} (from other thread)
- * is returned.
+ * {@link #send_deferred()} or {@link #invoke()} (from other thread) is
+ * returned.
*
- * FIXME It is possible to rewrite this using
- * Object.wait() and Object.notify(), but be sure to prepare the test
- * as well.
+ * FIXME It is possible to rewrite this using Object.wait() and
+ * Object.notify(), but be sure to prepare the test as well.
*/
public synchronized void waitWhileBusy()
{
@@ -819,26 +926,25 @@ public class gnuRequest
}
/**
- * Do actual invocation. This method recursively calls itself if
- * the redirection is detected.
+ * Do actual invocation. This method recursively calls itself if the
+ * redirection is detected.
*/
- private void p_invoke()
- throws SystemException
+ private void p_invoke() throws SystemException, ForwardRequest
{
binaryReply response = submit();
- ReplyHeader rh = response.header.create_reply_header();
+ if (m_rph == null)
+ m_rph = response.header.create_reply_header();
+
cdrBufInput input = response.getStream();
input.setOrb(orb);
- rh.read(input);
+ m_rph.read(input);
// The stream must be aligned sinve v1.2, but only once.
boolean align = response.header.version.since_inclusive(1, 2);
- boolean moved_permanently = false;
-
- switch (rh.reply_status)
+ switch (m_rph.reply_status)
{
case ReplyHeader.NO_EXCEPTION :
@@ -881,6 +987,9 @@ public class gnuRequest
}
}
+ if (m_interceptor != null)
+ m_interceptor.receive_reply(m_info);
+
break;
case ReplyHeader.SYSTEM_EXCEPTION :
@@ -889,12 +998,15 @@ public class gnuRequest
input.align(8);
align = false;
}
+ readExceptionId(input);
- SystemException exception = ObjectCreator.readSystemException(input);
+ m_sys_ex = ObjectCreator.readSystemException(input);
+ m_environment.exception(m_sys_ex);
- m_environment.exception(exception);
+ if (m_interceptor != null)
+ m_interceptor.receive_exception(m_info);
- throw exception;
+ throw m_sys_ex;
case ReplyHeader.USER_EXCEPTION :
if (align)
@@ -902,15 +1014,20 @@ public class gnuRequest
input.align(8);
align = false;
}
+ readExceptionId(input);
// Prepare an Any that will hold the exception.
gnuAny exc = new gnuAny();
+ exc.setOrb(orb);
exc.insert_Streamable(new streamReadyHolder(input));
UnknownUserException unuex = new UnknownUserException(exc);
m_environment.exception(unuex);
+ if (m_interceptor != null)
+ m_interceptor.receive_exception(m_info);
+
break;
case ReplyHeader.LOCATION_FORWARD_PERM :
@@ -925,21 +1042,40 @@ public class gnuRequest
}
catch (IOException ex)
{
- throw new MARSHAL(ex + " while reading the forwarding info");
+ new MARSHAL("Cant read forwarding info", 5103,
+ CompletionStatus.COMPLETED_NO
+ );
}
setIor(forwarded);
+ m_forward_ior = forwarded;
+
+ if (m_interceptor != null)
+ m_interceptor.receive_other(m_info);
+
// Repeat with the forwarded information.
p_invoke();
return;
default :
- throw new MARSHAL("Unknow reply status: " + rh.reply_status);
+ throw new MARSHAL("Unknow reply status", 8100 + m_rph.reply_status,
+ CompletionStatus.COMPLETED_NO
+ );
}
}
/**
+ * Read exception id without changing the stream pointer position.
+ */
+ void readExceptionId(cdrBufInput input)
+ {
+ input.mark(2048);
+ m_exception_id = input.read_string();
+ input.reset();
+ }
+
+ /**
* Write the operation parameters.
*
* @param header the message header
@@ -947,10 +1083,9 @@ public class gnuRequest
*
* @throws MARSHAL if the attempt to write the parameters has failde.
*/
- private void write_parameter_buffer(MessageHeader header,
- cdrBufOutput request_part
- )
- throws MARSHAL
+ protected void write_parameter_buffer(MessageHeader header,
+ cdrBufOutput request_part
+ ) throws MARSHAL
{
try
{
@@ -974,8 +1109,9 @@ public class gnuRequest
*
* @throws MARSHAL if the attempt to write the parameters has failde.
*/
- private void write_parameters(MessageHeader header, cdrBufOutput request_part)
- throws MARSHAL
+ protected void write_parameters(MessageHeader header,
+ cdrBufOutput request_part
+ ) throws MARSHAL
{
// Align after 1.2, but only once.
boolean align = header.version.since_inclusive(1, 2);
@@ -988,7 +1124,7 @@ public class gnuRequest
{
para = m_args.item(i);
- //This bit is set both for ARG_IN and ARG_INOUT
+ // This bit is set both for ARG_IN and ARG_INOUT
if ((para.flags() & ARG_IN.value) != 0)
{
if (align)
@@ -1002,7 +1138,277 @@ public class gnuRequest
}
catch (Bounds ex)
{
- throw new MARSHAL("Unable to write method arguments to CDR output.");
+ InternalError ierr = new InternalError();
+ ierr.initCause(ex);
+ throw ierr;
}
}
+
+ /* **************Implementation of the request info operations. ***** */
+
+ /**
+ * Add context to request.
+ */
+ public void add_request_service_context(ServiceContext service_context,
+ boolean replace
+ )
+ {
+ m_rqh.addContext(service_context, replace);
+ }
+
+ /**
+ * Get the Internet profile as an effective profile.
+ */
+ public TaggedProfile effective_profile()
+ {
+ cdrBufOutput buf = new cdrBufOutput(512);
+ buf.setOrb(orb);
+ ior.Internet.write(buf);
+
+ TaggedProfile p = new TaggedProfile();
+ p.tag = TAG_INTERNET_IOP.value;
+ p.profile_data = buf.buffer.toByteArray();
+ return p;
+ }
+
+ /**
+ * Return either target or forwarded targed.
+ */
+ public org.omg.CORBA.Object effective_target()
+ {
+ return new IOR_contructed_object(orb, ior);
+ }
+
+ /**
+ * Get effective component with the give id from the Internet profile.
+ */
+ public TaggedComponent get_effective_component(int id)
+ throws BAD_PARAM
+ {
+ if (id == TAG_CODE_SETS.value)
+ {
+ // Codesets are encoded separately.
+ cdrBufOutput buf = new cdrBufOutput(512);
+ buf.setOrb(orb);
+ ior.Internet.CodeSets.write(buf);
+
+ TaggedComponent t = new TaggedComponent();
+ t.tag = TAG_CODE_SETS.value;
+ t.component_data = buf.buffer.toByteArray();
+ return t;
+ }
+ else
+ {
+ for (int i = 0; i < ior.Internet.components.size(); i++)
+ {
+ TaggedComponent c =
+ (TaggedComponent) ior.Internet.components.get(i);
+ if (c.tag == id)
+ return c;
+ }
+ }
+ throw new BAD_PARAM("No component " + id + " in the Internet profile", 28,
+ CompletionStatus.COMPLETED_MAYBE
+ );
+ }
+
+ /**
+ * Get all components with the given id from the internet profile.
+ */
+ public TaggedComponent[] get_effective_components(int id)
+ throws BAD_PARAM
+ {
+ if (id == TAG_CODE_SETS.value)
+ return new TaggedComponent[] { get_effective_component(TAG_CODE_SETS.value) };
+ else
+ {
+ ArrayList components = new ArrayList(ior.Internet.components.size());
+ for (int i = 0; i < ior.Internet.components.size(); i++)
+ {
+ TaggedComponent c =
+ (TaggedComponent) ior.Internet.components.get(i);
+ if (c.tag == id)
+ components.add(c);
+ }
+ if (components.size() == 0)
+ throw new BAD_PARAM("No component " + id +
+ " in the Internet profile", 28, CompletionStatus.COMPLETED_MAYBE
+ );
+ else
+ {
+ TaggedComponent[] t = new TaggedComponent[ components.size() ];
+ for (int i = 0; i < t.length; i++)
+ t [ i ] = (TaggedComponent) components.get(i);
+ return t;
+ }
+ }
+ }
+
+ /**
+ * This should be not implemented up till jdk 1.5 inclusive.
+ */
+ public Policy get_request_policy(int type) throws INV_POLICY
+ {
+ throw new NO_IMPLEMENT();
+ }
+
+ /** @inheritDoc */
+ public String received_exception_id()
+ {
+ return m_exception_id;
+ }
+
+ /** @inheritDoc */
+ public Any received_exception()
+ {
+ if (m_exception_id == null)
+ return null;
+
+ if (m_sys_ex != null)
+ {
+ Any a = orb.create_any();
+ ObjectCreator.insertSysException(a, m_sys_ex);
+ return a;
+ }
+
+ Exception mex = m_environment.exception();
+
+ UnknownUserException ex = (UnknownUserException) mex;
+ if (ex == null)
+ return null;
+ else
+ return ex.except;
+ }
+
+ /**
+ * Return the forwarded reference, null if none.
+ */
+ public org.omg.CORBA.Object forward_reference()
+ {
+ if (m_forwarding_target != null)
+ return m_forwarding_target;
+
+ if (m_forward_ior != null)
+ return new IOR_contructed_object(orb, m_forward_ior);
+ else
+ return null;
+ }
+
+ /**
+ * Get the slot from the slot array inside this request.
+ */
+ public Any get_slot(int id) throws InvalidSlot
+ {
+ try
+ {
+ return m_slots [ id ];
+ }
+ catch (Exception e)
+ {
+ throw new InvalidSlot("slot id " + id + ":" + e);
+ }
+ }
+
+ /**
+ * Get the reply status.
+ */
+ public short reply_status()
+ {
+ if (m_rph == null)
+ throw new BAD_INV_ORDER("Request not yet sent", 14,
+ CompletionStatus.COMPLETED_NO
+ );
+ return (short) m_rph.reply_status;
+ }
+
+ /**
+ * Get the request id.
+ */
+ public int request_id()
+ {
+ return m_rqh.request_id;
+ }
+
+ /**
+ * Return true if the response is expected.
+ */
+ public boolean response_expected()
+ {
+ return !oneWay;
+ }
+
+ /**
+ * Determines how far the request shall progress before control is returned to
+ * the client. However up till JDK 1.5 inclusive this method always returns
+ * SYNC_WITH_TRANSPORT.
+ *
+ * @return {@link org.omg.Messaging.SYNC_WITH_TRANSPORT.value (1), always.
+ *
+ * @specnote as defined in the Suns 1.5 JDK API.
+ */
+ public short sync_scope()
+ {
+ return org.omg.Messaging.SYNC_WITH_TRANSPORT.value;
+ }
+
+ /** @inheritDoc */
+ public ServiceContext get_request_service_context(int ctx_name)
+ throws BAD_PARAM
+ {
+ return gnu.CORBA.GIOP.ServiceContext.findContext(ctx_name,
+ m_rqh.service_context
+ );
+ }
+
+ /** @inheritDoc */
+ public ServiceContext get_reply_service_context(int ctx_name)
+ throws BAD_PARAM
+ {
+ if (m_rph == null)
+ throw new BAD_INV_ORDER("Reply context not yet available");
+ return gnu.CORBA.GIOP.ServiceContext.findContext(ctx_name,
+ m_rph.service_context
+ );
+ }
+
+ /** @inheritDoc */
+ public String[] operation_context()
+ {
+ return ice_contexts();
+ }
+
+ /**
+ * Get contexts as required by interceptor.
+ */
+ public String[] ice_contexts()
+ {
+ if (m_context_list == null)
+ return new String[ 0 ];
+ else
+ {
+ try
+ {
+ String[] cn = new String[ m_context_list.count() ];
+ for (int i = 0; i < cn.length; i++)
+ cn [ i ] = m_context_list.item(i);
+ return cn;
+ }
+ catch (Bounds e)
+ {
+ throw new Unexpected(e);
+ }
+ }
+ }
+
+ /**
+ * Check if the call is done via DII.
+ */
+ public void checkDii()
+ {
+ if (m_parameter_buffer != null)
+ throw new NO_RESOURCES("The invocation method provides " +
+ "no access to this resource. DII call required.", 1,
+ CompletionStatus.COMPLETED_MAYBE
+ );
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/holderFactory.java b/libjava/classpath/gnu/CORBA/holderFactory.java
index 177797a..159d223 100644
--- a/libjava/classpath/gnu/CORBA/holderFactory.java
+++ b/libjava/classpath/gnu/CORBA/holderFactory.java
@@ -68,74 +68,76 @@ import org.omg.CORBA.UShortSeqHolder;
import org.omg.CORBA.WCharSeqHolder;
import org.omg.CORBA.WStringSeqHolder;
import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.ObjectHolder;
/**
- * Creates the suitable holder for storing the value of the given
- * type.
+ * Creates the suitable holder for storing the value of the given final_type.
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public class holderFactory
{
/**
- * The array, sufficiently large to use any {@link TCKind}._tk* constant
- * as an index.
+ * The array, sufficiently large to use any {@link TCKind}._tk* constant as
+ * an index.
*/
private static final Class[] holders;
+
private static final Class[] seqHolders;
static
- {
- holders = new Class[ 32 ];
- holders [ TCKind._tk_Principal ] = PrincipalHolder.class;
- holders [ TCKind._tk_TypeCode ] = TypeCodeHolder.class;
- holders [ TCKind._tk_any ] = AnyHolder.class;
- holders [ TCKind._tk_boolean ] = BooleanHolder.class;
- holders [ TCKind._tk_char ] = CharHolder.class;
- holders [ TCKind._tk_double ] = DoubleHolder.class;
- holders [ TCKind._tk_float ] = FloatHolder.class;
- holders [ TCKind._tk_fixed ] = FixedHolder.class;
- holders [ TCKind._tk_long ] = IntHolder.class;
- holders [ TCKind._tk_longdouble ] = DoubleHolder.class;
- holders [ TCKind._tk_longlong ] = LongHolder.class;
- holders [ TCKind._tk_octet ] = OctetHolder.class;
- holders [ TCKind._tk_short ] = ShortHolder.class;
- holders [ TCKind._tk_string ] = StringHolder.class;
- holders [ TCKind._tk_ulong ] = IntHolder.class;
- holders [ TCKind._tk_ulonglong ] = LongHolder.class;
- holders [ TCKind._tk_ushort ] = ShortHolder.class;
- holders [ TCKind._tk_wchar ] = WCharHolder.class;
- holders [ TCKind._tk_wstring ] = WStringHolder.class;
-
- seqHolders = new Class[ 32 ];
-
- seqHolders [ TCKind._tk_ulonglong ] = ULongLongSeqHolder.class;
- seqHolders [ TCKind._tk_short ] = ShortSeqHolder.class;
- seqHolders [ TCKind._tk_octet ] = OctetSeqHolder.class;
- seqHolders [ TCKind._tk_any ] = AnySeqHolder.class;
- seqHolders [ TCKind._tk_long ] = LongSeqHolder.class;
- seqHolders [ TCKind._tk_longlong ] = LongLongSeqHolder.class;
- seqHolders [ TCKind._tk_float ] = FloatSeqHolder.class;
- seqHolders [ TCKind._tk_double ] = DoubleSeqHolder.class;
- seqHolders [ TCKind._tk_char ] = CharSeqHolder.class;
- seqHolders [ TCKind._tk_boolean ] = BooleanSeqHolder.class;
- seqHolders [ TCKind._tk_wchar ] = WCharSeqHolder.class;
- seqHolders [ TCKind._tk_ushort ] = UShortSeqHolder.class;
- seqHolders [ TCKind._tk_ulong ] = ULongSeqHolder.class;
- seqHolders [ TCKind._tk_string ] = StringSeqHolder.class;
- seqHolders [ TCKind._tk_wstring ] = WStringSeqHolder.class;
- }
+ {
+ holders = new Class[32];
+ holders[TCKind._tk_Principal] = PrincipalHolder.class;
+ holders[TCKind._tk_TypeCode] = TypeCodeHolder.class;
+ holders[TCKind._tk_any] = AnyHolder.class;
+ holders[TCKind._tk_boolean] = BooleanHolder.class;
+ holders[TCKind._tk_char] = CharHolder.class;
+ holders[TCKind._tk_double] = DoubleHolder.class;
+ holders[TCKind._tk_float] = FloatHolder.class;
+ holders[TCKind._tk_fixed] = FixedHolder.class;
+ holders[TCKind._tk_long] = IntHolder.class;
+ holders[TCKind._tk_longdouble] = DoubleHolder.class;
+ holders[TCKind._tk_longlong] = LongHolder.class;
+ holders[TCKind._tk_octet] = OctetHolder.class;
+ holders[TCKind._tk_short] = ShortHolder.class;
+ holders[TCKind._tk_string] = StringHolder.class;
+ holders[TCKind._tk_ulong] = IntHolder.class;
+ holders[TCKind._tk_ulonglong] = LongHolder.class;
+ holders[TCKind._tk_ushort] = ShortHolder.class;
+ holders[TCKind._tk_wchar] = WCharHolder.class;
+ holders[TCKind._tk_wstring] = WStringHolder.class;
+ holders[TCKind._tk_objref] = ObjectHolder.class;
+
+ seqHolders = new Class[32];
+
+ seqHolders[TCKind._tk_ulonglong] = ULongLongSeqHolder.class;
+ seqHolders[TCKind._tk_short] = ShortSeqHolder.class;
+ seqHolders[TCKind._tk_octet] = OctetSeqHolder.class;
+ seqHolders[TCKind._tk_any] = AnySeqHolder.class;
+ seqHolders[TCKind._tk_long] = LongSeqHolder.class;
+ seqHolders[TCKind._tk_longlong] = LongLongSeqHolder.class;
+ seqHolders[TCKind._tk_float] = FloatSeqHolder.class;
+ seqHolders[TCKind._tk_double] = DoubleSeqHolder.class;
+ seqHolders[TCKind._tk_char] = CharSeqHolder.class;
+ seqHolders[TCKind._tk_boolean] = BooleanSeqHolder.class;
+ seqHolders[TCKind._tk_wchar] = WCharSeqHolder.class;
+ seqHolders[TCKind._tk_ushort] = UShortSeqHolder.class;
+ seqHolders[TCKind._tk_ulong] = ULongSeqHolder.class;
+ seqHolders[TCKind._tk_string] = StringSeqHolder.class;
+ seqHolders[TCKind._tk_wstring] = WStringSeqHolder.class;
+ }
/**
- * Create a holder for storing the value of the given built-in type.
- * This function returns the defined holders for the built-in primitive
- * types and they sequences.
+ * Create a holder for storing the value of the given built-in final_type. This
+ * function returns the defined holders for the built-in primitive types and
+ * they sequences.
*
* @param t the typecode
*
- * @return an instance of the corresponding built-in holder of null
- * if no such is defined for this type. The holder is created with a
- * parameterless constructor.
+ * @return an instance of the corresponding built-in holder of null if no such
+ * is defined for this final_type. The holder is created with a parameterless
+ * constructor.
*/
public static Streamable createHolder(TypeCode t)
{
@@ -145,24 +147,23 @@ public class holderFactory
int componentKind;
Streamable holder = null;
- Streamable component;
- if (kind < holders.length && holders [ kind ] != null)
- holder = (Streamable) holders [ kind ].newInstance();
+ if (kind < holders.length && holders[kind] != null)
+ holder = (Streamable) holders[kind].newInstance();
if (holder != null)
return holder;
switch (kind)
{
- case TCKind._tk_sequence :
- componentKind = t.content_type().kind().value();
- if (componentKind < seqHolders.length)
- return (Streamable) seqHolders [ componentKind ].newInstance();
- break;
-
- default :
- break;
+ case TCKind._tk_sequence:
+ componentKind = t.content_type().kind().value();
+ if (componentKind < seqHolders.length)
+ return (Streamable) seqHolders[componentKind].newInstance();
+ break;
+
+ default:
+ break;
}
}
catch (Exception ex)
diff --git a/libjava/classpath/gnu/CORBA/primitiveArrayTypeCode.java b/libjava/classpath/gnu/CORBA/primitiveArrayTypeCode.java
index 7e2beeb..fc020be 100644
--- a/libjava/classpath/gnu/CORBA/primitiveArrayTypeCode.java
+++ b/libjava/classpath/gnu/CORBA/primitiveArrayTypeCode.java
@@ -1,39 +1,39 @@
/* primitiveArrayTypeCode.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
- This file is part of GNU Classpath.
-
- GNU Classpath is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- GNU Classpath is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNU Classpath; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301 USA.
-
- Linking this library statically or dynamically with other modules is
- making a combined work based on this library. Thus, the terms and
- conditions of the GNU General Public License cover the whole
- combination.
-
- As a special exception, the copyright holders of this library give you
- permission to link this library with independent modules to produce an
- executable, regardless of the license terms of these independent
- modules, and to copy and distribute the resulting executable under
- terms of your choice, provided that you also meet, for each linked
- independent module, the terms and conditions of the license of that
- module. An independent module is a module which is not derived from
- or based on this library. If you modify this library, you may extend
- this exception to your version of the library, but you are not
- obligated to do so. If you do not wish to do so, delete this
- exception statement from your version. */
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
package gnu.CORBA;
@@ -61,10 +61,10 @@ public class primitiveArrayTypeCode
private int length;
/**
- * Create a primitive array type code, defining the sequence
- * {@link TCKind.tk_sequence)} with
+ * Create a primitive array type code, defining the sequence
+ * {@link TCKind.tk_sequence)} with
* the given member type.
- *
+ *
* @param array_of the sequence member type.
*/
public primitiveArrayTypeCode(TCKind array_of)
@@ -76,7 +76,7 @@ public class primitiveArrayTypeCode
/**
* Create a primitive array type code, defining the array, sequence
* or other type with the given member type.
- *
+ *
* @param this_type the type of this type (normally either
* sequence of array).
* @param array_of the sequence member type.
diff --git a/libjava/classpath/gnu/CORBA/primitiveTypeCode.java b/libjava/classpath/gnu/CORBA/primitiveTypeCode.java
index 1fa5cd0..4bf97d0 100644
--- a/libjava/classpath/gnu/CORBA/primitiveTypeCode.java
+++ b/libjava/classpath/gnu/CORBA/primitiveTypeCode.java
@@ -1,40 +1,41 @@
/* primitiveTypeCode.java --
Copyright (C) 2005 Free Software Foundation, Inc.
- This file is part of GNU Classpath.
-
- GNU Classpath is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- GNU Classpath is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNU Classpath; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301 USA.
-
- Linking this library statically or dynamically with other modules is
- making a combined work based on this library. Thus, the terms and
- conditions of the GNU General Public License cover the whole
- combination.
-
- As a special exception, the copyright holders of this library give you
- permission to link this library with independent modules to produce an
- executable, regardless of the license terms of these independent
- modules, and to copy and distribute the resulting executable under
- terms of your choice, provided that you also meet, for each linked
- independent module, the terms and conditions of the license of that
- module. An independent module is a module which is not derived from
- or based on this library. If you modify this library, you may extend
- this exception to your version of the library, but you are not
- obligated to do so. If you do not wish to do so, delete this
- exception statement from your version. */
-
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
package gnu.CORBA;
diff --git a/libjava/classpath/gnu/CORBA/typeNamer.java b/libjava/classpath/gnu/CORBA/typeNamer.java
index 8b70101..f790dc9 100644
--- a/libjava/classpath/gnu/CORBA/typeNamer.java
+++ b/libjava/classpath/gnu/CORBA/typeNamer.java
@@ -83,7 +83,7 @@ public class typeNamer
new primitiveTypeCode(TCKind.tk_any),
new primitiveTypeCode(TCKind.tk_TypeCode),
new primitiveTypeCode(TCKind.tk_Principal),
- new primitiveTypeCode(TCKind.tk_objref),
+ new recordTypeCode(TCKind.tk_objref),
new primitiveTypeCode(TCKind.tk_struct),
new primitiveTypeCode(TCKind.tk_union),
new primitiveTypeCode(TCKind.tk_enum),
@@ -104,6 +104,15 @@ public class typeNamer
new primitiveTypeCode(TCKind.tk_abstract_interface)
};
+ static
+ {
+ // The Id of the "abstract object" is defined as empty string.
+ recordTypeCode object =
+ (recordTypeCode) primitveCodes [ TCKind._tk_objref ];
+ object.setId("");
+ object.setName("Object");
+ }
+
/**
* Get the primitive type code.
*
@@ -168,4 +177,4 @@ public class typeNamer
return "type of kind '" + type.kind().value() + "'";
}
}
-}
+} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/universalHolder.java b/libjava/classpath/gnu/CORBA/universalHolder.java
index 6d8b774..c20dac44 100644
--- a/libjava/classpath/gnu/CORBA/universalHolder.java
+++ b/libjava/classpath/gnu/CORBA/universalHolder.java
@@ -60,7 +60,7 @@ import java.io.IOException;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-class universalHolder
+public class universalHolder
implements Streamable
{
/**
@@ -71,7 +71,7 @@ class universalHolder
/**
* Create the universal holder that uses the given buffer to store the data.
*/
- universalHolder(cdrBufOutput buffer)
+ public universalHolder(cdrBufOutput buffer)
{
value = buffer;
}
@@ -154,4 +154,21 @@ class universalHolder
{
return value.create_input_stream();
}
-}
+
+ /**
+ * Clone.
+ */
+ public universalHolder Clone()
+ {
+ try
+ {
+ cdrBufOutput nb = new cdrBufOutput(value.buffer.size());
+ value.buffer.writeTo(nb);
+ return new universalHolder(nb);
+ }
+ catch (IOException ex)
+ {
+ throw new Unexpected(ex);
+ }
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/gnu/classpath/Configuration.java.in b/libjava/classpath/gnu/classpath/Configuration.java.in
index 9da4a82..569ccf5 100644
--- a/libjava/classpath/gnu/classpath/Configuration.java.in
+++ b/libjava/classpath/gnu/classpath/Configuration.java.in
@@ -80,33 +80,6 @@ public interface Configuration
boolean INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@;
/**
- * Set to true if the VM provides a native method to implement
- * Proxy.getProxyClass completely, including argument verification.
- * If this is true, HAVE_NATIVE_GET_PROXY_DATA and
- * HAVE_NATIVE_GENERATE_PROXY_CLASS should be false.
- * @see java.lang.reflect.Proxy
- */
- boolean HAVE_NATIVE_GET_PROXY_CLASS = false;
-
- /**
- * Set to true if the VM provides a native method to implement
- * the first part of Proxy.getProxyClass: generation of the array
- * of methods to convert, and verification of the arguments.
- * If this is true, HAVE_NATIVE_GET_PROXY_CLASS should be false.
- * @see java.lang.reflect.Proxy
- */
- boolean HAVE_NATIVE_GET_PROXY_DATA = false;
-
- /**
- * Set to true if the VM provides a native method to implement
- * the second part of Proxy.getProxyClass: conversion of an array of
- * methods into an actual proxy class.
- * If this is true, HAVE_NATIVE_GET_PROXY_CLASS should be false.
- * @see java.lang.reflect.Proxy
- */
- boolean HAVE_NATIVE_GENERATE_PROXY_CLASS = false;
-
- /**
* Name of default AWT peer library.
*/
String default_awt_peer_toolkit = "@default_toolkit@";
diff --git a/libjava/classpath/gnu/classpath/RawData.java b/libjava/classpath/gnu/classpath/RawData.java
deleted file mode 100644
index 3ce9748..0000000
--- a/libjava/classpath/gnu/classpath/RawData.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/* RawData.java -- Pointer to VM specific data
- Copyright (C) 1999, 2000, 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., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-/* This file is originally part of libgcj. */
-
-package gnu.classpath;
-
-/** A type used to indicate special data used by native code that should not
- be marked by the garbage collector. */
-
-public abstract class RawData
-{
-}
diff --git a/libjava/classpath/gnu/classpath/RawData32.java b/libjava/classpath/gnu/classpath/RawData32.java
deleted file mode 100644
index c771631..0000000
--- a/libjava/classpath/gnu/classpath/RawData32.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/* RawData32.java -- 32 bit Pointer
- Copyright (C) 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., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.classpath;
-
-/**
- * A type used to indicate special data used by native code that should not
- * be marked by the garbage collector.
- */
-public final class RawData32 extends RawData
-{
- final int data;
-
- public RawData32(int data)
- {
- this.data = data;
- }
-}
diff --git a/libjava/classpath/gnu/classpath/RawData64.java b/libjava/classpath/gnu/classpath/RawData64.java
deleted file mode 100644
index e3b6a93..0000000
--- a/libjava/classpath/gnu/classpath/RawData64.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/* RawData64.java -- 64 bit Pointer
- Copyright (C) 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., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.classpath;
-
-/**
- * A type used to indicate special data used by native code that should not
- * be marked by the garbage collector.
- */
-public final class RawData64 extends RawData
-{
- final long data;
-
- public RawData64(long data)
- {
- this.data = data;
- }
-}
diff --git a/libjava/classpath/gnu/classpath/debug/Component.java b/libjava/classpath/gnu/classpath/debug/Component.java
index 3dfc892..242419c 100644
--- a/libjava/classpath/gnu/classpath/debug/Component.java
+++ b/libjava/classpath/gnu/classpath/debug/Component.java
@@ -110,6 +110,12 @@ public final class Component extends Level
*/
public static final Component X509 = new Component ("X.509", 6);
+ /**
+ * Trace access control policies, including the parsing of
+ * java.policy files.
+ */
+ public static final Component POLICY = new Component ("POLICY", 7);
+
private final int startIndex;
private final int endIndex;
diff --git a/libjava/classpath/gnu/classpath/jdwp/exception/InvalidThreadGroupException.java b/libjava/classpath/gnu/classpath/jdwp/exception/InvalidThreadGroupException.java
index 0476218..8b05e04 100644
--- a/libjava/classpath/gnu/classpath/jdwp/exception/InvalidThreadGroupException.java
+++ b/libjava/classpath/gnu/classpath/jdwp/exception/InvalidThreadGroupException.java
@@ -53,11 +53,11 @@ public class InvalidThreadGroupException
public InvalidThreadGroupException (long id)
{
super (JdwpConstants.Error.INVALID_THREAD_GROUP,
- "invalid thread id (" + id + ")");
+ "invalid thread group id (" + id + ")");
}
public InvalidThreadGroupException (Throwable t)
{
- super (JdwpConstants.Error.INVALID_THREAD, t);
+ super (JdwpConstants.Error.INVALID_THREAD_GROUP, t);
}
}
diff --git a/libjava/classpath/gnu/classpath/jdwp/exception/JdwpInternalErrorException.java b/libjava/classpath/gnu/classpath/jdwp/exception/JdwpInternalErrorException.java
index c022dc5..3cf8592 100644
--- a/libjava/classpath/gnu/classpath/jdwp/exception/JdwpInternalErrorException.java
+++ b/libjava/classpath/gnu/classpath/jdwp/exception/JdwpInternalErrorException.java
@@ -50,8 +50,13 @@ import gnu.classpath.jdwp.JdwpConstants;
public class JdwpInternalErrorException
extends JdwpException
{
- public JdwpInternalErrorException (Throwable cause)
+ public JdwpInternalErrorException(Throwable cause)
{
- super (JdwpConstants.Error.INTERNAL, cause);
+ super(JdwpConstants.Error.INTERNAL, cause);
+ }
+
+ public JdwpInternalErrorException(String msg)
+ {
+ super(JdwpConstants.Error.INTERNAL, msg);
}
}
diff --git a/libjava/classpath/gnu/classpath/jdwp/id/ClassLoaderId.java b/libjava/classpath/gnu/classpath/jdwp/id/ClassLoaderId.java
index 1338725..37c4c36 100644
--- a/libjava/classpath/gnu/classpath/jdwp/id/ClassLoaderId.java
+++ b/libjava/classpath/gnu/classpath/jdwp/id/ClassLoaderId.java
@@ -40,6 +40,7 @@ exception statement from your version. */
package gnu.classpath.jdwp.id;
import gnu.classpath.jdwp.JdwpConstants;
+import gnu.classpath.jdwp.exception.InvalidClassLoaderException;
/**
* A class which represents a JDWP thread id
@@ -61,4 +62,21 @@ public class ClassLoaderId
{
super (JdwpConstants.Tag.CLASS_LOADER);
}
+
+ /**
+ * Gets the ClassLoader represented by this ID
+ *
+ * @throws InvalidClassLoaderException if ClassLoader is garbage collected,
+ * or otherwise invalid
+ */
+ public ClassLoader getClassLoader ()
+ throws InvalidClassLoaderException
+ {
+ ClassLoader cl = (ClassLoader) _reference.get ();
+
+ if (cl == null)
+ throw new InvalidClassLoaderException (getId ());
+
+ return cl;
+ }
}
diff --git a/libjava/classpath/gnu/classpath/jdwp/id/ClassObjectId.java b/libjava/classpath/gnu/classpath/jdwp/id/ClassObjectId.java
index e5559ce..3e16422 100644
--- a/libjava/classpath/gnu/classpath/jdwp/id/ClassObjectId.java
+++ b/libjava/classpath/gnu/classpath/jdwp/id/ClassObjectId.java
@@ -40,6 +40,7 @@ exception statement from your version. */
package gnu.classpath.jdwp.id;
import gnu.classpath.jdwp.JdwpConstants;
+import gnu.classpath.jdwp.exception.InvalidClassException;
/**
* A class which represents a JDWP class object id
@@ -61,4 +62,21 @@ public class ClassObjectId
{
super (JdwpConstants.Tag.CLASS_OBJECT);
}
+
+ /**
+ * Gets the Class object represented by this ID
+ *
+ * @throws InvalidClassException if Class is garbage collected,
+ * or otherwise invalid
+ */
+ public Class getClassObject ()
+ throws InvalidClassException
+ {
+ Class cl = (Class) _reference.get ();
+
+ if (cl == null)
+ throw new InvalidClassException (getId ());
+
+ return cl;
+ }
}
diff --git a/libjava/classpath/gnu/classpath/jdwp/id/JdwpId.java b/libjava/classpath/gnu/classpath/jdwp/id/JdwpId.java
index 37f82e2..7f610e3 100644
--- a/libjava/classpath/gnu/classpath/jdwp/id/JdwpId.java
+++ b/libjava/classpath/gnu/classpath/jdwp/id/JdwpId.java
@@ -41,6 +41,7 @@ package gnu.classpath.jdwp.id;
import java.io.DataOutputStream;
import java.io.IOException;
+import java.lang.ref.SoftReference;
/**
* A baseclass for all object types reported to the debugger
@@ -62,6 +63,11 @@ public abstract class JdwpId
private byte _tag;
/**
+ * The object/class represented by this Id
+ */
+ protected SoftReference _reference;
+
+ /**
* Constructs an empty <code>JdwpId</code>
*/
public JdwpId (byte tag)
@@ -72,7 +78,7 @@ public abstract class JdwpId
/**
* Sets the id for this object reference
*/
- void setId (long id)
+ public void setId (long id)
{
_id = id;
}
@@ -86,15 +92,33 @@ public abstract class JdwpId
}
/**
+ * Gets the object/class reference for this ID
+ *
+ * @returns a refernce to the object or class
+ */
+ public SoftReference getReference ()
+ {
+ return _reference;
+ }
+
+ /**
+ * Sets the object/class reference for this ID
+ *
+ * @param ref a refernce to the object or class
+ */
+ public void setReference (SoftReference ref)
+ {
+ _reference = ref;
+ }
+
+ /**
* Compares two object ids for equality. Two object ids
* are equal if they point to the same type and contain to
- * the same id number. (NOTE: This is a much stricter check
- * than is necessary: all <code>JdwpId</code>s have unique
- * ids.)
+ * the same id number.
*/
public boolean equals (JdwpId id)
{
- return ((id.getClass () == getClass ()) && (id.getId () == getId ()));
+ return (id.getId () == getId ());
}
/**
diff --git a/libjava/classpath/gnu/classpath/jdwp/id/JdwpIdFactory.java b/libjava/classpath/gnu/classpath/jdwp/id/JdwpIdFactory.java
deleted file mode 100644
index 06ec3c7..0000000
--- a/libjava/classpath/gnu/classpath/jdwp/id/JdwpIdFactory.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/* JdwpIdFactory.java -- factory for generating type and object IDs
- Copyright (C) 2005 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., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath.jdwp.id;
-
-import java.util.HashMap;
-
-/**
- * This factory generates ids for objects and types that may
- * be sent to a debugger.
- *
- * @author Keith Seitz (keiths@redhat.com)
- */
-public class JdwpIdFactory
-{
- // ID of last object / referencetype
- private static Object _idLock = new Object ();
- private static Object _ridLock = new Object ();
- private static long _lastId = 0;
- private static long _lastRid = 0;
-
- // A list of all ID types
- private static HashMap _idList = new HashMap ();
-
- // Initialize the id list with known types
- static
- {
- // ObjectId and ArrayId are special cases. See newId.
- _idList.put (ClassLoaderId.typeClass, ClassLoaderId.class);
- _idList.put (ClassObjectId.typeClass, ClassObjectId.class);
- //_idList.put (FieldId.typeClass, FieldId.class);
- //_idList.put (FrameId.typeClass, FrameId.class);
- //_idList.put (MethodId.typeClass, MethodId.class);
- _idList.put (StringId.typeClass, StringId.class);
- _idList.put (ThreadId.typeClass, ThreadId.class);
- _idList.put (ThreadGroupId.typeClass, ThreadGroupId.class);
- }
-
- /**
- * Returns a new id for the given object
- *
- * @param object the object for which an id is desired
- * @returns a suitable object id
- */
- public static JdwpId newId (Object object)
- {
- JdwpId id = null;
-
- // Special case: arrays
- if (object.getClass ().isArray ())
- id = new ArrayId ();
- else
- {
- // Loop through all classes until we hit baseclass
- Class myClass;
- for (myClass = object.getClass (); myClass != null;
- myClass = myClass.getSuperclass ())
- {
- Class clz = (Class) _idList.get (myClass);
- if (clz != null)
- {
- try
- {
- id = (JdwpId) clz.newInstance ();
- synchronized (_idLock)
- {
- id.setId (++_lastId);
- }
- return id;
- }
- catch (InstantiationException ie)
- {
- // This really should not happen
- throw new RuntimeException ("cannot create new ID", ie);
- }
- catch (IllegalAccessException iae)
- {
- // This really should not happen
- throw new RuntimeException ("illegal access of ID", iae);
- }
- }
- }
-
- /* getSuperclass returned null and no matching ID type found.
- So it must derive from Object. */
- id = new ObjectId ();
- }
-
- synchronized (_idLock)
- {
- id.setId (++_lastId);
- }
-
- return id;
- }
-
- /**
- * Returns a new reference type id for the given class
- *
- * @param clazz the <code>Class</code> for which an id is desired
- * @returns a suitable reference type id or <code>null</code>
- */
- public static ReferenceTypeId newReferenceTypeId (Class clazz)
- {
- ReferenceTypeId id = null;
- try
- {
- if (clazz.isArray ())
- id = new ArrayReferenceTypeId ();
- else if (clazz.isInterface ())
- id = new InterfaceReferenceTypeId ();
- else
- id = new ClassReferenceTypeId ();
- synchronized (_ridLock)
- {
- id.setId (++_lastRid);
- }
- return id;
- }
- catch (InstantiationException ie)
- {
- return null;
- }
- catch (IllegalAccessException iae)
- {
- return null;
- }
- }
-}
diff --git a/libjava/classpath/gnu/classpath/jdwp/id/ObjectId.java b/libjava/classpath/gnu/classpath/jdwp/id/ObjectId.java
index e34a3b5..3e2abd4 100644
--- a/libjava/classpath/gnu/classpath/jdwp/id/ObjectId.java
+++ b/libjava/classpath/gnu/classpath/jdwp/id/ObjectId.java
@@ -40,12 +40,15 @@ exception statement from your version. */
package gnu.classpath.jdwp.id;
import gnu.classpath.jdwp.JdwpConstants;
+import gnu.classpath.jdwp.exception.InvalidObjectException;
import java.io.DataOutputStream;
import java.io.IOException;
/**
- * A class which represents a JDWP object id for an object
+ * This is a base class for all ObjectID-like entities in JDWP,
+ * inculding Objects, ClassObject, ClassLoader, Thread, ThreadGroup,
+ * etc.
*
* @author Keith Seitz <keiths@redhat.com>
*/
@@ -57,6 +60,9 @@ public class ObjectId
*/
public static final Class typeClass = Object.class;
+ // Handle to disable garbage collection
+ private Object _handle;
+
/**
* Constructs a new <code>ObjectId</code>
*/
@@ -85,6 +91,23 @@ public class ObjectId
}
/**
+ * Returns the object referred to by this ID
+ *
+ * @returns the object
+ * @throws InvalidObjectException if the object was garbage collected
+ * or is invalid
+ */
+ public Object getObject ()
+ throws InvalidObjectException
+ {
+ Object obj = _reference.get ();
+ if (obj == null)
+ throw new InvalidObjectException (_id);
+
+ return obj;
+ }
+
+ /**
* Writes the id to the stream
*
* @param outStream the stream to which to write
@@ -96,4 +119,21 @@ public class ObjectId
// All we need to do is write out our id as an 8-byte integer
outStream.writeLong (_id);
}
+
+ /**
+ * Disable garbage collection on object
+ */
+ public void disableCollection ()
+ throws InvalidObjectException
+ {
+ _handle = getObject ();
+ }
+
+ /**
+ * Enable garbage collection on object
+ */
+ public void enableCollection ()
+ {
+ _handle = null;
+ }
}
diff --git a/libjava/classpath/gnu/classpath/jdwp/id/ReferenceTypeId.java b/libjava/classpath/gnu/classpath/jdwp/id/ReferenceTypeId.java
index cdb7804..e7a5d2c 100644
--- a/libjava/classpath/gnu/classpath/jdwp/id/ReferenceTypeId.java
+++ b/libjava/classpath/gnu/classpath/jdwp/id/ReferenceTypeId.java
@@ -39,6 +39,8 @@ exception statement from your version. */
package gnu.classpath.jdwp.id;
+import gnu.classpath.jdwp.exception.InvalidClassException;
+
import java.io.DataOutputStream;
import java.io.IOException;
@@ -68,6 +70,22 @@ public class ReferenceTypeId
}
/**
+ * Gets the class associated with this ID
+ *
+ * @returns the class
+ * @throws InvalidClassException if the class is not valid
+ */
+ public Class getType ()
+ throws InvalidClassException
+ {
+ Class clazz = (Class) _reference.get ();
+ if (clazz == null)
+ throw new InvalidClassException (_id);
+
+ return clazz;
+ }
+
+ /**
* Outputs the reference type ID to the given output stream
*
* @param outStream the stream to which to write the data
diff --git a/libjava/classpath/gnu/classpath/jdwp/id/StringId.java b/libjava/classpath/gnu/classpath/jdwp/id/StringId.java
index ea1a83a..1ba8f6d 100644
--- a/libjava/classpath/gnu/classpath/jdwp/id/StringId.java
+++ b/libjava/classpath/gnu/classpath/jdwp/id/StringId.java
@@ -40,6 +40,7 @@ exception statement from your version. */
package gnu.classpath.jdwp.id;
import gnu.classpath.jdwp.JdwpConstants;
+import gnu.classpath.jdwp.exception.InvalidStringException;
/**
* A class which represents a JDWP string id
@@ -61,4 +62,21 @@ public class StringId
{
super (JdwpConstants.Tag.STRING);
}
+
+ /**
+ * Gets the String represented by this ID
+ *
+ * @throws InvalidStringException if String is garbage collected,
+ * or otherwise invalid
+ */
+ public String getString ()
+ throws InvalidStringException
+ {
+ String string = (String) _reference.get ();
+
+ if (string == null)
+ throw new InvalidStringException (getId ());
+
+ return string;
+ }
}
diff --git a/libjava/classpath/gnu/classpath/jdwp/id/ThreadGroupId.java b/libjava/classpath/gnu/classpath/jdwp/id/ThreadGroupId.java
index aef7d5b..f4d9d80 100644
--- a/libjava/classpath/gnu/classpath/jdwp/id/ThreadGroupId.java
+++ b/libjava/classpath/gnu/classpath/jdwp/id/ThreadGroupId.java
@@ -40,6 +40,7 @@ exception statement from your version. */
package gnu.classpath.jdwp.id;
import gnu.classpath.jdwp.JdwpConstants;
+import gnu.classpath.jdwp.exception.InvalidThreadGroupException;
/**
* A class which represents a JDWP thread group id
@@ -61,4 +62,21 @@ public class ThreadGroupId
{
super (JdwpConstants.Tag.THREAD_GROUP);
}
+
+ /**
+ * Gets the thread group represented by this ID
+ *
+ * @throws InvalidThreadGroupException if the group is invalid
+ * or garbage collected
+ */
+ public ThreadGroup getThreadGroup ()
+ throws InvalidThreadGroupException
+ {
+ ThreadGroup group = (ThreadGroup) _reference.get ();
+
+ if (group == null)
+ throw new InvalidThreadGroupException (getId ());
+
+ return group;
+ }
}
diff --git a/libjava/classpath/gnu/classpath/jdwp/id/ThreadId.java b/libjava/classpath/gnu/classpath/jdwp/id/ThreadId.java
index 733bf55..207d6b0 100644
--- a/libjava/classpath/gnu/classpath/jdwp/id/ThreadId.java
+++ b/libjava/classpath/gnu/classpath/jdwp/id/ThreadId.java
@@ -40,6 +40,7 @@ exception statement from your version. */
package gnu.classpath.jdwp.id;
import gnu.classpath.jdwp.JdwpConstants;
+import gnu.classpath.jdwp.exception.InvalidThreadException;
/**
* A class which represents a JDWP thread id
@@ -61,4 +62,24 @@ public class ThreadId
{
super (JdwpConstants.Tag.THREAD);
}
+
+ /**
+ * Gets the Thread represented by this ID
+ *
+ * @throws InvalidThreadException if thread is garbage collected,
+ * exited, or otherwise invalid
+ */
+ public Thread getThread ()
+ throws InvalidThreadException
+ {
+ Thread thread = (Thread) _reference.get ();
+
+ /* Spec says if thread is null, not valid, or exited,
+ throw invalid thread */
+ // FIXME: not valid? exited? Is this check valid?
+ if (thread == null || !thread.isAlive ())
+ throw new InvalidThreadException (getId ());
+
+ return thread;
+ }
}
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/CommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/CommandSet.java
index 17b956c..d3a2753 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/CommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/CommandSet.java
@@ -15,8 +15,8 @@ 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.
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
@@ -40,6 +40,7 @@ exception statement from your version. */
package gnu.classpath.jdwp.processor;
import gnu.classpath.jdwp.exception.JdwpException;
+import gnu.classpath.jdwp.VMIdManager;
import java.io.DataOutputStream;
import java.nio.ByteBuffer;
@@ -50,9 +51,14 @@ import java.nio.ByteBuffer;
*
* @author Aaron Luchko <aluchko@redhat.com>
*/
-public interface CommandSet
+public abstract class CommandSet
{
/**
+ * The VM's ID manager
+ */
+ protected final VMIdManager idMan = VMIdManager.getDefault ();
+
+ /**
* Runs the given command with the data in distr and writes the data for the
* reply packet to ostr.
*
@@ -62,7 +68,7 @@ public interface CommandSet
* @return true if the JDWP layer should shut down in response to this packet
* @throws JdwpException command wasn't carried out successfully
*/
- public boolean runCommand(ByteBuffer bb, DataOutputStream os,
- byte command)
+ public abstract boolean runCommand(ByteBuffer bb, DataOutputStream os,
+ byte command)
throws JdwpException;
}
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/FieldCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/FieldCommandSet.java
index f14635b..0907700 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/FieldCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/FieldCommandSet.java
@@ -49,7 +49,8 @@ import java.nio.ByteBuffer;
*
* @author Aaron Luchko <aluchko@redhat.com>
*/
-public class FieldCommandSet implements CommandSet
+public class FieldCommandSet
+ extends CommandSet
{
/**
* There are no commands for this CommandSet at this time so we just throw a
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/InterfaceTypeCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/InterfaceTypeCommandSet.java
index a32da38..5b29182 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/InterfaceTypeCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/InterfaceTypeCommandSet.java
@@ -50,7 +50,8 @@ import java.nio.ByteBuffer;
*
* @author Aaron Luchko <aluchko@redhat.com>
*/
-public class InterfaceTypeCommandSet implements CommandSet
+public class InterfaceTypeCommandSet
+ extends CommandSet
{
/**
* There are no commands for this CommandSet at this time so we just throw a
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java
index 38bb0cd..23a64c3 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java
@@ -1,4 +1,4 @@
-/* ObjectReferenceCommandSet.java -- lass to implement the ObjectReference
+/* ObjectReferenceCommandSet.java -- class to implement the ObjectReference
Command Set
Copyright (C) 2005 Free Software Foundation
@@ -36,20 +36,19 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package gnu.classpath.jdwp.processor;
-import gnu.classpath.jdwp.IVirtualMachine;
-import gnu.classpath.jdwp.Jdwp;
import gnu.classpath.jdwp.JdwpConstants;
+import gnu.classpath.jdwp.VMVirtualMachine;
import gnu.classpath.jdwp.exception.InvalidFieldException;
import gnu.classpath.jdwp.exception.JdwpException;
import gnu.classpath.jdwp.exception.JdwpInternalErrorException;
import gnu.classpath.jdwp.exception.NotImplementedException;
-import gnu.classpath.jdwp.id.IdManager;
import gnu.classpath.jdwp.id.ObjectId;
import gnu.classpath.jdwp.id.ReferenceTypeId;
import gnu.classpath.jdwp.util.Value;
-import gnu.classpath.jdwp.util.MethodInvoker;
+import gnu.classpath.jdwp.util.MethodResult;
import java.io.DataOutputStream;
import java.io.IOException;
@@ -62,14 +61,9 @@ import java.nio.ByteBuffer;
*
* @author Aaron Luchko <aluchko@redhat.com>
*/
-public class ObjectReferenceCommandSet implements CommandSet
+public class ObjectReferenceCommandSet
+ extends CommandSet
{
- // Our hook into the jvm
- private final IVirtualMachine vm = Jdwp.getIVirtualMachine();
-
- // Manages all the different ids that are assigned by jdwp
- private final IdManager idMan = Jdwp.getIdManager();
-
public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command)
throws JdwpException
{
@@ -103,7 +97,7 @@ public class ObjectReferenceCommandSet implements CommandSet
break;
default:
throw new NotImplementedException("Command " + command +
- " not found in String Reference Command Set.");
+ " not found in ObjectReference Command Set.");
}
}
catch (IOException ex)
@@ -118,7 +112,7 @@ public class ObjectReferenceCommandSet implements CommandSet
private void executeReferenceType(ByteBuffer bb, DataOutputStream os)
throws JdwpException, IOException
{
- ObjectId oid = idMan.readId(bb);
+ ObjectId oid = idMan.readObjectId(bb);
Object obj = oid.getObject();
Class clazz = obj.getClass();
ReferenceTypeId refId = idMan.getReferenceTypeId(clazz);
@@ -128,7 +122,7 @@ public class ObjectReferenceCommandSet implements CommandSet
private void executeGetValues(ByteBuffer bb, DataOutputStream os)
throws JdwpException, IOException
{
- ObjectId oid = idMan.readId(bb);
+ ObjectId oid = idMan.readObjectId(bb);
Object obj = oid.getObject();
int numFields = bb.getInt();
@@ -137,25 +131,41 @@ public class ObjectReferenceCommandSet implements CommandSet
for (int i = 0; i < numFields; i++)
{
- Field field = (Field) idMan.readId(bb).getObject();
- Value.writeValueFromField(os, field, obj);
+ Field field = (Field) idMan.readObjectId(bb).getObject();
+ try
+ {
+ field.setAccessible(true); // Might be a private field
+ Object value = field.get(obj);
+ Value.writeTaggedValue(os, value);
+ }
+ catch (IllegalArgumentException ex)
+ {
+ // I suppose this would best qualify as an invalid field then
+ throw new InvalidFieldException(ex);
+ }
+ catch (IllegalAccessException ex)
+ {
+ // Since we set it as accessible this really shouldn't happen
+ throw new JdwpInternalErrorException(ex);
+ }
}
}
private void executeSetValues(ByteBuffer bb, DataOutputStream os)
throws JdwpException, IOException
{
- ObjectId oid = idMan.readId(bb);
+ ObjectId oid = idMan.readObjectId(bb);
Object obj = oid.getObject();
int numFields = bb.getInt();
for (int i = 0; i < numFields; i++)
{
- Field field = (Field) idMan.readId(bb).getObject();
- Object value = Value.getObj(bb, field);
+ Field field = (Field) idMan.readObjectId(bb).getObject();
+ Object value = Value.getUntaggedObj(bb, field.getType());
try
{
+ field.setAccessible(true); // Might be a private field
field.set(obj, value);
}
catch (IllegalArgumentException ex)
@@ -165,7 +175,7 @@ public class ObjectReferenceCommandSet implements CommandSet
}
catch (IllegalAccessException ex)
{
- // We should be able to access any field
+ // Since we set it as accessible this really shouldn't happen
throw new JdwpInternalErrorException(ex);
}
}
@@ -184,16 +194,16 @@ public class ObjectReferenceCommandSet implements CommandSet
private void executeInvokeMethod(ByteBuffer bb, DataOutputStream os)
throws JdwpException, IOException
{
- ObjectId oid = idMan.readId(bb);
+ ObjectId oid = idMan.readObjectId(bb);
Object obj = oid.getObject();
- ObjectId tid = idMan.readId(bb);
+ ObjectId tid = idMan.readObjectId(bb);
Thread thread = (Thread) tid.getObject();
ReferenceTypeId rid = idMan.readReferenceTypeId(bb);
Class clazz = rid.getType();
- ObjectId mid = idMan.readId(bb);
+ ObjectId mid = idMan.readObjectId(bb);
Method method = (Method) mid.getObject();
int args = bb.getInt();
@@ -205,45 +215,49 @@ public class ObjectReferenceCommandSet implements CommandSet
}
int invokeOptions = bb.getInt();
-
- if ((invokeOptions & JdwpConstants.InvokeOptions.INVOKE_SINGLE_THREADED) != 0)
- { // We must suspend all other running threads first
- vm.suspendAllThreads();
+ boolean suspend = ((invokeOptions
+ & JdwpConstants.InvokeOptions.INVOKE_SINGLE_THREADED)
+ != 0);
+ if (suspend)
+ {
+ // We must suspend all other running threads first
+ VMVirtualMachine.suspendAllThreads ();
}
- boolean nonVirtual;
- if ((invokeOptions & JdwpConstants.InvokeOptions.INVOKE_NONVIRTUAL) != 0)
- nonVirtual = true;
- else
- nonVirtual = false;
- MethodInvoker vmi = new MethodInvoker(vm);
-
- vmi.executeMethod(obj, thread, clazz, method, values, nonVirtual);
- Object value = vmi.getReturnedValue();
- ObjectId exceptionId = vmi.getExceptionId();
-
- Value.writeValue(os, value);
- exceptionId.writeTagged(os);
+
+ boolean nonVirtual = ((invokeOptions
+ & JdwpConstants.InvokeOptions.INVOKE_NONVIRTUAL)
+ != 0);
+
+ MethodResult mr = VMVirtualMachine.executeMethod(obj, thread,
+ clazz, method,
+ values, nonVirtual);
+ Object value = mr.getReturnedValue();
+ Exception exception = mr.getThrownException();
+
+ ObjectId eId = idMan.getObjectId(exception);
+ Value.writeTaggedValue(os, value);
+ eId.writeTagged(os);
}
private void executeDisableCollection(ByteBuffer bb, DataOutputStream os)
throws JdwpException, IOException
{
- ObjectId oid = idMan.readId(bb);
+ ObjectId oid = idMan.readObjectId(bb);
oid.disableCollection();
}
private void executeEnableCollection(ByteBuffer bb, DataOutputStream os)
throws JdwpException, IOException
{
- ObjectId oid = idMan.readId(bb);
+ ObjectId oid = idMan.readObjectId(bb);
oid.enableCollection();
}
private void executeIsCollected(ByteBuffer bb, DataOutputStream os)
throws JdwpException, IOException
{
- ObjectId oid = idMan.readId(bb);
- boolean collected = oid.isCollected();
+ ObjectId oid = idMan.readObjectId(bb);
+ boolean collected = (oid.getReference().get () == null);
os.writeBoolean(collected);
}
}
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/PacketProcessor.java b/libjava/classpath/gnu/classpath/jdwp/processor/PacketProcessor.java
index 914494c..9e281f2 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/PacketProcessor.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/PacketProcessor.java
@@ -52,6 +52,7 @@ import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.security.PrivilegedAction;
/**
* This class is responsible for processing packets from the
@@ -62,7 +63,7 @@ import java.nio.ByteBuffer;
* @author Keith Seitz (keiths@redhat.com)
*/
public class PacketProcessor
- extends Thread
+ implements PrivilegedAction
{
// The connection to the debugger
private JdwpConnection _connection;
@@ -134,7 +135,7 @@ public class PacketProcessor
* Main run routine for this thread. Will loop getting packets
* from the connection and processing them.
*/
- public void run ()
+ public Object run ()
{
try
{
@@ -149,6 +150,7 @@ public class PacketProcessor
}
// Time to shutdown, tell Jdwp to shutdown
Jdwp.getDefault().shutdown();
+ return null;
}
/**
@@ -157,7 +159,6 @@ public class PacketProcessor
public void shutdown ()
{
_shutdown = true;
- interrupt ();
}
// Helper function which actually does all the work of waiting
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
index 34def9f..b9944f7 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
@@ -1,4 +1,4 @@
-/* ReferenceTypeCommandSet.java -- lass to implement the ReferenceType
+/* ReferenceTypeCommandSet.java -- class to implement the ReferenceType
Command Set
Copyright (C) 2005 Free Software Foundation
@@ -36,16 +36,15 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package gnu.classpath.jdwp.processor;
-import gnu.classpath.jdwp.IVirtualMachine;
-import gnu.classpath.jdwp.Jdwp;
import gnu.classpath.jdwp.JdwpConstants;
+import gnu.classpath.jdwp.VMVirtualMachine;
import gnu.classpath.jdwp.exception.InvalidFieldException;
import gnu.classpath.jdwp.exception.JdwpException;
import gnu.classpath.jdwp.exception.JdwpInternalErrorException;
import gnu.classpath.jdwp.exception.NotImplementedException;
-import gnu.classpath.jdwp.id.IdManager;
import gnu.classpath.jdwp.id.ObjectId;
import gnu.classpath.jdwp.id.ReferenceTypeId;
import gnu.classpath.jdwp.util.JdwpString;
@@ -63,14 +62,9 @@ import java.nio.ByteBuffer;
*
* @author Aaron Luchko <aluchko@redhat.com>
*/
-public class ReferenceTypeCommandSet implements CommandSet
+public class ReferenceTypeCommandSet
+ extends CommandSet
{
- // Our hook into the jvm
- private final IVirtualMachine vm = Jdwp.getIVirtualMachine();
-
- // Manages all the different ids that are assigned by jdwp
- private final IdManager idMan = Jdwp.getIdManager();
-
public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command)
throws JdwpException
{
@@ -125,7 +119,7 @@ public class ReferenceTypeCommandSet implements CommandSet
break;
default:
throw new NotImplementedException("Command " + command +
- " not found in String Reference Command Set.");
+ " not found in ReferenceType Command Set.");
}
}
catch (IOException ex)
@@ -152,7 +146,7 @@ public class ReferenceTypeCommandSet implements CommandSet
Class clazz = refId.getType();
ClassLoader loader = clazz.getClassLoader();
- ObjectId oid = idMan.getId(loader);
+ ObjectId oid = idMan.getObjectId(loader);
oid.write(os);
}
@@ -176,7 +170,7 @@ public class ReferenceTypeCommandSet implements CommandSet
for (int i = 0; i < fields.length; i++)
{
Field field = fields[i];
- idMan.getId(field).write(os);
+ idMan.getObjectId(field).write(os);
JdwpString.writeString(os, field.getName());
JdwpString.writeString(os, Signature.computeFieldSignature(field));
os.writeInt(field.getModifiers());
@@ -194,7 +188,7 @@ public class ReferenceTypeCommandSet implements CommandSet
for (int i = 0; i < methods.length; i++)
{
Method method = methods[i];
- idMan.getId(method).write(os);
+ idMan.getObjectId(method).write(os);
JdwpString.writeString(os, method.getName());
JdwpString.writeString(os, Signature.computeMethodSignature(method));
os.writeInt(method.getModifiers());
@@ -211,14 +205,31 @@ public class ReferenceTypeCommandSet implements CommandSet
os.writeInt(numFields); // Looks pointless but this is the protocol
for (int i = 0; i < numFields; i++)
{
- ObjectId fieldId = idMan.readId(bb);
+ ObjectId fieldId = idMan.readObjectId(bb);
Field field = (Field) (fieldId.getObject());
Class fieldClazz = field.getDeclaringClass();
// We don't actually need the clazz to get the field but we might as
// well check that the debugger got it right
if (fieldClazz.isAssignableFrom(clazz))
- Value.writeStaticValueFromField(os, field);
+ {
+ try
+ {
+ field.setAccessible(true); // Might be a private field
+ Object value = field.get(null);
+ Value.writeTaggedValue(os, value);
+ }
+ catch (IllegalArgumentException ex)
+ {
+ // I suppose this would best qualify as an invalid field then
+ throw new InvalidFieldException(ex);
+ }
+ catch (IllegalAccessException ex)
+ {
+ // Since we set it as accessible this really shouldn't happen
+ throw new JdwpInternalErrorException(ex);
+ }
+ }
else
throw new InvalidFieldException(fieldId.getId());
}
@@ -231,7 +242,7 @@ public class ReferenceTypeCommandSet implements CommandSet
Class clazz = refId.getType();
// We'll need to go into the jvm for this unless there's an easier way
- String sourceFileName = vm.getSourceFile(clazz);
+ String sourceFileName = VMVirtualMachine.getSourceFile(clazz);
JdwpString.writeString(os, sourceFileName);
// clazz.getProtectionDomain().getCodeSource().getLocation();
}
@@ -258,7 +269,7 @@ public class ReferenceTypeCommandSet implements CommandSet
Class clazz = refId.getType();
// I don't think there's any other way to get this
- int status = vm.getStatus(clazz);
+ int status = VMVirtualMachine.getClassStatus(clazz);
os.writeInt(status);
}
@@ -282,7 +293,7 @@ public class ReferenceTypeCommandSet implements CommandSet
{
ReferenceTypeId refId = idMan.readReferenceTypeId(bb);
Class clazz = refId.getType();
- ObjectId clazzObjectId = idMan.getId(clazz);
+ ObjectId clazzObjectId = idMan.getObjectId(clazz);
clazzObjectId.write(os);
}
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java
index 1f1b04c..8f5bc68 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java
@@ -16,8 +16,8 @@ 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.
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
@@ -40,7 +40,6 @@ exception statement from your version. */
package gnu.classpath.jdwp.processor;
-import gnu.classpath.jdwp.Jdwp;
import gnu.classpath.jdwp.JdwpConstants;
import gnu.classpath.jdwp.exception.JdwpException;
import gnu.classpath.jdwp.exception.JdwpInternalErrorException;
@@ -57,7 +56,8 @@ import java.nio.ByteBuffer;
*
* @author Aaron Luchko <aluchko@redhat.com>
*/
-public class StringReferenceCommandSet implements CommandSet
+public class StringReferenceCommandSet
+ extends CommandSet
{
public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command)
@@ -90,7 +90,7 @@ public class StringReferenceCommandSet implements CommandSet
private void executeValue(ByteBuffer bb, DataOutputStream os)
throws JdwpException, IOException
{
- ObjectId oid = Jdwp.getIdManager().readId(bb);
+ ObjectId oid = idMan.readObjectId(bb);
String str = (String) oid.getObject();
JdwpString.writeString(os, str);
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
index 32b9878..b834068 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
@@ -39,13 +39,11 @@ exception statement from your version. */
package gnu.classpath.jdwp.processor;
-import gnu.classpath.jdwp.IVirtualMachine;
-import gnu.classpath.jdwp.Jdwp;
import gnu.classpath.jdwp.JdwpConstants;
+import gnu.classpath.jdwp.VMVirtualMachine;
import gnu.classpath.jdwp.exception.JdwpException;
import gnu.classpath.jdwp.exception.JdwpInternalErrorException;
import gnu.classpath.jdwp.exception.NotImplementedException;
-import gnu.classpath.jdwp.id.IdManager;
import gnu.classpath.jdwp.id.ObjectId;
import gnu.classpath.jdwp.id.ReferenceTypeId;
import gnu.classpath.jdwp.util.JdwpString;
@@ -63,17 +61,9 @@ import java.util.Properties;
*
* @author Aaron Luchko <aluchko@redhat.com>
*/
-public class VirtualMachineCommandSet implements CommandSet
+public class VirtualMachineCommandSet
+ extends CommandSet
{
- // Our hook into the jvm
- private final IVirtualMachine vm = Jdwp.getIVirtualMachine();
-
- // Manages all the different ids that are assigned by jdwp
- private final IdManager idMan = Jdwp.getIdManager();
-
- // The Jdwp object
- private final Jdwp jdwp = Jdwp.getDefault();
-
public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command)
throws JdwpException
{
@@ -144,9 +134,9 @@ public class VirtualMachineCommandSet implements CommandSet
case JdwpConstants.CommandSet.VirtualMachine.ALL_CLASSES_WITH_GENERIC:
executeAllClassesWithGeneric(bb, os);
break;
-
default:
- break;
+ throw new NotImplementedException("Command " + command +
+ " not found in VirtualMachine Command Set.");
}
}
catch (IOException ex)
@@ -187,7 +177,7 @@ public class VirtualMachineCommandSet implements CommandSet
ArrayList allMatchingClasses = new ArrayList();
// This will be an Iterator over all loaded Classes
- Iterator iter = vm.getAllLoadedClasses();
+ Iterator iter = VMVirtualMachine.getAllLoadedClasses();
while (iter.hasNext())
{
@@ -203,7 +193,7 @@ public class VirtualMachineCommandSet implements CommandSet
Class clazz = (Class) allMatchingClasses.get(i);
ReferenceTypeId id = idMan.getReferenceTypeId(clazz);
id.writeTagged(os);
- int status = vm.getStatus(clazz);
+ int status = VMVirtualMachine.getClassStatus(clazz);
os.writeInt(status);
}
}
@@ -214,14 +204,14 @@ public class VirtualMachineCommandSet implements CommandSet
// Disable garbage collection while we're collecting the info on loaded
// classes so we some classes don't get collected between the time we get
// the count and the time we get the list
- vm.disableGarbageCollection();
+ //VMVirtualMachine.disableGarbageCollection();
- int classCount = vm.getAllLoadedClassesCount();
+ int classCount = VMVirtualMachine.getAllLoadedClassesCount();
os.writeInt(classCount);
// This will be an Iterator over all loaded Classes
- Iterator iter = vm.getAllLoadedClasses();
- vm.enableGarbageCollection();
+ Iterator iter = VMVirtualMachine.getAllLoadedClasses();
+ //VMVirtualMachine.enableGarbageCollection();
int count = 0;
// Note it's possible classes were created since out classCount so make
@@ -233,7 +223,7 @@ public class VirtualMachineCommandSet implements CommandSet
id.writeTagged(os);
String sig = Signature.computeClassSignature(clazz);
JdwpString.writeString(os, sig);
- int status = vm.getStatus(clazz);
+ int status = VMVirtualMachine.getClassStatus(clazz);
os.writeInt(status);
}
}
@@ -246,7 +236,7 @@ public class VirtualMachineCommandSet implements CommandSet
int numThreads = root.activeCount();
Thread allThreads[] = new Thread[numThreads];
- root.enumerate(allThreads, true);
+ root.enumerate(allThreads);
// We need to loop through for the true count since some threads may have
// been destroyed since we got
@@ -270,18 +260,18 @@ public class VirtualMachineCommandSet implements CommandSet
if (thread == null)
break; // No threads after this point
if (!thread.getThreadGroup().equals(jdwpGroup))
- idMan.getId(thread).write(os);
+ idMan.getObjectId(thread).write(os);
}
}
private void executeTopLevelThreadGroups(ByteBuffer bb, DataOutputStream os)
throws JdwpException, IOException
{
- ThreadGroup jdwpGroup = jdwp.getJdwpThreadGroup();
+ ThreadGroup jdwpGroup = Thread.currentThread().getThreadGroup ();
ThreadGroup root = getRootThreadGroup(jdwpGroup);
os.writeInt(1); // Just one top level group allowed?
- idMan.getId(root);
+ idMan.getObjectId(root);
}
private void executeDispose(ByteBuffer bb, DataOutputStream os)
@@ -291,11 +281,11 @@ public class VirtualMachineCommandSet implements CommandSet
// suspended multiple times, we likely need a way to keep track of how many
// times a thread has been suspended or else a stronger resume method for
// this purpose
- // vm.resumeAllThreadsExcept(jdwp.getJdwpThreadGroup());
+ // VMVirtualMachine.resumeAllThreads ();
// Simply shutting down the jdwp layer will take care of the rest of the
// shutdown other than disabling debugging in the VM
- // vm.disableDebugging();
+ // VMVirtualMachine.disableDebugging();
// Don't implement this until we're sure how to remove all the debugging
// effects from the VM.
@@ -318,27 +308,27 @@ public class VirtualMachineCommandSet implements CommandSet
private void executeSuspend(ByteBuffer bb, DataOutputStream os)
throws JdwpException
{
- vm.suspendAllThreadsExcept(jdwp.getJdwpThreadGroup());
+ VMVirtualMachine.suspendAllThreads ();
}
private void executeResume(ByteBuffer bb, DataOutputStream os)
throws JdwpException
{
- vm.resumeAllThreadsExcept(jdwp.getJdwpThreadGroup());
+ VMVirtualMachine.resumeAllThreads ();
}
private void executeExit(ByteBuffer bb, DataOutputStream os)
throws JdwpException, IOException
{
int exitCode = bb.getInt();
- jdwp.setExit(exitCode);
+ System.exit (exitCode);
}
private void executeCreateString(ByteBuffer bb, DataOutputStream os)
throws JdwpException, IOException
{
String string = JdwpString.readString(bb);
- ObjectId stringId = Jdwp.getIdManager().getId(string);
+ ObjectId stringId = idMan.getObjectId(string);
// Since this string isn't referenced anywhere we'll disable garbage
// collection on it so it's still around when the debugger gets back to it.
@@ -386,7 +376,7 @@ public class VirtualMachineCommandSet implements CommandSet
{
// Instead of going through the list of objects they give us it's probably
// better just to find the garbage collected objects ourselves
- idMan.update();
+ //idMan.update();
}
private void executeHoldEvents(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/transport/ITransport.java b/libjava/classpath/gnu/classpath/jdwp/transport/ITransport.java
index 371cf8f..60f1bb0 100644
--- a/libjava/classpath/gnu/classpath/jdwp/transport/ITransport.java
+++ b/libjava/classpath/gnu/classpath/jdwp/transport/ITransport.java
@@ -49,7 +49,7 @@ import java.util.HashMap;
* A class representing a transport layer. This class serves as a generic
* interface for all transport types used in the JDWP back-end.
*
- * @author Keith Seitz <keiths@redhat.com>
+ * @author Keith Seitz (keiths@redhat.com)
*/
public interface ITransport
{
@@ -71,6 +71,11 @@ public interface ITransport
throws TransportException;
/**
+ * Shutdown the transport
+ */
+ public void shutdown ();
+
+ /**
* Get the input stream for the transport
*/
public InputStream getInputStream ()
diff --git a/libjava/classpath/gnu/classpath/jdwp/transport/JdwpConnection.java b/libjava/classpath/gnu/classpath/jdwp/transport/JdwpConnection.java
index 18250d3..f008bbd 100644
--- a/libjava/classpath/gnu/classpath/jdwp/transport/JdwpConnection.java
+++ b/libjava/classpath/gnu/classpath/jdwp/transport/JdwpConnection.java
@@ -96,8 +96,9 @@ public class JdwpConnection
*
* @param transport the transport to use for communications
*/
- public JdwpConnection (ITransport transport)
+ public JdwpConnection (ThreadGroup group, ITransport transport)
{
+ super (group, "JDWP connection thread");
_transport = transport;
_commandQueue = new ArrayList ();
_shutdown = false;
@@ -177,7 +178,7 @@ public class JdwpConnection
2. Transport was shutdown
In either case, we make sure that all of the
back-end gets shutdown. */
- Jdwp.getInstance().shutdown ();
+ Jdwp.getDefault().shutdown ();
}
catch (Throwable t)
{
diff --git a/libjava/classpath/gnu/classpath/jdwp/transport/SocketTransport.java b/libjava/classpath/gnu/classpath/jdwp/transport/SocketTransport.java
index 0ad7357..49d9e1f 100644
--- a/libjava/classpath/gnu/classpath/jdwp/transport/SocketTransport.java
+++ b/libjava/classpath/gnu/classpath/jdwp/transport/SocketTransport.java
@@ -57,7 +57,7 @@ import javax.net.SocketFactory;
* configury string that looks like "name=dt_socket,
* address=localhost:1234,server=y".
*
- * @author Keith Seitz <keiths@redhat.com>
+ * @author Keith Seitz (keiths@redhat.com)
*/
class SocketTransport
implements ITransport
@@ -146,6 +146,22 @@ class SocketTransport
}
/**
+ * Shutdown the socket. This could cause SocketExceptions
+ * for anyone blocked on socket i/o
+ */
+ public void shutdown ()
+ {
+ try
+ {
+ _socket.close ();
+ }
+ catch (Throwable t)
+ {
+ // We don't really care about errors at this point
+ }
+ }
+
+ /**
* Returns an <code>InputStream</code> for the transport
*
* @throws IOException if an I/O error occurs creating the stream
diff --git a/libjava/classpath/gnu/java/awt/AWTUtilities.java b/libjava/classpath/gnu/java/awt/AWTUtilities.java
index a02d1c4..af1fc13 100644
--- a/libjava/classpath/gnu/java/awt/AWTUtilities.java
+++ b/libjava/classpath/gnu/java/awt/AWTUtilities.java
@@ -37,17 +37,28 @@ exception statement from your version. */
package gnu.java.awt;
+import java.applet.Applet;
import java.awt.Component;
import java.awt.Container;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Insets;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Toolkit;
+import java.awt.Window;
+import java.awt.event.MouseEvent;
import java.util.AbstractSequentialList;
import java.util.List;
import java.util.ListIterator;
import java.util.NoSuchElementException;
import java.util.WeakHashMap;
+import java.lang.reflect.InvocationTargetException;
/**
- * This class provides utility methods that are commonly used in AWT
- * (and Swing).
+ * This class mirrors the javax.swing.SwingUtilities class. It
+ * provides commonly needed functionalities for AWT classes without
+ * the need to reference classes in the javax.swing package.
*/
public class AWTUtilities
{
@@ -318,4 +329,366 @@ public class AWTUtilities
return visibleChildren;
}
+
+ /**
+ * Calculates the portion of the base rectangle which is inside the
+ * insets.
+ *
+ * @param base The rectangle to apply the insets to
+ * @param insets The insets to apply to the base rectangle
+ * @param ret A rectangle to use for storing the return value, or
+ * <code>null</code>
+ *
+ * @return The calculated area inside the base rectangle and its insets,
+ * either stored in ret or a new Rectangle if ret is <code>null</code>
+ *
+ * @see #calculateInnerArea
+ */
+ public static Rectangle calculateInsetArea(Rectangle base, Insets insets,
+ Rectangle ret)
+ {
+ if (ret == null)
+ ret = new Rectangle();
+ ret.setBounds(base.x + insets.left, base.y + insets.top,
+ base.width - (insets.left + insets.right),
+ base.height - (insets.top + insets.bottom));
+ return ret;
+ }
+
+ /**
+ * Calculates the bounds of a component in the component's own coordinate
+ * space. The result has the same height and width as the component's
+ * bounds, but its location is set to (0,0).
+ *
+ * @param aComponent The component to measure
+ *
+ * @return The component's bounds in its local coordinate space
+ */
+ public static Rectangle getLocalBounds(Component aComponent)
+ {
+ Rectangle bounds = aComponent.getBounds();
+ return new Rectangle(0, 0, bounds.width, bounds.height);
+ }
+
+ /**
+ * Returns the font metrics object for a given font. The metrics can be
+ * used to calculate crude bounding boxes and positioning information,
+ * for laying out components with textual elements.
+ *
+ * @param font The font to get metrics for
+ *
+ * @return The font's metrics
+ *
+ * @see java.awt.font.GlyphMetrics
+ */
+ public static FontMetrics getFontMetrics(Font font)
+ {
+ return Toolkit.getDefaultToolkit().getFontMetrics(font);
+ }
+
+ /**
+ * Returns the least ancestor of <code>comp</code> which has the
+ * specified name.
+ *
+ * @param name The name to search for
+ * @param comp The component to search the ancestors of
+ *
+ * @return The nearest ancestor of <code>comp</code> with the given
+ * name, or <code>null</code> if no such ancestor exists
+ *
+ * @see java.awt.Component#getName
+ * @see #getAncestorOfClass
+ */
+ public static Container getAncestorNamed(String name, Component comp)
+ {
+ while (comp != null && (comp.getName() != name))
+ comp = comp.getParent();
+ return (Container) comp;
+ }
+
+ /**
+ * Returns the least ancestor of <code>comp</code> which is an instance
+ * of the specified class.
+ *
+ * @param c The class to search for
+ * @param comp The component to search the ancestors of
+ *
+ * @return The nearest ancestor of <code>comp</code> which is an instance
+ * of the given class, or <code>null</code> if no such ancestor exists
+ *
+ * @see #getAncestorOfClass
+ * @see #windowForComponent
+ * @see
+ *
+ */
+ public static Container getAncestorOfClass(Class c, Component comp)
+ {
+ while (comp != null && (! c.isInstance(comp)))
+ comp = comp.getParent();
+ return (Container) comp;
+ }
+
+ /**
+ * Equivalent to calling <code>getAncestorOfClass(Window, comp)</code>.
+ *
+ * @param comp The component to search for an ancestor window
+ *
+ * @return An ancestral window, or <code>null</code> if none exists
+ */
+ public static Window windowForComponent(Component comp)
+ {
+ return (Window) getAncestorOfClass(Window.class, comp);
+ }
+
+ /**
+ * Returns the "root" of the component tree containint <code>comp</code>
+ * The root is defined as either the <em>least</em> ancestor of
+ * <code>comp</code> which is a {@link Window}, or the <em>greatest</em>
+ * ancestor of <code>comp</code> which is a {@link Applet} if no {@link
+ * Window} ancestors are found.
+ *
+ * @param comp The component to search for a root
+ *
+ * @return The root of the component's tree, or <code>null</code>
+ */
+ public static Component getRoot(Component comp)
+ {
+ Applet app = null;
+ Window win = null;
+
+ while (comp != null)
+ {
+ if (win == null && comp instanceof Window)
+ win = (Window) comp;
+ else if (comp instanceof Applet)
+ app = (Applet) comp;
+ comp = comp.getParent();
+ }
+
+ if (win != null)
+ return win;
+ else
+ return app;
+ }
+
+ /**
+ * Return true if a descends from b, in other words if b is an
+ * ancestor of a.
+ *
+ * @param a The child to search the ancestry of
+ * @param b The potential ancestor to search for
+ *
+ * @return true if a is a descendent of b, false otherwise
+ */
+ public static boolean isDescendingFrom(Component a, Component b)
+ {
+ while (true)
+ {
+ if (a == null || b == null)
+ return false;
+ if (a == b)
+ return true;
+ a = a.getParent();
+ }
+ }
+
+ /**
+ * Returns the deepest descendent of parent which is both visible and
+ * contains the point <code>(x,y)</code>. Returns parent when either
+ * parent is not a container, or has no children which contain
+ * <code>(x,y)</code>. Returns <code>null</code> when either
+ * <code>(x,y)</code> is outside the bounds of parent, or parent is
+ * <code>null</code>.
+ *
+ * @param parent The component to search the descendents of
+ * @param x Horizontal coordinate to search for
+ * @param y Vertical coordinate to search for
+ *
+ * @return A component containing <code>(x,y)</code>, or
+ * <code>null</code>
+ *
+ * @see java.awt.Container#findComponentAt
+ */
+ public static Component getDeepestComponentAt(Component parent, int x, int y)
+ {
+ if (parent == null || (! parent.contains(x, y)))
+ return null;
+
+ if (! (parent instanceof Container))
+ return parent;
+
+ Container c = (Container) parent;
+ return c.findComponentAt(x, y);
+ }
+
+ /**
+ * Converts a point from a component's local coordinate space to "screen"
+ * coordinates (such as the coordinate space mouse events are delivered
+ * in). This operation is equivalent to translating the point by the
+ * location of the component (which is the origin of its coordinate
+ * space).
+ *
+ * @param p The point to convert
+ * @param c The component which the point is expressed in terms of
+ *
+ * @see convertPointFromScreen
+ */
+ public static void convertPointToScreen(Point p, Component c)
+ {
+ Point c0 = c.getLocationOnScreen();
+ p.translate(c0.x, c0.y);
+ }
+
+ /**
+ * Converts a point from "screen" coordinates (such as the coordinate
+ * space mouse events are delivered in) to a component's local coordinate
+ * space. This operation is equivalent to translating the point by the
+ * negation of the component's location (which is the origin of its
+ * coordinate space).
+ *
+ * @param p The point to convert
+ * @param c The component which the point should be expressed in terms of
+ */
+ public static void convertPointFromScreen(Point p, Component c)
+ {
+ Point c0 = c.getLocationOnScreen();
+ p.translate(-c0.x, -c0.y);
+ }
+
+ /**
+ * Converts a point <code>(x,y)</code> from the coordinate space of one
+ * component to another. This is equivalent to converting the point from
+ * <code>source</code> space to screen space, then back from screen space
+ * to <code>destination</code> space. If exactly one of the two
+ * Components is <code>null</code>, it is taken to refer to the root
+ * ancestor of the other component. If both are <code>null</code>, no
+ * transformation is done.
+ *
+ * @param source The component which the point is expressed in terms of
+ * @param x Horizontal coordinate of point to transform
+ * @param y Vertical coordinate of point to transform
+ * @param destination The component which the return value will be
+ * expressed in terms of
+ *
+ * @return The point <code>(x,y)</code> converted from the coordinate
+ * space of the
+ * source component to the coordinate space of the destination component
+ *
+ * @see #convertPointToScreen
+ * @see #convertPointFromScreen
+ * @see #convertRectangle
+ * @see #getRoot
+ */
+ public static Point convertPoint(Component source, int x, int y,
+ Component destination)
+ {
+ Point pt = new Point(x, y);
+
+ if (source == null && destination == null)
+ return pt;
+
+ if (source == null)
+ source = getRoot(destination);
+
+ if (destination == null)
+ destination = getRoot(source);
+
+ convertPointToScreen(pt, source);
+ convertPointFromScreen(pt, destination);
+
+ return pt;
+ }
+
+
+ /**
+ * Converts a rectangle from the coordinate space of one component to
+ * another. This is equivalent to converting the rectangle from
+ * <code>source</code> space to screen space, then back from screen space
+ * to <code>destination</code> space. If exactly one of the two
+ * Components is <code>null</code>, it is taken to refer to the root
+ * ancestor of the other component. If both are <code>null</code>, no
+ * transformation is done.
+ *
+ * @param source The component which the rectangle is expressed in terms of
+ * @param rect The rectangle to convert
+ * @param destination The component which the return value will be
+ * expressed in terms of
+ *
+ * @return A new rectangle, equal in size to the input rectangle, but
+ * with its position converted from the coordinate space of the source
+ * component to the coordinate space of the destination component
+ *
+ * @see #convertPointToScreen
+ * @see #convertPointFromScreen
+ * @see #convertPoint
+ * @see #getRoot
+ */
+ public static Rectangle convertRectangle(Component source, Rectangle rect,
+ Component destination)
+ {
+ Point pt = convertPoint(source, rect.x, rect.y, destination);
+ return new Rectangle(pt.x, pt.y, rect.width, rect.height);
+ }
+
+ /**
+ * Convert a mouse event which refrers to one component to another. This
+ * includes changing the mouse event's coordinate space, as well as the
+ * source property of the event. If <code>source</code> is
+ * <code>null</code>, it is taken to refer to <code>destination</code>'s
+ * root component. If <code>destination</code> is <code>null</code>, the
+ * new event will remain expressed in <code>source</code>'s coordinate
+ * system.
+ *
+ * @param source The component the mouse event currently refers to
+ * @param sourceEvent The mouse event to convert
+ * @param destination The component the new mouse event should refer to
+ *
+ * @return A new mouse event expressed in terms of the destination
+ * component's coordinate space, and with the destination component as
+ * its source
+ *
+ * @see #convertPoint
+ */
+ public static MouseEvent convertMouseEvent(Component source,
+ MouseEvent sourceEvent,
+ Component destination)
+ {
+ Point newpt = convertPoint(source, sourceEvent.getX(), sourceEvent.getY(),
+ destination);
+
+ return new MouseEvent(destination, sourceEvent.getID(),
+ sourceEvent.getWhen(), sourceEvent.getModifiers(),
+ newpt.x, newpt.y, sourceEvent.getClickCount(),
+ sourceEvent.isPopupTrigger(),
+ sourceEvent.getButton());
+ }
+
+
+ /**
+ * Calls {@link java.awt.EventQueue.invokeLater} with the
+ * specified {@link Runnable}.
+ */
+ public static void invokeLater(Runnable doRun)
+ {
+ java.awt.EventQueue.invokeLater(doRun);
+ }
+
+ /**
+ * Calls {@link java.awt.EventQueue.invokeAndWait} with the
+ * specified {@link Runnable}.
+ */
+ public static void invokeAndWait(Runnable doRun)
+ throws InterruptedException,
+ InvocationTargetException
+ {
+ java.awt.EventQueue.invokeAndWait(doRun);
+ }
+
+ /**
+ * Calls {@link java.awt.EventQueue.isEventDispatchThread}.
+ */
+ public static boolean isEventDispatchThread()
+ {
+ return java.awt.EventQueue.isDispatchThread();
+ }
}
diff --git a/libjava/classpath/gnu/java/awt/ClasspathToolkit.java b/libjava/classpath/gnu/java/awt/ClasspathToolkit.java
index 5fb444f..1ec5664 100644
--- a/libjava/classpath/gnu/java/awt/ClasspathToolkit.java
+++ b/libjava/classpath/gnu/java/awt/ClasspathToolkit.java
@@ -1,5 +1,5 @@
/* ClasspathToolkit.java -- Abstract superclass for Classpath toolkits.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,11 +42,12 @@ import gnu.java.awt.EmbeddedWindow;
import gnu.java.awt.peer.ClasspathFontPeer;
import gnu.java.awt.peer.EmbeddedWindowPeer;
import gnu.java.awt.peer.ClasspathTextLayoutPeer;
+import gnu.java.security.action.SetAccessibleAction;
import java.awt.AWTException;
+import java.awt.Component;
import java.awt.Dimension;
import java.awt.DisplayMode;
-import java.awt.EventQueue;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.GraphicsDevice;
@@ -59,11 +60,14 @@ import java.awt.image.ImageProducer;
import java.awt.peer.RobotPeer;
import java.io.File;
import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.AttributedString;
import java.util.HashMap;
import java.util.Map;
+import java.security.AccessController;
import javax.imageio.spi.IIORegistry;
@@ -92,14 +96,6 @@ public abstract class ClasspathToolkit
extends Toolkit
{
/**
- * A map from URLs to previously loaded images, used by {@link
- * #getImage(java.net.URL)}. For images that were loaded via a path
- * to an image file, the map contains a key with a file URL.
- */
- private HashMap imageCache;
-
-
- /**
* Returns a shared instance of the local, platform-specific
* graphics environment.
*
@@ -109,59 +105,6 @@ public abstract class ClasspathToolkit
*/
public abstract GraphicsEnvironment getLocalGraphicsEnvironment();
-
- /**
- * Determines the current size of the default, primary screen.
- *
- * @throws HeadlessException if the local graphics environment is
- * headless, which means that no screen is attached and no user
- * interaction is allowed.
- */
- public Dimension getScreenSize()
- {
- DisplayMode mode;
-
- // getDefaultScreenDevice throws HeadlessException if the
- // local graphics environment is headless.
- mode = GraphicsEnvironment.getLocalGraphicsEnvironment()
- .getDefaultScreenDevice().getDisplayMode();
-
- return new Dimension(mode.getWidth(), mode.getHeight());
- }
-
-
- /**
- * Determines the current color model of the default, primary
- * screen.
- *
- * @see GraphicsEnvironment#getDefaultScreenDevice()
- * @see java.awt.GraphicsDevice#getDefaultConfiguration()
- * @see java.awt.GraphicsConfiguration#getColorModel()
- *
- * @throws HeadlessException if the local graphics environment is
- * headless, which means that no screen is attached and no user
- * interaction is allowed.
- */
- public ColorModel getColorModel()
- {
- // getDefaultScreenDevice throws HeadlessException if the
- // local graphics environment is headless.
- return GraphicsEnvironment.getLocalGraphicsEnvironment()
- .getDefaultScreenDevice().getDefaultConfiguration()
- .getColorModel();
- }
-
- /**
- * Retrieves the metrics for rendering a font on the screen.
- *
- * @param font the font whose metrics are requested.
- */
- public FontMetrics getFontMetrics(Font font)
- {
- return ((ClasspathFontPeer) font.getPeer ()).getFontMetrics (font);
- }
-
-
/**
* Acquires an appropriate {@link ClasspathFontPeer}, for use in
* classpath's implementation of {@link java.awt.Font}.
@@ -185,15 +128,42 @@ public abstract class ClasspathToolkit
* Creates a {@link Font}, in a platform-specific manner.
*
* The default implementation simply constructs a {@link Font}, but some
- * toolkits may wish to override this, to return {@link Font} subclasses which
- * implement {@link java.awt.font.OpenType} or
+ * toolkits may wish to override this, to return {@link Font} subclasses
+ * which implement {@link java.awt.font.OpenType} or
* {@link java.awt.font.MultipleMaster}.
*/
public Font getFont (String name, Map attrs)
{
- return new Font (name, attrs);
- }
+ Font f = null;
+ // Circumvent the package-privateness of the
+ // java.awt.Font.Font(String,Map) constructor.
+ try
+ {
+ Constructor fontConstructor = Font.class.getDeclaredConstructor
+ (new Class[] { String.class, Map.class });
+ AccessController.doPrivileged
+ (new SetAccessibleAction(fontConstructor));
+ f = (Font) fontConstructor.newInstance(new Object[] { name, attrs });
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new AssertionError(e);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new AssertionError(e);
+ }
+ catch (InstantiationException e)
+ {
+ throw new AssertionError(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new AssertionError(e);
+ }
+ return f;
+ }
/**
* Creates a font, reading the glyph definitions from a stream.
@@ -223,137 +193,6 @@ public abstract class ClasspathToolkit
*/
public abstract Font createFont(int format, InputStream stream);
-
- /**
- * Returns an image from the specified file, which must be in a
- * recognized format. The set of recognized image formats may vary
- * from toolkit to toolkit.
- *
- * <p>This method maintains a cache for images. If an image has been
- * loaded from the same path before, the cached copy will be
- * returned. The implementation may hold cached copies for an
- * indefinite time, which can consume substantial resources with
- * large images. Users are therefore advised to use {@link
- * #createImage(java.lang.String)} instead.
- *
- * <p>The default implementation creates a file URL for the
- * specified path and invokes {@link #getImage(URL)}.
- *
- * @param path A path to the image file.
- *
- * @return IllegalArgumentException if <code>path</code> does not
- * designate a valid path.
- */
- public Image getImage(String path)
- {
- try
- {
- return getImage(new File(path).toURL());
- }
- catch (MalformedURLException muex)
- {
- throw (IllegalArgumentException) new IllegalArgumentException(path)
- .initCause(muex);
- }
- }
-
-
- /**
- * Loads an image from the specified URL. The image data must be in
- * a recognized format. The set of recognized image formats may vary
- * from toolkit to toolkit.
- *
- * <p>This method maintains a cache for images. If an image has been
- * loaded from the same URL before, the cached copy will be
- * returned. The implementation may hold cached copies for an
- * indefinite time, which can consume substantial resources with
- * large images. Users are therefore advised to use {@link
- * #createImage(java.net.URL)} instead.
- *
- * @param url the URL from where the image is read.
- */
- public Image getImage(URL url)
- {
- Image result;
-
- synchronized (this)
- {
- // Many applications never call getImage. Therefore, we lazily
- // create the image cache when it is actually needed.
- if (imageCache == null)
- imageCache = new HashMap();
- else
- {
- result = (Image) imageCache.get(url);
- if (result != null)
- return result;
- }
-
- // The createImage(URL) method, which is specified by
- // java.awt.Toolkit, is not implemented by this abstract class
- // because it is platform-dependent. Once Classpath has support
- // for the javax.imageio package, it might be worth considering
- // that toolkits provide native stream readers. Then, the class
- // ClasspathToolkit could provide a general implementation that
- // delegates the image format parsing to javax.imageio.
- result = createImage(url);
-
- // It is not clear whether it would be a good idea to use weak
- // references here. The advantage would be reduced memory
- // consumption, since loaded images would not be kept
- // forever. But on VMs that frequently perform garbage
- // collection (which includes VMs with a parallel or incremental
- // collector), the image might frequently need to be re-loaded,
- // possibly over a slow network connection.
- imageCache.put(url, result);
-
- return result;
- }
- }
-
-
- /**
- * Returns an image from the specified file, which must be in a
- * recognized format. The set of recognized image formats may vary
- * from toolkit to toolkit.
- *
- * <p>A new image is created every time this method gets called,
- * even if the same path has been passed before.
- *
- * <p>The default implementation creates a file URL for the
- * specified path and invokes {@link #createImage(URL)}.
- *
- * @param path A path to the file to be read in.
- */
- public Image createImage(String path)
- {
- try
- {
- // The abstract method createImage(URL) is defined by
- // java.awt.Toolkit, but intentionally not implemented by
- // ClasspathToolkit because it is platform specific.
- return createImage(new File(path).toURL());
- }
- catch (MalformedURLException muex)
- {
- throw (IllegalArgumentException) new IllegalArgumentException(path)
- .initCause(muex);
- }
- }
-
- /**
- * Creates an ImageProducer from the specified URL. The image is assumed
- * to be in a recognised format. If the toolkit does not implement the
- * image format or the image format is not recognised, null is returned.
- * This default implementation is overriden by the Toolkit implementations.
- *
- * @param url URL to read image data from.
- */
- public ImageProducer createImageProducer(URL url)
- {
- return null;
- }
-
public abstract RobotPeer createRobot (GraphicsDevice screen)
throws AWTException;
@@ -365,15 +204,10 @@ public abstract class ClasspathToolkit
*/
public abstract EmbeddedWindowPeer createEmbeddedWindow (EmbeddedWindow w);
- /**
+ /**
* Used to register ImageIO SPIs provided by the toolkit.
*/
-
- public void registerImageIOSpis(IIORegistry reg)
- {
- }
-
- public abstract boolean nativeQueueEmpty();
- public abstract void wakeNativeQueue();
- public abstract void iterateNativeQueue(EventQueue locked, boolean block);
+ public void registerImageIOSpis(IIORegistry reg)
+ {
+ }
}
diff --git a/libjava/classpath/gnu/java/awt/EmbeddedWindow.java b/libjava/classpath/gnu/java/awt/EmbeddedWindow.java
index a85ce74..08b2140 100644
--- a/libjava/classpath/gnu/java/awt/EmbeddedWindow.java
+++ b/libjava/classpath/gnu/java/awt/EmbeddedWindow.java
@@ -98,11 +98,13 @@ public class EmbeddedWindow extends Frame
}
catch (IllegalAccessException e)
{
- // This should never happen.
+ throw new RuntimeException
+ ("couldn't set java.awt.Component.peer field");
}
catch (NoSuchFieldException e)
{
- // This should never happen.
+ throw new RuntimeException
+ ("couldn't set java.awt.Component.peer field");
}
super.addNotify();
diff --git a/libjava/classpath/gnu/java/awt/peer/GLightweightPeer.java b/libjava/classpath/gnu/java/awt/peer/GLightweightPeer.java
index 3bcaebc..5252e80 100644
--- a/libjava/classpath/gnu/java/awt/peer/GLightweightPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/GLightweightPeer.java
@@ -52,6 +52,7 @@ import java.awt.GraphicsConfiguration;
import java.awt.Image;
import java.awt.Insets;
import java.awt.Point;
+import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.event.PaintEvent;
import java.awt.image.ColorModel;
@@ -295,4 +296,44 @@ public class GLightweightPeer
public void flip(BufferCapabilities.FlipContents contents) { }
public void destroyBuffers() { }
+
+ public boolean isRestackSupported()
+ {
+ return false;
+ }
+
+ public void cancelPendingPaint(int x, int y, int width, int height)
+ {
+
+ }
+
+ public void restack()
+ {
+
+ }
+
+ public Rectangle getBounds()
+ {
+ return null;
+ }
+
+ public void reparent(ContainerPeer parent)
+ {
+
+ }
+
+ public void setBounds(int x, int y, int z, int width, int height)
+ {
+
+ }
+
+ public boolean isReparentSupported()
+ {
+ return false;
+ }
+
+ public void layout()
+ {
+
+ }
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics.java
index a125be7..160602b 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
+import gnu.classpath.Configuration;
+
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
@@ -52,7 +54,17 @@ import java.text.AttributedCharacterIterator;
public class GdkGraphics extends Graphics
{
- private final int native_state = GtkGenericPeer.getUniqueInteger();
+ static
+ {
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary("gtkpeer");
+ }
+ initStaticState ();
+ }
+
+ static native void initStaticState();
+ private final int native_state = GtkGenericPeer.getUniqueInteger ();
Color color, xorColor;
GtkComponentPeer component;
@@ -66,6 +78,7 @@ public class GdkGraphics extends Graphics
static final int GDK_COPY = 0, GDK_XOR = 2;
native void initState (GtkComponentPeer component);
+ native void initStateUnlocked (GtkComponentPeer component);
native void initState (int width, int height);
native void initFromImage (GtkImage image);
native void copyState (GdkGraphics g);
@@ -119,6 +132,15 @@ public class GdkGraphics extends Graphics
clip = new Rectangle (0, 0, d.width, d.height);
}
+ // called back by native side: realize_cb
+ void initComponentGraphicsUnlocked ()
+ {
+ initStateUnlocked (component);
+ color = component.awtComponent.getForeground ();
+ Dimension d = component.awtComponent.getSize ();
+ clip = new Rectangle (0, 0, d.width, d.height);
+ }
+
native void connectSignals (GtkComponentPeer component);
public native void clearRect(int x, int y, int width, int height);
@@ -327,7 +349,13 @@ public class GdkGraphics extends Graphics
public void setClip (Shape clip)
{
- if (clip != null)
+ if (clip == null)
+ {
+ // Reset clipping.
+ Dimension d = component.awtComponent.getSize();
+ setClip(new Rectangle (0, 0, d.width, d.height));
+ }
+ else
setClip(clip.getBounds());
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java
index b820317..6d9aabf 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java
@@ -45,6 +45,7 @@ import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Composite;
+import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.GradientPaint;
@@ -106,8 +107,7 @@ public class GdkGraphics2D extends Graphics2D
if (Configuration.INIT_LOAD_LIBRARY)
System.loadLibrary("gtkpeer");
- if (GtkToolkit.useGraphics2D())
- initStaticState();
+ initStaticState();
}
static native void initStaticState();
@@ -132,12 +132,14 @@ public class GdkGraphics2D extends Graphics2D
Composite comp;
private Stack stateStack;
+ private native void initStateUnlocked(GtkComponentPeer component);
private native void initState(GtkComponentPeer component);
private native void initState(int width, int height);
private native void initState(int[] pixes, int width, int height);
private native void copyState(GdkGraphics2D g);
public native void dispose();
private native void cairoSurfaceSetFilter(int filter);
+ private native void cairoSurfaceSetFilterUnlocked(int filter);
native void connectSignals(GtkComponentPeer component);
public void finalize()
@@ -236,6 +238,21 @@ public class GdkGraphics2D extends Graphics2D
stateStack = new Stack();
}
+ void initComponentGraphics2DUnlocked()
+ {
+ initStateUnlocked(component);
+
+ setColorUnlocked(component.awtComponent.getForeground());
+ setBackgroundUnlocked(component.awtComponent.getBackground());
+ setPaintUnlocked(getColorUnlocked());
+ setTransformUnlocked(new AffineTransform());
+ setStrokeUnlocked(new BasicStroke());
+ setRenderingHintsUnlocked(getDefaultHints());
+ setFontUnlocked(new Font("SansSerif", Font.PLAIN, 12));
+
+ stateStack = new Stack();
+ }
+
GdkGraphics2D(BufferedImage bimage)
{
this.bimage = bimage;
@@ -280,25 +297,37 @@ public class GdkGraphics2D extends Graphics2D
// drawing utility methods
private native void drawPixels(int[] pixels, int w, int h, int stride,
double[] i2u);
+ private native void setTexturePixelsUnlocked(int[] pixels, int w, int h, int stride);
private native void setTexturePixels(int[] pixels, int w, int h, int stride);
private native void setGradient(double x1, double y1, double x2, double y2,
int r1, int g1, int b1, int a1, int r2,
int g2, int b2, int a2, boolean cyclic);
+ private native void setGradientUnlocked(double x1, double y1, double x2, double y2,
+ int r1, int g1, int b1, int a1, int r2,
+ int g2, int b2, int a2, boolean cyclic);
// simple passthroughs to cairo
private native void cairoSave();
private native void cairoRestore();
private native void cairoSetMatrix(double[] m);
+ private native void cairoSetMatrixUnlocked(double[] m);
private native void cairoSetOperator(int cairoOperator);
private native void cairoSetRGBAColor(double red, double green,
double blue, double alpha);
+ private native void cairoSetRGBAColorUnlocked(double red, double green,
+ double blue, double alpha);
private native void cairoSetFillRule(int cairoFillRule);
private native void cairoSetLineWidth(double width);
+ private native void cairoSetLineWidthUnlocked(double width);
private native void cairoSetLineCap(int cairoLineCap);
+ private native void cairoSetLineCapUnlocked(int cairoLineCap);
private native void cairoSetLineJoin(int cairoLineJoin);
+ private native void cairoSetLineJoinUnlocked(int cairoLineJoin);
private native void cairoSetDash(double[] dashes, int ndash, double offset);
+ private native void cairoSetDashUnlocked(double[] dashes, int ndash, double offset);
private native void cairoSetMiterLimit(double limit);
+ private native void cairoSetMiterLimitUnlocked(double limit);
private native void cairoNewPath();
private native void cairoMoveTo(double x, double y);
private native void cairoLineTo(double x, double y);
@@ -689,6 +718,49 @@ public class GdkGraphics2D extends Graphics2D
throw new java.lang.UnsupportedOperationException();
}
+ public void setPaintUnlocked(Paint p)
+ {
+ if (paint == null)
+ return;
+
+ paint = p;
+ if (paint instanceof Color)
+ {
+ setColorUnlocked((Color) paint);
+ }
+ else if (paint instanceof TexturePaint)
+ {
+ TexturePaint tp = (TexturePaint) paint;
+ BufferedImage img = tp.getImage();
+
+ // map the image to the anchor rectangle
+ int width = (int) tp.getAnchorRect().getWidth();
+ int height = (int) tp.getAnchorRect().getHeight();
+
+ double scaleX = width / (double) img.getWidth();
+ double scaleY = width / (double) img.getHeight();
+
+ AffineTransform at = new AffineTransform(scaleX, 0, 0, scaleY, 0, 0);
+ AffineTransformOp op = new AffineTransformOp(at, getRenderingHints());
+ BufferedImage texture = op.filter(img, null);
+ int[] pixels = texture.getRGB(0, 0, width, height, null, 0, width);
+ setTexturePixelsUnlocked(pixels, width, height, width);
+ }
+ else if (paint instanceof GradientPaint)
+ {
+ GradientPaint gp = (GradientPaint) paint;
+ Point2D p1 = gp.getPoint1();
+ Point2D p2 = gp.getPoint2();
+ Color c1 = gp.getColor1();
+ Color c2 = gp.getColor2();
+ setGradientUnlocked(p1.getX(), p1.getY(), p2.getX(), p2.getY(), c1.getRed(),
+ c1.getGreen(), c1.getBlue(), c1.getAlpha(), c2.getRed(),
+ c2.getGreen(), c2.getBlue(), c2.getAlpha(), gp.isCyclic());
+ }
+ else
+ throw new java.lang.UnsupportedOperationException();
+ }
+
public void setTransform(AffineTransform tx)
{
transform = tx;
@@ -700,6 +772,17 @@ public class GdkGraphics2D extends Graphics2D
}
}
+ public void setTransformUnlocked(AffineTransform tx)
+ {
+ transform = tx;
+ if (transform != null)
+ {
+ double[] m = new double[6];
+ transform.getMatrix(m);
+ cairoSetMatrixUnlocked(m);
+ }
+ }
+
public void transform(AffineTransform tx)
{
if (transform == null)
@@ -784,6 +867,32 @@ public class GdkGraphics2D extends Graphics2D
cairoSetDash(double_dashes, double_dashes.length,
(double) bs.getDashPhase());
}
+ else
+ cairoSetDash(new double[0], 0, 0.0);
+ }
+ }
+
+ public void setStrokeUnlocked(Stroke st)
+ {
+ stroke = st;
+ if (stroke instanceof BasicStroke)
+ {
+ BasicStroke bs = (BasicStroke) stroke;
+ cairoSetLineCapUnlocked(bs.getEndCap());
+ cairoSetLineWidthUnlocked(bs.getLineWidth());
+ cairoSetLineJoinUnlocked(bs.getLineJoin());
+ cairoSetMiterLimitUnlocked(bs.getMiterLimit());
+ float[] dashes = bs.getDashArray();
+ if (dashes != null)
+ {
+ double[] double_dashes = new double[dashes.length];
+ for (int i = 0; i < dashes.length; i++)
+ double_dashes[i] = dashes[i];
+ cairoSetDashUnlocked(double_dashes, double_dashes.length,
+ (double) bs.getDashPhase());
+ }
+ else
+ cairoSetDashUnlocked(new double[0], 0, 0.0);
}
}
@@ -812,11 +921,27 @@ public class GdkGraphics2D extends Graphics2D
fg.getBlue() / 255.0, fg.getAlpha() / 255.0);
}
+ public void setColorUnlocked(Color c)
+ {
+ if (c == null)
+ c = Color.BLACK;
+
+ fg = c;
+ paint = c;
+ cairoSetRGBAColorUnlocked(fg.getRed() / 255.0, fg.getGreen() / 255.0,
+ fg.getBlue() / 255.0, fg.getAlpha() / 255.0);
+ }
+
public Color getColor()
{
return fg;
}
+ public Color getColorUnlocked()
+ {
+ return getColor();
+ }
+
public void clipRect(int x, int y, int width, int height)
{
clip(new Rectangle(x, y, width, height));
@@ -864,7 +989,13 @@ public class GdkGraphics2D extends Graphics2D
public void setClip(Shape s)
{
clip = s;
- if (s != null)
+ if (clip == null)
+ {
+ // Reset clipping.
+ Dimension d = component.awtComponent.getSize();
+ setClip(0, 0, d.width, d.height);
+ }
+ else
{
cairoNewPath();
if (s instanceof Rectangle2D)
@@ -929,6 +1060,11 @@ public class GdkGraphics2D extends Graphics2D
bg = c;
}
+ public void setBackgroundUnlocked(Color c)
+ {
+ setBackground(c);
+ }
+
public Color getBackground()
{
return bg;
@@ -1180,6 +1316,36 @@ public class GdkGraphics2D extends Graphics2D
|| hints.containsValue(RenderingHints.VALUE_STROKE_DEFAULT);
}
+ public void setRenderingHintsUnlocked(Map hints)
+ {
+ this.hints = new RenderingHints(getDefaultHints());
+ this.hints.add(new RenderingHints(hints));
+
+ if (hints.containsKey(RenderingHints.KEY_INTERPOLATION))
+ {
+ if (hints.containsValue(RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR))
+ cairoSurfaceSetFilterUnlocked(0);
+
+ else if (hints.containsValue(RenderingHints.VALUE_INTERPOLATION_BILINEAR))
+ cairoSurfaceSetFilterUnlocked(1);
+ }
+
+ if (hints.containsKey(RenderingHints.KEY_ALPHA_INTERPOLATION))
+ {
+ if (hints.containsValue(RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED))
+ cairoSurfaceSetFilterUnlocked(2);
+
+ else if (hints.containsValue(RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY))
+ cairoSurfaceSetFilterUnlocked(3);
+
+ else if (hints.containsValue(RenderingHints.VALUE_ALPHA_INTERPOLATION_DEFAULT))
+ cairoSurfaceSetFilterUnlocked(4);
+ }
+
+ shiftDrawCalls = hints.containsValue(RenderingHints.VALUE_STROKE_NORMALIZE)
+ || hints.containsValue(RenderingHints.VALUE_STROKE_DEFAULT);
+ }
+
public void addRenderingHints(Map hints)
{
this.hints.add(new RenderingHints(hints));
@@ -1344,6 +1510,9 @@ public class GdkGraphics2D extends Graphics2D
public void drawString(String str, float x, float y)
{
+ if (str == null || str.length() == 0)
+ return;
+
drawGlyphVector(getFont().createGlyphVector(null, str), x, y);
updateBufferedImage ();
}
@@ -1443,6 +1612,11 @@ public class GdkGraphics2D extends Graphics2D
.getFont(f.getName(), f.getAttributes());
}
+ public void setFontUnlocked(Font f)
+ {
+ setFont (f);
+ }
+
public String toString()
{
return (getClass().getName()
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java
index bfad87a..6cf7310 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java
@@ -42,6 +42,7 @@ import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.ImageCapabilities;
import java.awt.Rectangle;
+import java.awt.Toolkit;
import java.awt.geom.AffineTransform;
@@ -56,16 +57,11 @@ public class GdkGraphicsConfiguration
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();
+ bounds = ((GtkToolkit) Toolkit.getDefaultToolkit()).getBounds();
}
public GraphicsDevice getDevice()
@@ -135,4 +131,10 @@ public class GdkGraphicsConfiguration
return new ImageCapabilities(false);
}
+ public VolatileImage createCompatibleVolatileImage(int width, int height, int transparency)
+ {
+ // FIXME: implement
+ return null;
+ }
+
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
index 4f9d1c2..4b0b5d3 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
@@ -43,22 +43,14 @@ import java.awt.Graphics2D;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.HeadlessException;
+import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.util.Locale;
public class GdkGraphicsEnvironment extends GraphicsEnvironment
{
- GtkToolkit gtkToolkit;
-
- public GtkToolkit getToolkit()
- {
- return gtkToolkit;
- }
-
- public GdkGraphicsEnvironment (GtkToolkit tk)
+ public GdkGraphicsEnvironment ()
{
- super();
- gtkToolkit = tk;
}
public GraphicsDevice[] getScreenDevices ()
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
index 57d5a36..85cb1e4 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
@@ -122,7 +122,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
super (imagedata, imageoffset, imagelength);
}
- // called back by native side
+ // called back by native side: area_prepared_cb
void areaPrepared (int width, int height)
{
@@ -138,7 +138,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
}
}
- // called back by native side
+ // called back by native side: area_updated_cb
void areaUpdated (int x, int y, int width, int height,
int pixels[], int scansize)
{
@@ -306,7 +306,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
static String findFormatName(Object ext, boolean needWritable)
{
if (ext == null)
- throw new IllegalArgumentException("extension is null");
+ return null;
if (!(ext instanceof String))
throw new IllegalArgumentException("extension is not a string");
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java
index 2bf9d23..b5d1237 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java
@@ -42,16 +42,12 @@ import java.awt.Dimension;
import java.awt.DisplayMode;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
+import java.awt.Toolkit;
public class GdkScreenGraphicsDevice extends GraphicsDevice
{
GdkGraphicsEnvironment env;
- public GtkToolkit getToolkit()
- {
- return env.getToolkit();
- }
-
public GdkScreenGraphicsDevice (GdkGraphicsEnvironment e)
{
super ();
@@ -94,7 +90,7 @@ public class GdkScreenGraphicsDevice extends GraphicsDevice
public DisplayMode getDisplayMode()
{
// determine display mode
- Dimension dim = getToolkit().getScreenSize();
+ Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
DisplayMode mode = new DisplayMode(dim.width, dim.height, 0,
DisplayMode.REFRESH_RATE_UNKNOWN);
return mode;
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkButtonPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkButtonPeer.java
index ab5df9f..054ead6 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkButtonPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkButtonPeer.java
@@ -42,10 +42,14 @@ import java.awt.AWTEvent;
import java.awt.Button;
import java.awt.Component;
import java.awt.Point;
+import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.peer.ButtonPeer;
+// A composite widget. GtkButtons have transparent backgrounds. An
+// AWT Button is opaque. To compensate, a GtkButtonPeer is a
+// GtkButton packed in a GtkEventBox.
public class GtkButtonPeer extends GtkComponentPeer
implements ButtonPeer
{
@@ -61,6 +65,11 @@ public class GtkButtonPeer extends GtkComponentPeer
native void gtkWidgetRequestFocus ();
native void setNativeBounds (int x, int y, int width, int height);
+ // Because this is a composite widget, we need to retrieve the
+ // GtkButton's preferred dimensions, not the enclosing
+ // GtkEventBox's.
+ native void gtkWidgetGetPreferredDimensions (int[] dim);
+
public GtkButtonPeer (Button b)
{
super (b);
@@ -76,32 +85,11 @@ public class GtkButtonPeer extends GtkComponentPeer
gtkSetLabel(label);
}
- public void handleEvent (AWTEvent e)
+ void postActionEvent (int mods)
{
- if (e.getID () == MouseEvent.MOUSE_RELEASED && isEnabled ())
- {
- MouseEvent me = (MouseEvent) e;
- Point p = me.getPoint();
- p.translate(((Component) me.getSource()).getX(),
- ((Component) me.getSource()).getY());
- if (!me.isConsumed ()
- && (me.getModifiersEx () & MouseEvent.BUTTON1_DOWN_MASK) != 0
- && awtComponent.getBounds().contains(p))
- postActionEvent (((Button) awtComponent).getActionCommand (),
- me.getModifiersEx ());
- }
-
- if (e.getID () == KeyEvent.KEY_PRESSED)
- {
- KeyEvent ke = (KeyEvent) e;
- if (!ke.isConsumed () && ke.getKeyCode () == KeyEvent.VK_SPACE)
- {
- postActionEvent (((Button) awtComponent).getActionCommand (),
- ke.getModifiersEx ());
- gtkActivate ();
- }
- }
-
- super.handleEvent (e);
+ q().postEvent (new ActionEvent (awtWidget,
+ ActionEvent.ACTION_PERFORMED,
+ ((Button) awtComponent).getActionCommand (),
+ mods));
}
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java
index 8517572..3e05cf8 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java
@@ -49,6 +49,7 @@ public class GtkCheckboxPeer extends GtkComponentPeer
public GtkCheckboxGroupPeer old_group;
// The current state of the GTK checkbox.
private boolean currentState;
+ private boolean changing = false;
public native void create (GtkCheckboxGroupPeer group);
public native void nativeSetCheckboxGroup (GtkCheckboxGroupPeer group);
@@ -76,6 +77,15 @@ public class GtkCheckboxPeer extends GtkComponentPeer
public void setState (boolean state)
{
+ // prevent item_toggled_cb -> postItemEvent ->
+ // awtComponent.setState -> this.setState ->
+ // gtkToggleButtonSetActive self-deadlock on the GDK lock.
+ if (changing && Thread.currentThread() == GtkToolkit.mainThread)
+ {
+ changing = false;
+ return;
+ }
+
if (currentState != state)
gtkToggleButtonSetActive (state);
}
@@ -100,6 +110,7 @@ public class GtkCheckboxPeer extends GtkComponentPeer
// Override the superclass postItemEvent so that the peer doesn't
// need information that we have.
+ // called back by native side: item_toggled_cb
public void postItemEvent (Object item, int stateChange)
{
Checkbox currentCheckBox = ((Checkbox)awtComponent);
@@ -113,6 +124,7 @@ public class GtkCheckboxPeer extends GtkComponentPeer
{
super.postItemEvent (awtComponent, stateChange);
currentState = !currentCheckBox.getState();
+ changing = true;
currentCheckBox.setState(currentState);
}
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java
index 5028ea7..c140744 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java
@@ -74,8 +74,17 @@ public class GtkChoicePeer extends GtkComponentPeer
native void connectSignals ();
- public native void select (int position);
-
+ native void selectNative (int position);
+ native void selectNativeUnlocked (int position);
+
+ public void select (int position)
+ {
+ if (Thread.currentThread() == GtkToolkit.mainThread)
+ selectNativeUnlocked (position);
+ else
+ selectNative (position);
+ }
+
public void add (String item, int index)
{
int before = nativeGetSelected();
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkClipboard.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkClipboard.java
index c719cdd..a502e1f 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkClipboard.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkClipboard.java
@@ -38,133 +38,357 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
-import java.awt.datatransfer.Clipboard;
-import java.awt.datatransfer.ClipboardOwner;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.StringSelection;
-import java.awt.datatransfer.Transferable;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
+import java.awt.Image;
+import java.awt.datatransfer.*;
+
+import java.io.*;
+
+import java.util.List;
+import java.util.Iterator;
public class GtkClipboard extends Clipboard
{
- /* the number of milliseconds that we'll wait around for the
- owner of the GDK_SELECTION_PRIMARY selection to convert
- the requested data */
- static final int SELECTION_RECEIVED_TIMEOUT = 5000;
- /* We currently only support transferring of text between applications */
- static String selection;
- static Object selectionLock = new Object ();
+ // Given to the native side so it can signal special targets that
+ // can be converted to one of the special predefined DataFlavors.
+ static final String stringMimeType;
+ static final String imageMimeType;
+ static final String filesMimeType;
+
+ // Indicates whether the results of the clipboard selection can be
+ // cached by GtkSelection. True if
+ // gdk_display_supports_selection_notification.
+ static final boolean canCache;
+
+ static
+ {
+ stringMimeType = DataFlavor.stringFlavor.getMimeType();
+ imageMimeType = DataFlavor.imageFlavor.getMimeType();
+ filesMimeType = DataFlavor.javaFileListFlavor.getMimeType();
+
+ canCache = initNativeState(stringMimeType, imageMimeType, filesMimeType);
+ }
- static boolean hasSelection = false;
+ /**
+ * The one and only gtk+ clipboard instance.
+ */
+ private static GtkClipboard instance = new GtkClipboard();
- protected GtkClipboard()
+ /**
+ * Creates the clipboard and sets the initial contents to the
+ * current gtk+ selection.
+ */
+ private GtkClipboard()
{
super("System Clipboard");
- initNativeState();
+ setContents(new GtkSelection(), null);
+ }
+
+ /**
+ * Returns the one and only GtkClipboard instance.
+ */
+
+ static GtkClipboard getInstance()
+ {
+ return instance;
}
- public Transferable getContents(Object requestor)
+ /**
+ * Sets the GtkSelection facade as new contents of the clipboard.
+ * Called from gtk+ when another application grabs the clipboard and
+ * we loose ownership.
+ */
+ private static void setSystemContents()
{
- synchronized (this)
+ GtkClipboardNotifier.announce();
+ }
+
+ /**
+ * Sets the new contents and advertises the available flavors to the
+ * gtk+ clipboard.
+ */
+ public synchronized void setContents(Transferable contents,
+ ClipboardOwner owner)
+ {
+ super.setContents(contents, owner);
+
+ if (contents == null)
{
- if (hasSelection)
- return contents;
+ advertiseContent(null, false, false, false);
+ return;
}
- /* Java doesn't own the selection, so we need to ask X11 */
- // XXX: Does this hold with Swing too ?
- synchronized (selectionLock)
+ // We don't need to do anything for a GtkSelection facade.
+ if (contents instanceof GtkSelection)
+ return;
+
+ boolean text = false;
+ boolean images = false;
+ boolean files = false;
+
+ if (contents instanceof StringSelection
+ || contents.isDataFlavorSupported(DataFlavor.stringFlavor)
+ || contents.isDataFlavorSupported(DataFlavor.plainTextFlavor)
+ || contents.isDataFlavorSupported(DataFlavor
+ .getTextPlainUnicodeFlavor()))
+ text = true;
+
+ DataFlavor[] flavors = contents.getTransferDataFlavors();
+ String[] mimeTargets = new String[flavors.length];
+ for (int i = 0; i < flavors.length; i++)
{
- requestStringConversion();
-
- try
- {
- selectionLock.wait(SELECTION_RECEIVED_TIMEOUT);
- }
- catch (InterruptedException e)
+ DataFlavor flavor = flavors[i];
+ String mimeType = flavor.getMimeType();
+ mimeTargets[i] = mimeType;
+
+ if (! text)
+ if ("text".equals(flavor.getPrimaryType())
+ || flavor.isRepresentationClassReader())
+ text = true;
+
+ // XXX - We only support automatic image conversion for
+ // GtkImages at the moment. So explicitly check that we have
+ // one.
+ if (! images && flavors[i].equals(DataFlavor.imageFlavor))
{
- return null;
+ try
+ {
+ Object o = contents.getTransferData(DataFlavor.imageFlavor);
+ if (o instanceof GtkImage)
+ images = true;
+ }
+ catch (UnsupportedFlavorException ufe)
+ {
+ }
+ catch (IOException ioe)
+ {
+ }
+ catch (ClassCastException cce)
+ {
+ }
}
-
- return selection == null ? null : new StringSelection(selection);
+
+ if (flavors[i].equals(DataFlavor.javaFileListFlavor))
+ files = true;
}
+
+ advertiseContent(mimeTargets, text, images, files);
}
- void stringSelectionReceived(String newSelection)
+ /**
+ * Advertises new contents to the gtk+ clipboard given a string
+ * array of (mime-type) targets. When the boolean flags text, images
+ * and/or files are set then gtk+ is asked to also advertise the
+ * availability of any text, image or uri/file content types it
+ * supports. If targets is null (and all flags false) then the
+ * selection has explicitly been erased.
+ */
+ private native void advertiseContent(String[] targets,
+ boolean text,
+ boolean images,
+ boolean files);
+
+ /**
+ * Called by the gtk+ clipboard when an application has requested
+ * text. Return a string representing the current clipboard
+ * contents or null when no text can be provided.
+ */
+ private String provideText()
{
- synchronized (selectionLock)
+ Transferable contents = this.contents;
+ if (contents == null || contents instanceof GtkSelection)
+ return null;
+
+ // Handle StringSelection special since that is just pure text.
+ if (contents instanceof StringSelection)
{
- selection = newSelection;
- selectionLock.notify();
+ try
+ {
+ return (String) contents.getTransferData(DataFlavor.stringFlavor);
+ }
+ catch (UnsupportedFlavorException ufe)
+ {
+ }
+ catch (IOException ioe)
+ {
+ }
+ catch (ClassCastException cce)
+ {
+ }
}
- }
-
- /* convert Java clipboard data into a String suitable for sending
- to another application */
- synchronized String stringSelectionHandler() throws IOException
- {
- String selection = null;
+ // Try to get a plain text reader for the current contents and
+ // turn the result into a string.
try
{
- if (contents.isDataFlavorSupported(DataFlavor.stringFlavor))
- selection = (String)contents.getTransferData(DataFlavor.stringFlavor);
- else if (contents.isDataFlavorSupported(DataFlavor.plainTextFlavor))
+ DataFlavor plainText = DataFlavor.getTextPlainUnicodeFlavor();
+ Reader r = plainText.getReaderForText(contents);
+ if (r != null)
{
- StringBuffer sbuf = new StringBuffer();
- InputStreamReader reader;
- char readBuf[] = new char[512];
- int numChars;
-
- reader = new InputStreamReader
- ((InputStream)
- contents.getTransferData(DataFlavor.plainTextFlavor), "UNICODE");
-
- while (true)
+ StringBuffer sb = new StringBuffer();
+ char[] cs = new char[1024];
+ int l = r.read(cs);
+ while (l != -1)
{
- numChars = reader.read(readBuf);
- if (numChars == -1)
- break;
- sbuf.append(readBuf, 0, numChars);
+ sb.append(cs, 0, l);
+ l = r.read(cs);
}
-
- selection = new String(sbuf);
+ return sb.toString();
}
}
- catch (Exception e)
+ catch (IllegalArgumentException iae)
+ {
+ }
+ catch (UnsupportedEncodingException iee)
{
}
-
- return selection;
+ catch (UnsupportedFlavorException ufe)
+ {
+ }
+ catch (IOException ioe)
+ {
+ }
+
+ return null;
}
- public synchronized void setContents(Transferable contents,
- ClipboardOwner owner)
+ /**
+ * Called by the gtk+ clipboard when an application has requested an
+ * image. Returns a GtkImage representing the current clipboard
+ * contents or null when no image can be provided.
+ */
+ private GtkImage provideImage()
+ {
+ Transferable contents = this.contents;
+ if (contents == null || contents instanceof GtkSelection)
+ return null;
+
+ try
+ {
+ return (GtkImage) contents.getTransferData(DataFlavor.imageFlavor);
+ }
+ catch (UnsupportedFlavorException ufe)
+ {
+ }
+ catch (IOException ioe)
+ {
+ }
+ catch (ClassCastException cce)
+ {
+ }
+
+ return null;
+ }
+
+ /**
+ * Called by the gtk+ clipboard when an application has requested a
+ * uri-list. Return a string array containing the URIs representing
+ * the current clipboard contents or null when no URIs can be
+ * provided.
+ */
+ private String[] provideURIs()
{
- selectionGet();
+ Transferable contents = this.contents;
+ if (contents == null || contents instanceof GtkSelection)
+ return null;
- this.contents = contents;
- this.owner = owner;
+ try
+ {
+ List list = (List) contents.getTransferData
+ (DataFlavor.javaFileListFlavor);
+ String[] uris = new String[list.size()];
+ int u = 0;
+ Iterator it = list.iterator();
+ while (it.hasNext())
+ uris[u++] = ((File) it.next()).toURI().toString();
+ return uris;
+ }
+ catch (UnsupportedFlavorException ufe)
+ {
+ }
+ catch (IOException ioe)
+ {
+ }
+ catch (ClassCastException cce)
+ {
+ }
- hasSelection = true;
+ return null;
}
- synchronized void selectionClear()
+ /**
+ * Called by gtk+ clipboard when an application requests the given
+ * target mime-type. Returns a byte array containing the requested
+ * data, or null when the contents cannot be provided in the
+ * requested target mime-type. Only called after any explicit text,
+ * image or file/uri requests have been handled earlier and failed.
+ */
+ private byte[] provideContent(String target)
{
- hasSelection = false;
+ // Sanity check. The callback could be triggered just after we
+ // changed the clipboard.
+ Transferable contents = this.contents;
+ if (contents == null || contents instanceof GtkSelection)
+ return null;
+
+ // XXX - We are being called from a gtk+ callback. Which means we
+ // should return as soon as possible and not call arbitrary code
+ // that could deadlock or go bonkers. But we don't really know
+ // what DataTransfer contents object we are dealing with. Same for
+ // the other provideXXX() methods.
+ try
+ {
+ DataFlavor flavor = new DataFlavor(target);
+ Object o = contents.getTransferData(flavor);
+
+ if (o instanceof byte[])
+ return (byte[]) o;
+
+ if (o instanceof InputStream)
+ {
+ InputStream is = (InputStream) o;
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ byte[] bs = new byte[1024];
+ int l = is.read(bs);
+ while (l != -1)
+ {
+ baos.write(bs, 0, l);
+ l = is.read(bs);
+ }
+ return baos.toByteArray();
+ }
- if (owner != null)
+ if (o instanceof Serializable)
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(o);
+ oos.close();
+ return baos.toByteArray();
+ }
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ }
+ catch (UnsupportedFlavorException ufe)
{
- owner.lostOwnership(this, contents);
- owner = null;
- contents = null;
}
+ catch (IOException ioe)
+ {
+ }
+ catch (ClassCastException cce)
+ {
+ }
+
+ return null;
}
- native void initNativeState();
- static native void requestStringConversion();
- static native void selectionGet();
+ /**
+ * Initializes the gtk+ clipboard and caches any native side
+ * structures needed. Returns whether or not the contents of the
+ * Clipboard can be cached (gdk_display_supports_selection_notification).
+ */
+ private static native boolean initNativeState(String stringTarget,
+ String imageTarget,
+ String filesTarget);
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java
index 1578a9c..60e8371 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java
@@ -70,6 +70,9 @@ import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
import java.awt.image.VolatileImage;
import java.awt.peer.ComponentPeer;
+import java.awt.peer.ContainerPeer;
+import java.util.Timer;
+import java.util.TimerTask;
public class GtkComponentPeer extends GtkGenericPeer
implements ComponentPeer
@@ -83,6 +86,8 @@ public class GtkComponentPeer extends GtkGenericPeer
boolean isInRepaint;
+ static final Timer repaintTimer = new Timer (true);
+
/* this isEnabled differs from Component.isEnabled, in that it
knows if a parent is disabled. In that case Component.isEnabled
may return true, but our isEnabled will always return false */
@@ -95,6 +100,7 @@ public class GtkComponentPeer extends GtkGenericPeer
native void gtkWidgetGetPreferredDimensions (int[] dim);
native void gtkWidgetGetLocationOnScreen (int[] point);
native void gtkWidgetSetCursor (int type);
+ native void gtkWidgetSetCursorUnlocked (int type);
native void gtkWidgetSetBackground (int red, int green, int blue);
native void gtkWidgetSetForeground (int red, int green, int blue);
native void gtkWidgetSetSensitive (boolean sensitive);
@@ -372,8 +378,26 @@ public class GtkComponentPeer extends GtkGenericPeer
if (x == 0 && y == 0 && width == 0 && height == 0)
return;
- q().postEvent (new PaintEvent (awtComponent, PaintEvent.UPDATE,
- new Rectangle (x, y, width, height)));
+ repaintTimer.schedule(new RepaintTimerTask(x, y, width, height), tm);
+ }
+
+ private class RepaintTimerTask extends TimerTask
+ {
+ private int x, y, width, height;
+
+ RepaintTimerTask(int x, int y, int width, int height)
+ {
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+ }
+
+ public void run()
+ {
+ q().postEvent (new PaintEvent (awtComponent, PaintEvent.UPDATE,
+ new Rectangle (x, y, width, height)));
+ }
}
public void requestFocus ()
@@ -396,7 +420,11 @@ public class GtkComponentPeer extends GtkGenericPeer
public void setBounds (int x, int y, int width, int height)
{
+ int new_x = x;
+ int new_y = y;
+
Component parent = awtComponent.getParent ();
+ Component next_parent;
// Heavyweight components that are children of one or more
// lightweight containers have to be handled specially. Because
@@ -414,30 +442,44 @@ public class GtkComponentPeer extends GtkGenericPeer
{
lightweightChild = true;
+ next_parent = parent.getParent ();
+
i = ((Container) parent).getInsets ();
- x += parent.getX () + i.left;
- y += parent.getY () + i.top;
+ if (next_parent instanceof Window)
+ {
+ new_x += i.left;
+ new_y += i.top;
+ }
+ else
+ {
+ new_x += parent.getX () + i.left;
+ new_y += parent.getY () + i.top;
+ }
- parent = parent.getParent ();
+ parent = next_parent;
}
// We only need to convert from Java to GTK coordinates if we're
// placing a heavyweight component in a Window.
if (parent instanceof Window && !lightweightChild)
{
- Insets insets = ((Window) parent).getInsets ();
GtkWindowPeer peer = (GtkWindowPeer) parent.getPeer ();
+ // important: we want the window peer's insets here, not the
+ // window's, since user sub-classes of Window can override
+ // getInset and we only want to correct for the frame borders,
+ // not for any user-defined inset values
+ Insets insets = peer.getInsets ();
+
int menuBarHeight = 0;
if (peer instanceof GtkFramePeer)
menuBarHeight = ((GtkFramePeer) peer).getMenuBarHeight ();
- // Convert from Java coordinates to GTK coordinates.
- setNativeBounds (x - insets.left, y - insets.top + menuBarHeight,
- width, height);
+ new_x = x - insets.left;
+ new_y = y - insets.top + menuBarHeight;
}
- else
- setNativeBounds (x, y, width, height);
+
+ setNativeBounds (new_x, new_y, width, height);
}
void setCursor ()
@@ -447,7 +489,10 @@ public class GtkComponentPeer extends GtkGenericPeer
public void setCursor (Cursor cursor)
{
- gtkWidgetSetCursor (cursor.getType ());
+ if (Thread.currentThread() == GtkToolkit.mainThread)
+ gtkWidgetSetCursorUnlocked (cursor.getType ());
+ else
+ gtkWidgetSetCursor (cursor.getType ());
}
public void setEnabled (boolean b)
@@ -480,16 +525,26 @@ public class GtkComponentPeer extends GtkGenericPeer
return new Color (rgb[0], rgb[1], rgb[2]);
}
+ public native void setVisibleNative (boolean b);
+ public native void setVisibleNativeUnlocked (boolean b);
+
public void setVisible (boolean b)
{
- if (b)
- show ();
+ if (Thread.currentThread() == GtkToolkit.mainThread)
+ setVisibleNativeUnlocked (b);
else
- hide ();
+ setVisibleNative (b);
+ }
+
+ public void hide ()
+ {
+ setVisible (false);
}
- public native void hide ();
- public native void show ();
+ public void show ()
+ {
+ setVisible (true);
+ }
protected void postMouseEvent(int id, long when, int mods, int x, int y,
int clickCount, boolean popupTrigger)
@@ -586,7 +641,8 @@ public class GtkComponentPeer extends GtkGenericPeer
public void updateCursorImmediately ()
{
-
+ if (awtComponent.getCursor() != null)
+ setCursor(awtComponent.getCursor());
}
public boolean handlesWheelScrolling ()
@@ -648,4 +704,36 @@ public class GtkComponentPeer extends GtkGenericPeer
{
backBuffer.flush();
}
+
+ public String toString ()
+ {
+ return "peer of " + awtComponent.toString();
+ }
+ public Rectangle getBounds()
+ {
+ // FIXME: implement
+ return null;
+ }
+ public void reparent(ContainerPeer parent)
+ {
+ // FIXME: implement
+
+ }
+ public void setBounds(int x, int y, int width, int height, int z)
+ {
+ // FIXME: implement
+ setBounds (x, y, width, height);
+
+ }
+ public boolean isReparentSupported()
+ {
+ // FIXME: implement
+
+ return false;
+ }
+ public void layout()
+ {
+ // FIXME: implement
+
+ }
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkContainerPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkContainerPeer.java
index c2865f7..b035a98 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkContainerPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkContainerPeer.java
@@ -52,7 +52,6 @@ public class GtkContainerPeer extends GtkComponentPeer
implements ContainerPeer
{
Container c;
- boolean isValidating;
public GtkContainerPeer(Container c)
{
@@ -62,7 +61,6 @@ public class GtkContainerPeer extends GtkComponentPeer
public void beginValidate ()
{
- isValidating = true;
}
public void endValidate ()
@@ -90,8 +88,6 @@ public class GtkContainerPeer extends GtkComponentPeer
if (!(awtComponent instanceof Window))
setParentAndBounds ();
}
-
- isValidating = false;
}
public Insets getInsets()
@@ -153,4 +149,21 @@ public class GtkContainerPeer extends GtkComponentPeer
comp.getPeer().setBackground(c);
}
}
+
+ public boolean isRestackSupported()
+ {
+ // FIXME: implement
+ return false;
+ }
+
+ public void cancelPendingPaint(int x, int y, int width, int height)
+ {
+ // FIXME: implement
+ }
+
+ public void restack()
+ {
+ //FIXME: implement
+
+ }
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
index bd1f077..333407b 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
@@ -42,6 +42,7 @@ import java.awt.Dialog;
import java.awt.FileDialog;
import java.awt.Graphics;
import java.awt.Window;
+import java.awt.event.ComponentEvent;
import java.awt.peer.FileDialogPeer;
import java.io.File;
import java.io.FilenameFilter;
@@ -54,7 +55,7 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
private String currentDirectory = null;
private FilenameFilter filter;
- native void create (GtkContainerPeer parent);
+ native void create (GtkContainerPeer parent, int mode);
native void connectSignals ();
native void nativeSetFile (String file);
public native String nativeGetDirectory();
@@ -63,7 +64,8 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
public void create()
{
- create((GtkContainerPeer) awtComponent.getParent().getPeer());
+ create((GtkContainerPeer) awtComponent.getParent().getPeer(),
+ ((FileDialog) awtComponent).getMode());
FileDialog fd = (FileDialog) awtComponent;
@@ -87,10 +89,10 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
{
int[] dims = new int[2];
gtkWidgetGetPreferredDimensions (dims);
- ((GtkFileDialogPeer) this).setBoundsCallback ((Window) awtComponent,
- awtComponent.getX (),
- awtComponent.getY (),
- dims[0], dims[1]);
+
+ if (dims[0] != awtComponent.getWidth()
+ || dims[1] != awtComponent.getHeight())
+ awtComponent.setSize(dims[0], dims[1]);
}
super.setComponentBounds ();
}
@@ -155,6 +157,7 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
GtkFileFilterInfo object and send it to this method, which will
in turn call the filter's accept() method and give back the return
value. */
+ // called back by native side: filename_filter_cb
boolean filenameFilterCallback (String fullname) {
String filename = fullname.substring(fullname.lastIndexOf(FS) + 1);
String dirname = fullname.substring(0, fullname.lastIndexOf(FS));
@@ -167,20 +170,25 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
// GtkFileDialog will repaint by itself
return null;
}
-
+
+ // called back by native side: handle_response_cb
+ // only called from the GTK thread
void gtkHideFileDialog ()
{
+ // hide calls back the peer's setVisible method, so locking is a
+ // problem.
((Dialog) awtComponent).hide();
}
+ // called back by native side: handle_response_cb
void gtkDisposeFileDialog ()
{
((Dialog) awtComponent).dispose();
}
- /* Callback to set the file and directory values when the user is finished
- * with the dialog.
- */
+ // Callback to set the file and directory values when the user is finished
+ // with the dialog.
+ // called back by native side: handle_response_cb
void gtkSetFilename (String fileName)
{
FileDialog fd = (FileDialog) awtWidget;
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java
index b242d66..6eb90ff 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java
@@ -44,6 +44,7 @@ import java.awt.Image;
import java.awt.MenuBar;
import java.awt.Rectangle;
import java.awt.Window;
+import java.awt.event.ComponentEvent;
import java.awt.event.PaintEvent;
import java.awt.image.ColorModel;
import java.awt.peer.FramePeer;
@@ -55,6 +56,7 @@ public class GtkFramePeer extends GtkWindowPeer
private int menuBarHeight;
private MenuBarPeer menuBar;
native int getMenuBarHeight (MenuBarPeer bar);
+ native void setMenuBarWidthUnlocked (MenuBarPeer bar, int width);
native void setMenuBarWidth (MenuBarPeer bar, int width);
native void setMenuBarPeer (MenuBarPeer bar);
native void removeMenuBarPeer ();
@@ -117,6 +119,17 @@ public class GtkFramePeer extends GtkWindowPeer
public void setBounds (int x, int y, int width, int height)
{
+ // prevent window_configure_cb -> awtComponent.setSize ->
+ // peer.setBounds -> nativeSetBounds self-deadlock on GDK lock.
+ if (Thread.currentThread() == GtkToolkit.mainThread)
+ {
+ int menuBarWidth = width - insets.left - insets.right;
+ if (menuBar != null && menuBarWidth > 0)
+ setMenuBarWidthUnlocked (menuBar, menuBarWidth);
+
+ return;
+ }
+
int menuBarWidth = width - insets.left - insets.right;
if (menuBar != null && menuBarWidth > 0)
setMenuBarWidth (menuBar, menuBarWidth);
@@ -192,31 +205,25 @@ public class GtkFramePeer extends GtkWindowPeer
protected void postConfigureEvent (int x, int y, int width, int height)
{
- int frame_x = x - insets.left;
- // Since insets.top includes the MenuBar height, we need to add back
- // the MenuBar height to the frame's y position.
- // If no MenuBar exists in this frame, the MenuBar height will be 0.
- int frame_y = y - insets.top + menuBarHeight;
int frame_width = width + insets.left + insets.right;
- // Ditto as above. Since insets.top already includes the MenuBar's height,
- // we need to subtract the MenuBar's height from the top inset.
+ // Since insets.top already includes the MenuBar's height, we need
+ // to subtract the MenuBar's height from the top inset.
int frame_height = height + insets.top + insets.bottom - menuBarHeight;
- if (frame_x != awtComponent.getX()
- || frame_y != awtComponent.getY()
- || frame_width != awtComponent.getWidth()
+
+ if (frame_width != awtComponent.getWidth()
|| frame_height != awtComponent.getHeight())
- {
- if (frame_width != awtComponent.getWidth() && menuBar != null
- && width > 0)
- setMenuBarWidth (menuBar, width);
+ awtComponent.setSize(frame_width, frame_height);
- setBoundsCallback ((Window) awtComponent,
- frame_x,
- frame_y,
- frame_width,
- frame_height);
+ int frame_x = x - insets.left;
+ // Likewise, since insets.top includes the MenuBar height, we need
+ // to add back the MenuBar height to the frame's y position. If
+ // no MenuBar exists in this frame, the MenuBar height will be 0.
+ int frame_y = y - insets.top + menuBarHeight;
- awtComponent.validate();
+ if (frame_x != awtComponent.getX()
+ || frame_y != awtComponent.getY())
+ {
+ // awtComponent.setLocation(frame_x, frame_y);
}
}
@@ -251,6 +258,21 @@ public class GtkFramePeer extends GtkWindowPeer
{
}
+ public void setBoundsPrivate(int x, int y, int width, int height)
+ {
+ // TODO Auto-generated method stub
+
+ }
+ public void updateAlwaysOnTop()
+ {
+ // TODO Auto-generated method stub
+
+ }
+ public boolean requestWindowFocus()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkImage.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkImage.java
index abb4137..82a3463 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkImage.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkImage.java
@@ -51,7 +51,10 @@ import java.io.File;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Vector;
-import gnu.classpath.RawData;
+import java.io.ByteArrayOutputStream;
+import java.io.BufferedInputStream;
+import java.net.URL;
+import gnu.classpath.Pointer;
/**
* GtkImage - wraps a GdkPixbuf or GdkPixmap.
@@ -87,7 +90,7 @@ public class GtkImage extends Image
/**
* Pointer to the GdkPixbuf
*/
- RawData pixmap;
+ Pointer pixmap;
/**
* Observer queue.
@@ -129,11 +132,16 @@ public class GtkImage extends Image
private native void setPixels(int[] pixels);
/**
- * Loads an image using gdk-pixbuf.
+ * Loads an image using gdk-pixbuf from a file.
*/
private native boolean loadPixbuf(String name);
/**
+ * Loads an image using gdk-pixbuf from data.
+ */
+ private native boolean loadImageFromData(byte[] data);
+
+ /**
* Allocates a Gtk Pixbuf or pixmap
*/
private native void createPixmap();
@@ -187,6 +195,21 @@ public class GtkImage extends Image
}
/**
+ * Constructs a blank GtkImage. This is called when
+ * GtkToolkit.createImage (String) is called with an empty string
+ * argument (""). A blank image is loaded immediately upon
+ * construction and has width -1 and height -1.
+ */
+ public GtkImage ()
+ {
+ isLoaded = true;
+ observers = null;
+ offScreen = false;
+ props = new Hashtable();
+ errorLoading = false;
+ }
+
+ /**
* Constructs a GtkImage by loading a given file.
*
* @throws IllegalArgumentException if the image could not be loaded.
@@ -211,6 +234,58 @@ public class GtkImage extends Image
}
/**
+ * Constructs a GtkImage from a byte array of an image file.
+ *
+ * @throws IllegalArgumentException if the image could not be
+ * loaded.
+ */
+ public GtkImage (byte[] data)
+ {
+ if (loadImageFromData (data) != true)
+ throw new IllegalArgumentException ("Couldn't load image.");
+
+ isLoaded = true;
+ observers = null;
+ offScreen = false;
+ props = new Hashtable();
+ errorLoading = false;
+ }
+
+ /**
+ * Constructs a GtkImage from a URL. May result in an error image.
+ */
+ public GtkImage (URL url)
+ {
+ isLoaded = false;
+ observers = new Vector();
+ errorLoading = false;
+ if( url == null)
+ return;
+ ByteArrayOutputStream baos = new ByteArrayOutputStream (5000);
+ try
+ {
+ BufferedInputStream bis = new BufferedInputStream (url.openStream());
+
+ byte[] buf = new byte[5000];
+ int n = 0;
+
+ while ((n = bis.read(buf)) != -1)
+ baos.write(buf, 0, n);
+ bis.close();
+ }
+ catch(IOException e)
+ {
+ throw new IllegalArgumentException ("Couldn't load image.");
+ }
+ if (loadImageFromData (baos.toByteArray()) != true)
+ throw new IllegalArgumentException ("Couldn't load image.");
+
+ isLoaded = true;
+ observers = null;
+ props = new Hashtable();
+ }
+
+ /**
* Constructs an empty GtkImage.
*/
public GtkImage (int width, int height)
@@ -241,6 +316,25 @@ public class GtkImage extends Image
}
/**
+ * Package private constructor to create a GtkImage from a given
+ * PixBuf pointer.
+ */
+ GtkImage (Pointer pixbuf)
+ {
+ pixmap = pixbuf;
+ createFromPixbuf();
+ isLoaded = true;
+ observers = null;
+ offScreen = false;
+ props = new Hashtable();
+ }
+
+ /**
+ * Native helper function for constructor that takes a pixbuf Pointer.
+ */
+ private native void createFromPixbuf();
+
+ /**
* Callback from the image consumer.
*/
public void setImage(int width, int height,
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkImageConsumer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkImageConsumer.java
index 564cc8d..299f01d 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkImageConsumer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkImageConsumer.java
@@ -45,6 +45,7 @@ import java.awt.image.DirectColorModel;
import java.awt.image.ImageConsumer;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
+import java.awt.image.MemoryImageSource;
import java.util.Hashtable;
import java.util.Vector;
@@ -70,7 +71,10 @@ public class GtkImageConsumer implements ImageConsumer
public synchronized void imageComplete (int status)
{
- source.removeConsumer(this);
+ // we need to reuse the pixel cache for memory image sources since
+ // a memory image's backing array can be updated "live".
+ if (!(source instanceof MemoryImageSource))
+ source.removeConsumer(this);
target.setImage(width, height, pixelCache, properties);
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkLabelPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkLabelPeer.java
index fdd5fd1..3d099e9 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkLabelPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkLabelPeer.java
@@ -41,6 +41,9 @@ package gnu.java.awt.peer.gtk;
import java.awt.Label;
import java.awt.peer.LabelPeer;
+// A composite widget. GtkLabels have transparent backgrounds. An
+// AWT Label is opaque. To compensate, a GtkLabelPeer is a GtkLabel
+// packed in a GtkEventBox.
public class GtkLabelPeer extends GtkComponentPeer
implements LabelPeer
{
@@ -51,6 +54,10 @@ public class GtkLabelPeer extends GtkComponentPeer
public native void setText(String text);
native void setNativeBounds (int x, int y, int width, int height);
+ // Because this is a composite widget, we need to retrieve the
+ // GtkLabel's preferred dimensions, not the enclosing GtkEventBox's.
+ native void gtkWidgetGetPreferredDimensions (int[] dim);
+
void create ()
{
Label label = (Label) awtComponent;
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java
index 79eeaf9..a1a1cbd 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java
@@ -77,4 +77,9 @@ public class GtkMenuBarPeer extends GtkMenuComponentPeer
}
public native void delMenu(int index);
+
+ public void addMenu (Menu m)
+ {
+ // FIXME: implement
+ }
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
index 8d9d1ca..4c63359 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
+import java.awt.Font;
import java.awt.peer.MenuComponentPeer;
public class GtkMenuComponentPeer extends GtkGenericPeer
@@ -60,4 +61,9 @@ public class GtkMenuComponentPeer extends GtkGenericPeer
}
public native void dispose();
+
+ public void setFont(Font font)
+ {
+ // FIXME: implement
+ }
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuPeer.java
index 80332dd..fabcf1f 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuPeer.java
@@ -100,4 +100,9 @@ public class GtkMenuPeer extends GtkMenuItemPeer
}
public native void delItem(int index);
+
+ public void addSeparator()
+ {
+ // FIXME: implement
+ }
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java
index a842b83..e6896c9 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java
@@ -43,6 +43,7 @@ import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Rectangle;
import java.awt.TextArea;
+import java.awt.im.InputMethodRequests;
import java.awt.peer.TextAreaPeer;
import java.awt.peer.TextComponentPeer;
@@ -209,4 +210,10 @@ public class GtkTextAreaPeer extends GtkComponentPeer
{
insert (str, pos);
}
+
+ public InputMethodRequests getInputMethodRequests()
+ {
+ // FIXME: implement
+ return null;
+ }
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java
index 73a976b..4afdae8 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java
@@ -45,6 +45,7 @@ import java.awt.FontMetrics;
import java.awt.Rectangle;
import java.awt.TextField;
import java.awt.event.KeyEvent;
+import java.awt.im.InputMethodRequests;
import java.awt.peer.TextFieldPeer;
import java.awt.peer.TextComponentPeer;
@@ -193,4 +194,9 @@ public class GtkTextFieldPeer extends GtkComponentPeer
super.handleEvent (e);
}
+ public InputMethodRequests getInputMethodRequests()
+ {
+ // FIXME: implement
+ return null;
+ }
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java
index 6990110..0889d85 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java
@@ -88,9 +88,9 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
{
Hashtable containers = new Hashtable();
static EventQueue q;
- static Clipboard systemClipboard;
static boolean useGraphics2dSet;
static boolean useGraphics2d;
+ static Thread mainThread;
public static boolean useGraphics2D()
{
@@ -121,11 +121,19 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
portableNativeSync = 0; // false
gtkInit(portableNativeSync);
+
+ mainThread = new Thread ("GTK main thread")
+ {
+ public void run ()
+ {
+ gtkMain ();
+ }
+ };
+ mainThread.start ();
}
public GtkToolkit ()
{
- systemClipboard = new GtkClipboard ();
}
public native void beep();
@@ -244,6 +252,9 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
public Image createImage (String filename)
{
+ if (filename.length() == 0)
+ return new GtkImage ();
+
if (useGraphics2D())
return bufferedImageOrError(GdkPixbufDecoder.createBufferedImage (filename));
else
@@ -255,11 +266,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
if (useGraphics2D())
return bufferedImageOrError(GdkPixbufDecoder.createBufferedImage (url));
else
- {
- GdkPixbufDecoder d = new GdkPixbufDecoder (url);
- GtkImage image = new GtkImage (d);
- return image;
- }
+ return new GtkImage (url);
}
public Image createImage (ImageProducer producer)
@@ -279,11 +286,9 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
imagelength));
else
{
- GdkPixbufDecoder d = new GdkPixbufDecoder (imagedata,
- imageoffset,
- imagelength);
- GtkImage image = new GtkImage (d);
- return image;
+ byte[] datacopy = new byte[imagelength];
+ System.arraycopy (imagedata, imageoffset, datacopy, 0, imagelength);
+ return new GtkImage (datacopy);
}
}
@@ -395,7 +400,11 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
public Clipboard getSystemClipboard()
{
- return systemClipboard;
+ SecurityManager secman = System.getSecurityManager();
+ if (secman != null)
+ secman.checkSystemClipboardAccess();
+
+ return GtkClipboard.getInstance();
}
/**
@@ -628,7 +637,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
public GraphicsEnvironment getLocalGraphicsEnvironment()
{
- return new GdkGraphicsEnvironment(this);
+ return new GdkGraphicsEnvironment();
}
public Font createFont(int format, InputStream stream)
@@ -646,8 +655,5 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
GdkPixbufDecoder.registerSpis(reg);
}
- public native boolean nativeQueueEmpty();
- public native void wakeNativeQueue();
- public native void iterateNativeQueue(EventQueue locked, boolean block);
-
+ public static native void gtkMain();
} // class GtkToolkit
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java
index 71e05a8..c84d510 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java
@@ -41,6 +41,7 @@ package gnu.java.awt.peer.gtk;
import java.awt.Component;
import java.awt.Frame;
import java.awt.Window;
+import java.awt.event.ComponentEvent;
import java.awt.event.WindowEvent;
import java.awt.peer.WindowPeer;
@@ -104,6 +105,9 @@ public class GtkWindowPeer extends GtkContainerPeer
{
}
+ public native void setVisibleNative (boolean b);
+ public native void setVisibleNativeUnlocked (boolean b);
+
native void connectSignals ();
public GtkWindowPeer (Window window)
@@ -115,14 +119,27 @@ public class GtkWindowPeer extends GtkContainerPeer
public native void toFront();
native void nativeSetBounds (int x, int y, int width, int height);
+ native void nativeSetBoundsUnlocked (int x, int y, int width, int height);
public void setBounds (int x, int y, int width, int height)
{
+ // prevent window_configure_cb -> awtComponent.setSize ->
+ // peer.setBounds -> nativeSetBounds self-deadlock on GDK lock.
+ if (Thread.currentThread() == GtkToolkit.mainThread)
+ return;
+
nativeSetBounds (x, y,
width - insets.left - insets.right,
height - insets.top - insets.bottom);
}
+ public void setBoundsUnlocked (int x, int y, int width, int height)
+ {
+ nativeSetBoundsUnlocked (x, y,
+ width - insets.left - insets.right,
+ height - insets.top - insets.bottom);
+ }
+
public void setTitle (String title)
{
gtkWindowSetTitle (title);
@@ -140,10 +157,6 @@ public class GtkWindowPeer extends GtkContainerPeer
gtkWindowSetResizable (resizable);
}
- native void setBoundsCallback (Window window,
- int x, int y,
- int width, int height);
-
protected void postInsetsChangedEvent (int top, int left,
int bottom, int right)
{
@@ -153,36 +166,36 @@ public class GtkWindowPeer extends GtkContainerPeer
insets.right = right;
}
+ // called back by native side: window_configure_cb
+ // only called from GTK thread
protected void postConfigureEvent (int x, int y, int width, int height)
{
- int frame_x = x - insets.left;
- int frame_y = y - insets.top;
int frame_width = width + insets.left + insets.right;
int frame_height = height + insets.top + insets.bottom;
- if (frame_x != awtComponent.getX()
- || frame_y != awtComponent.getY()
- || frame_width != awtComponent.getWidth()
+ if (frame_width != awtComponent.getWidth()
|| frame_height != awtComponent.getHeight())
- {
- setBoundsCallback ((Window) awtComponent,
- frame_x, frame_y, frame_width, frame_height);
+ awtComponent.setSize(frame_width, frame_height);
- awtComponent.validate();
+ int frame_x = x - insets.left;
+ int frame_y = y - insets.top;
+
+ if (frame_x != awtComponent.getX()
+ || frame_y != awtComponent.getY())
+ {
+ // awtComponent.setLocation(frame_x, frame_y);
}
}
- native void nativeSetVisible (boolean b);
- public void setVisible (boolean b)
+ public void show ()
{
// Prevent the window manager from automatically placing this
// window when it is shown.
- if (b)
- setBounds (awtComponent.getX(),
- awtComponent.getY(),
- awtComponent.getWidth(),
- awtComponent.getHeight());
- nativeSetVisible (b);
+ setBounds (awtComponent.getX(),
+ awtComponent.getY(),
+ awtComponent.getWidth(),
+ awtComponent.getHeight());
+ setVisible (true);
}
void postWindowEvent (int id, Window opposite, int newState)
@@ -209,4 +222,14 @@ public class GtkWindowPeer extends GtkContainerPeer
else
q().postEvent (new WindowEvent ((Window) awtComponent, id, opposite));
}
+ public void updateAlwaysOnTop()
+ {
+ // TODO Auto-generated method stub
+
+ }
+ public boolean requestWindowFocus()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
}
diff --git a/libjava/classpath/gnu/java/nio/FileLockImpl.java b/libjava/classpath/gnu/java/nio/FileLockImpl.java
index 245fa73..673ca25 100644
--- a/libjava/classpath/gnu/java/nio/FileLockImpl.java
+++ b/libjava/classpath/gnu/java/nio/FileLockImpl.java
@@ -1,5 +1,5 @@
-/* FileLockImpl.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* FileLockImpl.java -- FileLock associated with a FileChannelImpl.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,20 +44,29 @@ import java.io.IOException;
import java.nio.channels.FileLock;
/**
+ * A FileLock associated with a FileChannelImpl.
+ *
* @author Michael Koch
* @since 1.4
*/
-public class FileLockImpl extends FileLock
+public final class FileLockImpl extends FileLock
{
- private FileChannelImpl ch;
-
+ /**
+ * Whether or not this lock is valid, false when channel is closed or
+ * release has been explicitly called.
+ */
+ private boolean valid;
+
public FileLockImpl (FileChannelImpl channel, long position,
long size, boolean shared)
{
super (channel, position, size, shared);
- ch = channel;
+ valid = true;
}
+ /**
+ * Releases this lock.
+ */
protected void finalize()
{
try
@@ -70,13 +79,26 @@ public class FileLockImpl extends FileLock
}
}
- public boolean isValid ()
+ /**
+ * Whether or not this lock is valid, false when channel is closed or
+ * release has been explicitly called.
+ */
+ public boolean isValid()
{
- return channel().isOpen();
+ if (valid)
+ valid = channel().isOpen();
+ return valid;
}
- public synchronized void release () throws IOException
+ /**
+ * Releases the lock if it is still valid. Marks this lock as invalid.
+ */
+ public void release() throws IOException
{
- ch.unlock(position(), size());
+ if (isValid())
+ {
+ valid = false;
+ ((FileChannelImpl) channel()).unlock(position(), size());
+ }
}
}
diff --git a/libjava/classpath/gnu/java/nio/channels/FileChannelImpl.java b/libjava/classpath/gnu/java/nio/channels/FileChannelImpl.java
index a87a2e8..0ee5d3f 100644
--- a/libjava/classpath/gnu/java/nio/channels/FileChannelImpl.java
+++ b/libjava/classpath/gnu/java/nio/channels/FileChannelImpl.java
@@ -73,6 +73,10 @@ public final class FileChannelImpl extends FileChannel
public static final int SYNC = 16;
public static final int DSYNC = 32;
+ public static FileChannelImpl in;
+ public static FileChannelImpl out;
+ public static FileChannelImpl err;
+
private static native void init();
static
@@ -83,6 +87,10 @@ public final class FileChannelImpl extends FileChannel
}
init();
+
+ in = new FileChannelImpl(0, READ);
+ out = new FileChannelImpl(1, WRITE);
+ err = new FileChannelImpl(2, WRITE);
}
/**
@@ -97,6 +105,8 @@ public final class FileChannelImpl extends FileChannel
private int mode;
+ final String description;
+
/* Open a file. MODE is a combination of the above mode flags. */
/* This is a static factory method, so that VM implementors can decide
* substitute subclasses of FileChannelImpl. */
@@ -109,7 +119,8 @@ public final class FileChannelImpl extends FileChannel
private FileChannelImpl(File file, int mode)
throws FileNotFoundException
{
- final String path = file.getPath();
+ String path = file.getPath();
+ description = path;
fd = open (path, mode);
this.mode = mode;
@@ -126,21 +137,26 @@ public final class FileChannelImpl extends FileChannel
/* ignore it */
}
- throw new FileNotFoundException(path + " is a directory");
+ throw new FileNotFoundException(description + " is a directory");
}
}
- /* Used by init() (native code) */
+ /**
+ * Constructor for default channels in, out and err.
+ *
+ * Used by init() (native code).
+ *
+ * @param fd the file descriptor (0, 1, 2 for stdin, stdout, stderr).
+ *
+ * @param mode READ or WRITE
+ */
FileChannelImpl (int fd, int mode)
{
this.fd = fd;
this.mode = mode;
+ this.description = "descriptor(" + fd + ")";
}
- public static FileChannelImpl in;
- public static FileChannelImpl out;
- public static FileChannelImpl err;
-
private native int open (String path, int mode) throws FileNotFoundException;
public native int available () throws IOException;
@@ -179,7 +195,7 @@ public final class FileChannelImpl extends FileChannel
throws IOException
{
if (position < 0)
- throw new IllegalArgumentException ();
+ throw new IllegalArgumentException ("position: " + position);
long oldPosition = implPosition ();
position (position);
int result = read(dst);
@@ -230,7 +246,7 @@ public final class FileChannelImpl extends FileChannel
throws IOException
{
if (position < 0)
- throw new IllegalArgumentException ();
+ throw new IllegalArgumentException ("position: " + position);
if (!isOpen ())
throw new ClosedChannelException ();
@@ -288,10 +304,11 @@ public final class FileChannelImpl extends FileChannel
throw new NonWritableChannelException();
}
else
- throw new IllegalArgumentException ();
+ throw new IllegalArgumentException ("mode: " + mode);
if (position < 0 || size < 0 || size > Integer.MAX_VALUE)
- throw new IllegalArgumentException ();
+ throw new IllegalArgumentException ("position: " + position
+ + ", size: " + size);
return mapImpl(nmode, position, (int) size);
}
@@ -336,7 +353,8 @@ public final class FileChannelImpl extends FileChannel
{
if (position < 0
|| count < 0)
- throw new IllegalArgumentException ();
+ throw new IllegalArgumentException ("position: " + position
+ + ", count: " + count);
if (!isOpen ())
throw new ClosedChannelException ();
@@ -399,7 +417,8 @@ public final class FileChannelImpl extends FileChannel
{
if (position < 0
|| count < 0)
- throw new IllegalArgumentException ();
+ throw new IllegalArgumentException ("position: " + position
+ + ", count: " + count);
if (!isOpen ())
throw new ClosedChannelException ();
@@ -424,24 +443,31 @@ public final class FileChannelImpl extends FileChannel
return total;
}
- public FileLock tryLock (long position, long size, boolean shared)
+ // Shared sanity checks between lock and tryLock methods.
+ private void lockCheck(long position, long size, boolean shared)
throws IOException
{
if (position < 0
|| size < 0)
- throw new IllegalArgumentException ();
+ throw new IllegalArgumentException ("position: " + position
+ + ", size: " + size);
if (!isOpen ())
- throw new ClosedChannelException ();
+ throw new ClosedChannelException();
- if (shared && (mode & READ) == 0)
- throw new NonReadableChannelException ();
-
- if (!shared && (mode & WRITE) == 0)
- throw new NonWritableChannelException ();
+ if (shared && ((mode & READ) == 0))
+ throw new NonReadableChannelException();
+ if (!shared && ((mode & WRITE) == 0))
+ throw new NonWritableChannelException();
+ }
+
+ public FileLock tryLock (long position, long size, boolean shared)
+ throws IOException
+ {
+ lockCheck(position, size, shared);
+
boolean completed = false;
-
try
{
begin();
@@ -468,15 +494,9 @@ public final class FileChannelImpl extends FileChannel
public FileLock lock (long position, long size, boolean shared)
throws IOException
{
- if (position < 0
- || size < 0)
- throw new IllegalArgumentException ();
-
- if (!isOpen ())
- throw new ClosedChannelException ();
+ lockCheck(position, size, shared);
boolean completed = false;
-
try
{
boolean lockable = lock(position, size, shared, true);
@@ -504,7 +524,7 @@ public final class FileChannelImpl extends FileChannel
throws IOException
{
if (newPosition < 0)
- throw new IllegalArgumentException ();
+ throw new IllegalArgumentException ("newPostition: " + newPosition);
if (!isOpen ())
throw new ClosedChannelException ();
@@ -519,7 +539,7 @@ public final class FileChannelImpl extends FileChannel
throws IOException
{
if (size < 0)
- throw new IllegalArgumentException ();
+ throw new IllegalArgumentException ("size: " + size);
if (!isOpen ())
throw new ClosedChannelException ();
@@ -532,4 +552,12 @@ public final class FileChannelImpl extends FileChannel
return this;
}
+
+ public String toString()
+ {
+ return (this.getClass()
+ + "[fd=" + fd
+ + ",mode=" + mode + ","
+ + description + "]");
+ }
}
diff --git a/libjava/classpath/gnu/java/nio/charset/UTF_16Decoder.java b/libjava/classpath/gnu/java/nio/charset/UTF_16Decoder.java
index 302c83e..e3927d9 100644
--- a/libjava/classpath/gnu/java/nio/charset/UTF_16Decoder.java
+++ b/libjava/classpath/gnu/java/nio/charset/UTF_16Decoder.java
@@ -1,5 +1,5 @@
/* UTF_16Decoder.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -105,8 +105,9 @@ final class UTF_16Decoder extends CharsetDecoder
}
// FIXME: Change so you only do a single comparison here.
- char c = byteOrder == BIG_ENDIAN ? (char) ((b1 << 8) | b2)
- : (char) ((b2 << 8) | b1);
+ char c = (byteOrder == BIG_ENDIAN
+ ? (char) (((b1 & 0xFF) << 8) | (b2 & 0xFF))
+ : (char) (((b2 & 0xFF) << 8) | (b1 & 0xFF)));
if (0xD800 <= c && c <= 0xDFFF)
{
@@ -119,8 +120,9 @@ final class UTF_16Decoder extends CharsetDecoder
return CoderResult.UNDERFLOW;
byte b3 = in.get ();
byte b4 = in.get ();
- char d = byteOrder == BIG_ENDIAN ? (char) ((b3 << 8) | b4)
- : (char) ((b4 << 8) | b3);
+ char d = (byteOrder == BIG_ENDIAN
+ ? (char) (((b3 & 0xFF) << 8) | (b4 & 0xFF))
+ : (char) (((b4 & 0xFF) << 8) | (b3 & 0xFF)));
// make sure d is a low surrogate
if (d < 0xDC00 || d > 0xDFFF)
return CoderResult.malformedForLength (2);
diff --git a/libjava/classpath/gnu/java/nio/charset/iconv/IconvDecoder.java b/libjava/classpath/gnu/java/nio/charset/iconv/IconvDecoder.java
index fa265a9..fa6f497 100644
--- a/libjava/classpath/gnu/java/nio/charset/iconv/IconvDecoder.java
+++ b/libjava/classpath/gnu/java/nio/charset/iconv/IconvDecoder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.java.nio.charset.iconv;
-import gnu.classpath.RawData;
+import gnu.classpath.Pointer;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
@@ -55,7 +55,7 @@ final class IconvDecoder extends CharsetDecoder
openIconv(info.iconvName());
}
- private RawData data;
+ private Pointer data;
private int inremaining;
private int outremaining;
diff --git a/libjava/classpath/gnu/java/nio/charset/iconv/IconvEncoder.java b/libjava/classpath/gnu/java/nio/charset/iconv/IconvEncoder.java
index bb10c9b..d5cc887 100644
--- a/libjava/classpath/gnu/java/nio/charset/iconv/IconvEncoder.java
+++ b/libjava/classpath/gnu/java/nio/charset/iconv/IconvEncoder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.java.nio.charset.iconv;
-import gnu.classpath.RawData;
+import gnu.classpath.Pointer;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
@@ -49,7 +49,7 @@ import java.nio.charset.CoderResult;
final class IconvEncoder extends CharsetEncoder
{
- private RawData data;
+ private Pointer data;
private int inremaining;
private int outremaining;
diff --git a/libjava/classpath/gnu/java/security/OID.java b/libjava/classpath/gnu/java/security/OID.java
index 8cda43e..473b6ba 100644
--- a/libjava/classpath/gnu/java/security/OID.java
+++ b/libjava/classpath/gnu/java/security/OID.java
@@ -1,5 +1,5 @@
/* OID.java -- numeric representation of an object identifier
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ import java.util.StringTokenizer;
/**
* This immutable class represents an object identifier, or OID.
*
- * <p>OIDs are represented as a series of hierarcical tokens, each of
+ * <p>OIDs are represented as a series of hierarchical tokens, each of
* which is usually represented as a single, unsigned integer. The
* hierarchy works so that later tokens are considered within the group
* of earlier tokens. Thus, the OID for the Serpent block cipher,
diff --git a/libjava/classpath/gnu/java/security/PolicyFile.java b/libjava/classpath/gnu/java/security/PolicyFile.java
index dd3a4de..c6a3061 100644
--- a/libjava/classpath/gnu/java/security/PolicyFile.java
+++ b/libjava/classpath/gnu/java/security/PolicyFile.java
@@ -37,6 +37,10 @@ exception statement from your version. */
package gnu.java.security;
+import gnu.classpath.SystemProperties;
+import gnu.classpath.debug.Component;
+import gnu.classpath.debug.SystemLogger;
+
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
@@ -66,6 +70,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
+import java.util.logging.Logger;
/**
* An implementation of a {@link java.security.Policy} object whose
@@ -143,24 +148,16 @@ public final class PolicyFile extends Policy
// Constants and fields.
// -------------------------------------------------------------------------
- private static final boolean DEBUG = true;
- // Package-private to avoid a trampoline.
- static void debug(String msg)
- {
- System.err.print(">> PolicyFile: ");
- System.err.println(msg);
- }
-
- private static void debug(Throwable t)
- {
- System.err.println(">> PolicyFile");
- t.printStackTrace(System.err);
- }
+ private static final Logger logger = SystemLogger.SYSTEM;
- private static final String DEFAULT_POLICY = System.getProperty("java.home")
- + System.getProperty("file.separator") + "lib"
- + System.getProperty("file.separator") + "security"
- + System.getProperty("file.separator") + "java.policy";
+ private static final String DEFAULT_POLICY =
+ SystemProperties.getProperty("java.home")
+ + SystemProperties.getProperty("file.separator") + "lib"
+ + SystemProperties.getProperty("file.separator") + "security"
+ + SystemProperties.getProperty("file.separator") + "java.policy";
+ private static final String DEFAULT_USER_POLICY =
+ SystemProperties.getProperty ("user.home") +
+ SystemProperties.getProperty ("file.separator") + ".java.policy";
private final Map cs2pc;
@@ -185,7 +182,8 @@ public final class PolicyFile extends Policy
CodeSource cs = (CodeSource) e.getKey();
if (cs.implies(codeSource))
{
- if (DEBUG) debug(cs+" -> "+codeSource);
+ logger.log (Component.POLICY, "{0} -> {1}", new Object[]
+ { cs, codeSource });
PermissionCollection pc = (PermissionCollection) e.getValue();
for (Enumeration ee = pc.elements(); ee.hasMoreElements(); )
{
@@ -193,50 +191,69 @@ public final class PolicyFile extends Policy
}
}
else
- if (DEBUG) debug(cs+" !-> "+codeSource);
+ logger.log (Component.POLICY, "{0} !-> {1}", new Object[]
+ { cs, codeSource });
}
- if (DEBUG) debug ("returning permissions " + perms + " for " + codeSource);
+ logger.log (Component.POLICY, "returning permissions {0} for {1}",
+ new Object[] { perms, codeSource });
return perms;
}
public void refresh()
{
cs2pc.clear();
- List policyFiles = new LinkedList();
+ final List policyFiles = new LinkedList();
try
{
- policyFiles.add(new File(DEFAULT_POLICY).toURL());
- if (DEBUG) debug ("defualt policy is " + DEFAULT_POLICY);
- policyFiles.addAll((List) AccessController.doPrivileged(
+ policyFiles.add (new File (DEFAULT_POLICY).toURL());
+ policyFiles.add (new File (DEFAULT_USER_POLICY).toURL ());
+
+ AccessController.doPrivileged(
new PrivilegedExceptionAction()
{
public Object run() throws Exception
{
- LinkedList l = new LinkedList();
+ String allow = Security.getProperty ("policy.allowSystemProperty");
+ if (allow == null || Boolean.getBoolean (allow))
+ {
+ String s = SystemProperties.getProperty ("java.security.policy");
+ logger.log (Component.POLICY, "java.security.policy={0}", s);
+ if (s != null)
+ {
+ boolean only = s.startsWith ("=");
+ if (only)
+ s = s.substring (1);
+ policyFiles.clear ();
+ policyFiles.add (new URL (s));
+ if (only)
+ return null;
+ }
+ }
for (int i = 1; ; i++)
{
- String s = Security.getProperty("policy.file."+i);
- if (DEBUG) debug("policy.file."+i+"="+s);
+ String pname = "policy.url." + i;
+ String s = Security.getProperty (pname);
+ logger.log (Component.POLICY, "{0}={1}", new Object []
+ { pname, s });
if (s == null)
break;
- l.add(new URL(s));
+ policyFiles.add (new URL (s));
}
- String s = System.getProperty("java.security.policy");
- if (DEBUG) debug("java.security.policy="+s);
- if (s != null)
- l.add(new URL(s));
- return l;
+ return null;
}
- }));
+ });
}
catch (PrivilegedActionException pae)
{
- if (DEBUG) debug(pae);
+ logger.log (Component.POLICY, "reading policy properties", pae);
}
catch (MalformedURLException mue)
{
- if (DEBUG) debug(mue);
+ logger.log (Component.POLICY, "setting default policies", mue);
}
+
+ logger.log (Component.POLICY, "building policy from URLs {0}",
+ policyFiles);
for (Iterator it = policyFiles.iterator(); it.hasNext(); )
{
try
@@ -246,7 +263,7 @@ public final class PolicyFile extends Policy
}
catch (IOException ioe)
{
- if (DEBUG) debug(ioe);
+ logger.log (Component.POLICY, "reading policy", ioe);
}
}
}
@@ -273,7 +290,7 @@ public final class PolicyFile extends Policy
*/
private void parse(final URL url) throws IOException
{
- if (DEBUG) debug ("reading policy file from " + url);
+ logger.log (Component.POLICY, "reading policy file from {0}", url);
final StreamTokenizer in = new StreamTokenizer(new InputStreamReader(url.openStream()));
in.resetSyntax();
in.slashSlashComments(true);
diff --git a/libjava/classpath/gnu/java/security/provider/DSAKeyPairGenerator.java b/libjava/classpath/gnu/java/security/provider/DSAKeyPairGenerator.java
index 2c643d5..ddd1800 100644
--- a/libjava/classpath/gnu/java/security/provider/DSAKeyPairGenerator.java
+++ b/libjava/classpath/gnu/java/security/provider/DSAKeyPairGenerator.java
@@ -1,5 +1,5 @@
/* GnuDSAKeyPairGenerator.java --- Gnu DSA Key Pair Generator
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,10 +45,12 @@ import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidParameterException;
import java.security.KeyPair;
import java.security.KeyPairGeneratorSpi;
+import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.interfaces.DSAParams;
import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.DSAParameterSpec;
+import java.security.spec.InvalidParameterSpecException;
import java.util.Random;
public class DSAKeyPairGenerator extends KeyPairGeneratorSpi
@@ -60,18 +62,15 @@ private BigInteger q = null; // the small prime
private BigInteger p = null; // the big prime
private BigInteger g = null;
-DSAKeyPairGenerator()
+public DSAKeyPairGenerator()
{
keysize = 1024;
+ getDefaults ();
}
public void initialize(int keysize, SecureRandom random)
{
- //if( ((keysize % 64) != 0) || (keysize < 512) || (keysize > 1024) )
- // throw new InvalidAlgorithmParameterException("Invalid key size");
-
- this.keysize = keysize;
- this.random = random;
+ initialize (keysize, false, random);
}
public void initialize(AlgorithmParameterSpec params,
@@ -81,65 +80,87 @@ public void initialize(AlgorithmParameterSpec params,
if( !( params instanceof DSAParameterSpec ) )
throw new InvalidAlgorithmParameterException("Must be DSAParameterSpec");
+ try
+ {
+ initialize ((DSAParams) params, random);
+ }
+ catch (InvalidParameterException ipe)
+ {
+ InvalidAlgorithmParameterException iape =
+ new InvalidAlgorithmParameterException();
+ iape.initCause (ipe);
+ throw iape;
+ }
+}
+
+public void initialize (DSAParams params, SecureRandom random)
+{
DSAParameterSpec dsaparameterspec = (DSAParameterSpec)params;
+ if (dsaparameterspec.getP() == null
+ || dsaparameterspec.getQ() == null
+ || dsaparameterspec.getG() == null)
+ {
+ throw new InvalidParameterException ("none of p, q, or g may be null");
+ }
p = dsaparameterspec.getP();
q = dsaparameterspec.getQ();
g = dsaparameterspec.getG();
this.random = random;
}
-public void initialize(DSAParams params, SecureRandom random)
- throws InvalidParameterException
-{
- if(params.getP() != null)
- p = params.getP();
- else
- throw new InvalidParameterException();
-
- if(params.getQ() != null)
- q = params.getQ();
- else
- throw new InvalidParameterException();
-
- if(params.getG() != null)
- g = params.getG();
- else
- throw new InvalidParameterException();
-
- this.random = random;
-}
-
public void initialize(int modlen, boolean genParams, SecureRandom random)
throws InvalidParameterException
{
if( ((modlen % 64) != 0) || (modlen < 512) || (modlen > 1024) )
throw new InvalidParameterException();
- if( (genParams == false) && (modlen != 512) && (modlen != 768) && (modlen != 1024) )
- throw new InvalidParameterException();
- this.keysize = modlen;
- this.random = random;
- p = null;
- q = null;
- g = null;
+ this.keysize = modlen;
+ this.random = random;
+ if (this.random == null)
+ {
+ this.random = new SecureRandom ();
+ }
+ if (genParams)
+ {
+ try
+ {
+ AlgorithmParameterGenerator apgDSA = AlgorithmParameterGenerator.getInstance("DSA");
+ apgDSA.init (modlen, random);
+ AlgorithmParameters apDSA = apgDSA.generateParameters();
+ DSAParameterSpec dsaparameterspec = (DSAParameterSpec)apDSA.getParameterSpec( DSAParameterSpec.class );
+ p = dsaparameterspec.getP();
+ q = dsaparameterspec.getQ();
+ g = dsaparameterspec.getG();
+ }
+ catch (NoSuchAlgorithmException nsae)
+ {
+ InvalidParameterException ipe =
+ new InvalidParameterException ("can't generate DSA parameters");
+ ipe.initCause (nsae);
+ throw ipe;
+ }
+ catch (InvalidParameterSpecException ipse)
+ {
+ InvalidParameterException ipe =
+ new InvalidParameterException ("can't generate DSA parameters");
+ ipe.initCause (ipse);
+ throw ipe;
+ }
+ }
+ else if (!getDefaults ())
+ {
+ throw new InvalidParameterException ("unsupported key size: " + modlen);
+ }
}
public KeyPair generateKeyPair()
{
- if( getDefaults() == false) {
- try {
- AlgorithmParameterGenerator apgDSA = AlgorithmParameterGenerator.getInstance("DSA");
- AlgorithmParameters apDSA = apgDSA.generateParameters();
- DSAParameterSpec dsaparameterspec = (DSAParameterSpec)apDSA.getParameterSpec( DSAParameterSpec.class );
- p = dsaparameterspec.getP();
- q = dsaparameterspec.getQ();
- g = dsaparameterspec.getG();
- } catch ( Exception e ) {
- return null;
- }
- }
+ if (random == null)
+ {
+ random = new SecureRandom ();
+ }
- BigInteger x = new BigInteger( 159, new Random() );
+ BigInteger x = new BigInteger( 159, random );
BigInteger y = g.modPow( x, p );
@@ -160,10 +181,12 @@ private boolean getDefaults()
p = new BigInteger("e9e642599d355f37c97ffd3567120b8e25c9cd43e927b3a9670fbec5d890141922d2c3b3ad2480093799869d1e846aab49fab0ad26d2ce6a22219d470bce7d777d4a21fbe9c270b57f607002f3cef8393694cf45ee3688c11a8c56ab127a3daf", 16);
q = new BigInteger("9cdbd84c9f1ac2f38d0f80f42ab952e7338bf511", 16);
g = new BigInteger("30470ad5a005fb14ce2d9dcd87e38bc7d1b1c5facbaecbe95f190aa7a31d23c4dbbcbe06174544401a5b2c020965d8c2bd2171d3668445771f74ba084d2029d83c1c158547f3a9f1a2715be23d51ae4d3e5a1f6a7064f316933a346d3f529252", 16);
- } else if( keysize == 512) {
+ return true;
+ } else if( keysize == 1024) {
p = new BigInteger("fd7f53811d75122952df4a9c2eece4e7f611b7523cef4400c31e3f80b6512669455d402251fb593d8d58fabfc5f5ba30f6cb9b556cd7813b801d346ff26660b76b9950a5a49f9fe8047b1022c24fbba9d7feb7c61bf83b57e7c6a8a6150f04fb83f6d3c51ec3023554135a169132f675f3ae2b61d72aeff22203199dd14801c7", 16);
q = new BigInteger("9760508f15230bccb292b982a2eb840bf0581cf5", 16);
g = new BigInteger("f7e1a085d69b3ddecbbcab5c36b857b97994afbbfa3aea82f9574c0b3d0782675159578ebad4594fe67107108180b449167123e84c281613b7cf09328cc8a6e13c167a8b547c8d28e0a3ae1e2bb3a675916ea37f0bfa213562f1fb627a01243bcca4f1bea8519089a883dfe15ae59f06928b665e807b552564014c3bfecf492a", 16);
+ return true;
}
return false;
}
diff --git a/libjava/classpath/gnu/java/security/provider/PKIXCertPathValidatorImpl.java b/libjava/classpath/gnu/java/security/provider/PKIXCertPathValidatorImpl.java
index 1268b16..ab89434 100644
--- a/libjava/classpath/gnu/java/security/provider/PKIXCertPathValidatorImpl.java
+++ b/libjava/classpath/gnu/java/security/provider/PKIXCertPathValidatorImpl.java
@@ -1,5 +1,5 @@
/* PKIXCertPathValidatorImpl.java -- PKIX certificate path validator.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -331,7 +331,7 @@ public class PKIXCertPathValidatorImpl extends CertPathValidatorSpi
continue;
try
{
- if (anchorCert == null)
+ if (anchorCert != null)
anchorCert.checkValidity(now);
p[p.length-1].verify(anchorKey);
if (anchorCert != null && anchorCert.getBasicConstraints() >= 0
diff --git a/libjava/classpath/gnu/javax/swing/plaf/gtk/GtkBorders.java b/libjava/classpath/gnu/javax/swing/plaf/gtk/GtkBorders.java
deleted file mode 100644
index ebba6a4..0000000
--- a/libjava/classpath/gnu/javax/swing/plaf/gtk/GtkBorders.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/* GtkBorders.java
- Copyright (c) 1999 by Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.javax.swing.plaf.gtk;
-import java.awt.*;
-import javax.swing.*;
-import javax.swing.border.*;
-import javax.swing.plaf.*;
-
-/**
- * Optional class, can be used to define nifty borders.
- *
- * @author Brian Jones
- * @see javax.swing.LookAndFeel
- */
-public class GtkBorders
-{
- public static class ButtonBorder extends AbstractBorder
- implements UIResource
- {
- private Border raised; // use by default
- private Border lowered; // use this one when pressed
-
- // creat the border
- public ButtonBorder()
- {
- raised = BorderFactory.createRaisedBevelBorder();
- lowered = BorderFactory.createLoweredBevelBorder();
- }
-
- // define the insets (in terms of one of the others)
- public Insets getBorderInsets(Component c)
- {
- return raised.getBorderInsets(c);
- }
-
- public void paintBorder(Component c, Graphics g, int x, int y,
- int width, int height)
- {
- AbstractButton b = (AbstractButton)c;
- ButtonModel model = b.getModel();
-
- if (model.isPressed() && model.isArmed())
- lowered.paintBorder(c, g, x, y, width, height);
- else
- raised.paintBorder(c, g, x, y, width, height);
- }
- }
-}
diff --git a/libjava/classpath/gnu/javax/swing/plaf/gtk/GtkCheckBoxUI.java b/libjava/classpath/gnu/javax/swing/plaf/gtk/GtkCheckBoxUI.java
deleted file mode 100644
index 0395af6..0000000
--- a/libjava/classpath/gnu/javax/swing/plaf/gtk/GtkCheckBoxUI.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* GtkCheckBoxUI.java
- Copyright (c) 1999 by Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.javax.swing.plaf.gtk;
-
-import java.awt.*;
-import javax.swing.*;
-import javax.swing.plaf.*;
-import javax.swing.plaf.basic.*;
-
-/**
- *
- * @author Brian Jones
- * @see javax.swing.LookAndFeel
- */
-public class GtkCheckBoxUI extends GtkRadioButtonUI
-{
- public GtkCheckBoxUI()
- {
- super();
- }
-
- public static ComponentUI createUI(JComponent c)
- {
- return new GtkCheckBoxUI();
- }
-
- public String getPropertyPrefix()
- {
- // FIXME
- System.err.println(super.getPropertyPrefix());
- return super.getPropertyPrefix();
- }
-}
-
diff --git a/libjava/classpath/gnu/javax/swing/plaf/gtk/GtkIconFactory.java b/libjava/classpath/gnu/javax/swing/plaf/gtk/GtkIconFactory.java
deleted file mode 100644
index 28fd36e..0000000
--- a/libjava/classpath/gnu/javax/swing/plaf/gtk/GtkIconFactory.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/* GtkIconFactory.java
- Copyright (c) 1999 by Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.javax.swing.plaf.gtk;
-import java.awt.*;
-import javax.swing.*;
-import javax.swing.plaf.*;
-import java.io.Serializable;
-
-/**
- *
- * @author Brian Jones
- * @see javax.swing.LookAndFeel
- */
-public class GtkIconFactory implements Serializable
-{
- private static Icon radioButtonIcon;
- private static Icon checkBoxIcon;
-
- public static Icon getRadioButtonIcon()
- {
- if (radioButtonIcon == null)
- radioButtonIcon = new RadioButtonIcon();
- return radioButtonIcon;
- }
-
- private static class RadioButtonIcon
- implements Icon, UIResource, Serializable
- {
- private static final int size = 15;
-
- public int getIconWidth() { return size; }
- public int getIconHeight() { return size; }
-
- public void paintIcon(Component c, Graphics g, int x, int y)
- {
- System.out.println("radiobuttonicon: paintIcon()");
- // get the button and model containing the state we are
- // supposed to show
- AbstractButton b = (AbstractButton)c;
- ButtonModel model = b.getModel();
-
- // If the button is being pressed (& armed), change the
- // background color
- // Note: could also do something different if the button is
- // disabled
-
- if (model.isPressed() && model.isArmed())
- {
- System.out.println("radiobuttonicon: pressed & armed");
- g.setColor(UIManager.getColor("RadioButton.pressed"));
- g.fillOval(x,y,size-1, size-1);
- }
- // draw an outer circle
- g.setColor(UIManager.getColor("RadioButton.foreground"));
- g.drawOval(x,y,size-1, size-1);
-
- // fill a small circle inside if the button is selected
- if (model.isSelected()) {
- g.fillOval(x+4, y+4, size-8, size-8);
- System.out.println("radiobuttonicon: is selected");
- }
- }
- }
-}
diff --git a/libjava/classpath/gnu/javax/swing/plaf/gtk/GtkLookAndFeel.java b/libjava/classpath/gnu/javax/swing/plaf/gtk/GtkLookAndFeel.java
deleted file mode 100644
index ed99e6d..0000000
--- a/libjava/classpath/gnu/javax/swing/plaf/gtk/GtkLookAndFeel.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/* GtkLookAndFeel.java
- Copyright (c) 1999 by Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.javax.swing.plaf.gtk;
-import java.awt.*;
-import javax.swing.*;
-import javax.swing.border.*;
-import javax.swing.plaf.*;
-import javax.swing.plaf.basic.*;
-
-/**
- *
- * @author Brian Jones
- * @see javax.swing.LookAndFeel
- */
-public class GtkLookAndFeel extends BasicLookAndFeel
-{
- private UIDefaults uiDefaults;
-
- /**
- */
- public GtkLookAndFeel()
- {
- super();
- }
-
- /**
- * A short string to identify this look and feel, for example in a
- * drop down list to choose between several look and feels.
- */
- public String getName() { return "GIMP Toolkit"; }
-
- /**
- * A much longer description of the look and feel.
- */
- public String getDescription()
- {
- return new String("The GIMP Toolkit Look and Feel for Java, " +
- "written by Brian Jones (cbj@gnu.org), " +
- "(c) 1999 by Free Software Foundation, Inc. " +
- "http://www.classpath.org");
- }
-
- /**
- * Return a unique string identifying this look and feel as different
- * from and not a subclass of any other look and feel. Usually, a
- * subclass will return the same <code>String</code> here as the
- * original look and feel if only a few changes are being made rather
- * than something completely new and different.
- */
- public String getID()
- {
- return "Gtk";
- }
-
- public boolean isNativeLookAndFeel()
- {
- return false;
- }
-
- public boolean isSupportedLookAndFeel()
- {
- return true;
- }
-
- protected void initClassDefaults(UIDefaults table)
- {
- super.initClassDefaults(table);
-
- String gtkPkgName = "gnu.javax.swing.plaf.gtk.";
-
-
- Object[] defaults = {
- "SliderUI", gtkPkgName + "GtkSliderUI"
- };
- /*
- "CheckBoxUI", gtkPkgName + "GtkCheckBoxUI",
- "ButtonUI", gtkPkgName + "GtkButtonUI"
- "ColorChooserUI", "MetalColorChooserUI",
- "MenuBarUI", "MetalMenuBarUI",
- "MenuUI", "MetalMenuUI",
- "MenuItemUI", "MetalMenuItemUI",
- "CheckBoxMenuItemUI", "MetalCheckBoxMenuItemUI",
- "RadioButtonMenuItemUI", "MetalRadioButtonMenuItemUI",
- "RadioButtonUI", "MetalRadioButtonUI",
- "ToggleButtonUI", "MetalToggleButtonUI",
- "PopupMenuUI", "MetalPopupMenuUI",
- "ProgressBarUI", "MetalProgressBarUI",
- "ScrollBarUI", "MetalScrollBarUI",
- "ScrollPaneUI", "MetalScrollPaneUI",
- "SplitPaneUI", "MetalSplitPaneUI",
- "SeparatorUI", "MetalSeparatorUI",
- "ToolBarSeparatorUI", "MetalToolBarSeparatorUI",
- "PopupMenuSeparatorUI", "MetalPopupMenuSeparatorUI",
- "TabbedPaneUI", "MetalTabbedPaneUI",
- "TextAreaUI", "MetalTextAreaUI",
- "TextFieldUI", "MetalTextFieldUI",
- "PasswordFieldUI", "MetalPasswordFieldUI",
- "TextPaneUI", "MetalTextPaneUI",
- "EditorPaneUI", "MetalEditorPaneUI",
- "TreeUI", "MetalTreeUI",
- "LabelUI", "MetalLabelUI",
- "ListUI", "MetalListUI",
- "ToolBarUI", "MetalToolBarUI",
- "ToolTipUI", "MetalToolTipUI",
- "ComboBoxUI", "MetalComboBoxUI",
- "TableUI", "MetalTableUI",
- "TableHeaderUI", "MetalTableHeaderUI",
- "InternalFrameUI", "GtkInternalFrameUI",
- "StandardDialogUI", "GtkStandardDialogUI",
- "DesktopPaneUI", "GtkDesktopPaneUI",
- "DesktopIconUI", "GtkDesktopIconUI",
- "DirectoryPaneUI", "GtkDirectoryPaneUI",
- "FileChooserUI", "GtkFileChooserUI",
- "OptionPaneUI", "GtkOptionPaneUI" }
- */
- table.putDefaults(defaults);
-
- }
-
- protected void initSystemColorDefaults(UIDefaults table)
- {
- String[] colors = {
- "desktop", "#000000",
- "activeCaption", "#163555",
- "activeCaptionText", "#FFFFFF",
- "activeCaptionBorder", "#000000",
- "inactiveCaption", "#375676",
- "inactiveCaptionText", "#999999",
- "inactiveCaptionBorder", "#000000",
- "window", "#FFFFFF",
- "windowBorder", "#969696",
- "windowText", "#000000",
- "menu", "#d6d6d6",
- "menuText", "#000000",
- "text", "#FFFFFF",
- "textText", "#000000",
- "textHighlight", "#00009c",
- "textHighlightText", "#FFFFFF",
- "textInactiveText", "#999999",
- "control", "#d6d6d6",
- "controlText", "#000000",
- "controlHighlight", "#eaeaea",
- "controlLtHighlight", "#eaeaea",
- "controlShadow", "#c3c3c3",
- "controlDkShadow", "#888888",
- "scrollbar", "#c3c3c3",
- "info", "#d6d6d6",
- "infoText", "#000000"
- };
-
- loadSystemColors(table, colors, false);
- }
-
- protected void initComponentDefaults(UIDefaults table)
- {
- super.initComponentDefaults(table);
-
- // define common resources
- // fonts
- FontUIResource sansSerifPlain10 =
- new FontUIResource("SansSerif", Font.PLAIN, 10);
- FontUIResource serifPlain10 =
- new FontUIResource("Serif", Font.PLAIN, 10);
- // insets
- // borders
- // colors
- ColorUIResource controlDkShadow = new ColorUIResource(table.getColor("controlDkShadow"));
- ColorUIResource controlShadow = new ColorUIResource(table.getColor("controlShadow"));
- ColorUIResource control = new ColorUIResource(table.getColor("control"));
- ColorUIResource scrollbar = new ColorUIResource(table.getColor("scrollbar"));
- ColorUIResource controlHighlight = new ColorUIResource(table.getColor("controlHighlight"));
- if (scrollbar == null)
- System.out.println("scrollbar is null");
-
- ColorUIResource white = new ColorUIResource(Color.white);
- ColorUIResource black = new ColorUIResource(Color.black);
- ColorUIResource blue = new ColorUIResource(Color.blue);
-
- // icons
- Object errorIcon = LookAndFeel.makeIcon(getClass(), "icons/error.gif");
- // any other resources like dimensions and integer values
-
- // define defaults
- Object[] defaults =
- {
- "Button.font", sansSerifPlain10,
- "CheckBox.font", sansSerifPlain10,
- "RadioButton.pressed", black,
- "Slider.focus", blue,
- "Slider.foreground", control,
- "Slider.highlight", controlHighlight,
- "Slider.shadow", controlShadow,
- "Slider.background", controlDkShadow
-
-// "Slider.background", "#888888",
-// "Slider.focus", "#c3c3c3",
-// "Slider.foreground", "#d6d6d6",
-// "Slider.highlight", "#ffffff",
-// "Slider.shadow", "#000000"
-
-
- };
-
- table.putDefaults(defaults);
- }
-}
diff --git a/libjava/classpath/gnu/javax/swing/plaf/gtk/GtkRadioButtonUI.java b/libjava/classpath/gnu/javax/swing/plaf/gtk/GtkRadioButtonUI.java
deleted file mode 100644
index 19d5338..0000000
--- a/libjava/classpath/gnu/javax/swing/plaf/gtk/GtkRadioButtonUI.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* GtkRadioButtonUI.java
- Copyright (c) 1999 by Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.javax.swing.plaf.gtk;
-
-import java.awt.*;
-import javax.swing.*;
-import javax.swing.plaf.*;
-import javax.swing.plaf.basic.*;
-
-/**
- *
- * @author Brian Jones
- * @see javax.swing.LookAndFeel
- */
-public class GtkRadioButtonUI extends BasicRadioButtonUI
-{
- public GtkRadioButtonUI()
- {
- super();
- }
-
- public static ComponentUI createUI(JComponent c)
- {
- return new GtkRadioButtonUI();
- }
-
- public String getPropertyPrefix()
- {
- // FIXME
- System.err.println(super.getPropertyPrefix());
- return super.getPropertyPrefix();
- }
-}
-
diff --git a/libjava/classpath/gnu/javax/swing/plaf/gtk/GtkSliderUI.java b/libjava/classpath/gnu/javax/swing/plaf/gtk/GtkSliderUI.java
deleted file mode 100644
index c576b3d..0000000
--- a/libjava/classpath/gnu/javax/swing/plaf/gtk/GtkSliderUI.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/* GtkSliderUI.java
- Copyright (c) 1999 by Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.javax.swing.plaf.gtk;
-import java.awt.*;
-import javax.swing.*;
-import javax.swing.plaf.*;
-import javax.swing.plaf.basic.*;
-
-/**
- * Gtk-like slider
- *
- * @author Brian Jones
- * @see javax.swing.LookAndFeel
- */
-public class GtkSliderUI extends BasicSliderUI
-{
- private static Color thumbFgColor;
- private static Color thumbBgColor;
- private static Color thumbHighlight;
- private static Color thumbFocus;
-
- private static Color bgColor;
- private static Color fgColor;
- private static Color focusColor;
- private static Color highlight;
- private static Color shadow;
-
- private static final Dimension PREF_HORIZ = new Dimension(250, 15);
- private static final Dimension PREF_VERT = new Dimension(15, 250);
- private static final Dimension MIN_HORIZ = new Dimension(25, 15);
- private static final Dimension MIN_VERT = new Dimension(15, 25);
-
- public GtkSliderUI()
- {
- super(null);
- bgColor = UIManager.getColor("Slider.background");
- fgColor = UIManager.getColor("Slider.foreground");
- focusColor = UIManager.getColor("Slider.focus");
- highlight = UIManager.getColor("Slider.highlight");
- shadow = UIManager.getColor("Slider.shadow");
-
- System.out.println("bgColor: " + bgColor);
- System.out.println("fgColor: " + fgColor);
- System.out.println("focusColor: " + focusColor);
- System.out.println("highlight: " + highlight);
- System.out.println("shadow: " + shadow);
- }
-
- public static ComponentUI createUI(JComponent c)
- {
- return new GtkSliderUI();
- }
-
- // methods not overridden here, using Basic defaults
- // installUI()
- // uninstall()
-
- public Dimension getPreferredHorizontalSize()
- {
- /*
- Dimension thumbSize = getThumbSize();
- Dimenstion labelSize = getLabelSize();
- // getTickLength()
- int width = thumbSize.width +
- getWidthOfWidestLabel
- */
- return PREF_HORIZ;
- }
-
- public Dimension getPreferredVerticalSize()
- {
- return PREF_VERT;
- }
-
- public Dimension getMinimumHorizontalSize()
- {
- return MIN_HORIZ;
- }
-
- public Dimension getMinimumVerticalSize()
- {
- return MIN_VERT;
- }
-
- /**
- * Returns thumb size based on slider orientation
- */
- protected Dimension getThumbSize()
- {
- Dimension size = new Dimension();
-
- if (slider.getOrientation() == JSlider.VERTICAL) {
- size.width = 15;
- size.height = 33;
- }
- else {
- size.width = 33;
- size.height = 15;
- }
- return size;
- }
-
- /**
- * Reserved width or height for ticks, as appropriate to the slider
- * orientation.
- */
- protected int getTickLength()
- {
- return 10;
- }
-
- public void paintFocus(Graphics g)
- {
- super.paintFocus(g);
- System.err.println("focus " + focusRect);
- }
-
- /**
- * Must account for Unicode when drawing text.
- */
- public void paintLabels(Graphics g)
- {
- super.paintLabels(g);
- System.err.println("label " + labelRect);
- }
-
- /**
- * A drawRect() generated slider has ghosting when moving left on
- * a horizontal slider and the bottom is not painted when moving
- * right.
- */
- public void paintThumb(Graphics g)
- {
- int x = thumbRect.x;
- int y = thumbRect.y;
- int h = thumbRect.height;
- int w = thumbRect.width;
-
-// "Slider.background", "#888888",
-// "Slider.focus", "#c3c3c3",
-// "Slider.foreground", "#d6d6d6",
-// "Slider.highlight", "#ffffff",
-// "Slider.shadow", "#000000"
-
- g.setColor(fgColor);
- g.fillRect(x,y,w,h);
- g.setColor(bgColor);
-
- if (slider.getOrientation() == JSlider.HORIZONTAL) {
- g.drawRect(x, y, w, h);
- g.setColor(highlight);
- g.drawLine(x+1, y+h-1, x+w, y+h-1);
- g.setColor(focusColor);
- g.drawLine(x+2, y+h-2, x+w, y+h-2);
- g.setColor(Color.black);
- g.drawLine(x+1, y+h-2, x+1, y+h-2);
- g.drawRect(x+1, y+1, w-1, 12);
- }
- else
- g.drawRect(x, y, w, h);
-
- System.err.println("thumb " + thumbRect);
- }
-
- // public void paintTicks(Graphics g)
-
- public void paintTrack(Graphics g)
- {
-// super.paintTrack(g);
- int x = trackRect.x;
- int y = trackRect.y;
- int h = trackRect.height;
- int w = trackRect.width;
-
- System.err.println("track " + trackRect);
-
- g.setColor(Color.black);
- g.fillRect(x,y,w,h);
-
-// if (slider.getOrientation() == JSlider.HORIZONTAL)
-// g.drawLine(x, y+h-1, x+w-1, y+h-1);
-// else
-// g.drawLine(x+w-1, y, x+w-1, y+h-1);
-
-// System.err.println("track " + trackRect);
-// System.err.println("content " + contentRect);
- }
-
- // the four methods below allow you to control tick painting without
- // worrying about what paintTicks does, look for in other UI delegates
- // protected void paintMajorTickForHorizSlider(Graphics g, Rectangle tickBounds, int x)
- // protected void paintMajorTickForVertSlider(Graphics g, Rectangle tickBounds, int y)
- // protected void paintMinorTickForHorizSlider(Graphics g, Rectangle tickBounds, int x)
- // protected void paintMinorTickForVertSlider(Graphics g, Rectangle tickBounds, int y)
-}
diff --git a/libjava/classpath/gnu/javax/swing/plaf/gtk/README b/libjava/classpath/gnu/javax/swing/plaf/gtk/README
deleted file mode 100644
index 2b3f001..0000000
--- a/libjava/classpath/gnu/javax/swing/plaf/gtk/README
+++ /dev/null
@@ -1,37 +0,0 @@
-This is a start at a GTK look and feel for Java.
-It is usable already, but it mainly just defaults back to Basic Look and
-Feel for everything.
-
-Sliders are currently broken. I haven't figured out why yet.
-
-A bunch of system colors defined in GtkLookandFeel though I have a feeling
-I'll be defining more ColorUIResources shortly.
-
-Based on Gnome File Manager colors... or my Window Manager setup
-
-desktop #000000 (gtk)
-activeCaption #163555 (window manager)
-activeCaptionText #FFFFFF (window manager)
-activeCaptionBorder #000000 (unsure of this)
-inactiveCaption #375676 (window manager)
-inactiveCaptionText #999999 (window manager)
-inactiveCaptionBorder #000000 (unsure of this)
-window #FFFFFF (gtk)
-windowBorder #969696 (gtk)
-windowText #000000 (gtk)
-menu #d6d6d6 (gtk)
-menuText #000000 (gtk)
-text #FFFFFF (gtk)
-textText #000000 (gtk)
-textHighlight #00009c (gtk)
-textHighlightText #FFFFFF (gtk)
-textInactiveText #999999 (unsure of this)
-control #d6d6d6 (gtk)
-controlText #000000 (gtk)
-controlHighlight #eaeaea (gtk)
-controlLtHighlight #eaeaea (unsure of this)
-controlShadow #c3c3c3 (gtk)
-controlDkShadow #888888 (unsure of this)
-scrollbar #c3c3c3 (gtk)
-info #d6d6d6 (gtk)
-infoText #000000 (gtk)
diff --git a/libjava/classpath/gnu/javax/swing/plaf/gtk/SliderTest.java b/libjava/classpath/gnu/javax/swing/plaf/gtk/SliderTest.java
deleted file mode 100644
index a838444..0000000
--- a/libjava/classpath/gnu/javax/swing/plaf/gtk/SliderTest.java
+++ /dev/null
@@ -1,82 +0,0 @@
-import javax.swing.*;
-import javax.swing.event.*;
-import java.awt.*;
-import java.awt.event.*;
-import gnu.javax.swing.plaf.gtk.*;
-
-public class SliderTest extends JFrame
-{
- public SliderTest()
- {
- super("JSlider Test");
- Container c = getContentPane();
- c.setLayout(new BorderLayout());
- this.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) { System.exit(0); }
- });
-
- JSlider s = new JSlider();
- s.createStandardLabels(10);
- s.setMinorTickSpacing(10);
- s.setMajorTickSpacing(20);
- s.setPaintTicks(true);
- s.setPaintTrack(true);
- s.setPaintLabels(true);
- s.setRequestFocusEnabled(true);
-
- // turning off double buffering in repaint manager
- // in order to use debug graphics
- RepaintManager repaintManager = RepaintManager.currentManager(s);
- repaintManager.setDoubleBufferingEnabled(false);
-
- s.setDebugGraphicsOptions(DebugGraphics.BUFFERED_OPTION | DebugGraphics.FLASH_OPTION);
- DebugGraphics.setFlashColor(Color.red); // color of flash
- DebugGraphics.setFlashTime(4); // time delay of drawing operation flashing
- DebugGraphics.setFlashCount(3); // number of time to draw
-
- this.setSize(250, 100);
- c.add(new JLabel("Default Slider"), "North");
- c.add(s, "Center");
-
- try {
- UIManager.setLookAndFeel("gnu.javax.swing.plaf.gtk.GtkLookAndFeel");
- SwingUtilities.updateComponentTreeUI(this);
- } catch (Exception e) {
- e.printStackTrace();
- System.exit(0);
- }
-
- center();
- }
-
- public void actionPerformed(ActionEvent e) {
- System.exit(0);
- }
-
- public void center()
- {
- // Centering the frame
- Toolkit t = this.getToolkit();
- Dimension framesize = this.getSize();
- Dimension screensize = t.getScreenSize();
-
- // Calculate point for frame (main)
- Point pframe = new Point();
- pframe.x = (screensize.width - framesize.width) / 2;
- pframe.y = (screensize.height - framesize.height) / 2;
-
- // Set the location of each to be centered
- this.setLocation(pframe);
- }
-
- public static void main(String [] argv)
- {
- SliderTest t = new SliderTest();
- t.show();
- }
-
-}
-
-
-
-
diff --git a/libjava/classpath/gnu/xml/xpath/ArithmeticExpr.java b/libjava/classpath/gnu/xml/xpath/ArithmeticExpr.java
index 3cef4ad..cbc1ee0 100644
--- a/libjava/classpath/gnu/xml/xpath/ArithmeticExpr.java
+++ b/libjava/classpath/gnu/xml/xpath/ArithmeticExpr.java
@@ -95,17 +95,31 @@ final class ArithmeticExpr
case DIVIDE:
if (rn == 0.0d || rn == -0.0d)
{
- return new Double(ln < 0.0d ?
- Double.NEGATIVE_INFINITY :
- Double.POSITIVE_INFINITY);
+ if (ln == 0.0d || ln == -0.0d)
+ {
+ return new Double(Double.NaN);
+ }
+ else
+ {
+ return new Double(ln < 0.0d ?
+ Double.NEGATIVE_INFINITY :
+ Double.POSITIVE_INFINITY);
+ }
}
return new Double(ln / rn);
case MODULO:
- if (rn == 0.0d || rn == -0.0d)
+ if (rn == 0.0d || rn == 0.0d)
{
- return new Double(ln < 0.0d ?
- Double.NEGATIVE_INFINITY :
- Double.POSITIVE_INFINITY);
+ if (ln == 0.0d || ln == -0.0d)
+ {
+ return new Double(Double.NaN);
+ }
+ else
+ {
+ return new Double(ln < 0.0d ?
+ Double.NEGATIVE_INFINITY :
+ Double.POSITIVE_INFINITY);
+ }
}
return new Double(ln % rn);
default:
diff --git a/libjava/classpath/gnu/xml/xpath/XPathParser.java b/libjava/classpath/gnu/xml/xpath/XPathParser.java
index 624dcd8..03066fb 100644
--- a/libjava/classpath/gnu/xml/xpath/XPathParser.java
+++ b/libjava/classpath/gnu/xml/xpath/XPathParser.java
@@ -1,43 +1,43 @@
// created by jay 0.8 (c) 1998 Axel.Schreiner@informatik.uni-osnabrueck.de
// line 2 "XPathParser.y"
-/*
- * XPathParser.java
- * Copyright (C) 2004 The Free Software Foundation
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP 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 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP 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 this program; 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
- * obliged to do so. If you do not wish to do so, delete this
- * exception statement from your version.
- */
+/* XPathParser.y - An XPath 1.0 parser.
+ Copyright (C) 2004 The 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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
package gnu.xml.xpath;
diff --git a/libjava/classpath/gnu/xml/xpath/XPathParser.y b/libjava/classpath/gnu/xml/xpath/XPathParser.y
index d7dc4f1..5501513 100644
--- a/libjava/classpath/gnu/xml/xpath/XPathParser.y
+++ b/libjava/classpath/gnu/xml/xpath/XPathParser.y
@@ -1,41 +1,41 @@
%{
-/*
- * XPathParser.java
- * Copyright (C) 2004 The Free Software Foundation
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP 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 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP 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 this program; 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
- * obliged to do so. If you do not wish to do so, delete this
- * exception statement from your version.
- */
+/* XPathParser.y - An XPath 1.0 parser.
+ Copyright (C) 2004 The 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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
package gnu.xml.xpath;
diff --git a/libjava/classpath/include/Makefile.am b/libjava/classpath/include/Makefile.am
index 7b698e6..a65ac5e 100644
--- a/libjava/classpath/include/Makefile.am
+++ b/libjava/classpath/include/Makefile.am
@@ -1,3 +1,5 @@
+include_HEADERS = jni.h jni_md.h jawt.h jawt_md.h
+
DISTCLEANFILES = jni_md.h
ARG_JNI_JAVAH = -jni
@@ -57,15 +59,55 @@ $(top_srcdir)/include/gnu_java_awt_peer_gtk_GtkPanelPeer.h \
$(top_srcdir)/include/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.h \
$(top_srcdir)/include/gnu_java_awt_peer_gtk_GtkScrollPanePeer.h \
$(top_srcdir)/include/gnu_java_awt_peer_gtk_GtkScrollbarPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_gtk_GtkSelection.h \
$(top_srcdir)/include/gnu_java_awt_peer_gtk_GtkTextAreaPeer.h \
$(top_srcdir)/include/gnu_java_awt_peer_gtk_GtkTextFieldPeer.h \
$(top_srcdir)/include/gnu_java_awt_peer_gtk_GtkToolkit.h \
$(top_srcdir)/include/gnu_java_awt_peer_gtk_GtkWindowPeer.h \
$(top_srcdir)/include/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.h
+QTPEER_H_FILES = \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtCheckboxPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtToolkit.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtAudioClip.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtScreenDevice.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtTextFieldPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtMenuItemPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtButtonPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtWindowPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtDialogPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtImage.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtMenuBarPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtVolatileImage.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtFontPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtChoicePeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtGraphics.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtComponentPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtMenuPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtTextAreaPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QPen.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtPanelPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QPainterPath.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtFontMetrics.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtScrollPanePeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtGraphicsEnvironment.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QMatrix.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtLabelPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtPopupMenuPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtFramePeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtListPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtScrollbarPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtCanvasPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtMenuComponentPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_MainQtThread.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtFileDialogPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtContainerPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtEmbeddedWindowPeer.h
+
H_FILES = \
$(XMLJ_H_FILES) \
$(GTKPEER_H_FILES) \
+$(QTPEER_H_FILES) \
$(top_srcdir)/include/gnu_java_net_PlainDatagramSocketImpl.h \
$(top_srcdir)/include/gnu_java_net_PlainSocketImpl.h \
$(top_srcdir)/include/gnu_java_nio_VMPipe.h \
@@ -104,6 +146,9 @@ $(top_srcdir)/include/gnu_xml_libxmlj_transform_%.h: $(top_builddir)/lib/gnu/xml
$(top_srcdir)/include/gnu_java_awt_peer_gtk_%.h: $(top_builddir)/lib/gnu/java/awt/peer/gtk/%.class
$(JAVAH) -o $@ gnu.java.awt.peer.gtk.$*
+$(top_srcdir)/include/gnu_java_awt_peer_qt_%.h: $(top_builddir)/lib/gnu/java/awt/peer/qt/%.class
+ $(JAVAH) -o $@ gnu.java.awt.peer.qt.$*
+
$(top_srcdir)/include/gnu_java_net_PlainDatagramSocketImpl.h: $(top_srcdir)/gnu/java/net/PlainDatagramSocketImpl.java
$(JAVAH) -o $@ gnu.java.net.PlainDatagramSocketImpl
$(top_srcdir)/include/gnu_java_net_PlainSocketImpl.h: $(top_srcdir)/gnu/java/net/PlainSocketImpl.java
diff --git a/libjava/classpath/include/Makefile.in b/libjava/classpath/include/Makefile.in
index 384107c..a6b7313 100644
--- a/libjava/classpath/include/Makefile.in
+++ b/libjava/classpath/include/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -13,6 +13,7 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
+
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
@@ -37,8 +38,8 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = include
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(srcdir)/config.h.in
+DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/config.h.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
@@ -52,6 +53,17 @@ CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(includedir)"
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(include_HEADERS)
+ETAGS = etags
+CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
@@ -83,8 +95,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -146,6 +164,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -157,12 +176,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -184,10 +204,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -227,6 +250,7 @@ target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
+include_HEADERS = jni.h jni_md.h jawt.h jawt_md.h
DISTCLEANFILES = jni_md.h
ARG_JNI_JAVAH = -jni
ARG_CLASSPATH_JAVAH = -bootclasspath
@@ -284,15 +308,55 @@ $(top_srcdir)/include/gnu_java_awt_peer_gtk_GtkPanelPeer.h \
$(top_srcdir)/include/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.h \
$(top_srcdir)/include/gnu_java_awt_peer_gtk_GtkScrollPanePeer.h \
$(top_srcdir)/include/gnu_java_awt_peer_gtk_GtkScrollbarPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_gtk_GtkSelection.h \
$(top_srcdir)/include/gnu_java_awt_peer_gtk_GtkTextAreaPeer.h \
$(top_srcdir)/include/gnu_java_awt_peer_gtk_GtkTextFieldPeer.h \
$(top_srcdir)/include/gnu_java_awt_peer_gtk_GtkToolkit.h \
$(top_srcdir)/include/gnu_java_awt_peer_gtk_GtkWindowPeer.h \
$(top_srcdir)/include/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.h
+QTPEER_H_FILES = \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtCheckboxPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtToolkit.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtAudioClip.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtScreenDevice.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtTextFieldPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtMenuItemPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtButtonPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtWindowPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtDialogPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtImage.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtMenuBarPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtVolatileImage.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtFontPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtChoicePeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtGraphics.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtComponentPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtMenuPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtTextAreaPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QPen.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtPanelPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QPainterPath.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtFontMetrics.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtScrollPanePeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtGraphicsEnvironment.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QMatrix.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtLabelPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtPopupMenuPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtFramePeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtListPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtScrollbarPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtCanvasPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtMenuComponentPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_MainQtThread.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtFileDialogPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtContainerPeer.h \
+$(top_srcdir)/include/gnu_java_awt_peer_qt_QtEmbeddedWindowPeer.h
+
H_FILES = \
$(XMLJ_H_FILES) \
$(GTKPEER_H_FILES) \
+$(QTPEER_H_FILES) \
$(top_srcdir)/include/gnu_java_net_PlainDatagramSocketImpl.h \
$(top_srcdir)/include/gnu_java_net_PlainSocketImpl.h \
$(top_srcdir)/include/gnu_java_nio_VMPipe.h \
@@ -375,12 +439,71 @@ clean-libtool:
distclean-libtool:
-rm -f libtool
uninstall-info-am:
+install-includeHEADERS: $(include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)"
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+ $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+uninstall-includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
tags: TAGS
-TAGS:
+TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
ctags: CTAGS
-CTAGS:
-
+CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
@@ -412,8 +535,11 @@ distdir: $(DISTFILES)
check-am: all-am
check: check-am
@CREATE_JNI_HEADERS_FALSE@all-local:
-all-am: Makefile config.h all-local
+all-am: Makefile $(HEADERS) config.h all-local
installdirs:
+ for dir in "$(DESTDIR)$(includedir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
@@ -446,7 +572,7 @@ clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr \
- distclean-libtool
+ distclean-libtool distclean-tags
dvi: dvi-am
@@ -458,7 +584,7 @@ info: info-am
info-am:
-install-data-am:
+install-data-am: install-includeHEADERS
install-exec-am:
@@ -484,17 +610,19 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-info-am
+uninstall-am: uninstall-includeHEADERS uninstall-info-am
-.PHONY: all all-am all-local check check-am clean clean-generic \
- clean-libtool distclean distclean-generic distclean-hdr \
- distclean-libtool distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-exec \
- install-exec-am install-info install-info-am install-man \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- uninstall uninstall-am uninstall-info-am
+.PHONY: CTAGS GTAGS all all-am all-local check check-am clean \
+ clean-generic clean-libtool ctags distclean distclean-generic \
+ distclean-hdr distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-includeHEADERS install-info install-info-am \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am tags uninstall uninstall-am uninstall-includeHEADERS \
+ uninstall-info-am
@CREATE_JNI_HEADERS_TRUE@all-local: $(H_FILES)
@@ -511,6 +639,9 @@ uninstall-am: uninstall-info-am
@CREATE_JNI_HEADERS_TRUE@$(top_srcdir)/include/gnu_java_awt_peer_gtk_%.h: $(top_builddir)/lib/gnu/java/awt/peer/gtk/%.class
@CREATE_JNI_HEADERS_TRUE@ $(JAVAH) -o $@ gnu.java.awt.peer.gtk.$*
+@CREATE_JNI_HEADERS_TRUE@$(top_srcdir)/include/gnu_java_awt_peer_qt_%.h: $(top_builddir)/lib/gnu/java/awt/peer/qt/%.class
+@CREATE_JNI_HEADERS_TRUE@ $(JAVAH) -o $@ gnu.java.awt.peer.qt.$*
+
@CREATE_JNI_HEADERS_TRUE@$(top_srcdir)/include/gnu_java_net_PlainDatagramSocketImpl.h: $(top_srcdir)/gnu/java/net/PlainDatagramSocketImpl.java
@CREATE_JNI_HEADERS_TRUE@ $(JAVAH) -o $@ gnu.java.net.PlainDatagramSocketImpl
@CREATE_JNI_HEADERS_TRUE@$(top_srcdir)/include/gnu_java_net_PlainSocketImpl.h: $(top_srcdir)/gnu/java/net/PlainSocketImpl.java
diff --git a/libjava/classpath/include/config.h.in b/libjava/classpath/include/config.h.in
index bebef37..ab5e109 100644
--- a/libjava/classpath/include/config.h.in
+++ b/libjava/classpath/include/config.h.in
@@ -54,6 +54,9 @@
/* Define to 1 if you have the `gethostname' function. */
#undef HAVE_GETHOSTNAME
+/* Define to 1 if you have the `getpagesize' function. */
+#undef HAVE_GETPAGESIZE
+
/* Define to 1 if you have the `getpeername' function. */
#undef HAVE_GETPEERNAME
@@ -87,15 +90,30 @@
/* Define to 1 if you have the `lseek' function. */
#undef HAVE_LSEEK
+/* Define to 1 if you have the `madvise' function. */
+#undef HAVE_MADVISE
+
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET
+/* Define to 1 if you have the `mincore' function. */
+#undef HAVE_MINCORE
+
/* Define to 1 if you have the `mktime' function. */
#undef HAVE_MKTIME
+/* Define to 1 if you have the `mmap' function. */
+#undef HAVE_MMAP
+
+/* Define to 1 if you have the `msync' function. */
+#undef HAVE_MSYNC
+
+/* Define to 1 if you have the `munmap' function. */
+#undef HAVE_MUNMAP
+
/* Define to 1 if you have the `open' function. */
#undef HAVE_OPEN
@@ -144,6 +162,9 @@
/* Define to 1 if `tm_zone' is member of `struct tm'. */
#undef HAVE_STRUCT_TM_TM_ZONE
+/* Define to 1 if you have the `sysconf' function. */
+#undef HAVE_SYSCONF
+
/* Define to 1 if you have the <sys/config.h> header file. */
#undef HAVE_SYS_CONFIG_H
@@ -153,6 +174,9 @@
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
+/* Define to 1 if you have the <sys/mman.h> header file. */
+#undef HAVE_SYS_MMAN_H
+
/* Define to 1 if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkGraphics.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkGraphics.h
index aa2a298..427f091 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkGraphics.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkGraphics.h
@@ -10,7 +10,9 @@ extern "C"
{
#endif
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initStaticState (JNIEnv *env, jclass);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2 (JNIEnv *env, jobject, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initStateUnlocked (JNIEnv *env, jobject, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__II (JNIEnv *env, jobject, jint, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initFromImage (JNIEnv *env, jobject, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_copyState (JNIEnv *env, jobject, jobject);
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkGraphics2D.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkGraphics2D.h
index 0f9d04f..2d29cfc 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkGraphics2D.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkGraphics2D.h
@@ -11,28 +11,39 @@ extern "C"
#endif
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initStaticState (JNIEnv *env, jclass);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initStateUnlocked (JNIEnv *env, jobject, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2 (JNIEnv *env, jobject, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState__II (JNIEnv *env, jobject, jint, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState___3III (JNIEnv *env, jobject, jintArray, jint, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_copyState (JNIEnv *env, jobject, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_dispose (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilter (JNIEnv *env, jobject, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilterUnlocked (JNIEnv *env, jobject, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_connectSignals (JNIEnv *env, jobject, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable (JNIEnv *env, jobject, jobject, jint, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_drawPixels (JNIEnv *env, jobject, jintArray, jint, jint, jint, jdoubleArray);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixelsUnlocked (JNIEnv *env, jobject, jintArray, jint, jint, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixels (JNIEnv *env, jobject, jintArray, jint, jint, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setGradient (JNIEnv *env, jobject, jdouble, jdouble, jdouble, jdouble, jint, jint, jint, jint, jint, jint, jint, jint, jboolean);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setGradientUnlocked (JNIEnv *env, jobject, jdouble, jdouble, jdouble, jdouble, jint, jint, jint, jint, jint, jint, jint, jint, jboolean);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSave (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRestore (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrix (JNIEnv *env, jobject, jdoubleArray);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrixUnlocked (JNIEnv *env, jobject, jdoubleArray);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetOperator (JNIEnv *env, jobject, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBAColor (JNIEnv *env, jobject, jdouble, jdouble, jdouble, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBAColorUnlocked (JNIEnv *env, jobject, jdouble, jdouble, jdouble, jdouble);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetFillRule (JNIEnv *env, jobject, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineWidth (JNIEnv *env, jobject, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineWidthUnlocked (JNIEnv *env, jobject, jdouble);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineCap (JNIEnv *env, jobject, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineCapUnlocked (JNIEnv *env, jobject, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineJoin (JNIEnv *env, jobject, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineJoinUnlocked (JNIEnv *env, jobject, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetDash (JNIEnv *env, jobject, jdoubleArray, jint, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetDashUnlocked (JNIEnv *env, jobject, jdoubleArray, jint, jdouble);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMiterLimit (JNIEnv *env, jobject, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMiterLimitUnlocked (JNIEnv *env, jobject, jdouble);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoNewPath (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoMoveTo (JNIEnv *env, jobject, jdouble, jdouble);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoLineTo (JNIEnv *env, jobject, jdouble, jdouble);
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkButtonPeer.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkButtonPeer.h
index 06dad77..9601e83 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkButtonPeer.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkButtonPeer.h
@@ -19,6 +19,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetSetBack
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkActivate (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetRequestFocus (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkButtonPeer_setNativeBounds (JNIEnv *env, jobject, jint, jint, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetGetPreferredDimensions (JNIEnv *env, jobject, jintArray);
#ifdef __cplusplus
}
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkChoicePeer.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkChoicePeer.h
index 5ca5aea..1d92ed6 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkChoicePeer.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkChoicePeer.h
@@ -17,7 +17,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkChoicePeer_nativeAdd (JNIEn
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkChoicePeer_nativeRemove (JNIEnv *env, jobject, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkChoicePeer_nativeRemoveAll (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkChoicePeer_connectSignals (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkChoicePeer_select (JNIEnv *env, jobject, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkChoicePeer_selectNative (JNIEnv *env, jobject, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkChoicePeer_selectNativeUnlocked (JNIEnv *env, jobject, jint);
#ifdef __cplusplus
}
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkClipboard.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkClipboard.h
index 709a6c0..6c76ed8 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkClipboard.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkClipboard.h
@@ -10,11 +10,8 @@ extern "C"
{
#endif
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkClipboard_initNativeState (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkClipboard_requestStringConversion (JNIEnv *env, jclass);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkClipboard_selectionGet (JNIEnv *env, jclass);
-#undef gnu_java_awt_peer_gtk_GtkClipboard_SELECTION_RECEIVED_TIMEOUT
-#define gnu_java_awt_peer_gtk_GtkClipboard_SELECTION_RECEIVED_TIMEOUT 5000L
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkClipboard_advertiseContent (JNIEnv *env, jobject, jobjectArray, jboolean, jboolean, jboolean);
+JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_gtk_GtkClipboard_initNativeState (JNIEnv *env, jclass, jstring, jstring, jstring);
#ifdef __cplusplus
}
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkComponentPeer.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkComponentPeer.h
index ea0e822..2c32e3f 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkComponentPeer.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkComponentPeer.h
@@ -18,6 +18,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetD
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetPreferredDimensions (JNIEnv *env, jobject, jintArray);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetLocationOnScreen (JNIEnv *env, jobject, jintArray);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursor (JNIEnv *env, jobject, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursorUnlocked (JNIEnv *env, jobject, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetBackground (JNIEnv *env, jobject, jint, jint, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetForeground (JNIEnv *env, jobject, jint, jint, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetSensitive (JNIEnv *env, jobject, jboolean);
@@ -28,8 +29,8 @@ JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_isRealize
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setNativeEventMask (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectSignals (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setNativeBounds (JNIEnv *env, jobject, jint, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_hide (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_show (JNIEnv *env, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setVisibleNative (JNIEnv *env, jobject, jboolean);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setVisibleNativeUnlocked (JNIEnv *env, jobject, jboolean);
#ifdef __cplusplus
}
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkFileDialogPeer.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkFileDialogPeer.h
index 3a2a413..340fcc3 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkFileDialogPeer.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkFileDialogPeer.h
@@ -10,7 +10,7 @@ extern "C"
{
#endif
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_create (JNIEnv *env, jobject, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_create (JNIEnv *env, jobject, jobject, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_connectSignals (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetFile (JNIEnv *env, jobject, jstring);
JNIEXPORT jstring JNICALL Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeGetDirectory (JNIEnv *env, jobject);
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkFramePeer.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkFramePeer.h
index f383131..2095d42 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkFramePeer.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkFramePeer.h
@@ -11,6 +11,7 @@ extern "C"
#endif
JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_GtkFramePeer_getMenuBarHeight (JNIEnv *env, jobject, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarWidthUnlocked (JNIEnv *env, jobject, jobject, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarWidth (JNIEnv *env, jobject, jobject, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarPeer (JNIEnv *env, jobject, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkFramePeer_removeMenuBarPeer (JNIEnv *env, jobject);
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkImage.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkImage.h
index 7aa1827..48940a1 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkImage.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkImage.h
@@ -13,11 +13,13 @@ extern "C"
JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GtkImage_getPixels (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkImage_setPixels (JNIEnv *env, jobject, jintArray);
JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_gtk_GtkImage_loadPixbuf (JNIEnv *env, jobject, jstring);
+JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_gtk_GtkImage_loadImageFromData (JNIEnv *env, jobject, jbyteArray);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkImage_createPixmap (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkImage_freePixmap (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkImage_createScaledPixmap (JNIEnv *env, jobject, jobject, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkImage_drawPixelsScaled (JNIEnv *env, jobject, jobject, jint, jint, jint, jint, jint, jint, jint, jboolean);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkImage_drawPixelsScaledFlipped (JNIEnv *env, jobject, jobject, jint, jint, jint, jboolean, jboolean, jint, jint, jint, jint, jint, jint, jint, jint, jboolean);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkImage_createFromPixbuf (JNIEnv *env, jobject);
#ifdef __cplusplus
}
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkLabelPeer.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkLabelPeer.h
index cde8d93..4855090 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkLabelPeer.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkLabelPeer.h
@@ -15,6 +15,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkLabelPeer_gtkWidgetModifyFo
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkLabelPeer_nativeSetAlignment (JNIEnv *env, jobject, jfloat);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkLabelPeer_setText (JNIEnv *env, jobject, jstring);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkLabelPeer_setNativeBounds (JNIEnv *env, jobject, jint, jint, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkLabelPeer_gtkWidgetGetPreferredDimensions (JNIEnv *env, jobject, jintArray);
#ifdef __cplusplus
}
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkToolkit.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkToolkit.h
index 55febed..ffeb399 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkToolkit.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkToolkit.h
@@ -16,9 +16,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkToolkit_getScreenSizeDimens
JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_GtkToolkit_getScreenResolution (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkToolkit_sync (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkToolkit_loadSystemColors (JNIEnv *env, jobject, jintArray);
-JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_gtk_GtkToolkit_nativeQueueEmpty (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkToolkit_wakeNativeQueue (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkToolkit_iterateNativeQueue (JNIEnv *env, jobject, jobject, jboolean);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkMain (JNIEnv *env, jclass);
#ifdef __cplusplus
}
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkWindowPeer.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkWindowPeer.h
index 56fa79c..1d80f0a 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkWindowPeer.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkWindowPeer.h
@@ -15,13 +15,14 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowSetResi
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowSetModal (JNIEnv *env, jobject, jboolean);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_realize (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create (JNIEnv *env, jobject, jint, jboolean, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setVisibleNative (JNIEnv *env, jobject, jboolean);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setVisibleNativeUnlocked (JNIEnv *env, jobject, jboolean);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectSignals (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toBack (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toFront (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetBounds (JNIEnv *env, jobject, jint, jint, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetBoundsUnlocked (JNIEnv *env, jobject, jint, jint, jint, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setSize (JNIEnv *env, jobject, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setBoundsCallback (JNIEnv *env, jobject, jobject, jint, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetVisible (JNIEnv *env, jobject, jboolean);
#undef gnu_java_awt_peer_gtk_GtkWindowPeer_GDK_WINDOW_TYPE_HINT_NORMAL
#define gnu_java_awt_peer_gtk_GtkWindowPeer_GDK_WINDOW_TYPE_HINT_NORMAL 0L
#undef gnu_java_awt_peer_gtk_GtkWindowPeer_GDK_WINDOW_TYPE_HINT_DIALOG
diff --git a/libjava/classpath/include/java_nio_VMDirectByteBuffer.h b/libjava/classpath/include/java_nio_VMDirectByteBuffer.h
index 4c52a9a..3214d38 100644
--- a/libjava/classpath/include/java_nio_VMDirectByteBuffer.h
+++ b/libjava/classpath/include/java_nio_VMDirectByteBuffer.h
@@ -10,12 +10,12 @@ extern "C"
{
#endif
-JNIEXPORT void JNICALL Java_java_nio_VMDirectByteBuffer_init (JNIEnv *env, jclass);
JNIEXPORT jobject JNICALL Java_java_nio_VMDirectByteBuffer_allocate (JNIEnv *env, jclass, jint);
JNIEXPORT void JNICALL Java_java_nio_VMDirectByteBuffer_free (JNIEnv *env, jclass, jobject);
-JNIEXPORT jbyte JNICALL Java_java_nio_VMDirectByteBuffer_get__Lgnu_classpath_RawData_2I (JNIEnv *env, jclass, jobject, jint);
-JNIEXPORT void JNICALL Java_java_nio_VMDirectByteBuffer_get__Lgnu_classpath_RawData_2I_3BII (JNIEnv *env, jclass, jobject, jint, jbyteArray, jint, jint);
-JNIEXPORT void JNICALL Java_java_nio_VMDirectByteBuffer_put (JNIEnv *env, jclass, jobject, jint, jbyte);
+JNIEXPORT jbyte JNICALL Java_java_nio_VMDirectByteBuffer_get__Lgnu_classpath_Pointer_2I (JNIEnv *env, jclass, jobject, jint);
+JNIEXPORT void JNICALL Java_java_nio_VMDirectByteBuffer_get__Lgnu_classpath_Pointer_2I_3BII (JNIEnv *env, jclass, jobject, jint, jbyteArray, jint, jint);
+JNIEXPORT void JNICALL Java_java_nio_VMDirectByteBuffer_put__Lgnu_classpath_Pointer_2IB (JNIEnv *env, jclass, jobject, jint, jbyte);
+JNIEXPORT void JNICALL Java_java_nio_VMDirectByteBuffer_put__Lgnu_classpath_Pointer_2I_3BII (JNIEnv *env, jclass, jobject, jint, jbyteArray, jint, jint);
JNIEXPORT jobject JNICALL Java_java_nio_VMDirectByteBuffer_adjustAddress (JNIEnv *env, jclass, jobject, jint);
JNIEXPORT void JNICALL Java_java_nio_VMDirectByteBuffer_shiftDown (JNIEnv *env, jclass, jobject, jint, jint, jint);
diff --git a/libjava/classpath/java/awt/AWTKeyStroke.java b/libjava/classpath/java/awt/AWTKeyStroke.java
index c10d53e..0e06225 100644
--- a/libjava/classpath/java/awt/AWTKeyStroke.java
+++ b/libjava/classpath/java/awt/AWTKeyStroke.java
@@ -412,13 +412,25 @@ public class AWTKeyStroke implements Serializable
{
token = t.nextToken();
if ("shift".equals(token))
- modifiers |= KeyEvent.SHIFT_DOWN_MASK;
+ {
+ modifiers |= KeyEvent.SHIFT_MASK;
+ modifiers |= KeyEvent.SHIFT_DOWN_MASK;
+ }
else if ("ctrl".equals(token) || "control".equals(token))
- modifiers |= KeyEvent.CTRL_DOWN_MASK;
+ {
+ modifiers |= KeyEvent.CTRL_MASK;
+ modifiers |= KeyEvent.CTRL_DOWN_MASK;
+ }
else if ("meta".equals(token))
- modifiers |= KeyEvent.META_DOWN_MASK;
+ {
+ modifiers |= KeyEvent.META_MASK;
+ modifiers |= KeyEvent.META_DOWN_MASK;
+ }
else if ("alt".equals(token))
- modifiers |= KeyEvent.ALT_DOWN_MASK;
+ {
+ modifiers |= KeyEvent.ALT_MASK;
+ modifiers |= KeyEvent.ALT_DOWN_MASK;
+ }
else if ("button1".equals(token))
modifiers |= KeyEvent.BUTTON1_DOWN_MASK;
else if ("button2".equals(token))
diff --git a/libjava/classpath/java/awt/BorderLayout.java b/libjava/classpath/java/awt/BorderLayout.java
index c9eb5dd..adf2ebf 100644
--- a/libjava/classpath/java/awt/BorderLayout.java
+++ b/libjava/classpath/java/awt/BorderLayout.java
@@ -48,34 +48,30 @@ package java.awt;
public class BorderLayout implements LayoutManager2, java.io.Serializable
{
-/*
- * Static Variables
- */
-
-/**
- * Constant indicating the top of the container
- */
-public static final String NORTH = "North";
+ /**
+ * Constant indicating the top of the container
+ */
+ public static final String NORTH = "North";
-/**
- * Constant indicating the bottom of the container
- */
-public static final String SOUTH = "South";
+ /**
+ * Constant indicating the bottom of the container
+ */
+ public static final String SOUTH = "South";
-/**
- * Constant indicating the right side of the container
- */
-public static final String EAST = "East";
+ /**
+ * Constant indicating the right side of the container
+ */
+ public static final String EAST = "East";
-/**
- * Constant indicating the left side of the container
- */
-public static final String WEST = "West";
+ /**
+ * Constant indicating the left side of the container
+ */
+ public static final String WEST = "West";
-/**
- * Constant indicating the center of the container
- */
-public static final String CENTER = "Center";
+ /**
+ * Constant indicating the center of the container
+ */
+ public static final String CENTER = "Center";
/**
@@ -91,7 +87,6 @@ public static final String CENTER = "Center";
*/
public static final String BEFORE_FIRST_LINE = "First";
-
/**
* The constant indicating the position after the last line of the
* layout. The exact position depends on the writing system: For a
@@ -105,7 +100,6 @@ public static final String CENTER = "Center";
*/
public static final String AFTER_LAST_LINE = "Last";
-
/**
* The constant indicating the position before the first item of the
* layout. The exact position depends on the writing system: For a
@@ -119,7 +113,6 @@ public static final String CENTER = "Center";
*/
public static final String BEFORE_LINE_BEGINS = "Before";
-
/**
* The constant indicating the position after the last item of the
* layout. The exact position depends on the writing system: For a
@@ -133,7 +126,6 @@ public static final String CENTER = "Center";
*/
public static final String AFTER_LINE_ENDS = "After";
-
/**
* The constant indicating the position before the first line of the
* layout. The exact position depends on the writing system: For a
@@ -144,7 +136,6 @@ public static final String CENTER = "Center";
*/
public static final String PAGE_START = BEFORE_FIRST_LINE;
-
/**
* The constant indicating the position after the last line of the
* layout. The exact position depends on the writing system: For a
@@ -155,7 +146,6 @@ public static final String CENTER = "Center";
*/
public static final String PAGE_END = AFTER_LAST_LINE;
-
/**
* The constant indicating the position before the first item of the
* layout. The exact position depends on the writing system: For a
@@ -166,7 +156,6 @@ public static final String CENTER = "Center";
*/
public static final String LINE_START = BEFORE_LINE_BEGINS;
-
/**
* The constant indicating the position after the last item of the
* layout. The exact position depends on the writing system: For a
@@ -178,398 +167,341 @@ public static final String CENTER = "Center";
public static final String LINE_END = AFTER_LINE_ENDS;
+ /**
+ * Serialization constant.
+ */
+ private static final long serialVersionUID = -8658291919501921765L;
-// Serialization constant
-private static final long serialVersionUID = -8658291919501921765L;
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * @serial
- */
-private Component north;
-
-/**
- * @serial
- */
-private Component south;
-
-/**
- * @serial
- */
-private Component east;
-
-/**
- * @serial
- */
-private Component west;
-
-/**
- * @serial
- */
-private Component center;
-
-/**
- * @serial
- */
-private Component firstLine;
-
-/**
- * @serial
- */
-private Component lastLine;
-
-/**
- * @serial
- */
-private Component firstItem;
-
-/**
- * @serial
- */
-private Component lastItem;
-
-/**
- * @serial The horizontal gap between components
- */
-private int hgap;
-
-/**
- * @serial The vertical gap between components
- */
-private int vgap;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Initializes a new instance of <code>BorderLayout</code> with no
- * horiztonal or vertical gaps between components.
- */
-public
-BorderLayout()
-{
- this(0,0);
-}
-/*************************************************************************/
+ /**
+ * @serial
+ */
+ private Component north;
-/**
- * Initializes a new instance of <code>BorderLayout</code> with the
- * specified horiztonal and vertical gaps between components.
- *
- * @param hgap The horizontal gap between components.
- * @param vgap The vertical gap between components.
- */
-public
-BorderLayout(int hgap, int vgap)
-{
- this.hgap = hgap;
- this.vgap = vgap;
-}
+ /**
+ * @serial
+ */
+ private Component south;
-/*************************************************************************/
+ /**
+ * @serial
+ */
+ private Component east;
-/*
- * Instance Variables
- */
+ /**
+ * @serial
+ */
+ private Component west;
-/**
- * Returns the horitzontal gap value.
- *
- * @return The horitzontal gap value.
+ /**
+ * @serial
*/
-public int
-getHgap()
-{
- return(hgap);
-}
+ private Component center;
-/*************************************************************************/
-
-/**
- * Sets the horizontal gap to the specified value.
- *
- * @param hgap The new horizontal gap.
- */
-public void
-setHgap(int hgap)
-{
- this.hgap = hgap;
-}
-
-/*************************************************************************/
-
-/**
- * Returns the vertical gap value.
- *
- * @return The vertical gap value.
- */
-public int
-getVgap()
-{
- return(vgap);
-}
+ /**
+ * @serial
+ */
+ private Component firstLine;
-/*************************************************************************/
+ /**
+ * @serial
+ */
+ private Component lastLine;
-/**
- * Sets the vertical gap to the specified value.
- *
- * @param vgap The new vertical gap value.
- */
-public void
-setVgap(int vgap)
-{
- this.vgap = vgap;
-}
+ /**
+ * @serial
+ */
+ private Component firstItem;
-/*************************************************************************/
+ /**
+ * @serial
+ */
+ private Component lastItem;
-/**
- * Adds a component to the layout in the specified constraint position,
- * which must be one of the string constants defined in this class.
- *
- * @param component The component to add.
- * @param constraints The constraint string.
- *
- * @exception IllegalArgumentException If the constraint object is not
- * a string, or is not one of the specified constants in this class.
- */
-public void
-addLayoutComponent(Component component, Object constraints)
-{
- if (constraints != null && ! (constraints instanceof String))
- throw new IllegalArgumentException("Constraint must be a string");
+ /**
+ * @serial The horizontal gap between components
+ */
+ private int hgap;
- addLayoutComponent((String) constraints, component);
-}
+ /**
+ * @serial The vertical gap between components
+ */
+ private int vgap;
-/*************************************************************************/
-/**
- * Adds a component to the layout in the specified constraint position,
- * which must be one of the string constants defined in this class.
- *
- * @param constraints The constraint string.
- * @param component The component to add.
- *
- * @exception IllegalArgumentException If the constraint object is not
- * one of the specified constants in this class.
- *
- * @deprecated This method is deprecated in favor of
- * <code>addLayoutComponent(Component, Object)</code>.
- */
-public void
-addLayoutComponent(String constraints, Component component)
-{
- String str = constraints;
-
- if (str == null || str.equals(CENTER))
- center = component;
- else if (str.equals(NORTH))
- north = component;
- else if (str.equals(SOUTH))
- south = component;
- else if (str.equals(EAST))
- east = component;
- else if (str.equals(WEST))
- west = component;
- else if (str.equals(BEFORE_FIRST_LINE))
- firstLine = component;
- else if (str.equals(AFTER_LAST_LINE))
- lastLine = component;
- else if (str.equals(BEFORE_LINE_BEGINS))
- firstItem = component;
- else if (str.equals(AFTER_LINE_ENDS))
- lastItem = component;
- else
- throw new IllegalArgumentException("Constraint value not valid: " + str);
-}
+ /**
+ * Initializes a new instance of <code>BorderLayout</code> with no
+ * horiztonal or vertical gaps between components.
+ */
+ public BorderLayout()
+ {
+ this(0,0);
+ }
-/*************************************************************************/
+ /**
+ * Initializes a new instance of <code>BorderLayout</code> with the
+ * specified horiztonal and vertical gaps between components.
+ *
+ * @param hgap The horizontal gap between components.
+ * @param vgap The vertical gap between components.
+ */
+ public BorderLayout(int hgap, int vgap)
+ {
+ this.hgap = hgap;
+ this.vgap = vgap;
+ }
-/**
- * Removes the specified component from the layout.
- *
- * @param component The component to remove from the layout.
- */
-public void
-removeLayoutComponent(Component component)
-{
- if (north == component)
- north = null;
- if (south == component)
- south = null;
- if (east == component)
- east = null;
- if (west == component)
- west = null;
- if (center == component)
- center = null;
- if (firstItem == component)
- firstItem = null;
- if (lastItem == component)
- lastItem = null;
- if (firstLine == component)
- firstLine = null;
- if (lastLine == component)
- lastLine = null;
-}
+ /**
+ * Returns the horitzontal gap value.
+ *
+ * @return The horitzontal gap value.
+ */
+ public int getHgap()
+ {
+ return(hgap);
+ }
-/*************************************************************************/
+ /**
+ * Sets the horizontal gap to the specified value.
+ *
+ * @param hgap The new horizontal gap.
+ */
+ public void setHgap(int hgap)
+ {
+ this.hgap = hgap;
+ }
-/**
- * Returns the minimum size of the specified container using this layout.
- *
- * @param target The container to calculate the minimum size for.
- *
- * @return The minimum size of the container
- */
-public Dimension
-minimumLayoutSize(Container target)
-{
- return calcSize(target, MIN);
-}
+ /**
+ * Returns the vertical gap value.
+ *
+ * @return The vertical gap value.
+ */
+ public int getVgap()
+ {
+ return(vgap);
+ }
-/*************************************************************************/
+ /**
+ * Sets the vertical gap to the specified value.
+ *
+ * @param vgap The new vertical gap value.
+ */
+ public void setVgap(int vgap)
+ {
+ this.vgap = vgap;
+ }
-/**
- * Returns the preferred size of the specified container using this layout.
- *
- * @param target The container to calculate the preferred size for.
- *
- * @return The preferred size of the container
- */
-public Dimension
-preferredLayoutSize(Container target)
-{
- return calcSize(target, PREF);
-}
+ /**
+ * Adds a component to the layout in the specified constraint position,
+ * which must be one of the string constants defined in this class.
+ *
+ * @param component The component to add.
+ * @param constraints The constraint string.
+ *
+ * @exception IllegalArgumentException If the constraint object is not
+ * a string, or is not one of the specified constants in this class.
+ */
+ public void addLayoutComponent(Component component, Object constraints)
+ {
+ if (constraints != null && ! (constraints instanceof String))
+ throw new IllegalArgumentException("Constraint must be a string");
-/*************************************************************************/
+ addLayoutComponent((String) constraints, component);
+ }
-/**
- * Returns the maximum size of the specified container using this layout.
- *
- * @param target The container to calculate the maximum size for.
- *
- * @return The maximum size of the container
- */
-public Dimension
-maximumLayoutSize(Container target)
-{
- return calcSize(target, MAX);
-}
+ /**
+ * Adds a component to the layout in the specified constraint position,
+ * which must be one of the string constants defined in this class.
+ *
+ * @param constraints The constraint string.
+ * @param component The component to add.
+ *
+ * @exception IllegalArgumentException If the constraint object is not
+ * one of the specified constants in this class.
+ *
+ * @deprecated This method is deprecated in favor of
+ * <code>addLayoutComponent(Component, Object)</code>.
+ */
+ public void addLayoutComponent(String constraints, Component component)
+ {
+ String str = constraints;
+
+ if (str == null || str.equals(CENTER))
+ center = component;
+ else if (str.equals(NORTH))
+ north = component;
+ else if (str.equals(SOUTH))
+ south = component;
+ else if (str.equals(EAST))
+ east = component;
+ else if (str.equals(WEST))
+ west = component;
+ else if (str.equals(BEFORE_FIRST_LINE))
+ firstLine = component;
+ else if (str.equals(AFTER_LAST_LINE))
+ lastLine = component;
+ else if (str.equals(BEFORE_LINE_BEGINS))
+ firstItem = component;
+ else if (str.equals(AFTER_LINE_ENDS))
+ lastItem = component;
+ else
+ throw new IllegalArgumentException("Constraint value not valid: " + str);
+ }
-/*************************************************************************/
+ /**
+ * Removes the specified component from the layout.
+ *
+ * @param component The component to remove from the layout.
+ */
+ public void removeLayoutComponent(Component component)
+ {
+ if (north == component)
+ north = null;
+ if (south == component)
+ south = null;
+ if (east == component)
+ east = null;
+ if (west == component)
+ west = null;
+ if (center == component)
+ center = null;
+ if (firstItem == component)
+ firstItem = null;
+ if (lastItem == component)
+ lastItem = null;
+ if (firstLine == component)
+ firstLine = null;
+ if (lastLine == component)
+ lastLine = null;
+ }
-/**
- * Returns the X axis alignment, which is a <code>float</code> indicating
- * where along the X axis this container wishs to position its layout.
- * 0 indicates align to the left, 1 indicates align to the right, and 0.5
- * indicates align to the center.
- *
- * @param parent The parent container.
- *
- * @return The X alignment value.
- */
-public float
-getLayoutAlignmentX(Container parent)
-{
- return(parent.getAlignmentX());
-}
+ /**
+ * Returns the minimum size of the specified container using this layout.
+ *
+ * @param target The container to calculate the minimum size for.
+ *
+ * @return The minimum size of the container
+ */
+ public Dimension minimumLayoutSize(Container target)
+ {
+ return calcSize(target, MIN);
+ }
-/*************************************************************************/
+ /**
+ * Returns the preferred size of the specified container using this layout.
+ *
+ * @param target The container to calculate the preferred size for.
+ *
+ * @return The preferred size of the container
+ */
+ public Dimension preferredLayoutSize(Container target)
+ {
+ return calcSize(target, PREF);
+ }
-/**
- * Returns the Y axis alignment, which is a <code>float</code> indicating
- * where along the Y axis this container wishs to position its layout.
- * 0 indicates align to the top, 1 indicates align to the bottom, and 0.5
- * indicates align to the center.
- *
- * @param parent The parent container.
- *
- * @return The Y alignment value.
- */
-public float
-getLayoutAlignmentY(Container parent)
-{
- return(parent.getAlignmentY());
-}
+ /**
+ * Returns the maximum size of the specified container using this layout.
+ *
+ * @param target The container to calculate the maximum size for.
+ *
+ * @return The maximum size of the container
+ */
+ public Dimension maximumLayoutSize(Container target)
+ {
+ return calcSize(target, MAX);
+ }
-/*************************************************************************/
+ /**
+ * Returns the X axis alignment, which is a <code>float</code> indicating
+ * where along the X axis this container wishs to position its layout.
+ * 0 indicates align to the left, 1 indicates align to the right, and 0.5
+ * indicates align to the center.
+ *
+ * @param parent The parent container.
+ *
+ * @return The X alignment value.
+ */
+ public float getLayoutAlignmentX(Container parent)
+ {
+ return(parent.getAlignmentX());
+ }
-/**
- * Instructs this object to discard any layout information it might
- * have cached.
- *
- * @param parent The parent container.
- */
-public void
-invalidateLayout(Container parent)
-{
-}
+ /**
+ * Returns the Y axis alignment, which is a <code>float</code> indicating
+ * where along the Y axis this container wishs to position its layout.
+ * 0 indicates align to the top, 1 indicates align to the bottom, and 0.5
+ * indicates align to the center.
+ *
+ * @param parent The parent container.
+ *
+ * @return The Y alignment value.
+ */
+ public float getLayoutAlignmentY(Container parent)
+ {
+ return(parent.getAlignmentY());
+ }
-/*************************************************************************/
+ /**
+ * Instructs this object to discard any layout information it might
+ * have cached.
+ *
+ * @param parent The parent container.
+ */
+ public void invalidateLayout(Container parent)
+ {
+ // FIXME: Implement this properly!
+ }
-/**
- * Lays out the specified container according to the constraints
- * in this object.
- *
- * @param target The container to lay out.
- */
-public void
-layoutContainer(Container target)
-{
- synchronized (target.getTreeLock ())
- {
- Insets i = target.getInsets();
-
- ComponentOrientation orient = target.getComponentOrientation ();
- boolean left_to_right = orient.isLeftToRight ();
-
- Component my_north = north;
- Component my_east = east;
- Component my_south = south;
- Component my_west = west;
-
- // Note that we currently don't handle vertical layouts. Neither
- // does JDK 1.3.
- if (firstLine != null)
- my_north = firstLine;
- if (lastLine != null)
- my_south = lastLine;
- if (firstItem != null)
- {
- if (left_to_right)
- my_west = firstItem;
- else
- my_east = firstItem;
- }
- if (lastItem != null)
- {
- if (left_to_right)
- my_east = lastItem;
- else
- my_west = lastItem;
- }
-
- Dimension c = calcCompSize(center, PREF);
- Dimension n = calcCompSize(my_north, PREF);
- Dimension s = calcCompSize(my_south, PREF);
- Dimension e = calcCompSize(my_east, PREF);
- Dimension w = calcCompSize(my_west, PREF);
- Dimension t = target.getSize();
-
- /*
+ /**
+ * Lays out the specified container according to the constraints
+ * in this object.
+ *
+ * @param target The container to lay out.
+ */
+ public void layoutContainer(Container target)
+ {
+ synchronized (target.getTreeLock ())
+ {
+ Insets i = target.getInsets();
+
+ ComponentOrientation orient = target.getComponentOrientation ();
+ boolean left_to_right = orient.isLeftToRight ();
+
+ Component my_north = north;
+ Component my_east = east;
+ Component my_south = south;
+ Component my_west = west;
+
+ // Note that we currently don't handle vertical layouts. Neither
+ // does JDK 1.3.
+ if (firstLine != null)
+ my_north = firstLine;
+ if (lastLine != null)
+ my_south = lastLine;
+ if (firstItem != null)
+ {
+ if (left_to_right)
+ my_west = firstItem;
+ else
+ my_east = firstItem;
+ }
+ if (lastItem != null)
+ {
+ if (left_to_right)
+ my_east = lastItem;
+ else
+ my_west = lastItem;
+ }
+
+ Dimension c = calcCompSize(center, PREF);
+ Dimension n = calcCompSize(my_north, PREF);
+ Dimension s = calcCompSize(my_south, PREF);
+ Dimension e = calcCompSize(my_east, PREF);
+ Dimension w = calcCompSize(my_west, PREF);
+ int targetWidth = target.getWidth();
+ int targetHeight = target.getHeight();
+
+ /*
<-> hgap <-> hgap
+----------------------------+ }
|t | } i.top
@@ -588,144 +520,144 @@ layoutContainer(Container target)
<---------------------->
<--> ww <-->
i.left i.right
- */
-
- int x1 = i.left;
- int x2 = x1 + w.width + hgap;
- int x3;
- if (t.width <= i.right + e.width)
- x3 = x2 + w.width + hgap;
- else
- x3 = t.width - i.right - e.width;
- int ww = t.width - i.right - i.left;
-
- int y1 = i.top;
- int y2 = y1 + n.height + vgap;
- int midh = Math.max(e.height, Math.max(w.height, c.height));
- int y3;
- if (t.height <= i.bottom + s.height)
- y3 = y2 + midh + vgap;
- else
- y3 = t.height - i.bottom - s.height;
- int hh = y3-y2-vgap;
-
- setBounds(center, x2, y2, x3-x2-hgap, hh);
- setBounds(my_north, x1, y1, ww, n.height);
- setBounds(my_south, x1, y3, ww, s.height);
- setBounds(my_west, x1, y2, w.width, hh);
- setBounds(my_east, x3, y2, e.width, hh);
- }
-}
-
-/*************************************************************************/
+ */
+
+ int x1 = i.left;
+ int x2 = x1 + w.width + (w.width == 0 ? 0 : hgap);
+ int x3;
+ if (targetWidth <= i.right + e.width)
+ x3 = x2 + w.width + (w.width == 0 ? 0 : hgap);
+ else
+ x3 = targetWidth - i.right - e.width;
+ int ww = targetWidth - i.right - i.left;
+
+ int y1 = i.top;
+ int y2 = y1 + n.height + (n.height == 0 ? 0 : vgap);
+ int midh = Math.max(e.height, Math.max(w.height, c.height));
+ int y3;
+ if (targetHeight <= i.bottom + s.height)
+ y3 = y2 + midh + vgap;
+ else
+ y3 = targetHeight - i.bottom - s.height;
+ int hh = y3-y2-(s.height == 0 ? 0 : vgap);
+
+ setBounds(center, x2, y2, x3-x2-(w.width == 0 ? 0 : hgap), hh);
+ setBounds(my_north, x1, y1, ww, n.height);
+ setBounds(my_south, x1, y3, ww, s.height);
+ setBounds(my_west, x1, y2, w.width, hh);
+ setBounds(my_east, x3, y2, e.width, hh);
+ }
+ }
-/**
- * Returns a string representation of this layout manager.
- *
- * @return A string representation of this object.
- */
-public String
-toString()
-{
- return getClass().getName() + "[hgap=" + hgap + ",vgap=" + vgap + "]";
-}
-
-private void
-setBounds(Component comp, int x, int y, int w, int h)
-{
- if (comp == null)
- return;
- comp.setBounds(x, y, w, h);
-}
-
-// Some constants for use with calcSize().
-private static final int MIN = 0;
-private static final int MAX = 1;
-private static final int PREF = 2;
+ /**
+ * Returns a string representation of this layout manager.
+ *
+ * @return A string representation of this object.
+ */
+ public String toString()
+ {
+ return getClass().getName() + "[hgap=" + hgap + ",vgap=" + vgap + "]";
+ }
-private Dimension
-calcCompSize(Component comp, int what)
-{
- if (comp == null || !comp.isVisible())
- return new Dimension(0, 0);
- if (what == MIN)
- return comp.getMinimumSize();
- else if (what == MAX)
- return comp.getMaximumSize();
- return comp.getPreferredSize();
-}
+ /**
+ * FIXME: Document me!
+ */
+ private void setBounds(Component comp, int x, int y, int w, int h)
+ {
+ if (comp == null)
+ return;
+ comp.setBounds(x, y, w, h);
+ }
+
+ // FIXME: Maybe move to top of file.
+ // Some constants for use with calcSize().
+ private static final int MIN = 0;
+ private static final int MAX = 1;
+ private static final int PREF = 2;
+
+ private Dimension calcCompSize(Component comp, int what)
+ {
+ if (comp == null || !comp.isVisible())
+ return new Dimension(0, 0);
+ if (what == MIN)
+ return comp.getMinimumSize();
+ else if (what == MAX)
+ return comp.getMaximumSize();
+ return comp.getPreferredSize();
+ }
-// This is a helper function used to compute the various sizes for
-// this layout.
-private Dimension
-calcSize(Container target, int what)
-{
- synchronized (target.getTreeLock ())
- {
- Insets ins = target.getInsets();
-
- ComponentOrientation orient = target.getComponentOrientation ();
- boolean left_to_right = orient.isLeftToRight ();
-
- Component my_north = north;
- Component my_east = east;
- Component my_south = south;
- Component my_west = west;
-
- // Note that we currently don't handle vertical layouts. Neither
- // does JDK 1.3.
- if (firstLine != null)
- my_north = firstLine;
- if (lastLine != null)
- my_south = lastLine;
- if (firstItem != null)
- {
- if (left_to_right)
- my_west = firstItem;
- else
- my_east = firstItem;
- }
- if (lastItem != null)
- {
- if (left_to_right)
- my_east = lastItem;
- else
- my_west = lastItem;
- }
-
- Dimension ndim = calcCompSize(my_north, what);
- Dimension sdim = calcCompSize(my_south, what);
- Dimension edim = calcCompSize(my_east, what);
- Dimension wdim = calcCompSize(my_west, what);
- Dimension cdim = calcCompSize(center, what);
-
- int width = edim.width + cdim.width + wdim.width + (hgap * 2);
- // check for overflow
- if (width < edim.width || width < cdim.width || width < cdim.width)
+ /**
+ * This is a helper function used to compute the various sizes for
+ * this layout.
+ */
+ private Dimension calcSize(Container target, int what)
+ {
+ synchronized (target.getTreeLock ())
+ {
+ Insets ins = target.getInsets();
+
+ ComponentOrientation orient = target.getComponentOrientation ();
+ boolean left_to_right = orient.isLeftToRight ();
+
+ Component my_north = north;
+ Component my_east = east;
+ Component my_south = south;
+ Component my_west = west;
+
+ // Note that we currently don't handle vertical layouts. Neither
+ // does JDK 1.3.
+ if (firstLine != null)
+ my_north = firstLine;
+ if (lastLine != null)
+ my_south = lastLine;
+ if (firstItem != null)
+ {
+ if (left_to_right)
+ my_west = firstItem;
+ else
+ my_east = firstItem;
+ }
+ if (lastItem != null)
+ {
+ if (left_to_right)
+ my_east = lastItem;
+ else
+ my_west = lastItem;
+ }
+
+ Dimension ndim = calcCompSize(my_north, what);
+ Dimension sdim = calcCompSize(my_south, what);
+ Dimension edim = calcCompSize(my_east, what);
+ Dimension wdim = calcCompSize(my_west, what);
+ Dimension cdim = calcCompSize(center, what);
+
+ int width = edim.width + cdim.width + wdim.width + (hgap * 2);
+ // Check for overflow.
+ if (width < edim.width || width < cdim.width || width < cdim.width)
width = Integer.MAX_VALUE;
- if (ndim.width > width)
- width = ndim.width;
- if (sdim.width > width)
- width = sdim.width;
+ if (ndim.width > width)
+ width = ndim.width;
+ if (sdim.width > width)
+ width = sdim.width;
- width += (ins.left + ins.right);
+ width += (ins.left + ins.right);
- int height = edim.height;
- if (cdim.height > height)
- height = cdim.height;
- if (wdim.height > height)
- height = wdim.height;
+ int height = edim.height;
+ if (cdim.height > height)
+ height = cdim.height;
+ if (wdim.height > height)
+ height = wdim.height;
- int addedHeight = height + (ndim.height + sdim.height + (vgap * 2)
- + ins.top + ins.bottom);
- // check for overflow
- if (addedHeight < height)
+ int addedHeight = height + (ndim.height + sdim.height + (vgap * 2)
+ + ins.top + ins.bottom);
+ // Check for overflow.
+ if (addedHeight < height)
height = Integer.MAX_VALUE;
- else
+ else
height = addedHeight;
- return(new Dimension(width, height));
- }
+ return(new Dimension(width, height));
+ }
+ }
}
-} // class BorderLayout
diff --git a/libjava/classpath/java/awt/Component.java b/libjava/classpath/java/awt/Component.java
index 4491904..0ae1ffa 100644
--- a/libjava/classpath/java/awt/Component.java
+++ b/libjava/classpath/java/awt/Component.java
@@ -897,9 +897,21 @@ public abstract class Component
if(!isVisible())
{
this.visible = true;
- if (peer != null)
- peer.setVisible(true);
- invalidate();
+ // Avoid NullPointerExceptions by creating a local reference.
+ ComponentPeer currentPeer=peer;
+ if (currentPeer != null)
+ currentPeer.setVisible(true);
+
+ // Invalidate the parent if we have one. The component itself must
+ // not be invalidated. We also avoid NullPointerException with
+ // a local reference here.
+ Container currentParent = parent;
+ if (currentParent != null)
+ {
+ currentParent.invalidate();
+ currentParent.repaint();
+ }
+
ComponentEvent ce =
new ComponentEvent(this,ComponentEvent.COMPONENT_SHOWN);
getToolkit().getSystemEventQueue().postEvent(ce);
@@ -930,10 +942,23 @@ public abstract class Component
{
if (isVisible())
{
- if (peer != null)
- peer.setVisible(false);
+ // Avoid NullPointerExceptions by creating a local reference.
+ ComponentPeer currentPeer=peer;
+ if (currentPeer != null)
+ currentPeer.setVisible(false);
+
this.visible = false;
- invalidate();
+
+ // Invalidate the parent if we have one. The component itself must
+ // not be invalidated. We also avoid NullPointerException with
+ // a local reference here.
+ Container currentParent = parent;
+ if (currentParent != null)
+ {
+ currentParent.invalidate();
+ currentParent.repaint();
+ }
+
ComponentEvent ce =
new ComponentEvent(this,ComponentEvent.COMPONENT_HIDDEN);
getToolkit().getSystemEventQueue().postEvent(ce);
@@ -963,10 +988,12 @@ public abstract class Component
*/
public void setForeground(Color c)
{
- firePropertyChange("foreground", foreground, c);
if (peer != null)
peer.setForeground(c);
+
+ Color previous = foreground;
foreground = c;
+ firePropertyChange("foreground", previous, c);
}
/**
@@ -992,7 +1019,7 @@ public abstract class Component
{
if (background != null)
return background;
- return parent == null ? SystemColor.window : parent.getBackground();
+ return parent == null ? null : parent.getBackground();
}
/**
@@ -1006,16 +1033,18 @@ public abstract class Component
public void setBackground(Color c)
{
// return if the background is already set to that color.
- if (background != null && c != null)
- if (background.equals(c))
- return;
+ if ((c != null) && c.equals(background))
+ return;
+
// If c is null, inherit from closest ancestor whose bg is set.
if (c == null && parent != null)
c = parent.getBackground();
- firePropertyChange("background", background, c);
if (peer != null && c != null)
peer.setBackground(c);
+
+ Color previous = background;
background = c;
+ firePropertyChange("background", previous, c);
}
/**
@@ -1039,13 +1068,15 @@ public abstract class Component
*/
public Font getFont()
{
- if (font != null)
- return font;
+ Font f = font;
+ if (f != null)
+ return f;
- if (parent != null)
- return parent.getFont ();
+ Component p = parent;
+ if (p != null)
+ return p.getFont();
else
- return new Font ("Dialog", Font.PLAIN, 12);
+ return new Font("Dialog", Font.PLAIN, 12);
}
/**
@@ -1058,15 +1089,16 @@ public abstract class Component
*/
public void setFont(Font newFont)
{
- if (font == newFont)
- return;
-
- Font oldFont = font;
- font = newFont;
- if (peer != null)
- peer.setFont(font);
- firePropertyChange("font", oldFont, newFont);
- invalidate();
+ if((newFont != null && (font == null || !font.equals(newFont)))
+ || newFont == null)
+ {
+ Font oldFont = font;
+ font = newFont;
+ if (peer != null)
+ peer.setFont(font);
+ firePropertyChange("font", oldFont, newFont);
+ invalidate();
+ }
}
/**
@@ -1372,9 +1404,6 @@ public abstract class Component
// Erase old bounds and repaint new bounds for lightweights.
if (isLightweight() && isShowing ())
{
- boolean shouldRepaintParent = false;
- boolean shouldRepaintSelf = false;
-
if (parent != null)
{
Rectangle parentBounds = parent.getBounds();
@@ -1384,14 +1413,11 @@ public abstract class Component
Rectangle newBounds = new Rectangle(parent.getX() + x,
parent.getY() + y,
width, height);
- shouldRepaintParent = parentBounds.intersects(oldBounds);
- shouldRepaintSelf = parentBounds.intersects(newBounds);
+ Rectangle destroyed = oldBounds.union(newBounds);
+ if (!destroyed.isEmpty())
+ parent.repaint(0, destroyed.x, destroyed.y, destroyed.width,
+ destroyed.height);
}
-
- if (shouldRepaintParent && parent != null)
- parent.repaint(oldx, oldy, oldwidth, oldheight);
- if (shouldRepaintSelf)
- repaint();
}
// Only post event if this component is visible and has changed size.
@@ -1798,9 +1824,8 @@ public abstract class Component
*/
public void paint(Graphics g)
{
- // Paint the heavyweight peer
- if (!isLightweight() && peer != null)
- peer.paint(g);
+ // This is a callback method and is meant to be overridden by subclasses
+ // that want to perform custom painting.
}
/**
@@ -1816,10 +1841,20 @@ public abstract class Component
*
* @see #paint(Graphics)
* @see #repaint()
+ *
+ * @specnote In contrast to what the spec says, tests show that the exact
+ * behaviour is to clear the background on lightweight and
+ * top-level components only. Heavyweight components are not
+ * affected by this method and only call paint().
*/
public void update(Graphics g)
{
- if (!isLightweight())
+ // Tests show that the clearing of the background is only done in
+ // two cases:
+ // - If the component is lightweight (yes this is in contrast to the spec).
+ // or
+ // - If the component is a toplevel container.
+ if (isLightweight() || getParent() == null)
{
Rectangle clip = g.getClipBounds();
if (clip == null)
@@ -1827,7 +1862,6 @@ public abstract class Component
else
g.clearRect(clip.x, clip.y, clip.width, clip.height);
}
-
paint(g);
}
@@ -1854,7 +1888,14 @@ public abstract class Component
*/
public void repaint()
{
- repaint(0, 0, 0, width, height);
+ if(!isShowing())
+ {
+ Component p = parent;
+ if (p != null)
+ p.repaint(0, getX(), getY(), width, height);
+ }
+ else
+ repaint(0, 0, 0, width, height);
}
/**
@@ -1868,7 +1909,14 @@ public abstract class Component
*/
public void repaint(long tm)
{
- repaint(tm, 0, 0, width, height);
+ if(!isShowing())
+ {
+ Component p = parent;
+ if (p != null)
+ p.repaint(tm, getX(), getY(), width, height);
+ }
+ else
+ repaint(tm, 0, 0, width, height);
}
/**
@@ -1885,7 +1933,14 @@ public abstract class Component
*/
public void repaint(int x, int y, int w, int h)
{
- repaint(0, x, y, w, h);
+ if(!isShowing())
+ {
+ Component p = parent;
+ if (p != null)
+ p.repaint(0, x + getX(), y + getY(), width, height);
+ }
+ else
+ repaint(0, x, y, w, h);
}
/**
@@ -1903,14 +1958,18 @@ public abstract class Component
*/
public void repaint(long tm, int x, int y, int width, int height)
{
- // Handle lightweight repainting by forwarding to native parent
- if (isLightweight() && parent != null)
+ if(!isShowing())
{
- if (parent != null)
- parent.repaint(tm, x + getX(), y + getY(), width, height);
+ Component p = parent;
+ if (p != null)
+ p.repaint(tm, x + getX(), y + getY(), width, height);
+ }
+ else
+ {
+ ComponentPeer p = peer;
+ if (p != null)
+ p.repaint(tm, x, y, width, height);
}
- else if (peer != null)
- peer.repaint(tm, x, y, width, height);
}
/**
@@ -1971,7 +2030,7 @@ public abstract class Component
public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h)
{
if ((flags & (FRAMEBITS | ALLBITS)) != 0)
- repaint ();
+ repaint();
else if ((flags & SOMEBITS) != 0)
{
if (incrementalDraw)
@@ -1981,10 +2040,10 @@ public abstract class Component
long tm = redrawRate.longValue();
if (tm < 0)
tm = 0;
- repaint (tm);
+ repaint(tm);
}
else
- repaint (100);
+ repaint(100);
}
}
return (flags & (ALLBITS | ABORT | ERROR)) == 0;
@@ -2282,8 +2341,6 @@ public abstract class Component
// Some subclasses in the AWT package need to override this behavior,
// hence the use of dispatchEventImpl().
dispatchEventImpl(e);
- if (peer != null && ! e.consumed)
- peer.handleEvent(e);
}
/**
@@ -4183,6 +4240,10 @@ public abstract class Component
param.append(",translucent");
if (isDoubleBuffered())
param.append(",doublebuffered");
+ if (parent == null)
+ param.append(",parent==null");
+ else
+ param.append(",parent==").append(parent.getName());
return param.toString();
}
@@ -4742,7 +4803,7 @@ p * <li>the set of backward traversal keys
* @param e the event to dispatch
*/
- void dispatchEventImpl (AWTEvent e)
+ void dispatchEventImpl(AWTEvent e)
{
Event oldEvent = translateEvent (e);
@@ -4776,8 +4837,12 @@ p * <li>the set of backward traversal keys
break;
}
}
- processEvent (e);
+ if (e.id != PaintEvent.PAINT && e.id != PaintEvent.UPDATE)
+ processEvent(e);
}
+
+ if (peer != null)
+ peer.handleEvent(e);
}
/**
diff --git a/libjava/classpath/java/awt/Container.java b/libjava/classpath/java/awt/Container.java
index 303d13b..13d32f8 100644
--- a/libjava/classpath/java/awt/Container.java
+++ b/libjava/classpath/java/awt/Container.java
@@ -42,6 +42,7 @@ import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
+import java.awt.peer.ComponentPeer;
import java.awt.peer.ContainerPeer;
import java.awt.peer.LightweightPeer;
import java.beans.PropertyChangeListener;
@@ -59,7 +60,8 @@ import java.util.Iterator;
import java.util.Set;
import javax.accessibility.Accessible;
-import javax.swing.SwingUtilities;
+
+import gnu.java.awt.AWTUtilities;
/**
* A generic window toolkit object that acts as a container for other objects.
@@ -338,8 +340,12 @@ public class Container extends Component
if (comp.parent != null)
comp.parent.remove(comp);
comp.parent = this;
+
if (peer != null)
{
+ // Notify the component that it has a new parent.
+ comp.addNotify();
+
if (comp.isLightweight ())
{
enableEvents (comp.eventMask);
@@ -348,7 +354,8 @@ public class Container extends Component
}
}
- invalidate();
+ // Invalidate the layout of the added component and its ancestors.
+ comp.invalidate();
if (component == null)
component = new Component[4]; // FIXME, better initial size?
@@ -394,6 +401,9 @@ public class Container extends Component
ContainerEvent.COMPONENT_ADDED,
comp);
getToolkit().getSystemEventQueue().postEvent(ce);
+
+ // Repaint this container.
+ repaint();
}
}
}
@@ -429,6 +439,9 @@ public class Container extends Component
ContainerEvent.COMPONENT_REMOVED,
r);
getToolkit().getSystemEventQueue().postEvent(ce);
+
+ // Repaint this container.
+ repaint();
}
}
}
@@ -513,6 +526,11 @@ public class Container extends Component
public void invalidate()
{
super.invalidate();
+ if (layoutMgr != null && layoutMgr instanceof LayoutManager2)
+ {
+ LayoutManager2 lm2 = (LayoutManager2) layoutMgr;
+ lm2.invalidateLayout(this);
+ }
}
/**
@@ -534,6 +552,7 @@ public class Container extends Component
*/
void invalidateTree()
{
+ super.invalidate(); // Clean cached layout state.
for (int i = 0; i < ncomponents; i++)
{
Component comp = component[i];
@@ -541,6 +560,12 @@ public class Container extends Component
if (comp instanceof Container)
((Container) comp).invalidateTree();
}
+
+ if (layoutMgr != null && layoutMgr instanceof LayoutManager2)
+ {
+ LayoutManager2 lm2 = (LayoutManager2) layoutMgr;
+ lm2.invalidateLayout(this);
+ }
}
/**
@@ -596,11 +621,15 @@ public class Container extends Component
public void setFont(Font f)
{
- super.setFont(f);
- // FIXME: Although it might make more sense to invalidate only
- // those children whose font == null, Sun invalidates all children.
- // So we'll do the same.
- invalidateTree();
+ if( (f != null && (font == null || !font.equals(f)))
+ || f == null)
+ {
+ super.setFont(f);
+ // FIXME: Although it might make more sense to invalidate only
+ // those children whose font == null, Sun invalidates all children.
+ // So we'll do the same.
+ invalidateTree();
+ }
}
/**
@@ -622,10 +651,21 @@ public class Container extends Component
*/
public Dimension preferredSize()
{
- if (layoutMgr != null)
- return layoutMgr.preferredLayoutSize (this);
- else
- return super.preferredSize ();
+ synchronized(treeLock)
+ {
+ if(valid && prefSize != null)
+ return new Dimension(prefSize);
+ LayoutManager layout = getLayout();
+ if (layout != null)
+ {
+ Dimension layoutSize = layout.preferredLayoutSize(this);
+ if(valid)
+ prefSize = layoutSize;
+ return new Dimension(layoutSize);
+ }
+ else
+ return super.preferredSize ();
+ }
}
/**
@@ -647,8 +687,15 @@ public class Container extends Component
*/
public Dimension minimumSize()
{
- if (layoutMgr != null)
- return layoutMgr.minimumLayoutSize (this);
+ if(valid && minSize != null)
+ return new Dimension(minSize);
+
+ LayoutManager layout = getLayout();
+ if (layout != null)
+ {
+ minSize = layout.minimumLayoutSize (this);
+ return minSize;
+ }
else
return super.minimumSize ();
}
@@ -660,10 +707,15 @@ public class Container extends Component
*/
public Dimension getMaximumSize()
{
- if (layoutMgr != null && layoutMgr instanceof LayoutManager2)
+ if (valid && maxSize != null)
+ return new Dimension(maxSize);
+
+ LayoutManager layout = getLayout();
+ if (layout != null && layout instanceof LayoutManager2)
{
- LayoutManager2 lm2 = (LayoutManager2) layoutMgr;
- return lm2.maximumLayoutSize(this);
+ LayoutManager2 lm2 = (LayoutManager2) layout;
+ maxSize = lm2.maximumLayoutSize(this);
+ return maxSize;
}
else
return super.getMaximumSize();
@@ -678,13 +730,7 @@ public class Container extends Component
*/
public float getAlignmentX()
{
- if (layoutMgr instanceof LayoutManager2)
- {
- LayoutManager2 lm2 = (LayoutManager2) layoutMgr;
- return lm2.getLayoutAlignmentX(this);
- }
- else
- return super.getAlignmentX();
+ return super.getAlignmentX();
}
/**
@@ -696,13 +742,7 @@ public class Container extends Component
*/
public float getAlignmentY()
{
- if (layoutMgr instanceof LayoutManager2)
- {
- LayoutManager2 lm2 = (LayoutManager2) layoutMgr;
- return lm2.getLayoutAlignmentY(this);
- }
- else
- return super.getAlignmentY();
+ return super.getAlignmentY();
}
/**
@@ -718,8 +758,7 @@ public class Container extends Component
{
if (!isShowing())
return;
- // Paint self first.
- super.paint(g);
+
// Visit heavyweights as well, in case they were
// erased when we cleared the background for this container.
visitChildren(g, GfxPaintVisitor.INSTANCE, false);
@@ -733,10 +772,30 @@ public class Container extends Component
* drawn.
*
* @param g The graphics context for this update.
+ *
+ * @specnote The specification suggests that this method forwards the
+ * update() call to all its lightweight children. Tests show
+ * that this is not done either in the JDK. The exact behaviour
+ * seems to be that the background is cleared in heavyweight
+ * Containers, and all other containers
+ * directly call paint(), causing the (lightweight) children to
+ * be painted.
*/
public void update(Graphics g)
{
- super.update(g);
+ // It seems that the JDK clears the background of containers like Panel
+ // and Window (within this method) but not of 'plain' Containers or
+ // JComponents. This could
+ // lead to the assumption that it only clears heavyweight containers.
+ // However that is not quite true. In a test with a custom Container
+ // that overrides isLightweight() to return false, the background is
+ // also not cleared. So we do a check on !(peer instanceof LightweightPeer)
+ // instead.
+ ComponentPeer p = peer;
+ if (p != null && !(p instanceof LightweightPeer))
+ g.clearRect(0, 0, getWidth(), getHeight());
+
+ paint(g);
}
/**
@@ -1198,7 +1257,7 @@ public class Container extends Component
}
if (focusTraversalKeys == null)
- focusTraversalKeys = new Set[3];
+ focusTraversalKeys = new Set[4];
keystrokes = Collections.unmodifiableSet (new HashSet (keystrokes));
firePropertyChange (name, focusTraversalKeys[id], keystrokes);
@@ -1465,12 +1524,8 @@ public class Container extends Component
for (int i = ncomponents - 1; i >= 0; --i)
{
Component comp = component[i];
- // If we're visiting heavyweights as well,
- // don't recurse into Containers here. This avoids
- // painting the same nested child multiple times.
boolean applicable = comp.isVisible()
- && (comp.isLightweight()
- || !lightweightOnly && ! (comp instanceof Container));
+ && (comp.isLightweight() || !lightweightOnly);
if (applicable)
visitChild(gfx, visitor, comp);
@@ -1525,11 +1580,9 @@ public class Container extends Component
void dispatchEventImpl(AWTEvent e)
{
// Give lightweight dispatcher a chance to handle it.
- if (eventTypeEnabled (e.id)
- && dispatcher != null
- && dispatcher.handleEvent (e))
+ if (dispatcher != null && dispatcher.handleEvent (e))
return;
-
+
if ((e.id <= ContainerEvent.CONTAINER_LAST
&& e.id >= ContainerEvent.CONTAINER_FIRST)
&& (containerListener != null
@@ -1539,6 +1592,26 @@ public class Container extends Component
super.dispatchEventImpl(e);
}
+ /**
+ * Tests if this container has an interest in the given event id.
+ *
+ * @param eventId The event id to check.
+ *
+ * @return <code>true</code> if a listener for the event id exists or
+ * if the eventMask is set for the event id.
+ *
+ * @see java.awt.Component#eventTypeEnabled(int)
+ */
+ boolean eventTypeEnabled(int eventId)
+ {
+ if(eventId <= ContainerEvent.CONTAINER_LAST
+ && eventId >= ContainerEvent.CONTAINER_FIRST)
+ return containerListener != null
+ || (eventMask & AWTEvent.CONTAINER_EVENT_MASK) != 0;
+ else
+ return super.eventTypeEnabled(eventId);
+ }
+
// This is used to implement Component.transferFocus.
Component findNextFocusComponent(Component child)
{
@@ -1603,12 +1676,11 @@ public class Container extends Component
// If we're not lightweight, and we just got a lightweight
// child, we need a lightweight dispatcher to feed it events.
- if (! this.isLightweight())
- {
- if (dispatcher == null)
- dispatcher = new LightweightDispatcher (this);
- }
-
+ if (!this.isLightweight() && dispatcher == null)
+ dispatcher = new LightweightDispatcher (this);
+
+ if (dispatcher != null)
+ dispatcher.enableEvents(component[i].eventMask);
enableEvents(component[i].eventMask);
if (peer != null && !isLightweight ())
@@ -1862,7 +1934,6 @@ public class Container extends Component
* rather than mimic it exactly we write something which does "roughly
* the same thing".
*/
-
class LightweightDispatcher implements Serializable
{
private static final long serialVersionUID = 5184291520170872969L;
@@ -1870,10 +1941,8 @@ class LightweightDispatcher implements Serializable
private Cursor nativeCursor;
private long eventMask;
- private transient Component mouseEventTarget;
private transient Component pressedComponent;
private transient Component lastComponentEntered;
- private transient Component tempComponent;
private transient int pressCount;
LightweightDispatcher(Container c)
@@ -1881,11 +1950,17 @@ class LightweightDispatcher implements Serializable
nativeContainer = c;
}
- void acquireComponentForMouseEvent(MouseEvent me)
+ void enableEvents(long l)
+ {
+ eventMask |= l;
+ }
+
+ Component acquireComponentForMouseEvent(MouseEvent me)
{
int x = me.getX ();
int y = me.getY ();
+ Component mouseEventTarget = null;
// Find the candidate which should receive this event.
Component parent = nativeContainer;
Component candidate = null;
@@ -1893,13 +1968,13 @@ class LightweightDispatcher implements Serializable
while (candidate == null && parent != null)
{
candidate =
- SwingUtilities.getDeepestComponentAt(parent, p.x, p.y);
+ AWTUtilities.getDeepestComponentAt(parent, p.x, p.y);
if (candidate == null || (candidate.eventMask & me.getID()) == 0)
- {
- candidate = null;
- p = SwingUtilities.convertPoint(parent, p.x, p.y, parent.parent);
- parent = parent.parent;
- }
+ {
+ candidate = null;
+ p = AWTUtilities.convertPoint(parent, p.x, p.y, parent.parent);
+ parent = parent.parent;
+ }
}
// If the only candidate we found was the native container itself,
@@ -1915,25 +1990,24 @@ class LightweightDispatcher implements Serializable
{
// Old candidate could have been removed from
// the nativeContainer so we check first.
- if (SwingUtilities.isDescendingFrom(lastComponentEntered, nativeContainer))
- {
- Point tp =
- SwingUtilities.convertPoint(nativeContainer,
- x, y, lastComponentEntered);
- MouseEvent exited = new MouseEvent (lastComponentEntered,
- MouseEvent.MOUSE_EXITED,
- me.getWhen (),
- me.getModifiersEx (),
- tp.x, tp.y,
- me.getClickCount (),
- me.isPopupTrigger (),
- me.getButton ());
- tempComponent = lastComponentEntered;
- lastComponentEntered = null;
- tempComponent.dispatchEvent(exited);
- }
+ if (AWTUtilities.isDescendingFrom(lastComponentEntered,
+ nativeContainer))
+ {
+ Point tp = AWTUtilities.convertPoint(nativeContainer,
+ x, y, lastComponentEntered);
+ MouseEvent exited = new MouseEvent (lastComponentEntered,
+ MouseEvent.MOUSE_EXITED,
+ me.getWhen (),
+ me.getModifiersEx (),
+ tp.x, tp.y,
+ me.getClickCount (),
+ me.isPopupTrigger (),
+ me.getButton ());
+ lastComponentEntered.dispatchEvent (exited);
+ }
lastComponentEntered = null;
}
+
// If we have a candidate, maybe enter it.
if (candidate != null)
{
@@ -1942,10 +2016,10 @@ class LightweightDispatcher implements Serializable
&& candidate.isShowing()
&& candidate != nativeContainer
&& candidate != lastComponentEntered)
- {
+ {
lastComponentEntered = mouseEventTarget;
- Point cp = SwingUtilities.convertPoint(nativeContainer,
- x, y, lastComponentEntered);
+ Point cp = AWTUtilities.convertPoint(nativeContainer,
+ x, y, lastComponentEntered);
MouseEvent entered = new MouseEvent (lastComponentEntered,
MouseEvent.MOUSE_ENTERED,
me.getWhen (),
@@ -1958,17 +2032,38 @@ class LightweightDispatcher implements Serializable
}
}
+ // Check which buttons where pressed except the last button that
+ // changed state.
+ int modifiers = me.getModifiersEx() & (MouseEvent.BUTTON1_DOWN_MASK
+ | MouseEvent.BUTTON2_DOWN_MASK
+ | MouseEvent.BUTTON3_DOWN_MASK);
+ switch(me.getButton())
+ {
+ case MouseEvent.BUTTON1:
+ modifiers &= ~MouseEvent.BUTTON1_DOWN_MASK;
+ break;
+ case MouseEvent.BUTTON2:
+ modifiers &= ~MouseEvent.BUTTON2_DOWN_MASK;
+ break;
+ case MouseEvent.BUTTON3:
+ modifiers &= ~MouseEvent.BUTTON3_DOWN_MASK;
+ break;
+ }
+
if (me.getID() == MouseEvent.MOUSE_RELEASED
- || me.getID() == MouseEvent.MOUSE_PRESSED && pressCount > 0
+ || me.getID() == MouseEvent.MOUSE_PRESSED && modifiers > 0
|| me.getID() == MouseEvent.MOUSE_DRAGGED)
- // If any of the following events occur while a button is held down,
- // they should be dispatched to the same component to which the
- // original MOUSE_PRESSED event was dispatched:
- // - MOUSE_RELEASED
- // - MOUSE_PRESSED: another button pressed while the first is held down
- // - MOUSE_DRAGGED
- if (SwingUtilities.isDescendingFrom(pressedComponent, nativeContainer))
- mouseEventTarget = pressedComponent;
+ {
+ // If any of the following events occur while a button is held down,
+ // they should be dispatched to the same component to which the
+ // original MOUSE_PRESSED event was dispatched:
+ // - MOUSE_RELEASED
+ // - MOUSE_PRESSED: another button pressed while the first is held
+ // down
+ // - MOUSE_DRAGGED
+ if (AWTUtilities.isDescendingFrom(pressedComponent, nativeContainer))
+ mouseEventTarget = pressedComponent;
+ }
else if (me.getID() == MouseEvent.MOUSE_CLICKED)
{
// Don't dispatch CLICKED events whose target is not the same as the
@@ -1978,6 +2073,7 @@ class LightweightDispatcher implements Serializable
else if (pressCount == 0)
pressedComponent = null;
}
+ return mouseEventTarget;
}
boolean handleEvent(AWTEvent e)
@@ -1986,41 +2082,42 @@ class LightweightDispatcher implements Serializable
{
MouseEvent me = (MouseEvent) e;
- acquireComponentForMouseEvent(me);
-
+ // Make the LightWeightDispatcher reentrant. This is necessary when
+ // a lightweight component does its own modal event queue.
+ Component mouseEventTarget = acquireComponentForMouseEvent(me);
+
// Avoid dispatching ENTERED and EXITED events twice.
if (mouseEventTarget != null
&& mouseEventTarget.isShowing()
&& e.getID() != MouseEvent.MOUSE_ENTERED
&& e.getID() != MouseEvent.MOUSE_EXITED)
{
- MouseEvent newEvt =
- SwingUtilities.convertMouseEvent(nativeContainer, me,
- mouseEventTarget);
- mouseEventTarget.dispatchEvent(newEvt);
-
switch (e.getID())
{
- case MouseEvent.MOUSE_PRESSED:
- if (pressCount++ == 0)
- pressedComponent = mouseEventTarget;
- break;
-
- case MouseEvent.MOUSE_RELEASED:
- // Clear our memory of the original PRESSED event, only if
- // we're not expecting a CLICKED event after this. If
- // there is a CLICKED event after this, it will do clean up.
- if (--pressCount == 0
- && mouseEventTarget != pressedComponent)
- pressedComponent = null;
- break;
+ case MouseEvent.MOUSE_PRESSED:
+ if (pressCount++ == 0)
+ pressedComponent = mouseEventTarget;
+ break;
+ case MouseEvent.MOUSE_RELEASED:
+ // Clear our memory of the original PRESSED event, only if
+ // we're not expecting a CLICKED event after this. If
+ // there is a CLICKED event after this, it will do clean up.
+ if (--pressCount == 0
+ && mouseEventTarget != pressedComponent)
+ pressedComponent = null;
+ break;
}
- if (newEvt.isConsumed())
- e.consume();
+
+ MouseEvent newEvt =
+ AWTUtilities.convertMouseEvent(nativeContainer, me,
+ mouseEventTarget);
+ mouseEventTarget.dispatchEvent(newEvt);
+
+ if (newEvt.isConsumed())
+ e.consume();
}
}
-
+
return e.isConsumed();
}
-
-} // class LightweightDispatcher
+}
diff --git a/libjava/classpath/java/awt/EventQueue.java b/libjava/classpath/java/awt/EventQueue.java
index a8b0078..15b6e1e 100644
--- a/libjava/classpath/java/awt/EventQueue.java
+++ b/libjava/classpath/java/awt/EventQueue.java
@@ -38,8 +38,6 @@ exception statement from your version. */
package java.awt;
-import gnu.java.awt.ClasspathToolkit;
-
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.InputMethodEvent;
@@ -78,10 +76,7 @@ public class EventQueue
private EventDispatchThread dispatchThread = new EventDispatchThread(this);
private boolean shutdown = false;
- private long lastNativeQueueAccess = 0;
- private long humanLatencyThreshold = 100;
-
- synchronized void setShutdown (boolean b)
+ synchronized private void setShutdown (boolean b)
{
shutdown = b;
}
@@ -94,8 +89,8 @@ public class EventQueue
// This is the exact self-shutdown condition specified in J2SE:
// http://java.sun.com/j2se/1.4.2/docs/api/java/awt/doc-files/AWTThreadIssues.html
- if (peekEvent() == null
- && ((ClasspathToolkit) Toolkit.getDefaultToolkit()).nativeQueueEmpty())
+ // FIXME: check somewhere that the native queue is empty
+ if (peekEvent() == null)
{
Frame[] frames = Frame.getFrames();
for (int i = 0; i < frames.length; ++i)
@@ -127,50 +122,22 @@ public class EventQueue
{
if (next != null)
return next.getNextEvent();
-
- ClasspathToolkit tk = ((ClasspathToolkit) Toolkit.getDefaultToolkit());
- long curr = System.currentTimeMillis();
-
- if (! tk.nativeQueueEmpty() &&
- (curr - lastNativeQueueAccess > humanLatencyThreshold))
- {
- tk.iterateNativeQueue(this, false);
- lastNativeQueueAccess = curr;
- }
while (next_in == next_out)
{
- // Only the EventDispatchThread associated with the top of the stack is
- // allowed to get events from the native source; everyone else just
- // waits on the head of the queue.
-
- if (isDispatchThread())
- {
- // We are not allowed to return null from this method, yet it
- // is possible that we actually have run out of native events
- // in the enclosing while() loop, and none of the native events
- // happened to cause AWT events. We therefore ought to check
- // the isShutdown() condition here, before risking a "native
- // wait". If we check it before entering this function we may
- // wait forever for events after the shutdown condition has
- // arisen.
-
- if (isShutdown())
- throw new InterruptedException();
-
- tk.iterateNativeQueue(this, true);
- lastNativeQueueAccess = System.currentTimeMillis();
- }
- else
- {
- try
- {
- wait();
- }
- catch (InterruptedException ie)
- {
- }
- }
+ // We are not allowed to return null from this method, yet it
+ // is possible that we actually have run out of native events
+ // in the enclosing while() loop, and none of the native events
+ // happened to cause AWT events. We therefore ought to check
+ // the isShutdown() condition here, before risking a "native
+ // wait". If we check it before entering this function we may
+ // wait forever for events after the shutdown condition has
+ // arisen.
+
+ if (isShutdown())
+ throw new InterruptedException();
+
+ wait();
}
AWTEvent res = queue[next_out];
@@ -298,15 +265,6 @@ public class EventQueue
dispatchThread.start();
}
- // Window events might represent the closing of a window, which
- // might cause the end of the dispatch thread's life, so we'll wake
- // it up here to give it a chance to check for shutdown.
-
- if (!isDispatchThread()
- || (evt.getID() == WindowEvent.WINDOW_CLOSED)
- || (evt.getID() == WindowEvent.WINDOW_CLOSING))
- ((ClasspathToolkit) Toolkit.getDefaultToolkit()).wakeNativeQueue();
-
notify();
}
@@ -478,7 +436,6 @@ public class EventQueue
next_in = 0;
next_out = 0;
- ((ClasspathToolkit) Toolkit.getDefaultToolkit()).wakeNativeQueue();
setShutdown(true);
dispatchThread = null;
this.notifyAll();
diff --git a/libjava/classpath/java/awt/FlowLayout.java b/libjava/classpath/java/awt/FlowLayout.java
index 4674990..7d0771d 100644
--- a/libjava/classpath/java/awt/FlowLayout.java
+++ b/libjava/classpath/java/awt/FlowLayout.java
@@ -205,12 +205,12 @@ public class FlowLayout implements LayoutManager, Serializable
else if (align == TRAILING)
myalign = left_to_right ? RIGHT : LEFT;
- if (myalign == LEFT)
- x = ins.left + hgap;
+ if (myalign == RIGHT)
+ x = ins.left + (d.width - new_w) + hgap;
else if (myalign == CENTER)
x = ins.left + (d.width - new_w) / 2 + hgap;
- else
- x = ins.left + (d.width - new_w) + hgap;
+ else // LEFT and all other values of align.
+ x = ins.left + hgap;
for (int k = i; k < j; ++k)
{
@@ -269,9 +269,9 @@ public class FlowLayout implements LayoutManager, Serializable
*/
public void setAlignment (int align)
{
- if (align != LEFT && align != RIGHT && align != CENTER
- && align != LEADING && align != TRAILING)
- throw new IllegalArgumentException ("invalid alignment: " + align);
+ // The JDK accepts invalid values and treats them as
+ // LEFT during layout, so do we. The invalid value is even stored,
+ // getAlignment() returns the same invalid value.
this.align = align;
}
diff --git a/libjava/classpath/java/awt/Font.java b/libjava/classpath/java/awt/Font.java
index 30961ab..5de9458 100644
--- a/libjava/classpath/java/awt/Font.java
+++ b/libjava/classpath/java/awt/Font.java
@@ -353,9 +353,11 @@ private static final long serialVersionUID = -4206021311591459213L;
this(null, attrs);
}
- /* This extra constructor is here to permit ClasspathToolkit and to build
- a font with a "logical name" as well as attrs. */
- public Font (String name, Map attrs)
+ /* This extra constructor is here to permit ClasspathToolkit and to
+ build a font with a "logical name" as well as attrs.
+ ClasspathToolkit.getFont(String,Map) uses reflection to call this
+ package-private constructor. */
+ Font (String name, Map attrs)
{
// If attrs is null, setting it to an empty HashMap will give this
// Font default attributes.
diff --git a/libjava/classpath/java/awt/FontMetrics.java b/libjava/classpath/java/awt/FontMetrics.java
index e702a62..6dd73ec 100644
--- a/libjava/classpath/java/awt/FontMetrics.java
+++ b/libjava/classpath/java/awt/FontMetrics.java
@@ -193,7 +193,8 @@ public abstract class FontMetrics implements java.io.Serializable
*/
public int charWidth(int ch)
{
- return charWidth((char) ch);
+ char[] chars = Character.toChars(ch);
+ return charsWidth(chars, 0, chars.length);
}
/**
@@ -235,7 +236,8 @@ public abstract class FontMetrics implements java.io.Serializable
public int charsWidth(char[] buf, int offset, int len)
{
int total_width = 0;
- for (int i = offset; i < len; i++)
+ int endOffset = offset + len;
+ for (int i = offset; i < endOffset; i++)
total_width += charWidth(buf[i]);
return total_width;
}
diff --git a/libjava/classpath/java/awt/Frame.java b/libjava/classpath/java/awt/Frame.java
index 0cb97f8..05c9384 100644
--- a/libjava/classpath/java/awt/Frame.java
+++ b/libjava/classpath/java/awt/Frame.java
@@ -401,20 +401,6 @@ remove(MenuComponent menu)
menuBar.remove(menu);
}
-/**
- * Notifies this frame that it should create its native peer.
- */
-private static void fireDummyEvent()
-{
- EventQueue.invokeLater(new Runnable()
- {
- public void run()
- {
- // Do nothing here.
- }
- });
-}
-
public void
addNotify()
{
@@ -423,11 +409,6 @@ addNotify()
if (peer == null)
peer = getToolkit ().createFrame (this);
- // We now know there's a Frame (us) with a live peer, so we can start the
- // fundamental queue and dispatch thread, by inserting a dummy event.
- if (parent != null && parent.isDisplayable())
- fireDummyEvent();
-
super.addNotify();
}
@@ -436,12 +417,6 @@ public void removeNotify()
if (menuBar != null)
menuBar.removeNotify();
super.removeNotify();
-
- // By now we've been disconnected from the peer, and the peer set to
- // null. This is formally the same as saying "we just became
- // un-displayable", so we wake up the event queue with a dummy event to
- // see if it's time to shut down.
- fireDummyEvent();
}
/**
diff --git a/libjava/classpath/java/awt/GraphicsConfiguration.java b/libjava/classpath/java/awt/GraphicsConfiguration.java
index 6dc27793..069d741 100644
--- a/libjava/classpath/java/awt/GraphicsConfiguration.java
+++ b/libjava/classpath/java/awt/GraphicsConfiguration.java
@@ -126,6 +126,22 @@ public abstract class GraphicsConfiguration
}
/**
+ * Returns a buffered volatile image optimized to this device, and
+ * with the given transparency. Because the buffer is volatile, it
+ * can be optimized by native graphics accelerators.
+ *
+ * @param w the width of the buffer
+ * @param h the height of the buffer
+ * @param transparency the transparency value for the buffer
+ * @return the buffered image, or null if none is supported
+ * @throws AWTException if the capabilities cannot be met
+ * @since 1.5
+ */
+ public abstract VolatileImage createCompatibleVolatileImage(int width,
+ int height,
+ int transparency);
+
+ /**
* Returns a buffered image optimized to this device, and with the specified
* transparency, so that blitting can be supported in the buffered image.
*
diff --git a/libjava/classpath/java/awt/GridBagLayout.java b/libjava/classpath/java/awt/GridBagLayout.java
index 767610c..7f9ab24 100644
--- a/libjava/classpath/java/awt/GridBagLayout.java
+++ b/libjava/classpath/java/awt/GridBagLayout.java
@@ -192,16 +192,12 @@ public class GridBagLayout
if (clone.gridwidth == 0)
clone.gridwidth = GridBagConstraints.REMAINDER;
- else if (clone.gridwidth < 0
- && clone.gridwidth != GridBagConstraints.REMAINDER
- && clone.gridwidth != GridBagConstraints.RELATIVE)
+ else if (clone.gridwidth < 0)
clone.gridwidth = 1;
if (clone.gridheight == 0)
clone.gridheight = GridBagConstraints.REMAINDER;
- else if (clone.gridheight < 0
- && clone.gridheight != GridBagConstraints.REMAINDER
- && clone.gridheight != GridBagConstraints.RELATIVE)
+ else if (clone.gridheight < 0)
clone.gridheight = 1;
comptable.put (component, clone);
@@ -913,7 +909,7 @@ public class GridBagLayout
sizes[start] = Math.max(sizes[start], size);
weights[start] = Math.max(weights[start], weight);
}
- else
+ else if (span > 1)
{
int numOccupied = span;
int lastOccupied = -1;
diff --git a/libjava/classpath/java/awt/Label.java b/libjava/classpath/java/awt/Label.java
index 8867fa1..d6db329 100644
--- a/libjava/classpath/java/awt/Label.java
+++ b/libjava/classpath/java/awt/Label.java
@@ -215,12 +215,17 @@ getText()
public synchronized void
setText(String text)
{
- this.text = text;
-
- if (peer != null)
+ if ((this.text == null && text != null)
+ || (this.text != null && ! this.text.equals(text)))
{
- LabelPeer lp = (LabelPeer) peer;
- lp.setText (text);
+ this.text = text;
+
+ if (peer != null)
+ {
+ LabelPeer lp = (LabelPeer) peer;
+ lp.setText (text);
+ }
+ invalidate();
}
}
diff --git a/libjava/classpath/java/awt/List.java b/libjava/classpath/java/awt/List.java
index 5fcc79b..ab7d359 100644
--- a/libjava/classpath/java/awt/List.java
+++ b/libjava/classpath/java/awt/List.java
@@ -163,6 +163,7 @@ List(int rows, boolean multipleMode)
{
this.rows = rows;
this.multipleMode = multipleMode;
+ selected = new int[0];
if (GraphicsEnvironment.isHeadless())
throw new HeadlessException ();
diff --git a/libjava/classpath/java/awt/MenuItem.java b/libjava/classpath/java/awt/MenuItem.java
index 66798c8..58dcb67 100644
--- a/libjava/classpath/java/awt/MenuItem.java
+++ b/libjava/classpath/java/awt/MenuItem.java
@@ -179,14 +179,11 @@ private transient ActionListener action_listeners;
*/
public boolean setCurrentAccessibleValue(Number number)
{
- if (number.intValue() == 0)
- {
- setEnabled(false);
- return false;
- }
-
- setEnabled(true);
- return true;
+ boolean result = (number.intValue() != 0);
+ // this. is required by javac 1.3, otherwise it is confused with
+ // MenuItem.this.setEnabled.
+ this.setEnabled(result);
+ return result;
}
/* (non-Javadoc)
diff --git a/libjava/classpath/java/awt/TextComponent.java b/libjava/classpath/java/awt/TextComponent.java
index 9edbd88..60e72fc 100644
--- a/libjava/classpath/java/awt/TextComponent.java
+++ b/libjava/classpath/java/awt/TextComponent.java
@@ -475,7 +475,7 @@ select(int selectionStart, int selectionEnd)
if (selectionEnd > text.length())
selectionEnd = text.length();
- if (selectionStart > getSelectionEnd())
+ if (selectionStart > selectionEnd)
selectionStart = selectionEnd;
this.selectionStart = selectionStart;
diff --git a/libjava/classpath/java/awt/Toolkit.java b/libjava/classpath/java/awt/Toolkit.java
index c7c6f9f..2ca88b6 100644
--- a/libjava/classpath/java/awt/Toolkit.java
+++ b/libjava/classpath/java/awt/Toolkit.java
@@ -790,6 +790,9 @@ public abstract class Toolkit
{
// Presumably the only reason this isn't abstract is for backwards
// compatibility? FIXME?
+ if (GraphicsEnvironment.isHeadless())
+ throw new HeadlessException("No custom cursor in an headless graphics "
+ + "environment.");
return null;
}
@@ -801,6 +804,9 @@ public abstract class Toolkit
*/
public Dimension getBestCursorSize(int preferredWidth, int preferredHeight)
{
+ if (GraphicsEnvironment.isHeadless())
+ throw new HeadlessException("No best cursor size in an headless "
+ + "graphics environment.");
return new Dimension (0,0);
}
diff --git a/libjava/classpath/java/awt/Window.java b/libjava/classpath/java/awt/Window.java
index e26c4e3..1689d03 100644
--- a/libjava/classpath/java/awt/Window.java
+++ b/libjava/classpath/java/awt/Window.java
@@ -155,6 +155,9 @@ public class Window extends Container implements Accessible
}
}
});
+
+ GraphicsEnvironment g = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ graphicsConfiguration = g.getDefaultScreenDevice().getDefaultConfiguration();
}
Window(GraphicsConfiguration gc)
@@ -619,6 +622,8 @@ public class Window extends Container implements Accessible
|| windowStateListener != null
|| (eventMask & AWTEvent.WINDOW_EVENT_MASK) != 0))
processEvent(e);
+ else if (e.id == ComponentEvent.COMPONENT_RESIZED)
+ validate ();
else
super.dispatchEventImpl(e);
}
@@ -741,7 +746,25 @@ public class Window extends Container implements Accessible
if (activeWindow == this)
return manager.getFocusOwner ();
else
- return windowFocusOwner;
+ return null;
+ }
+
+ /**
+ * Returns the child component of this window that would receive
+ * focus if this window were to become focused. If the window
+ * already has the top-level focus, then this method returns the
+ * same component as getFocusOwner. If no child component has
+ * requested focus within the window, then the initial focus owner
+ * is returned. If this is a non-focusable window, this method
+ * returns null.
+ *
+ * @return the child component of this window that most recently had
+ * the focus, or <code>null</code>
+ * @since 1.4
+ */
+ public Component getMostRecentFocusOwner ()
+ {
+ return windowFocusOwner;
}
/**
@@ -1070,44 +1093,6 @@ public class Window extends Container implements Accessible
this.focusableWindowState = focusableWindowState;
}
- // setBoundsCallback is needed so that when a user moves a window,
- // the Window's location can be updated without calling the peer's
- // setBounds method. When a user moves a window the peer window's
- // location is updated automatically and the windowing system sends
- // a message back to the application informing it of its updated
- // dimensions. We must update the AWT Window class with these new
- // dimensions. But we don't want to call the peer's setBounds
- // method, because the peer's dimensions have already been updated.
- // (Under X, having this method prevents Configure event loops when
- // moving windows: Component.setBounds -> peer.setBounds ->
- // postConfigureEvent -> Component.setBounds -> ... In some cases
- // Configure event loops cause windows to jitter back and forth
- // continuously).
- void setBoundsCallback (int x, int y, int w, int h)
- {
- if (this.x == x && this.y == y && width == w && height == h)
- return;
- invalidate();
- boolean resized = width != w || height != h;
- boolean moved = this.x != x || this.y != y;
- this.x = x;
- this.y = y;
- width = w;
- height = h;
- if (resized && isShowing ())
- {
- ComponentEvent ce =
- new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED);
- getToolkit().getSystemEventQueue().postEvent(ce);
- }
- if (moved && isShowing ())
- {
- ComponentEvent ce =
- new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED);
- getToolkit().getSystemEventQueue().postEvent(ce);
- }
- }
-
/**
* Generate a unique name for this window.
*
diff --git a/libjava/classpath/java/awt/datatransfer/Clipboard.java b/libjava/classpath/java/awt/datatransfer/Clipboard.java
index 9953a72..5fa1d1a 100644
--- a/libjava/classpath/java/awt/datatransfer/Clipboard.java
+++ b/libjava/classpath/java/awt/datatransfer/Clipboard.java
@@ -1,5 +1,5 @@
/* Clipboard.java -- Class for transferring data via cut and paste.
- Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,16 +38,21 @@ exception statement from your version. */
package java.awt.datatransfer;
+import java.io.IOException;
+import java.util.ArrayList;
+
/**
* This class allows data to be transferred using a cut and paste type
* mechanism.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Mark J. Wielaard (mark@klomp.org)
*/
public class Clipboard
{
/**
- * The data being transferred.
+ * The data currently on this clipboard. For use by
+ * subclasses. Also returned by the public method getContents().
*/
protected Transferable contents;
@@ -57,7 +62,10 @@ public class Clipboard
protected ClipboardOwner owner;
// The clipboard name
- private String name;
+ private final String name;
+
+ // The flavor listeners (most likely small).
+ private final ArrayList listeners = new ArrayList(3);
/**
* Initializes a new instance of <code>Clipboard</code> with the
@@ -81,7 +89,8 @@ public class Clipboard
/**
* Returns the contents of the clipboard.
*
- * @param requestor The object requesting the contents.
+ * @param requestor The object requesting the contents. This
+ * implementation ignores this parameter.
*
* @exception IllegalStateException If the clipboard is currently unavailable
*/
@@ -91,24 +100,108 @@ public class Clipboard
}
/**
- * Sets the content and owner of this clipboard.
- * If the given owner is different from the current owner
- * then lostOwnership is called on the current owner.
- * XXX - is this called with the old or new contents.
+ * Sets the content and owner of this clipboard. If the given owner
+ * is different from the current owner then <code>lostOwnership()</code>
+ * is called on the current owner with the old contents of the given
+ * clipboard.
*
* @param contents The new clipboard contents.
* @param owner The new clipboard owner
*
* @exception IllegalStateException If the clipboard is currently unavailable
*/
- public synchronized void setContents(Transferable contents, ClipboardOwner owner)
+ public synchronized void setContents(Transferable contents,
+ ClipboardOwner owner)
{
- if (this.owner != owner)
- if (this.owner != null)
- this.owner.lostOwnership(this, contents);
-
- this.owner = owner;
+ Transferable oldContents = getContents(null);
this.contents = contents;
+ if (this.owner != owner)
+ {
+ ClipboardOwner oldOwner = this.owner;
+ this.owner = owner;
+ if (oldOwner != null)
+ oldOwner.lostOwnership(this, oldContents);
+ }
+
+ FlavorListener[] fs = getFlavorListeners();
+ if (fs.length > 0)
+ {
+ // We are a bit optimistic here. We assume DataFlavors will be
+ // given in the same order. If the number of flavors is
+ // different or the order of the DataFlavors in the list then
+ // fire a change event.
+ boolean newFlavors = ((contents != null && oldContents == null)
+ || (contents == null && oldContents != null));
+ if (!newFlavors && contents != null && oldContents != null)
+ {
+ DataFlavor[] df1 = contents.getTransferDataFlavors();
+ DataFlavor[] df2 = oldContents.getTransferDataFlavors();
+ newFlavors = df1.length != df2.length;
+
+ for (int i = 0; !newFlavors && i < df1.length; i++)
+ newFlavors = !df1[i].equals(df2[i]);
+ }
+
+ if (newFlavors)
+ {
+ FlavorEvent e = new FlavorEvent(this);
+ for (int i = 0; i < fs.length; i++)
+ fs[i].flavorsChanged(e);
+ }
+ }
+ }
+
+ public DataFlavor[] getAvailableDataFlavors()
+ {
+ Transferable c = getContents(null);
+ if (c == null)
+ return new DataFlavor[0];
+ else
+ return c.getTransferDataFlavors();
+ }
+
+ public boolean isDataFlavorAvailable(DataFlavor flavor)
+ {
+ DataFlavor[] fs = getAvailableDataFlavors();
+ for (int i = 0; i < fs.length; i++)
+ if (flavor.equals(fs[i]))
+ return true;
+
+ return false;
}
-}
+ public Object getData(DataFlavor flavor)
+ throws UnsupportedFlavorException, IOException
+ {
+ Transferable c = getContents(null);
+ if (c == null)
+ throw new UnsupportedFlavorException(flavor);
+ else
+ return c.getTransferData(flavor);
+ }
+
+ public void addFlavorListener(FlavorListener listener)
+ {
+ synchronized(listeners)
+ {
+ listeners.add(listener);
+ }
+ }
+
+ public void removeFlavorListener(FlavorListener listener)
+ {
+ synchronized(listeners)
+ {
+ listeners.remove(listener);
+ }
+ }
+
+ public FlavorListener[] getFlavorListeners()
+ {
+ synchronized(listeners)
+ {
+ return (FlavorListener[])
+ listeners.toArray(new FlavorListener[listeners.size()]);
+ }
+ }
+}
diff --git a/libjava/classpath/java/awt/datatransfer/DataFlavor.java b/libjava/classpath/java/awt/datatransfer/DataFlavor.java
index e5fbd24..38f415b 100644
--- a/libjava/classpath/java/awt/datatransfer/DataFlavor.java
+++ b/libjava/classpath/java/awt/datatransfer/DataFlavor.java
@@ -49,6 +49,7 @@ import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
+import java.rmi.Remote;
/**
* This class represents a particular data format used for transferring
@@ -127,10 +128,9 @@ static
javaFileListFlavor
= new DataFlavor(java.util.List.class,
+ "application/x-java-file-list; class=java.util.List",
"Java File List");
- // javaFileListFlavor.mimeType = "application/x-java-file-list";
-
imageFlavor
= new DataFlavor(java.awt.Image.class,
"Java Image");
@@ -335,7 +335,8 @@ getRepresentationClassFromMime(String mimeString, ClassLoader classLoader)
public
DataFlavor(String mimeType, String humanPresentableName)
{
- this (getRepresentationClassFromMime (mimeType, null), humanPresentableName);
+ this (getRepresentationClassFromMime (mimeType, null),
+ mimeType, humanPresentableName);
}
/*************************************************************************/
@@ -426,17 +427,15 @@ getPrimaryType()
public String
getSubType()
{
- int idx = mimeType.indexOf("/");
- if (idx == -1)
- return("");
-
- String subtype = mimeType.substring(idx + 1);
+ int start = mimeType.indexOf("/");
+ if (start == -1)
+ return "";
- idx = subtype.indexOf(" ");
- if (idx == -1)
- return(subtype);
+ int end = mimeType.indexOf(";", start + 1);
+ if (end == -1)
+ return mimeType.substring(start + 1);
else
- return(subtype.substring(0, idx));
+ return mimeType.substring(start + 1, end);
}
/*************************************************************************/
@@ -480,6 +479,9 @@ getParameter(String paramName, String mimeString)
public String
getParameter(String paramName)
{
+ if ("humanPresentableName".equals(paramName))
+ return getHumanPresentableName();
+
return getParameter(paramName, mimeType);
}
@@ -500,21 +502,28 @@ setHumanPresentableName(String humanPresentableName)
/**
* Tests the MIME type of this object for equality against the specified
- * MIME type.
+ * MIME type. Ignores parameters.
*
* @param mimeType The MIME type to test against.
*
* @return <code>true</code> if the MIME type is equal to this object's
- * MIME type, <code>false</code> otherwise.
+ * MIME type (ignoring parameters), <code>false</code> otherwise.
*
* @exception NullPointerException If mimeType is null.
*/
public boolean
isMimeTypeEqual(String mimeType)
{
- // FIXME: Need to handle default attributes and parameters
+ String mime = getMimeType();
+ int i = mime.indexOf(";");
+ if (i != -1)
+ mime = mime.substring(0, i);
+
+ i = mimeType.indexOf(";");
+ if (i != -1)
+ mimeType = mimeType.substring(0, i);
- return(this.mimeType.equals(mimeType));
+ return mime.equals(mimeType);
}
/*************************************************************************/
@@ -599,8 +608,7 @@ isRepresentationClassSerializable()
public boolean
isRepresentationClassRemote()
{
- // FIXME: Implement
- throw new RuntimeException("Not implemented");
+ return Remote.class.isAssignableFrom (representationClass);
}
/*************************************************************************/
@@ -852,12 +860,11 @@ readExternal(ObjectInput stream) throws IOException, ClassNotFoundException
public String
toString()
{
- return("DataFlavor[representationClass="
- + representationClass.getName()
- + ",mimeType="
- + mimeType
- + "humanPresentableName="
- + humanPresentableName);
+ return(getClass().getName()
+ + "[representationClass=" + getRepresentationClass().getName()
+ + ",mimeType=" + getMimeType()
+ + ",humanPresentableName=" + getHumanPresentableName()
+ + "]");
}
/*************************************************************************/
diff --git a/libjava/classpath/java/awt/event/MouseWheelEvent.java b/libjava/classpath/java/awt/event/MouseWheelEvent.java
index bc603aa..d1d22d2 100644
--- a/libjava/classpath/java/awt/event/MouseWheelEvent.java
+++ b/libjava/classpath/java/awt/event/MouseWheelEvent.java
@@ -49,7 +49,7 @@ import javax.swing.Scrollable;
/**
* This event is generated for a mouse wheel rotation. The wheel (the middle
* mouse button on most modern mice) can be rotated towards or away from the
- * user, and is ofteh used for scrolling.
+ * user, and is often used for scrolling.
*
* <p>Because of the special use for scrolling components, MouseWheelEvents
* often affect a different component than the one located at the point of
diff --git a/libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java b/libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java
index b9ca1b7..194d483 100644
--- a/libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java
+++ b/libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java
@@ -80,6 +80,7 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter
*/
public void setHints(int flags)
{
+ if (consumer != null)
consumer.setHints(flags);
}
@@ -100,6 +101,7 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter
public void setPixels(int x, int y, int w, int h,
ColorModel model, byte[] pixels, int offset, int scansize)
{
+ if (consumer != null)
consumer.setPixels(x, y, w, h, model, pixels, offset, scansize);
}
@@ -120,6 +122,7 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter
public void setPixels(int x, int y, int w, int h,
ColorModel model, int[] pixels, int offset, int scansize)
{
+ if (consumer != null)
consumer.setPixels(x, y, w, h, model, pixels, offset, scansize);
}
diff --git a/libjava/classpath/java/awt/image/ConvolveOp.java b/libjava/classpath/java/awt/image/ConvolveOp.java
index f841c13..49ca2a6 100644
--- a/libjava/classpath/java/awt/image/ConvolveOp.java
+++ b/libjava/classpath/java/awt/image/ConvolveOp.java
@@ -1,5 +1,5 @@
/* ConvolveOp.java --
- Copyright (C) 2004 Free Software Foundation -- ConvolveOp
+ Copyright (C) 2004, 2005 Free Software Foundation -- ConvolveOp
This file is part of GNU Classpath.
@@ -177,11 +177,13 @@ public class ConvolveOp implements BufferedImageOp, RasterOp
}
/**
+ * Returns (a clone of) the convolution kernel.
+ *
* @return The convolution kernel.
*/
public Kernel getKernel()
{
- return kernel;
+ return (Kernel) kernel.clone();
}
/* (non-Javadoc)
@@ -189,8 +191,6 @@ public class ConvolveOp implements BufferedImageOp, RasterOp
* java.awt.image.WritableRaster)
*/
public WritableRaster filter(Raster src, WritableRaster dest) {
- if (src.numBands != dest.numBands)
- throw new ImagingOpException(null);
if (src == dest)
throw new IllegalArgumentException();
if (src.getWidth() < kernel.getWidth() ||
@@ -199,6 +199,8 @@ public class ConvolveOp implements BufferedImageOp, RasterOp
if (dest == null)
dest = createCompatibleDestRaster(src);
+ else if (src.numBands != dest.numBands)
+ throw new ImagingOpException(null);
// Deal with bottom edge
if (edge == EDGE_ZERO_FILL)
diff --git a/libjava/classpath/java/awt/image/CropImageFilter.java b/libjava/classpath/java/awt/image/CropImageFilter.java
index 490f43c..4fcfdec 100644
--- a/libjava/classpath/java/awt/image/CropImageFilter.java
+++ b/libjava/classpath/java/awt/image/CropImageFilter.java
@@ -79,6 +79,7 @@ public class CropImageFilter extends ImageFilter
*/
public void setDimensions(int width, int height)
{
+ if (consumer != null)
consumer.setDimensions(this.width, this.height);
}
@@ -93,7 +94,8 @@ public class CropImageFilter extends ImageFilter
public void setProperties(Hashtable props)
{
props.put("filters", "CropImageFilter");
- consumer.setProperties(props);
+ if (consumer != null)
+ consumer.setProperties(props);
}
/**
@@ -130,9 +132,10 @@ public class CropImageFilter extends ImageFilter
cropped[i * bounds.width + j] = pixels[start + bounds.x + j];
}
- consumer.setPixels(bounds.x, bounds.y,
- bounds.width, bounds.height,
- model, cropped, 0, bounds.width);
+ if (consumer != null)
+ consumer.setPixels(0, 0,
+ bounds.width, bounds.height,
+ model, cropped, 0, bounds.width);
}
}
@@ -170,9 +173,10 @@ public class CropImageFilter extends ImageFilter
cropped[i * bounds.width + j] = pixels[start + bounds.x + j];
}
- consumer.setPixels(bounds.x, bounds.y,
- bounds.width, bounds.height,
- model, cropped, 0, bounds.width);
+ if (consumer != null)
+ consumer.setPixels(0, 0,
+ bounds.width, bounds.height,
+ model, cropped, 0, bounds.width);
}
}
diff --git a/libjava/classpath/java/awt/image/DirectColorModel.java b/libjava/classpath/java/awt/image/DirectColorModel.java
index c98c3f8..4f37151 100644
--- a/libjava/classpath/java/awt/image/DirectColorModel.java
+++ b/libjava/classpath/java/awt/image/DirectColorModel.java
@@ -348,9 +348,24 @@ public class DirectColorModel extends PackedColorModel
{
return getComponents(getPixelFromArray(pixel), components, offset);
}
-
+
+ /**
+ * Creates a <code>WriteableRaster</code> that has a <code>SampleModel</code>
+ * that is compatible with this <code>ColorModel</code>.
+ *
+ * @param w the width of the writeable raster to create
+ * @param h the height of the writeable raster to create
+ *
+ * @throws IllegalArgumentException if <code>w</code> or <code>h</code>
+ * is less than or equal to zero
+ */
public final WritableRaster createCompatibleWritableRaster(int w, int h)
{
+ // Sun also makes this check here.
+ if(w <= 0 || h <= 0)
+ throw new IllegalArgumentException("width (=" + w + ") and height (="
+ + h + ") must be > 0");
+
SampleModel sm = createCompatibleSampleModel(w, h);
Point origin = new Point(0, 0);
return Raster.createWritableRaster(sm, origin);
@@ -418,3 +433,4 @@ public class DirectColorModel extends PackedColorModel
return super.toString();
}
}
+
diff --git a/libjava/classpath/java/awt/image/ImageFilter.java b/libjava/classpath/java/awt/image/ImageFilter.java
index 9940a2b..c39c4a4 100644
--- a/libjava/classpath/java/awt/image/ImageFilter.java
+++ b/libjava/classpath/java/awt/image/ImageFilter.java
@@ -125,6 +125,7 @@ public class ImageFilter implements ImageConsumer, Cloneable
*/
public void setDimensions(int width, int height)
{
+ if (consumer != null)
consumer.setDimensions(width, height);
}
@@ -137,7 +138,8 @@ public class ImageFilter implements ImageConsumer, Cloneable
public void setProperties(Hashtable props)
{
props.put("filters", "ImageFilter");
- consumer.setProperties(props);
+ if (consumer != null)
+ consumer.setProperties(props);
}
/**
@@ -149,6 +151,7 @@ public class ImageFilter implements ImageConsumer, Cloneable
* @see ColorModel */
public void setColorModel(ColorModel model)
{
+ if (consumer != null)
consumer.setColorModel(model);
}
@@ -164,6 +167,7 @@ public class ImageFilter implements ImageConsumer, Cloneable
*/
public void setHints(int flags)
{
+ if (consumer != null)
consumer.setHints(flags);
}
@@ -184,6 +188,7 @@ public class ImageFilter implements ImageConsumer, Cloneable
public void setPixels(int x, int y, int w, int h,
ColorModel model, byte[] pixels, int offset, int scansize)
{
+ if (consumer != null)
consumer.setPixels(x, y, w, h, model, pixels, offset, scansize);
}
@@ -204,6 +209,7 @@ public class ImageFilter implements ImageConsumer, Cloneable
public void setPixels(int x, int y, int w, int h,
ColorModel model, int[] pixels, int offset, int scansize)
{
+ if (consumer != null)
consumer.setPixels(x, y, w, h, model, pixels, offset, scansize);
}
@@ -215,6 +221,7 @@ public class ImageFilter implements ImageConsumer, Cloneable
*/
public void imageComplete(int status)
{
+ if (consumer != null)
consumer.imageComplete(status);
}
}
diff --git a/libjava/classpath/java/awt/image/PixelGrabber.java b/libjava/classpath/java/awt/image/PixelGrabber.java
index b576dbf..b8ca70c 100644
--- a/libjava/classpath/java/awt/image/PixelGrabber.java
+++ b/libjava/classpath/java/awt/image/PixelGrabber.java
@@ -131,6 +131,9 @@ public class PixelGrabber implements ImageConsumer
public PixelGrabber(ImageProducer ip, int x, int y, int w, int h,
int pix[], int off, int scansize)
{
+ if (ip == null)
+ throw new NullPointerException("The ImageProducer must not be null.");
+
this.ip = ip;
this.x = x;
this.y = y;
@@ -179,6 +182,10 @@ public class PixelGrabber implements ImageConsumer
boolean forceRGB)
{
this.ip = img.getSource();
+
+ if (this.ip == null)
+ throw new NullPointerException("The ImageProducer must not be null.");
+
this.x = x;
this.y = y;
width = w;
@@ -209,7 +216,15 @@ public class PixelGrabber implements ImageConsumer
{
public void run ()
{
- ip.startProduction (PixelGrabber.this);
+ try
+ {
+ ip.startProduction (PixelGrabber.this);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ imageComplete(ImageConsumer.IMAGEABORTED);
+ }
}
};
grabberThread.start ();
@@ -601,7 +616,8 @@ public class PixelGrabber implements ImageConsumer
consumerStatus = status;
setObserverStatus ();
grabbing = false;
- ip.removeConsumer (this);
+ if (ip != null)
+ ip.removeConsumer (this);
notifyAll ();
}
diff --git a/libjava/classpath/java/awt/image/RGBImageFilter.java b/libjava/classpath/java/awt/image/RGBImageFilter.java
index f7b39b9..ecfed06 100644
--- a/libjava/classpath/java/awt/image/RGBImageFilter.java
+++ b/libjava/classpath/java/awt/image/RGBImageFilter.java
@@ -79,10 +79,12 @@ public abstract class RGBImageFilter extends ImageFilter
if( ( model instanceof IndexColorModel) && canFilterIndexColorModel ) {
newmodel = filterIndexColorModel( (IndexColorModel) model );
- consumer.setColorModel(newmodel);
+ if (consumer != null)
+ consumer.setColorModel(newmodel);
}
else {
- consumer.setColorModel(ColorModel.getRGBdefault());
+ if (consumer != null)
+ consumer.setColorModel(ColorModel.getRGBdefault());
}
}
@@ -178,6 +180,7 @@ public abstract class RGBImageFilter extends ImageFilter
{
if(model == origmodel && (model instanceof IndexColorModel) && canFilterIndexColorModel)
{
+ if (consumer != null)
consumer.setPixels(x, y, w, h, newmodel, pixels, offset, scansize);
}
else
@@ -185,7 +188,8 @@ public abstract class RGBImageFilter extends ImageFilter
int intPixels[] =
convertColorModelToDefault( x, y, w, h, model, pixels, offset, scansize );
filterRGBPixels( x, y, w, h, intPixels, offset, scansize );
- consumer.setPixels(x, y, w, h, ColorModel.getRGBdefault(), intPixels, offset, scansize);
+ if (consumer != null)
+ consumer.setPixels(x, y, w, h, ColorModel.getRGBdefault(), intPixels, offset, scansize);
}
}
@@ -209,6 +213,7 @@ public abstract class RGBImageFilter extends ImageFilter
{
if(model == origmodel && (model instanceof IndexColorModel) && canFilterIndexColorModel)
{
+ if (consumer != null)
consumer.setPixels(x, y, w, h, newmodel, pixels, offset, scansize);
}
else
@@ -216,7 +221,8 @@ public abstract class RGBImageFilter extends ImageFilter
//FIXME: Store the filtered pixels in a separate temporary buffer?
convertColorModelToDefault( x, y, w, h, model, pixels, offset, scansize );
filterRGBPixels( x, y, w, h, pixels, offset, scansize );
- consumer.setPixels(x, y, w, h, ColorModel.getRGBdefault(), pixels, offset, scansize);
+ if (consumer != null)
+ consumer.setPixels(x, y, w, h, ColorModel.getRGBdefault(), pixels, offset, scansize);
}
}
diff --git a/libjava/classpath/java/awt/image/ReplicateScaleFilter.java b/libjava/classpath/java/awt/image/ReplicateScaleFilter.java
index 3841e49..d76f9db 100644
--- a/libjava/classpath/java/awt/image/ReplicateScaleFilter.java
+++ b/libjava/classpath/java/awt/image/ReplicateScaleFilter.java
@@ -124,7 +124,8 @@ public class ReplicateScaleFilter extends ImageFilter
destHeight = (int) (height * ((double) destWidth / srcWidth));
}
- consumer.setDimensions(destWidth, destHeight);
+ if (consumer != null)
+ consumer.setDimensions(destWidth, destHeight);
}
/**
@@ -136,7 +137,8 @@ public class ReplicateScaleFilter extends ImageFilter
public void setProperties(Hashtable props)
{
props.put("filters", "ReplicateScaleFilter");
- consumer.setProperties(props);
+ if (consumer != null)
+ consumer.setProperties(props);
}
/**
@@ -165,9 +167,10 @@ public class ReplicateScaleFilter extends ImageFilter
model, pixels, offset, scansize,
rx, ry, destScansize);
- consumer.setPixels((int) Math.floor(x/rx), (int) Math.floor(y/ry),
- (int) Math.ceil(w/rx), (int) Math.ceil(h/ry),
- model, destPixels, 0, destScansize);
+ if (consumer != null)
+ consumer.setPixels((int) Math.floor(x/rx), (int) Math.floor(y/ry),
+ (int) Math.ceil(w/rx), (int) Math.ceil(h/ry),
+ model, destPixels, 0, destScansize);
}
/**
@@ -196,9 +199,10 @@ public class ReplicateScaleFilter extends ImageFilter
model, pixels, offset, scansize,
rx, ry, destScansize);
- consumer.setPixels((int) Math.floor(x/rx), (int) Math.floor(y/ry),
- (int) Math.ceil(w/rx), (int) Math.ceil(h/ry),
- model, destPixels, 0, destScansize);
+ if (consumer != null)
+ consumer.setPixels((int) Math.floor(x/rx), (int) Math.floor(y/ry),
+ (int) Math.ceil(w/rx), (int) Math.ceil(h/ry),
+ model, destPixels, 0, destScansize);
}
private byte[] replicatePixels(int srcx, int srcy, int srcw, int srch,
diff --git a/libjava/classpath/java/awt/peer/ComponentPeer.java b/libjava/classpath/java/awt/peer/ComponentPeer.java
index 7ed8f60..1ba1692 100644
--- a/libjava/classpath/java/awt/peer/ComponentPeer.java
+++ b/libjava/classpath/java/awt/peer/ComponentPeer.java
@@ -51,6 +51,7 @@ import java.awt.Graphics;
import java.awt.GraphicsConfiguration;
import java.awt.Image;
import java.awt.Point;
+import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.event.PaintEvent;
import java.awt.image.ColorModel;
@@ -184,4 +185,48 @@ public interface ComponentPeer
* @since 1.2
*/
void destroyBuffers();
+
+ /**
+ * Get the bounds of this component peer.
+ *
+ * @return component peer bounds
+ * @since 1.5
+ */
+ Rectangle getBounds();
+
+ /**
+ * Reparent this component under another container.
+ *
+ * @param parent
+ * @since 1.5
+ */
+ void reparent(ContainerPeer parent);
+
+ /**
+ * Set the bounds of this component peer.
+ *
+ * @param x the new x co-ordinate
+ * @param y the new y co-ordinate
+ * @param width the new width
+ * @param height the new height
+ * @param z the new stacking level
+ * @since 1.5
+ */
+ void setBounds (int x, int y, int width, int height, int z);
+
+ /**
+ * Check if this component supports being reparented.
+ *
+ * @return true if this component can be reparented,
+ * false otherwise.
+ * @since 1.5
+ */
+ boolean isReparentSupported();
+
+ /**
+ * Layout this component peer.
+ *
+ * @since 1.5
+ */
+ void layout();
}
diff --git a/libjava/classpath/java/awt/peer/ContainerPeer.java b/libjava/classpath/java/awt/peer/ContainerPeer.java
index f1373a1..76673a1 100644
--- a/libjava/classpath/java/awt/peer/ContainerPeer.java
+++ b/libjava/classpath/java/awt/peer/ContainerPeer.java
@@ -54,6 +54,31 @@ public interface ContainerPeer extends ComponentPeer
void endLayout();
boolean isPaintPending();
-
+
+ /**
+ * Check if this container peer can be restacked.
+ *
+ * @return true if this container peer supports being restacked, false otherwise
+ * @since 1.5
+ */
+ boolean isRestackSupported();
+
+ /**
+ * Cancel a pending paint event on a region of this container.
+ *
+ * @param x the x co-ordinate of the region
+ * @param y the y co-ordinate of the region
+ * @param width the width of the region
+ * @param height the height of the region
+ * @since 1.5
+ */
+ void cancelPendingPaint(int x, int y, int width, int height);
+
+ /**
+ * Restack the component peers in this container peer.
+ *
+ * @since 1.5
+ */
+ void restack();
} // interface ContainerPeer
diff --git a/libjava/classpath/java/awt/peer/FramePeer.java b/libjava/classpath/java/awt/peer/FramePeer.java
index 13498ff..13435f8 100644
--- a/libjava/classpath/java/awt/peer/FramePeer.java
+++ b/libjava/classpath/java/awt/peer/FramePeer.java
@@ -51,5 +51,25 @@ public interface FramePeer extends WindowPeer
int getState();
void setState(int state);
void setMaximizedBounds(Rectangle r);
+
+ /**
+ * Check if this frame peer supports being restacked.
+ *
+ * @return true if this frame peer can be restacked,
+ * false otherwise
+ * @since 1.5
+ */
+ boolean isRestackSupported();
+
+ /**
+ * Sets the bounds of this frame peer.
+ *
+ * @param x the new x co-ordinate
+ * @param y the new y co-ordinate
+ * @param width the new width
+ * @param height the new height
+ * @since 1.5
+ */
+ void setBoundsPrivate(int x, int y, int width, int height);
} // interface FramePeer
diff --git a/libjava/classpath/java/awt/peer/MenuBarPeer.java b/libjava/classpath/java/awt/peer/MenuBarPeer.java
index c5f7c58..44e37e2 100644
--- a/libjava/classpath/java/awt/peer/MenuBarPeer.java
+++ b/libjava/classpath/java/awt/peer/MenuBarPeer.java
@@ -42,6 +42,7 @@ import java.awt.Menu;
public interface MenuBarPeer extends MenuComponentPeer
{
+ void addMenu(Menu m);
void addHelpMenu(Menu menu);
void delMenu(int index);
} // interface MenuBarPeer
diff --git a/libjava/classpath/java/awt/peer/MenuComponentPeer.java b/libjava/classpath/java/awt/peer/MenuComponentPeer.java
index 1b10ca1..bfd3414 100644
--- a/libjava/classpath/java/awt/peer/MenuComponentPeer.java
+++ b/libjava/classpath/java/awt/peer/MenuComponentPeer.java
@@ -38,8 +38,18 @@ exception statement from your version. */
package java.awt.peer;
+import java.awt.Font;
+
public interface MenuComponentPeer
{
void dispose();
+
+ /**
+ * Set the font on this menu component peer.
+ *
+ * @param font the new font
+ * @since 1.5
+ */
+ void setFont (Font font);
} // interface MenuComponentPeer
diff --git a/libjava/classpath/java/awt/peer/MenuPeer.java b/libjava/classpath/java/awt/peer/MenuPeer.java
index c51ea73..91d0f0d 100644
--- a/libjava/classpath/java/awt/peer/MenuPeer.java
+++ b/libjava/classpath/java/awt/peer/MenuPeer.java
@@ -43,6 +43,7 @@ import java.awt.MenuItem;
public interface MenuPeer extends MenuItemPeer
{
void addItem (MenuItem item);
+ void addSeparator ();
void delItem (int index);
}
diff --git a/libjava/classpath/java/awt/peer/TextComponentPeer.java b/libjava/classpath/java/awt/peer/TextComponentPeer.java
index cacc7d8..f807299 100644
--- a/libjava/classpath/java/awt/peer/TextComponentPeer.java
+++ b/libjava/classpath/java/awt/peer/TextComponentPeer.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package java.awt.peer;
import java.awt.Rectangle;
+import java.awt.im.InputMethodRequests;
public interface TextComponentPeer extends ComponentPeer
{
@@ -53,5 +54,13 @@ public interface TextComponentPeer extends ComponentPeer
int getIndexAtPoint(int x, int y);
Rectangle getCharacterBounds(int pos);
long filterEvents(long filter);
+
+ /**
+ * Retrieve this text component peer's input method requests.
+ *
+ * @return the input method requests made by this text component peer
+ * @since 1.5
+ */
+ InputMethodRequests getInputMethodRequests();
} // interface TextComponentPeer
diff --git a/libjava/classpath/java/awt/peer/WindowPeer.java b/libjava/classpath/java/awt/peer/WindowPeer.java
index 8f136dd..6c014de 100644
--- a/libjava/classpath/java/awt/peer/WindowPeer.java
+++ b/libjava/classpath/java/awt/peer/WindowPeer.java
@@ -42,5 +42,19 @@ public interface WindowPeer extends ContainerPeer
{
void toBack();
void toFront();
+
+ /**
+ * FIXME: unknown.
+ * @since 1.5
+ */
+ void updateAlwaysOnTop();
+
+ /**
+ * Request that this window peer be given the window focus.
+ *
+ * @return true if the window received focus, false otherwise
+ * @since 1.5
+ */
+ boolean requestWindowFocus();
} // interface WindowPeer
diff --git a/libjava/classpath/java/beans/Expression.java b/libjava/classpath/java/beans/Expression.java
index 20b04f1..d92cb72 100644
--- a/libjava/classpath/java/beans/Expression.java
+++ b/libjava/classpath/java/beans/Expression.java
@@ -1,5 +1,5 @@
/* java.beans.Expression
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,7 +51,7 @@ public class Expression extends Statement
{
// This is a placeholder to indicate that value hasn't been set
// yet;
- private static final Object unset = new Object();
+ private static final Object UNSET = new Object();
// The value to return. This is equal to unset until getValue is called.
private Object value;
@@ -89,7 +89,7 @@ public class Expression extends Statement
public Expression(Object target, String methodName, Object[] arguments)
{
super(target, methodName, arguments);
- this.value = unset;
+ this.value = UNSET;
}
/**
@@ -105,7 +105,7 @@ public class Expression extends Statement
*/
public Object getValue() throws Exception
{
- if (value == unset)
+ if (value == UNSET)
value = doExecute();
return value;
}
@@ -126,7 +126,7 @@ public class Expression extends Statement
public String toString()
{
String result = super.toString();
- if (value != unset)
+ if (value != UNSET)
return value.getClass().getName() + " " + result;
return result;
}
diff --git a/libjava/classpath/java/beans/Statement.java b/libjava/classpath/java/beans/Statement.java
index 01f86dd..8e916a2 100644
--- a/libjava/classpath/java/beans/Statement.java
+++ b/libjava/classpath/java/beans/Statement.java
@@ -1,5 +1,5 @@
/* java.beans.Statement
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,6 +42,9 @@ import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.WeakHashMap;
+
/**
* class Statement
*
@@ -54,6 +57,11 @@ import java.lang.reflect.Method;
*/
public class Statement
{
+ /** Nested map for the relation between a class, its instances and their
+ * names.
+ */
+ private static HashMap classMaps = new HashMap();
+
private Object target;
private String methodName;
private Object[] arguments;
@@ -64,8 +72,11 @@ public class Statement
private transient Constructor ctor;
/**
- * Constructs a statement representing the invocation of
- * object.methodName(arg[0], arg[1], ...);
+ * <p>Constructs a statement representing the invocation of
+ * object.methodName(arg[0], arg[1], ...);</p>
+ *
+ * <p>If the argument array is null it is replaced with an
+ * array of zero length.</p>
*
* @param target The object to invoke the method on.
* @param methodName The object method to invoke.
@@ -75,7 +86,41 @@ public class Statement
{
this.target = target;
this.methodName = methodName;
- this.arguments = arguments;
+ this.arguments = (arguments != null) ? arguments : new Object[0];
+ storeTargetName(target);
+ }
+
+ /** Creates a name for the target instance or does nothing if the object's
+ * name is already known. This makes sure that there *is* a name for every
+ * target instance.
+ */
+ private static synchronized void storeTargetName(Object obj)
+ {
+ Class klass = obj.getClass();
+ WeakHashMap names = (WeakHashMap) classMaps.get(klass);
+
+ if ( names == null )
+ {
+ names = new WeakHashMap();
+
+ names.put(obj,
+ ( klass == String.class ? ("\"" + obj + "\"") :
+ (klass.getName() + names.size()) ));
+
+ classMaps.put(klass, names);
+
+ return;
+ }
+
+ String targetName = (String) names.get(obj);
+ if ( targetName == null )
+ {
+ names.put(obj,
+ ( klass == String.class ? ("\"" + obj + "\"") :
+ (klass.getName() + names.size()) ));
+ }
+
+ // Nothing to do. The given object was already stored.
}
/**
@@ -234,15 +279,7 @@ public class Statement
{
// Skip methods with wrong number of args.
Class ptypes[] = ctors[i].getParameterTypes();
- System.out.println("ptypeslen = " + ptypes.length);
- System.out.println("ptypes = " + ptypes);
- System.out.println("ctor = " + ctors[i].getName());
- for (int j=0; j < ptypes.length; j++) {
- System.out.println("param = " + ptypes[i].getName());
-
- }
-
-
+
if (ptypes.length != args.length)
continue;
@@ -313,14 +350,24 @@ public class Statement
/** Return a string representation. */
public String toString()
{
- String result = target.getClass().getName() + "." + methodName + "(";
+ StringBuffer result = new StringBuffer();
+
+ Class klass = target.getClass();
+
+ result.append( ((WeakHashMap) classMaps.get(klass)).get(target));
+ result.append(".");
+ result.append(methodName);
+ result.append("(");
+
String sep = "";
for (int i = 0; i < arguments.length; i++)
{
- result = result + sep + arguments[i].getClass().getName();
- sep = ", ";
+ result.append(sep);
+ result.append(arguments[i].getClass().getName());
+ sep = ", ";
}
- result = result + ")";
- return result;
+ result.append(")");
+
+ return result.toString();
}
}
diff --git a/libjava/classpath/java/io/ObjectInputStream.java b/libjava/classpath/java/io/ObjectInputStream.java
index 05776a7..54d5eea 100644
--- a/libjava/classpath/java/io/ObjectInputStream.java
+++ b/libjava/classpath/java/io/ObjectInputStream.java
@@ -501,8 +501,7 @@ public class ObjectInputStream extends InputStream
flags, fields);
assignNewHandle(osc);
- if (callersClassLoader == null)
- callersClassLoader = currentLoader();
+ ClassLoader callersClassLoader = currentLoader();
for (int i = 0; i < field_count; i++)
{
@@ -528,36 +527,7 @@ public class ObjectInputStream extends InputStream
/* Now that fields have been read we may resolve the class
* (and read annotation if needed). */
- Class clazz;
- try
- {
- clazz = resolveClass(osc);
- }
- catch (ClassNotFoundException cnfe)
- {
- // Maybe it was an primitive class?
- if (name.equals("void"))
- clazz = Void.TYPE;
- else if (name.equals("boolean"))
- clazz = Boolean.TYPE;
- else if (name.equals("byte"))
- clazz = Byte.TYPE;
- else if (name.equals("short"))
- clazz = Short.TYPE;
- else if (name.equals("char"))
- clazz = Character.TYPE;
- else if (name.equals("int"))
- clazz = Integer.TYPE;
- else if (name.equals("long"))
- clazz = Long.TYPE;
- else if (name.equals("float"))
- clazz = Float.TYPE;
- else if (name.equals("double"))
- clazz = Double.TYPE;
- else
- throw cnfe;
- }
-
+ Class clazz = resolveClass(osc);
boolean oldmode = setBlockDataMode(true);
osc.setClass(clazz, lookupClass(clazz.getSuperclass()));
classLookupTable.put(clazz, osc);
@@ -770,16 +740,34 @@ public class ObjectInputStream extends InputStream
protected Class resolveClass(ObjectStreamClass osc)
throws ClassNotFoundException, IOException
{
- if (callersClassLoader == null)
+ String name = osc.getName();
+ try
{
- callersClassLoader = currentLoader ();
- if (DEBUG && dump)
- {
- dumpElementln ("CallersClassLoader = " + callersClassLoader);
- }
+ return Class.forName(name, true, currentLoader());
+ }
+ catch(ClassNotFoundException x)
+ {
+ if (name.equals("void"))
+ return Void.TYPE;
+ else if (name.equals("boolean"))
+ return Boolean.TYPE;
+ else if (name.equals("byte"))
+ return Byte.TYPE;
+ else if (name.equals("char"))
+ return Character.TYPE;
+ else if (name.equals("short"))
+ return Short.TYPE;
+ else if (name.equals("int"))
+ return Integer.TYPE;
+ else if (name.equals("long"))
+ return Long.TYPE;
+ else if (name.equals("float"))
+ return Float.TYPE;
+ else if (name.equals("double"))
+ return Double.TYPE;
+ else
+ throw x;
}
-
- return Class.forName(osc.getName(), true, callersClassLoader);
}
/**
@@ -957,19 +945,13 @@ public class ObjectInputStream extends InputStream
{
if (this.readDataFromBlock)
{
- if (this.blockDataPosition + length > this.blockDataBytes)
- {
- int remain = this.blockDataBytes - this.blockDataPosition;
- if (remain != 0)
- {
- System.arraycopy(this.blockData, this.blockDataPosition,
- data, offset, remain);
- offset += remain;
- length -= remain;
- }
- readNextBlock ();
- }
-
+ int remain = this.blockDataBytes - this.blockDataPosition;
+ if (remain == 0)
+ {
+ readNextBlock();
+ remain = this.blockDataBytes - this.blockDataPosition;
+ }
+ length = Math.min(length, remain);
System.arraycopy(this.blockData, this.blockDataPosition,
data, offset, length);
this.blockDataPosition += length;
@@ -1281,7 +1263,7 @@ public class ObjectInputStream extends InputStream
}
catch (NoSuchFieldException e)
{
- throw new IllegalArgumentException(e.getMessage());
+ throw new IllegalArgumentException(e);
}
}
@@ -1426,6 +1408,7 @@ public class ObjectInputStream extends InputStream
ObjectStreamField field = clazz.getField(name);
boolean illegal = false;
+ // XXX This code is horrible and needs to be rewritten!
try
{
try
@@ -1485,7 +1468,7 @@ public class ObjectInputStream extends InputStream
catch (NoSuchFieldException e)
{
if (field == null)
- throw new IllegalArgumentException(e.getMessage());
+ throw new IllegalArgumentException(e);
}
}
@@ -1829,8 +1812,8 @@ public class ObjectInputStream extends InputStream
}
catch (InstantiationException e)
{
- throw new ClassNotFoundException
- ("Instance of " + real_class + " could not be created");
+ throw (ClassNotFoundException) new ClassNotFoundException
+ ("Instance of " + real_class + " could not be created").initCause(e);
}
}
@@ -1871,13 +1854,13 @@ public class ObjectInputStream extends InputStream
if (exception instanceof ClassNotFoundException)
throw (ClassNotFoundException) exception;
- throw new IOException("Exception thrown from readObject() on " +
- klass + ": " + exception.getClass().getName());
+ throw (IOException) new IOException(
+ "Exception thrown from readObject() on " + klass).initCause(x);
}
catch (Exception x)
{
- throw new IOException("Failure invoking readObject() on " +
- klass + ": " + x.getClass().getName());
+ throw (IOException) new IOException(
+ "Failure invoking readObject() on " + klass).initCause(x);
}
// Invalidate fields which has been read through readFields.
@@ -1905,7 +1888,6 @@ public class ObjectInputStream extends InputStream
private Hashtable classLookupTable;
private GetField prereadFields;
- private ClassLoader callersClassLoader;
private static boolean dump;
// The nesting depth for debugging output
diff --git a/libjava/classpath/java/lang/Character.java b/libjava/classpath/java/lang/Character.java
index 4eac147..1e4f219 100644
--- a/libjava/classpath/java/lang/Character.java
+++ b/libjava/classpath/java/lang/Character.java
@@ -1457,6 +1457,57 @@ public final class Character implements Serializable, Comparable
private static final int MIRROR_MASK = 0x40;
/**
+ * Min value for supplementary code point.
+ *
+ * @since 1.5
+ */
+ public static final int MIN_SUPPLEMENTARY_CODE_POINT = 0x10000;
+
+ /**
+ * Min value for code point.
+ *
+ * @since 1.5
+ */
+ public static final int MIN_CODE_POINT = 0;
+
+
+ /**
+ * Max value for code point.
+ *
+ * @since 1.5
+ */
+ public static final int MAX_CODE_POINT = 0x010ffff;
+
+
+ /**
+ * Minimum high surrrogate code in UTF-16 encoding.
+ *
+ * @since 1.5
+ */
+ public static final char MIN_HIGH_SURROGATE = '\ud800';
+
+ /**
+ * Maximum high surrrogate code in UTF-16 encoding.
+ *
+ * @since 1.5
+ */
+ public static final char MAX_HIGH_SURROGATE = '\udbff';
+
+ /**
+ * Minimum low surrrogate code in UTF-16 encoding.
+ *
+ * @since 1.5
+ */
+ public static final char MIN_LOW_SURROGATE = '\udc00';
+
+ /**
+ * Maximum low surrrogate code in UTF-16 encoding.
+ *
+ * @since 1.5
+ */
+ public static final char MAX_LOW_SURROGATE = '\udfff';
+
+ /**
* Grabs an attribute offset from the Unicode attribute database. The lower
* 5 bits are the character type, the next 2 bits are flags, and the top
* 9 bits are the offset into the attribute tables.
@@ -2250,4 +2301,118 @@ public final class Character implements Serializable, Comparable
{
return compareTo((Character) o);
}
+
+ /**
+ * Converts a unicode code point to a UTF-16 representation of that
+ * code point.
+ *
+ * @param codePoint the unicode code point
+ *
+ * @return the UTF-16 representation of that code point
+ *
+ * @throws IllegalArgumentException if the code point is not a valid
+ * unicode code point
+ *
+ * @since 1.5
+ */
+ public static char[] toChars(int codePoint)
+ {
+ char[] result = new char[charCount(codePoint)];
+ int ignore = toChars(codePoint, result, 0);
+ return result;
+ }
+
+ /**
+ * Converts a unicode code point to its UTF-16 representation.
+ *
+ * @param codePoint the unicode code point
+ * @param dst the target char array
+ * @param dstIndex the start index for the target
+ *
+ * @return number of characters written to <code>dst</code>
+ *
+ * @throws IllegalArgumentException if <code>codePoint</code> is not a
+ * valid unicode code point
+ * @throws NullPointerException if <code>dst</code> is <code>null</code>
+ * @throws IndexOutOfBoundsException if <code>dstIndex</code> is not valid
+ * in <code>dst</code> or if the UTF-16 representation does not
+ * fit into <code>dst</code>
+ *
+ * @since 1.5
+ */
+ public static int toChars(int codePoint, char[] dst, int dstIndex)
+ {
+ if (!isValidCodePoint(codePoint))
+ {
+ throw new IllegalArgumentException("not a valid code point: "
+ + codePoint);
+ }
+
+ int result;
+ if (isSupplementaryCodePoint(codePoint))
+ {
+ // Write second char first to cause IndexOutOfBoundsException
+ // immediately.
+ dst[dstIndex + 1] = (char) ((codePoint & 0x3ff)
+ + (int) MIN_LOW_SURROGATE );
+ dst[dstIndex] = (char) ((codePoint >> 10) + (int) MIN_HIGH_SURROGATE);
+ result = 2;
+ }
+ else
+ {
+ dst[dstIndex] = (char) codePoint;
+ result = 1;
+ }
+ return result;
+ }
+
+ /**
+ * Return number of 16-bit characters required to represent the given
+ * code point.
+ *
+ * @param codePoint a uncode code point
+ *
+ * @return 2 if codePoint >= 0x10000, 1 otherwise.
+ *
+ * @since 1.5
+ */
+ public static int charCount(int codePoint)
+ {
+ return
+ (codePoint >= MIN_SUPPLEMENTARY_CODE_POINT)
+ ? 2
+ : 1;
+ }
+
+ /**
+ * Determines whether the specified code point is
+ * in the range 0x10000 .. 0x10FFFF, i.e. the character is within the Unicode
+ * supplementary character range.
+ *
+ * @param codePoint a Unicode code point
+ *
+ * @return <code>true</code> if code point is in supplementary range
+ *
+ * @since 1.5
+ */
+ public static boolean isSupplementaryCodePoint(int codePoint)
+ {
+ return codePoint >= MIN_SUPPLEMENTARY_CODE_POINT
+ && codePoint <= MAX_CODE_POINT;
+ }
+
+ /**
+ * Determines whether the specified code point is
+ * in the range 0x0000 .. 0x10FFFF, i.e. it is a valid Unicode code point.
+ *
+ * @param codePoint a Unicode code point
+ *
+ * @return <code>true</code> if code point is valid
+ *
+ * @since 1.5
+ */
+ public static boolean isValidCodePoint(int codePoint)
+ {
+ return codePoint >= MIN_CODE_POINT && codePoint <= MAX_CODE_POINT;
+ }
} // class Character
diff --git a/libjava/classpath/java/lang/Class.java b/libjava/classpath/java/lang/Class.java
index 6b8bc93..22f148e 100644
--- a/libjava/classpath/java/lang/Class.java
+++ b/libjava/classpath/java/lang/Class.java
@@ -156,11 +156,7 @@ public final class Class implements Serializable
*/
public static Class forName(String name) throws ClassNotFoundException
{
- Class result = VMClass.forName (name);
- if (result == null)
- result = Class.forName(name, true,
- VMStackWalker.getCallingClassLoader());
- return result;
+ return VMClass.forName(name, true, VMStackWalker.getCallingClassLoader());
}
/**
@@ -205,24 +201,8 @@ public final class Class implements Serializable
if (cl != null)
sm.checkPermission(new RuntimePermission("getClassLoader"));
}
- if (name.startsWith("["))
- return VMClass.loadArrayClass(name, null);
- Class c = VMClassLoader.loadClass(name, true);
- if (c != null)
- {
- if (initialize)
- VMClass.initialize(c);
- return c;
- }
- throw new ClassNotFoundException(name);
}
- if (name.startsWith("["))
- return VMClass.loadArrayClass(name, classloader);
- Class c = classloader.loadClass(name);
- classloader.resolveClass(c);
- if (initialize)
- VMClass.initialize(c);
- return c;
+ return VMClass.forName(name, initialize, classloader);
}
/**
diff --git a/libjava/classpath/java/lang/ClassLoader.java b/libjava/classpath/java/lang/ClassLoader.java
index b644511..0d50a6e 100644
--- a/libjava/classpath/java/lang/ClassLoader.java
+++ b/libjava/classpath/java/lang/ClassLoader.java
@@ -124,14 +124,6 @@ import java.util.StringTokenizer;
public abstract class ClassLoader
{
/**
- * All classes loaded by this classloader. VM's may choose to implement
- * this cache natively; but it is here available for use if necessary. It
- * is not private in order to allow native code (and trusted subclasses)
- * access to this field.
- */
- final HashMap loadedClasses = new HashMap();
-
- /**
* All packages defined by this classloader. It is not private in order to
* allow native code (and trusted subclasses) access to this field.
*/
@@ -472,15 +464,11 @@ public abstract class ClassLoader
ProtectionDomain domain)
throws ClassFormatError
{
+ checkInitialized();
if (domain == null)
domain = StaticData.defaultProtectionDomain;
- if (! initialized)
- throw new SecurityException("attempt to define class from uninitialized class loader");
- Class retval = VMClassLoader.defineClass(this, name, data,
- offset, len, domain);
- loadedClasses.put(retval.getName(), retval);
- return retval;
+ return VMClassLoader.defineClass(this, name, data, offset, len, domain);
}
/**
@@ -493,6 +481,7 @@ public abstract class ClassLoader
*/
protected final void resolveClass(Class c)
{
+ checkInitialized();
VMClassLoader.resolveClass(c);
}
@@ -508,6 +497,7 @@ public abstract class ClassLoader
protected final Class findSystemClass(String name)
throws ClassNotFoundException
{
+ checkInitialized();
return Class.forName(name, false, StaticData.systemClassLoader);
}
@@ -544,6 +534,7 @@ public abstract class ClassLoader
*/
protected final void setSigners(Class c, Object[] signers)
{
+ checkInitialized();
c.setSigners(signers);
}
@@ -556,9 +547,8 @@ public abstract class ClassLoader
*/
protected final synchronized Class findLoadedClass(String name)
{
- // NOTE: If the VM is keeping its own cache, it may make sense to have
- // this method be native.
- return (Class) loadedClasses.get(name);
+ checkInitialized();
+ return VMClassLoader.findLoadedClass(this, name);
}
/**
@@ -1113,4 +1103,16 @@ public abstract class ClassLoader
.initCause(e);
}
}
+
+ /**
+ * Before doing anything "dangerous" please call this method to make sure
+ * this class loader instance was properly constructed (and not obtained
+ * by exploiting the finalizer attack)
+ * @see #initialized
+ */
+ private void checkInitialized()
+ {
+ if (! initialized)
+ throw new SecurityException("attempt to use uninitialized class loader");
+ }
}
diff --git a/libjava/classpath/java/lang/IllegalArgumentException.java b/libjava/classpath/java/lang/IllegalArgumentException.java
index 7b822b9..75a0b8b 100644
--- a/libjava/classpath/java/lang/IllegalArgumentException.java
+++ b/libjava/classpath/java/lang/IllegalArgumentException.java
@@ -47,7 +47,8 @@ package java.lang;
*
* @author Brian Jones
* @author Warren Levy (warrenl@cygnus.com)
- * @status updated to 1.4
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @status updated to 1.5
*/
public class IllegalArgumentException extends RuntimeException
{
@@ -72,4 +73,57 @@ public class IllegalArgumentException extends RuntimeException
{
super(s);
}
+
+ /**
+ * <p>
+ * Constructs a <code>IllegalArgumentException</code> using
+ * the specified error message, which should give further details
+ * as to the reason for this exception. The specified cause
+ * <code>Throwable</code> may be used to provide additional history,
+ * with regards to the root of the problem. It is perfectly valid
+ * for this to be null, if the cause of the problem is unknown.
+ * </p>
+ * <p>
+ * <strong>Note</strong>: the detail message from the cause is not
+ * automatically incorporated into the resulting detail message of
+ * this exception.
+ * </p>
+ *
+ * @param message the detail message, which should give the reason for
+ * this exception being thrown.
+ * @param cause the cause of this exception, or null if the cause
+ * is unknown.
+ * @since 1.5
+ */
+ public IllegalArgumentException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ /**
+ * <p>
+ * Constructs a <code>IllegalArgumentException</code> using
+ * the specified cause <code>Throwable</code>, which may be used
+ * to provide additional history, with regards to the root of the
+ * problem. It is perfectly valid for this to be null, if the
+ * cause of the problem is unknown.
+ * </p>
+ * <p>
+ * The detail message is automatically constructed from the detail
+ * message of the supplied causal exception. If the cause is null,
+ * then the detail message will also be null. Otherwise, the detail
+ * message of this exception will be that of the causal exception.
+ * This makes this constructor very useful for simply wrapping another
+ * exception.
+ * </p>
+ *
+ * @param cause the cause of this exception, or null if the cause
+ * is unknown.
+ * @since 1.5
+ */
+ public IllegalArgumentException(Throwable cause)
+ {
+ super(cause);
+ }
+
}
diff --git a/libjava/classpath/java/lang/IllegalStateException.java b/libjava/classpath/java/lang/IllegalStateException.java
index 5c2bbad..6b4e5f8 100644
--- a/libjava/classpath/java/lang/IllegalStateException.java
+++ b/libjava/classpath/java/lang/IllegalStateException.java
@@ -51,8 +51,9 @@ package java.lang;
*
* @author Brian Jones
* @author Warren Levy (warrenl@cygnus.com)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.1
- * @status updated to 1.4
+ * @status updated to 1.5
*/
public class IllegalStateException extends RuntimeException
{
@@ -77,4 +78,58 @@ public class IllegalStateException extends RuntimeException
{
super(s);
}
+
+ /**
+ * <p>
+ * Constructs a <code>IllegalStateException</code> using
+ * the specified error message, which should give further details
+ * as to the reason for this exception. The specified cause
+ * <code>Throwable</code> may be used to provide additional history,
+ * with regards to the root of the problem. It is perfectly valid
+ * for this to be null, if the cause of the problem is unknown.
+ * </p>
+ * <p>
+ * <strong>Note</strong>: the detail message from the cause is not
+ * automatically incorporated into the resulting detail message of
+ * this exception.
+ * </p>
+ *
+ * @param message the detail message, which should give the reason for
+ * this exception being thrown.
+ * @param cause the cause of this exception, or null if the cause
+ * is unknown.
+ * @since 1.5
+ */
+ public IllegalStateException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ /**
+ * <p>
+ * Constructs a <code>IllegalStateException</code> using
+ * the specified cause <code>Throwable</code>, which may be used
+ * to provide additional history, with regards to the root of the
+ * problem. It is perfectly valid for this to be null, if the
+ * cause of the problem is unknown.
+ * </p>
+ * <p>
+ * The detail message is automatically constructed from the detail
+ * message of the supplied causal exception. If the cause is null,
+ * then the detail message will also be null. Otherwise, the detail
+ * message of this exception will be that of the causal exception.
+ * This makes this constructor very useful for simply wrapping another
+ * exception.
+ * </p>
+ *
+ * @param cause the cause of this exception, or null if the cause
+ * is unknown.
+ * @since 1.5
+ */
+ public IllegalStateException(Throwable cause)
+ {
+ super(cause);
+ }
+
}
+
diff --git a/libjava/classpath/java/lang/Integer.java b/libjava/classpath/java/lang/Integer.java
index 07be4e3..53de9ab 100644
--- a/libjava/classpath/java/lang/Integer.java
+++ b/libjava/classpath/java/lang/Integer.java
@@ -718,12 +718,12 @@ public final class Integer extends Number implements Comparable
int len = str.length();
boolean isNeg = false;
if (len == 0)
- throw new NumberFormatException();
+ throw new NumberFormatException("string length is null");
int ch = str.charAt(index);
if (ch == '-')
{
if (len == 1)
- throw new NumberFormatException();
+ throw new NumberFormatException("pure '-'");
isNeg = true;
ch = str.charAt(++index);
}
@@ -748,7 +748,7 @@ public final class Integer extends Number implements Comparable
}
}
if (index == len)
- throw new NumberFormatException();
+ throw new NumberFormatException("non terminated number: " + str);
int max = MAX_VALUE / radix;
// We can't directly write `max = (MAX_VALUE + 1) / radix'.
@@ -760,12 +760,12 @@ public final class Integer extends Number implements Comparable
while (index < len)
{
if (val < 0 || val > max)
- throw new NumberFormatException();
+ throw new NumberFormatException("number overflow (pos=" + index + ") : " + str);
ch = Character.digit(str.charAt(index++), radix);
val = val * radix + ch;
if (ch < 0 || (val < 0 && (! isNeg || val != MIN_VALUE)))
- throw new NumberFormatException();
+ throw new NumberFormatException("invalid character at position " + index + " in " + str);
}
return isNeg ? -val : val;
}
diff --git a/libjava/classpath/java/lang/SecurityException.java b/libjava/classpath/java/lang/SecurityException.java
index a95d797..84be33c 100644
--- a/libjava/classpath/java/lang/SecurityException.java
+++ b/libjava/classpath/java/lang/SecurityException.java
@@ -45,8 +45,9 @@ package java.lang;
*
* @author Brian Jones
* @author Warren Levy (warrenl@cygnus.com)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @see SecurityManager
- * @status updated to 1.4
+ * @status updated to 1.5
*/
public class SecurityException extends RuntimeException
{
@@ -71,4 +72,57 @@ public class SecurityException extends RuntimeException
{
super(s);
}
+
+ /**
+ * <p>
+ * Constructs a <code>SecurityException</code> using
+ * the specified error message, which should give further details
+ * as to the reason for this exception. The specified cause
+ * <code>Throwable</code> may be used to provide additional history,
+ * with regards to the root of the problem. It is perfectly valid
+ * for this to be null, if the cause of the problem is unknown.
+ * </p>
+ * <p>
+ * <strong>Note</strong>: the detail message from the cause is not
+ * automatically incorporated into the resulting detail message of
+ * this exception.
+ * </p>
+ *
+ * @param message the detail message, which should give the reason for
+ * this exception being thrown.
+ * @param cause the cause of this exception, or null if the cause
+ * is unknown.
+ * @since 1.5
+ */
+ public SecurityException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ /**
+ * <p>
+ * Constructs a <code>SecurityException</code> using
+ * the specified cause <code>Throwable</code>, which may be used
+ * to provide additional history, with regards to the root of the
+ * problem. It is perfectly valid for this to be null, if the
+ * cause of the problem is unknown.
+ * </p>
+ * <p>
+ * The detail message is automatically constructed from the detail
+ * message of the supplied causal exception. If the cause is null,
+ * then the detail message will also be null. Otherwise, the detail
+ * message of this exception will be that of the causal exception.
+ * This makes this constructor very useful for simply wrapping another
+ * exception.
+ * </p>
+ *
+ * @param cause the cause of this exception, or null if the cause
+ * is unknown.
+ * @since 1.5
+ */
+ public SecurityException(Throwable cause)
+ {
+ super(cause);
+ }
+
}
diff --git a/libjava/classpath/java/lang/UnsupportedOperationException.java b/libjava/classpath/java/lang/UnsupportedOperationException.java
index 0387d0e..e691cc7 100644
--- a/libjava/classpath/java/lang/UnsupportedOperationException.java
+++ b/libjava/classpath/java/lang/UnsupportedOperationException.java
@@ -44,8 +44,9 @@ package java.lang;
* requested of it that it does not support.
*
* @author Warren Levy (warrenl@cygnus.com)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.2
- * @status updated to 1.4
+ * @status updated to 1.5
*/
public class UnsupportedOperationException extends RuntimeException
{
@@ -70,4 +71,57 @@ public class UnsupportedOperationException extends RuntimeException
{
super(s);
}
+
+ /**
+ * <p>
+ * Constructs a <code>UnsupportedOperationException</code> using
+ * the specified error message, which should give further details
+ * as to the reason for this exception. The specified cause
+ * <code>Throwable</code> may be used to provide additional history,
+ * with regards to the root of the problem. It is perfectly valid
+ * for this to be null, if the cause of the problem is unknown.
+ * </p>
+ * <p>
+ * <strong>Note</strong>: the detail message from the cause is not
+ * automatically incorporated into the resulting detail message of
+ * this exception.
+ * </p>
+ *
+ * @param message the detail message, which should give the reason for
+ * this exception being thrown.
+ * @param cause the cause of this exception, or null if the cause
+ * is unknown.
+ * @since 1.5
+ */
+ public UnsupportedOperationException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ /**
+ * <p>
+ * Constructs a <code>UnsupportedOperationException</code> using
+ * the specified cause <code>Throwable</code>, which may be used
+ * to provide additional history, with regards to the root of the
+ * problem. It is perfectly valid for this to be null, if the
+ * cause of the problem is unknown.
+ * </p>
+ * <p>
+ * The detail message is automatically constructed from the detail
+ * message of the supplied causal exception. If the cause is null,
+ * then the detail message will also be null. Otherwise, the detail
+ * message of this exception will be that of the causal exception.
+ * This makes this constructor very useful for simply wrapping another
+ * exception.
+ * </p>
+ *
+ * @param cause the cause of this exception, or null if the cause
+ * is unknown.
+ * @since 1.5
+ */
+ public UnsupportedOperationException(Throwable cause)
+ {
+ super(cause);
+ }
+
}
diff --git a/libjava/classpath/java/lang/reflect/Proxy.java b/libjava/classpath/java/lang/reflect/Proxy.java
index dc1ac87..7a5fd30 100644
--- a/libjava/classpath/java/lang/reflect/Proxy.java
+++ b/libjava/classpath/java/lang/reflect/Proxy.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package java.lang.reflect;
-import gnu.classpath.Configuration;
import gnu.java.lang.reflect.TypeSignature;
import java.io.Serializable;
@@ -263,16 +262,16 @@ public class Proxy implements Serializable
Class clazz = (Class) proxyClasses.get(pt);
if (clazz == null)
{
- if (Configuration.HAVE_NATIVE_GET_PROXY_CLASS)
- clazz = getProxyClass0(loader, interfaces);
+ if (VMProxy.HAVE_NATIVE_GET_PROXY_CLASS)
+ clazz = VMProxy.getProxyClass(loader, interfaces);
else
{
- ProxyData data = (Configuration.HAVE_NATIVE_GET_PROXY_DATA
- ? getProxyData0(loader, interfaces)
+ ProxyData data = (VMProxy.HAVE_NATIVE_GET_PROXY_DATA
+ ? VMProxy.getProxyData(loader, interfaces)
: ProxyData.getProxyData(pt));
- clazz = (Configuration.HAVE_NATIVE_GENERATE_PROXY_CLASS
- ? generateProxyClass0(loader, data)
+ clazz = (VMProxy.HAVE_NATIVE_GENERATE_PROXY_CLASS
+ ? VMProxy.generateProxyClass(loader, data)
: new ClassFactory(data).generate(loader));
}
@@ -388,74 +387,6 @@ public class Proxy implements Serializable
}
/**
- * Optional native method to replace (and speed up) the pure Java
- * implementation of getProxyClass. Only needed if
- * Configuration.HAVE_NATIVE_GET_PROXY_CLASS is true, this does the
- * work of both getProxyData0 and generateProxyClass0 with no
- * intermediate form in Java. The native code may safely assume that
- * this class must be created, and does not already exist.
- *
- * @param loader the class loader to define the proxy class in; null
- * implies the bootstrap class loader
- * @param interfaces the interfaces the class will extend
- * @return the generated proxy class
- * @throws IllegalArgumentException if the constraints for getProxyClass
- * were violated, except for problems with null
- * @throws NullPointerException if `interfaces' is null or contains
- * a null entry, or if handler is null
- * @see Configuration#HAVE_NATIVE_GET_PROXY_CLASS
- * @see #getProxyClass(ClassLoader, Class[])
- * @see #getProxyData0(ClassLoader, Class[])
- * @see #generateProxyClass0(ProxyData)
- */
- private static native Class getProxyClass0(ClassLoader loader,
- Class[] interfaces);
-
- /**
- * Optional native method to replace (and speed up) the pure Java
- * implementation of getProxyData. Only needed if
- * Configuration.HAVE_NATIVE_GET_PROXY_DATA is true. The native code
- * may safely assume that a new ProxyData object must be created which
- * does not duplicate any existing ones.
- *
- * @param loader the class loader to define the proxy class in; null
- * implies the bootstrap class loader
- * @param interfaces the interfaces the class will extend
- * @return all data that is required to make this proxy class
- * @throws IllegalArgumentException if the constraints for getProxyClass
- * were violated, except for problems with null
- * @throws NullPointerException if `interfaces' is null or contains
- * a null entry, or if handler is null
- * @see Configuration.HAVE_NATIVE_GET_PROXY_DATA
- * @see #getProxyClass(ClassLoader, Class[])
- * @see #getProxyClass0(ClassLoader, Class[])
- * @see ProxyType#getProxyData()
- */
- private static native ProxyData getProxyData0(ClassLoader loader,
- Class[] interfaces);
-
- /**
- * Optional native method to replace (and speed up) the pure Java
- * implementation of generateProxyClass. Only needed if
- * Configuration.HAVE_NATIVE_GENERATE_PROXY_CLASS is true. The native
- * code may safely assume that a new Class must be created, and that
- * the ProxyData object does not describe any existing class.
- *
- * @param loader the class loader to define the proxy class in; null
- * implies the bootstrap class loader
- * @param data the struct of information to convert to a Class. This
- * has already been verified for all problems except exceeding
- * VM limitations
- * @return the newly generated class
- * @throws IllegalArgumentException if VM limitations are exceeded
- * @see #getProxyClass(ClassLoader, Class[])
- * @see #getProxyClass0(ClassLoader, Class[])
- * @see ProxyData#generateProxyClass(ClassLoader)
- */
- private static native Class generateProxyClass0(ClassLoader loader,
- ProxyData data);
-
- /**
* Helper class for mapping unique ClassLoader and interface combinations
* to proxy classes.
*
@@ -502,49 +433,6 @@ public class Proxy implements Serializable
return hash;
}
- // A more comprehensive comparison of two arrays,
- // ignore array element order, and
- // ignore redundant elements
- private static boolean sameTypes(Class arr1[], Class arr2[]) {
- if (arr1.length == 1 && arr2.length == 1) {
- return arr1[0] == arr2[0];
- }
-
- // total occurrance of elements of arr1 in arr2
- int total_occ_of_arr1_in_arr2 = 0;
- each_type:
- for (int i = arr1.length; --i >= 0; )
- {
- Class t = arr1[i];
- for (int j = i; --j >= 0; )
- {
- if (t == arr1[j])
- { //found duplicate type
- continue each_type;
- }
- }
-
- // count c(a unique element of arr1)'s
- // occurrences in arr2
- int occ_in_arr2 = 0;
- for (int j = arr2.length; --j >= 0; )
- {
- if (t == arr2[j])
- {
- ++occ_in_arr2;
- }
- }
- if (occ_in_arr2 == 0)
- { // t does not occur in arr2
- return false;
- }
-
- total_occ_of_arr1_in_arr2 += occ_in_arr2;
- }
- // now, each element of arr2 must have been visited
- return total_occ_of_arr1_in_arr2 == arr2.length;
- }
-
/**
* Calculates equality.
*
@@ -556,7 +444,10 @@ public class Proxy implements Serializable
ProxyType pt = (ProxyType) other;
if (loader != pt.loader || interfaces.length != pt.interfaces.length)
return false;
- return sameTypes(interfaces, pt.interfaces);
+ for (int i = 0; i < interfaces.length; i++)
+ if (interfaces[i] != pt.interfaces[i])
+ return false;
+ return true;
}
} // class ProxyType
@@ -720,7 +611,7 @@ public class Proxy implements Serializable
*
* @author Eric Blake (ebb9@email.byu.edu)
*/
- private static final class ProxyData
+ static final class ProxyData
{
/**
* The package this class is in <b>including the trailing dot</b>
@@ -876,7 +767,6 @@ public class Proxy implements Serializable
private static final class ClassFactory
{
/** Constants for assisting the compilation */
- private static final byte POOL = 0;
private static final byte FIELD = 1;
private static final byte METHOD = 2;
private static final byte INTERFACE = 3;
@@ -909,7 +799,6 @@ public class Proxy implements Serializable
private static final char GETFIELD = 180;
private static final char INVOKEVIRTUAL = 182;
private static final char INVOKESPECIAL = 183;
- private static final char INVOKESTATIC = 184;
private static final char INVOKEINTERFACE = 185;
private static final char NEW = 187;
private static final char ANEWARRAY = 189;
diff --git a/libjava/classpath/java/net/DatagramSocket.java b/libjava/classpath/java/net/DatagramSocket.java
index 8596b7f..875ddc7 100644
--- a/libjava/classpath/java/net/DatagramSocket.java
+++ b/libjava/classpath/java/net/DatagramSocket.java
@@ -1,5 +1,5 @@
/* DatagramSocket.java -- A class to model UDP sockets
- Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004
+ Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,6 +38,8 @@ exception statement from your version. */
package java.net;
+import gnu.classpath.SystemProperties;
+
import gnu.java.net.PlainDatagramSocketImpl;
import gnu.java.nio.DatagramChannelImpl;
@@ -172,7 +174,7 @@ public class DatagramSocket
*/
public DatagramSocket(SocketAddress address) throws SocketException
{
- String propVal = System.getProperty("impl.prefix");
+ String propVal = SystemProperties.getProperty("impl.prefix");
if (propVal == null || propVal.equals(""))
impl = new PlainDatagramSocketImpl();
else
diff --git a/libjava/classpath/java/net/Inet4Address.java b/libjava/classpath/java/net/Inet4Address.java
index 00c6501..74ce6ef 100644
--- a/libjava/classpath/java/net/Inet4Address.java
+++ b/libjava/classpath/java/net/Inet4Address.java
@@ -142,7 +142,7 @@ public final class Inet4Address extends InetAddress
*/
public boolean isMCNodeLocal()
{
- return isMCNodeLocal();
+ return super.isMCNodeLocal();
}
/**
@@ -172,7 +172,7 @@ public final class Inet4Address extends InetAddress
*/
public boolean isMCOrgLocal()
{
- return isMCOrgLocal();
+ return super.isMCOrgLocal();
}
/**
diff --git a/libjava/classpath/java/net/JarURLConnection.java b/libjava/classpath/java/net/JarURLConnection.java
index 3067ecb..0ffd1af 100644
--- a/libjava/classpath/java/net/JarURLConnection.java
+++ b/libjava/classpath/java/net/JarURLConnection.java
@@ -1,5 +1,5 @@
/* JarURLConnection.java -- Class for manipulating remote jar files
- Copyright (C) 1998, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -151,8 +151,9 @@ public abstract class JarURLConnection extends URLConnection
*/
public JarEntry getJarEntry() throws IOException
{
+ if (entryName == null)
+ return null;
JarFile jarFile = getJarFile();
-
return jarFile != null ? jarFile.getJarEntry(entryName) : null;
}
diff --git a/libjava/classpath/java/net/NetworkInterface.java b/libjava/classpath/java/net/NetworkInterface.java
index eccd2da..47b1c67 100644
--- a/libjava/classpath/java/net/NetworkInterface.java
+++ b/libjava/classpath/java/net/NetworkInterface.java
@@ -38,7 +38,12 @@ exception statement from your version. */
package java.net;
+import java.util.Collection;
+import java.util.Collections;
import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
import java.util.Vector;
/**
@@ -143,9 +148,7 @@ public final class NetworkInterface
public static NetworkInterface getByName(String name)
throws SocketException
{
- Vector networkInterfaces = VMNetworkInterface.getInterfaces();
-
- for (Enumeration e = networkInterfaces.elements(); e.hasMoreElements();)
+ for (Enumeration e = getNetworkInterfaces(); e.hasMoreElements();)
{
NetworkInterface tmp = (NetworkInterface) e.nextElement();
@@ -170,9 +173,7 @@ public final class NetworkInterface
public static NetworkInterface getByInetAddress(InetAddress addr)
throws SocketException
{
- Vector networkInterfaces = VMNetworkInterface.getInterfaces();
-
- for (Enumeration interfaces = networkInterfaces.elements();
+ for (Enumeration interfaces = getNetworkInterfaces();
interfaces.hasMoreElements();)
{
NetworkInterface tmp = (NetworkInterface) interfaces.nextElement();
@@ -188,6 +189,41 @@ public final class NetworkInterface
throw new SocketException("no network interface is bound to such an IP address");
}
+ static private Collection condense(Collection interfaces)
+ {
+ final Map condensed = new HashMap();
+
+ final Iterator interfs = interfaces.iterator();
+ while (interfs.hasNext()) {
+
+ final NetworkInterface face = (NetworkInterface) interfs.next();
+ final String name = face.getName();
+
+ if (condensed.containsKey(name))
+ {
+ final NetworkInterface conface = (NetworkInterface) condensed.get(name);
+ if (!conface.inetAddresses.containsAll(face.inetAddresses))
+ {
+ final Iterator faceAddresses = face.inetAddresses.iterator();
+ while (faceAddresses.hasNext())
+ {
+ final InetAddress faceAddress = (InetAddress) faceAddresses.next();
+ if (!conface.inetAddresses.contains(faceAddress))
+ {
+ conface.inetAddresses.add(faceAddress);
+ }
+ }
+ }
+ }
+ else
+ {
+ condensed.put(name, face);
+ }
+ }
+
+ return condensed.values();
+ }
+
/**
* Return an <code>Enumeration</code> of all available network interfaces
*
@@ -202,7 +238,9 @@ public final class NetworkInterface
if (networkInterfaces.isEmpty())
return null;
- return networkInterfaces.elements();
+ Collection condensed = condense(networkInterfaces);
+
+ return Collections.enumeration(condensed);
}
/**
diff --git a/libjava/classpath/java/net/URLClassLoader.java b/libjava/classpath/java/net/URLClassLoader.java
index 8ebc3e0..85b3857 100644
--- a/libjava/classpath/java/net/URLClassLoader.java
+++ b/libjava/classpath/java/net/URLClassLoader.java
@@ -588,10 +588,10 @@ public class URLClassLoader extends SecureClassLoader
* in the order given to the URLClassLoader which uses these URLs to
* load classes and resources (after using the default parent ClassLoader).
*
- * @exception SecurityException if the SecurityManager disallows the
- * creation of a ClassLoader.
* @param urls Locations that should be searched by this ClassLoader when
* resolving Classes or Resources.
+ * @exception SecurityException if the SecurityManager disallows the
+ * creation of a ClassLoader.
* @see SecureClassLoader
*/
public URLClassLoader(URL[] urls) throws SecurityException
@@ -610,13 +610,13 @@ public class URLClassLoader extends SecureClassLoader
* can throw a SecurityException. Then the supplied URLs are added
* in the order given to the URLClassLoader which uses these URLs to
* load classes and resources (after using the supplied parent ClassLoader).
- * @exception SecurityException if the SecurityManager disallows the
- * creation of a ClassLoader.
- * @exception SecurityException
* @param urls Locations that should be searched by this ClassLoader when
* resolving Classes or Resources.
* @param parent The parent class loader used before trying this class
* loader.
+ * @exception SecurityException if the SecurityManager disallows the
+ * creation of a ClassLoader.
+ * @exception SecurityException
* @see SecureClassLoader
*/
public URLClassLoader(URL[] urls, ClassLoader parent)
@@ -658,14 +658,14 @@ public class URLClassLoader extends SecureClassLoader
* load classes and resources (after using the supplied parent ClassLoader).
* It will use the supplied <CODE>URLStreamHandlerFactory</CODE> to get the
* protocol handlers of the supplied URLs.
- * @exception SecurityException if the SecurityManager disallows the
- * creation of a ClassLoader.
- * @exception SecurityException
* @param urls Locations that should be searched by this ClassLoader when
* resolving Classes or Resources.
* @param parent The parent class loader used before trying this class
* loader.
* @param factory Used to get the protocol handler for the URLs.
+ * @exception SecurityException if the SecurityManager disallows the
+ * creation of a ClassLoader.
+ * @exception SecurityException
* @see SecureClassLoader
*/
public URLClassLoader(URL[] urls, ClassLoader parent,
@@ -764,12 +764,12 @@ public class URLClassLoader extends SecureClassLoader
* package is sealed. If the Manifest indicates that the package is sealed
* then the Package will be sealed with respect to the supplied URL.
*
- * @exception IllegalArgumentException If this package name already exists
- * in this class loader
* @param name The name of the package
* @param manifest The manifest describing the specification,
* implementation and sealing details of the package
* @param url the code source url to seal the package
+ * @exception IllegalArgumentException If this package name already exists
+ * in this class loader
* @return the defined Package
*/
protected Package definePackage(String name, Manifest manifest, URL url)
@@ -900,7 +900,11 @@ public class URLClassLoader extends SecureClassLoader
else
result = defineClass(className, classData, 0, classData.length, source);
- super.setSigners(result, resource.getCertificates());
+ // Avoid NullPointerExceptions.
+ Certificate[] resourceCertificates = resource.getCertificates();
+ if(resourceCertificates != null)
+ super.setSigners(result, resourceCertificates);
+
return result;
}
catch (IOException ioe)
@@ -1016,11 +1020,11 @@ public class URLClassLoader extends SecureClassLoader
/**
* Finds all the resources with a particular name from all the locations.
*
- * @exception IOException when an error occurs accessing one of the
- * locations
* @param resourceName the name of the resource to lookup
* @return a (possible empty) enumeration of URLs where the resource can be
* found
+ * @exception IOException when an error occurs accessing one of the
+ * locations
*/
public Enumeration findResources(String resourceName)
throws IOException
@@ -1055,7 +1059,7 @@ public class URLClassLoader extends SecureClassLoader
*
* @param source The codesource that needs the permissions to be accessed
* @return the collection of permissions needed to access the code resource
- * @see java.security.SecureClassLoader#getPermissions()
+ * @see java.security.SecureClassLoader#getPermissions(CodeSource)
*/
protected PermissionCollection getPermissions(CodeSource source)
{
diff --git a/libjava/classpath/java/nio/Buffer.java b/libjava/classpath/java/nio/Buffer.java
index 47dabf2..2c7e00d 100644
--- a/libjava/classpath/java/nio/Buffer.java
+++ b/libjava/classpath/java/nio/Buffer.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package java.nio;
-import gnu.classpath.RawData;
+import gnu.classpath.Pointer;
/**
* @since 1.4
@@ -49,7 +49,7 @@ public abstract class Buffer
int limit = 0;
int pos = 0;
int mark = -1;
- RawData address;
+ Pointer address;
/**
* Creates a new Buffer.
diff --git a/libjava/classpath/java/nio/DirectByteBufferImpl.java b/libjava/classpath/java/nio/DirectByteBufferImpl.java
index 1667299..53bb668 100644
--- a/libjava/classpath/java/nio/DirectByteBufferImpl.java
+++ b/libjava/classpath/java/nio/DirectByteBufferImpl.java
@@ -1,4 +1,4 @@
-/* DirectByteBufferImpl.java --
+/* DirectByteBufferImpl.java --
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,7 @@ exception statement from your version. */
package java.nio;
-import gnu.classpath.RawData;
+import gnu.classpath.Pointer;
abstract class DirectByteBufferImpl extends ByteBuffer
{
@@ -59,9 +59,9 @@ abstract class DirectByteBufferImpl extends ByteBuffer
static final class ReadOnly extends DirectByteBufferImpl
{
- ReadOnly(Object owner, RawData address,
- int capacity, int limit,
- int position)
+ ReadOnly(Object owner, Pointer address,
+ int capacity, int limit,
+ int position)
{
super(owner, address, capacity, limit, position);
}
@@ -89,9 +89,9 @@ abstract class DirectByteBufferImpl extends ByteBuffer
super(capacity);
}
- ReadWrite(Object owner, RawData address,
- int capacity, int limit,
- int position)
+ ReadWrite(Object owner, Pointer address,
+ int capacity, int limit,
+ int position)
{
super(owner, address, capacity, limit, position);
}
@@ -109,9 +109,9 @@ abstract class DirectByteBufferImpl extends ByteBuffer
this.address = VMDirectByteBuffer.allocate(capacity);
}
- DirectByteBufferImpl(Object owner, RawData address,
- int capacity, int limit,
- int position)
+ DirectByteBufferImpl(Object owner, Pointer address,
+ int capacity, int limit,
+ int position)
{
super(capacity, limit, position, -1);
this.owner = owner;
@@ -120,7 +120,7 @@ abstract class DirectByteBufferImpl extends ByteBuffer
/**
* Allocates a new direct byte buffer.
- */
+ */
public static ByteBuffer allocate(int capacity)
{
return new DirectByteBufferImpl.ReadWrite(capacity);
@@ -131,7 +131,7 @@ abstract class DirectByteBufferImpl extends ByteBuffer
if (owner == this)
VMDirectByteBuffer.free(address);
}
-
+
public byte get()
{
checkForUnderflow();
@@ -170,7 +170,7 @@ abstract class DirectByteBufferImpl extends ByteBuffer
position(pos + 1);
return this;
}
-
+
public ByteBuffer put(int index, byte value)
{
checkIndex(index);
@@ -178,12 +178,24 @@ abstract class DirectByteBufferImpl extends ByteBuffer
VMDirectByteBuffer.put(address, index, value);
return this;
}
-
+
+ public ByteBuffer put (byte[] src, int offset, int length)
+ {
+ checkArraySize (src.length, offset, length);
+ checkForUnderflow (length);
+
+ int index = position ();
+ VMDirectByteBuffer.put (address, index, src, offset, length);
+ position (index + length);
+
+ return this;
+ }
+
void shiftDown(int dst_offset, int src_offset, int count)
{
VMDirectByteBuffer.shiftDown(address, dst_offset, src_offset, count);
}
-
+
public ByteBuffer compact()
{
checkIfReadOnly();
@@ -191,15 +203,15 @@ abstract class DirectByteBufferImpl extends ByteBuffer
int pos = position();
if (pos > 0)
{
- int count = remaining();
- VMDirectByteBuffer.shiftDown(address, 0, pos, count);
- position(count);
- limit(capacity());
+ int count = remaining();
+ VMDirectByteBuffer.shiftDown(address, 0, pos, count);
+ position(count);
+ limit(capacity());
}
else
{
- position(limit());
- limit(capacity());
+ position(limit());
+ limit(capacity());
}
return this;
}
@@ -233,9 +245,9 @@ abstract class DirectByteBufferImpl extends ByteBuffer
if (mark != pos)
{
- result.position(mark);
- result.mark();
- result.position(pos);
+ result.position(mark);
+ result.mark();
+ result.position(pos);
}
return result;
}
@@ -289,18 +301,18 @@ abstract class DirectByteBufferImpl extends ByteBuffer
{
return ByteBufferHelper.getChar(this, order());
}
-
+
public ByteBuffer putChar(char value)
{
ByteBufferHelper.putChar(this, value, order());
return this;
}
-
+
public char getChar(int index)
{
return ByteBufferHelper.getChar(this, index, order());
}
-
+
public ByteBuffer putChar(int index, char value)
{
ByteBufferHelper.putChar(this, index, value, order());
@@ -311,18 +323,18 @@ abstract class DirectByteBufferImpl extends ByteBuffer
{
return ByteBufferHelper.getShort(this, order());
}
-
+
public ByteBuffer putShort(short value)
{
ByteBufferHelper.putShort(this, value, order());
return this;
}
-
+
public short getShort(int index)
{
return ByteBufferHelper.getShort(this, index, order());
}
-
+
public ByteBuffer putShort(int index, short value)
{
ByteBufferHelper.putShort(this, index, value, order());
@@ -333,18 +345,18 @@ abstract class DirectByteBufferImpl extends ByteBuffer
{
return ByteBufferHelper.getInt(this, order());
}
-
+
public ByteBuffer putInt(int value)
{
ByteBufferHelper.putInt(this, value, order());
return this;
}
-
+
public int getInt(int index)
{
return ByteBufferHelper.getInt(this, index, order());
}
-
+
public ByteBuffer putInt(int index, int value)
{
ByteBufferHelper.putInt(this, index, value, order());
@@ -355,18 +367,18 @@ abstract class DirectByteBufferImpl extends ByteBuffer
{
return ByteBufferHelper.getLong(this, order());
}
-
+
public ByteBuffer putLong(long value)
{
ByteBufferHelper.putLong(this, value, order());
return this;
}
-
+
public long getLong(int index)
{
return ByteBufferHelper.getLong(this, index, order());
}
-
+
public ByteBuffer putLong(int index, long value)
{
ByteBufferHelper.putLong(this, index, value, order());
@@ -377,13 +389,13 @@ abstract class DirectByteBufferImpl extends ByteBuffer
{
return ByteBufferHelper.getFloat(this, order());
}
-
+
public ByteBuffer putFloat(float value)
{
ByteBufferHelper.putFloat(this, value, order());
return this;
}
-
+
public float getFloat(int index)
{
return ByteBufferHelper.getFloat(this, index, order());
@@ -405,12 +417,12 @@ abstract class DirectByteBufferImpl extends ByteBuffer
ByteBufferHelper.putDouble(this, value, order());
return this;
}
-
+
public double getDouble(int index)
{
return ByteBufferHelper.getDouble(this, index, order());
}
-
+
public ByteBuffer putDouble(int index, double value)
{
ByteBufferHelper.putDouble(this, index, value, order());
diff --git a/libjava/classpath/java/nio/MappedByteBufferImpl.java b/libjava/classpath/java/nio/MappedByteBufferImpl.java
index 1b075d8..a53040f 100644
--- a/libjava/classpath/java/nio/MappedByteBufferImpl.java
+++ b/libjava/classpath/java/nio/MappedByteBufferImpl.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package java.nio;
-import gnu.classpath.RawData;
+import gnu.classpath.Pointer;
import java.io.IOException;
@@ -48,12 +48,12 @@ final class MappedByteBufferImpl extends MappedByteBuffer
/** Posix uses this for the pointer returned by mmap;
* Win32 uses it for the pointer returned by MapViewOfFile. */
- public RawData implPtr;
+ public Pointer implPtr;
/** Posix uses this for the actual length passed to mmap;
* Win32 uses it for the pointer returned by CreateFileMapping. */
public long implLen;
- public MappedByteBufferImpl(RawData address, int size, boolean readOnly)
+ public MappedByteBufferImpl(Pointer address, int size, boolean readOnly)
throws IOException
{
super(size, size, 0, -1);
diff --git a/libjava/classpath/java/nio/channels/FileLock.java b/libjava/classpath/java/nio/channels/FileLock.java
index 151c23f..c466958 100644
--- a/libjava/classpath/java/nio/channels/FileLock.java
+++ b/libjava/classpath/java/nio/channels/FileLock.java
@@ -45,10 +45,10 @@ import java.io.IOException;
*/
public abstract class FileLock
{
- FileChannel channel;
- long position;
- long size;
- boolean shared;
+ private final FileChannel channel;
+ private final long position;
+ private final long size;
+ private final boolean shared;
/**
* Initializes the file lock.
diff --git a/libjava/classpath/java/nio/charset/Charset.java b/libjava/classpath/java/nio/charset/Charset.java
index 6de2917..0476b0d 100644
--- a/libjava/classpath/java/nio/charset/Charset.java
+++ b/libjava/classpath/java/nio/charset/Charset.java
@@ -68,9 +68,9 @@ public abstract class Charset implements Comparable
{
private CharsetEncoder cachedEncoder;
private CharsetDecoder cachedDecoder;
-
+
/**
- * Charset providers.
+ * Extra Charset providers.
*/
private static CharsetProvider[] providers;
@@ -204,13 +204,19 @@ public abstract class Charset implements Comparable
private static Charset charsetForName(String charsetName)
{
checkName (charsetName);
- Charset cs = null;
- CharsetProvider[] providers = providers2();
- for (int i = 0; i < providers.length; i++)
+ // Try the default provider first
+ // (so we don't need to load external providers unless really necessary)
+ // if it is an exotic charset try loading the external providers.
+ Charset cs = provider().charsetForName(charsetName);
+ if (cs == null)
{
- cs = providers[i].charsetForName(charsetName);
- if (cs != null)
- break;
+ CharsetProvider[] providers = providers2();
+ for (int i = 0; i < providers.length; i++)
+ {
+ cs = providers[i].charsetForName(charsetName);
+ if (cs != null)
+ break;
+ }
}
return cs;
}
@@ -218,6 +224,11 @@ public abstract class Charset implements Comparable
public static SortedMap availableCharsets()
{
TreeMap charsets = new TreeMap(String.CASE_INSENSITIVE_ORDER);
+ for (Iterator i = provider().charsets(); i.hasNext(); )
+ {
+ Charset cs = (Charset) i.next();
+ charsets.put(cs.name(), cs);
+ }
CharsetProvider[] providers = providers2();
for (int j = 0; j < providers.length; j++)
@@ -246,7 +257,7 @@ public abstract class Charset implements Comparable
/**
* We need to support multiple providers, reading them from
* java.nio.charset.spi.CharsetProvider in the resource directory
- * META-INF/services.
+ * META-INF/services. This returns the "extra" charset providers.
*/
private static CharsetProvider[] providers2()
{
@@ -257,7 +268,6 @@ public abstract class Charset implements Comparable
Enumeration en = ClassLoader.getSystemResources
("META-INF/services/java.nio.charset.spi.CharsetProvider");
LinkedHashSet set = new LinkedHashSet();
- set.add(provider());
while (en.hasMoreElements())
{
BufferedReader rdr = new BufferedReader(new InputStreamReader
diff --git a/libjava/classpath/java/rmi/server/RMIClassLoader.java b/libjava/classpath/java/rmi/server/RMIClassLoader.java
index 1a2e283..a7a7cb8 100644
--- a/libjava/classpath/java/rmi/server/RMIClassLoader.java
+++ b/libjava/classpath/java/rmi/server/RMIClassLoader.java
@@ -214,7 +214,7 @@ public class RMIClassLoader
//try context class loader first
try
{
- return loader.loadClass (name);
+ return Class.forName(name, false, loader);
}
catch (ClassNotFoundException e)
{
@@ -237,7 +237,7 @@ public class RMIClassLoader
") at codebase (" + codebases + ")");
}
- return loader.loadClass (name);
+ return Class.forName(name, false, loader);
}
/**
diff --git a/libjava/classpath/java/security/KeyPairGenerator.java b/libjava/classpath/java/security/KeyPairGenerator.java
index e6f926e..a6e010be 100644
--- a/libjava/classpath/java/security/KeyPairGenerator.java
+++ b/libjava/classpath/java/security/KeyPairGenerator.java
@@ -1,5 +1,5 @@
/* KeyPairGenerator.java --- Key Pair Generator Class
- Copyright (C) 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -300,7 +300,6 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
*/
public void initialize(int keysize, SecureRandom random)
{
- initialize(keysize, random);
}
/**
diff --git a/libjava/classpath/java/security/cert/X509CertSelector.java b/libjava/classpath/java/security/cert/X509CertSelector.java
index 4149a37..e3b8c0e 100644
--- a/libjava/classpath/java/security/cert/X509CertSelector.java
+++ b/libjava/classpath/java/security/cert/X509CertSelector.java
@@ -1,5 +1,5 @@
/* X509CertSelector.java -- selects X.509 certificates by criteria.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -915,7 +915,7 @@ public class X509CertSelector implements CertSelector, Cloneable
}
if (sigId != null)
{
- if (!sigId.equals(cert.getSigAlgOID()))
+ if (!sigId.toString().equals(cert.getSigAlgOID()))
return false;
}
if (subjectKeyId != null)
diff --git a/libjava/classpath/java/sql/Date.java b/libjava/classpath/java/sql/Date.java
index 48a274f..d429cc8 100644
--- a/libjava/classpath/java/sql/Date.java
+++ b/libjava/classpath/java/sql/Date.java
@@ -1,5 +1,5 @@
/* Date.java -- Wrapper around java.util.Date
- Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -154,8 +154,6 @@ public class Date extends java.util.Date
*
* @param str The string to parse.
* @return The resulting <code>java.sql.Date</code> value.
- *
- * @deprecated
*/
public static Date valueOf (String str)
{
@@ -178,8 +176,6 @@ public class Date extends java.util.Date
* This method returns this date in JDBC format.
*
* @return This date as a string.
- *
- * @deprecated
*/
public String toString()
{
diff --git a/libjava/classpath/java/sql/Time.java b/libjava/classpath/java/sql/Time.java
index eb6ef2d..5755152 100644
--- a/libjava/classpath/java/sql/Time.java
+++ b/libjava/classpath/java/sql/Time.java
@@ -1,5 +1,5 @@
/* Time.java -- Wrapper around java.util.Date
- Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -139,8 +139,6 @@ public class Time extends java.util.Date
*
* @param str The string to parse.
* @return The resulting <code>java.sql.Time</code> value.
- *
- * @deprecated
*/
public static Time valueOf (String str)
{
@@ -193,8 +191,6 @@ public class Time extends java.util.Date
* This method returns this date in JDBC format.
*
* @return This date as a string.
- *
- * @deprecated
*/
public String toString ()
{
diff --git a/libjava/classpath/java/text/AttributedCharacterIterator.java b/libjava/classpath/java/text/AttributedCharacterIterator.java
index e5686ba..8413c20 100644
--- a/libjava/classpath/java/text/AttributedCharacterIterator.java
+++ b/libjava/classpath/java/text/AttributedCharacterIterator.java
@@ -58,7 +58,7 @@ import java.util.Set;
public interface AttributedCharacterIterator extends CharacterIterator
{
/**
- * This class defines attribute keys that are used as text attributes.
+ * Defines attribute keys that are used as text attributes.
*/
public static class Attribute implements Serializable
{
@@ -74,7 +74,8 @@ public interface AttributedCharacterIterator extends CharacterIterator
* This is the attribute for the reading form of text. This is used
* for storing pronunciation along with the written text for languages
* which need it. The value of attributes of this key type are
- * instances of <code>Annotation</code> which wrappers a <code>String</code>.
+ * instances of <code>Annotation</code> which wrappers a
+ * <code>String</code>.
*/
public static final Attribute READING = new Attribute ("READING");
@@ -87,14 +88,13 @@ public interface AttributedCharacterIterator extends CharacterIterator
new Attribute ("INPUT_METHOD_SEGMENT");
/**
- * This is the name of the attribute key
+ * The name of the attribute key
* @serial
*/
private String name;
/**
- * This method initializes a new instance of this class with the specified
- * name.
+ * Initializes a new instance of this class with the specified name.
*
* @param name The name of this attribute key.
*/
@@ -104,7 +104,7 @@ public interface AttributedCharacterIterator extends CharacterIterator
}
/**
- * This method returns the name of this attribute.
+ * Returns the name of this attribute.
*
* @return The attribute name
*/
@@ -114,14 +114,16 @@ public interface AttributedCharacterIterator extends CharacterIterator
}
/**
- * This method resolves an instance of <code>AttributedCharacterIterator.Attribute</code>
+ * Resolves an instance of
+ * <code>AttributedCharacterIterator.Attribute</code>
* that is being deserialized to one of the three pre-defined attribute
* constants. It does this by comparing the names of the attributes. The
* constant that the deserialized object resolves to is returned.
*
* @return The resolved contant value
*
- * @exception InvalidObjectException If the object being deserialized cannot be resolved.
+ * @exception InvalidObjectException If the object being deserialized
+ * cannot be resolved.
*/
protected Object readResolve() throws InvalidObjectException
{
@@ -134,21 +136,25 @@ public interface AttributedCharacterIterator extends CharacterIterator
if (this.equals (INPUT_METHOD_SEGMENT))
return INPUT_METHOD_SEGMENT;
- throw new InvalidObjectException ("Can't resolve Attribute: " + getName());
+ throw new InvalidObjectException ("Can't resolve Attribute: "
+ + getName());
}
/**
- * This method tests this object for equality against the specified object.
+ * Tests this object for equality against the specified object.
* The two objects will be considered equal if and only if:
* <ul>
* <li>The specified object is not <code>null</code>.
- * <li>The specified object is an instance of <code>AttributedCharacterIterator.Attribute</code>.
+ * <li>The specified object is an instance of
+ * <code>AttributedCharacterIterator.Attribute</code>.
* <li>The specified object has the same attribute name as this object.
* </ul>
*
- * @param The <code>Object</code> to test for equality against this object.
+ * @param obj the <code>Object</code> to test for equality against this
+ * object.
*
- * @return <code>true</code> if the specified object is equal to this one, <code>false</code> otherwise.
+ * @return <code>true</code> if the specified object is equal to this one,
+ * <code>false</code> otherwise.
*/
public final boolean equals (Object obj)
{
@@ -159,7 +165,7 @@ public interface AttributedCharacterIterator extends CharacterIterator
}
/**
- * This method returns a hash value for this object.
+ * Returns a hash value for this object.
*
* @return A hash value for this object.
*/
@@ -169,7 +175,7 @@ public interface AttributedCharacterIterator extends CharacterIterator
}
/**
- * This method returns a <code>String</code> representation of this object.
+ * Returns a <code>String</code> representation of this object.
*
* @return A <code>String</code> representation of this object.
*/
@@ -181,7 +187,7 @@ public interface AttributedCharacterIterator extends CharacterIterator
} // Inner class Attribute
/**
- * This method returns a list of all keys that are defined for the
+ * Returns a list of all keys that are defined for the
* text range. This can be an empty list if no attributes are defined.
*
* @return A list of keys
@@ -189,15 +195,15 @@ public interface AttributedCharacterIterator extends CharacterIterator
Set getAllAttributeKeys();
/**
- * This method returns a <code>Map</code> of the attributed defined for
- * the current character.
+ * Returns a <code>Map</code> of the attributes defined for the current
+ * character.
*
* @return A <code>Map</code> of the attributes for the current character.
*/
Map getAttributes();
/**
- * This method returns the value of the specified attribute for the
+ * Returns the value of the specified attribute for the
* current character. If the attribute is not defined for the current
* character, <code>null</code> is returned.
*
@@ -208,7 +214,7 @@ public interface AttributedCharacterIterator extends CharacterIterator
Object getAttribute (AttributedCharacterIterator.Attribute attrib);
/**
- * This method returns the index of the first character in the run that
+ * Returns the index of the first character in the run that
* contains all attributes defined for the current character.
*
* @return The start index of the run
@@ -216,7 +222,7 @@ public interface AttributedCharacterIterator extends CharacterIterator
int getRunStart();
/**
- * This method returns the index of the first character in the run that
+ * Returns the index of the first character in the run that
* contains all attributes in the specified <code>Set</code> defined for
* the current character.
*
@@ -227,7 +233,7 @@ public interface AttributedCharacterIterator extends CharacterIterator
int getRunStart (Set attribs);
/**
- * This method returns the index of the first character in the run that
+ * Returns the index of the first character in the run that
* contains the specified attribute defined for the current character.
*
* @param attrib The attribute.
@@ -237,15 +243,15 @@ public interface AttributedCharacterIterator extends CharacterIterator
int getRunStart (AttributedCharacterIterator.Attribute attrib);
/**
- * This method returns the index of the character after the end of the run
- * that contains all attributed defined for the current character.
+ * Returns the index of the character after the end of the run
+ * that contains all attributes defined for the current character.
*
* @return The end index of the run.
*/
int getRunLimit();
/**
- * This method returns the index of the character after the end of the run
+ * Returns the index of the character after the end of the run
* that contains all attributes in the specified <code>Set</code> defined
* for the current character.
*
@@ -256,7 +262,7 @@ public interface AttributedCharacterIterator extends CharacterIterator
int getRunLimit (Set attribs);
/**
- * This methods returns the index of the character after the end of the run
+ * Returns the index of the character after the end of the run
* that contains the specified attribute defined for the current character.
*
* @param attrib The attribute.
diff --git a/libjava/classpath/java/text/AttributedString.java b/libjava/classpath/java/text/AttributedString.java
index b9ced8f..9f0d5af 100644
--- a/libjava/classpath/java/text/AttributedString.java
+++ b/libjava/classpath/java/text/AttributedString.java
@@ -1,5 +1,5 @@
/* AttributedString.java -- Models text with attributes
- Copyright (C) 1998, 1999, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,379 +47,326 @@ import java.util.Map;
import java.util.Set;
/**
- * This class models a <code>String</code> with attributes over various
- * subranges of the string. It allows applications to access this
- * information via the <code>AttributedCharcterIterator</code> interface.
- *
- * @version 0.0
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class AttributedString
-{
-
-/*************************************************************************/
-
-/*
- * Inner Classes
- */
-
-/**
- * This class contains the attributes and ranges of text over which
- * that attributes apply.
- */
-final class AttributeRange
-{
-
-/*
- * Instance Variables
- */
-
-/**
- * A Map of the attributes
- */
-Map attribs;
-
-/**
- * The beginning index of the attributes
- */
-int begin_index;
-
-/**
- * The ending index of the attributes
- */
-int end_index;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-AttributeRange(Map attribs, int begin_index, int end_index)
-{
- this.attribs = attribs;
- this.begin_index = begin_index;
- this.end_index = end_index;
-}
-
-} // Inner class AttributeRange
-
-/*************************************************************************/
-
-/*
- * Instance Variables
+ * This class models a <code>String</code> with attributes over various
+ * subranges of the string. It allows applications to access this
+ * information via the <code>AttributedCharcterIterator</code> interface.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
*/
-
-/**
- * This object holds the string we are representing.
- */
-private StringCharacterIterator sci;
-
-/**
- * This is the attribute information
- */
-private AttributeRange[] attribs;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * This method initializes a new instance of <code>AttributedString</code>
- * that represents the specified <code>String</code> with no attributes.
- *
- * @param str The <code>String</code> to be attributed.
- */
-public
-AttributedString(String str)
-{
- sci = new StringCharacterIterator(str);
- attribs = new AttributeRange[0];
-}
-
-/*************************************************************************/
-
-/**
- * This method initializes a new instance of <code>AttributedString</code>
- * that represents that specified <code>String</code> with the specified
- * attributes over the entire length of the <code>String</code>.
- *
- * @param str The <code>String</code> to be attributed.
- * @param attributes The attribute list.
- */
-public
-AttributedString(String str, Map attributes)
-{
- this(str);
-
- attribs = new AttributeRange[1];
- attribs[0] = new AttributeRange(attributes, 0, str.length());
-}
-
-/*************************************************************************/
-
-/**
- * This method initializes a new instance of <code>AttributedString</code>
- * that will use the text and attribute information from the specified
- * <code>AttributedCharacterIterator</code>.
- *
- * @param aci The <code>AttributedCharacterIterator</code> containing the text and attribute information.
- */
-public
-AttributedString(AttributedCharacterIterator aci)
-{
- this(aci, aci.getBeginIndex(), aci.getEndIndex(), null);
-}
-
-/*************************************************************************/
-
-/**
- * This method initializes a new instance of <code>AttributedString</code>
- * that will use the text and attribute information from the specified
- * subrange of the specified <code>AttributedCharacterIterator</code>.
- *
- * @param aci The <code>AttributedCharacterIterator</code> containing the text and attribute information.
- * @param begin_index The beginning index of the text subrange.
- * @param end_index The ending index of the text subrange.
- */
-public
-AttributedString(AttributedCharacterIterator aci, int begin_index,
- int end_index)
+public class AttributedString
{
- this(aci, begin_index, end_index, null);
-}
-
-/*************************************************************************/
-/**
- * This method initializes a new instance of <code>AttributedString</code>
- * that will use the text and attribute information from the specified
- * subrange of the specified <code>AttributedCharacterIterator</code>.
- * Only attributes from the source iterator that are present in the
- * specified array of attributes will be included in the attribute list
- * for this object.
- *
- * @param aci The <code>AttributedCharacterIterator</code> containing the text and attribute information.
- * @param begin_index The beginning index of the text subrange.
- * @param end_index The ending index of the text subrange.
- * @param attributes A list of attributes to include from the iterator, or <code>null</code> to include all attributes.
- */
-public
-AttributedString(AttributedCharacterIterator aci, int begin_index,
- int end_index, AttributedCharacterIterator.Attribute[] attributes)
-{
- // Validate some arguments
- if ((begin_index < 0) || (end_index < begin_index))
- throw new IllegalArgumentException("Bad index values");
-
- StringBuffer sb = new StringBuffer("");
-
- // Get the valid attribute list
- Set all_attribs = aci.getAllAttributeKeys();
- if (attributes != null)
- all_attribs.retainAll(Arrays.asList(attributes));
-
- // Loop through and extract the attributes
- char c = aci.setIndex(begin_index);
-
- ArrayList accum = new ArrayList();
- do
- {
- sb.append(c);
-
- Iterator iter = all_attribs.iterator();
- while(iter.hasNext())
- {
- Object obj = iter.next();
-
- // What should we do if this is not true?
- if (!(obj instanceof AttributedCharacterIterator.Attribute))
- continue;
-
- AttributedCharacterIterator.Attribute attrib =
- (AttributedCharacterIterator.Attribute)obj;
-
- // Make sure the attribute is defined.
- int rl = aci.getRunLimit(attrib);
- if (rl == -1)
- continue;
- if (rl > end_index)
- rl = end_index;
- rl -= begin_index;
-
- // Check to see if we already processed this one
- int rs = aci.getRunStart(attrib);
- if ((rs < aci.getIndex()) && (aci.getIndex() != begin_index))
- continue;
-
- // If the attribute run starts before the beginning index, we
- // need to junk it if it is an Annotation.
- Object attrib_obj = aci.getAttribute(attrib);
- if (rs < begin_index)
- {
- if (attrib_obj instanceof Annotation)
- continue;
-
- rs = begin_index;
- }
- else
- {
- rs -= begin_index;
- }
-
- // Create a map object. Yes this will only contain one attribute
- Map new_map = new Hashtable();
- new_map.put(attrib, attrib_obj);
-
- // Add it to the attribute list.
- accum.add(new AttributeRange(new_map, rs, rl));
- }
-
- c = aci.next();
+ /**
+ * The attributes and ranges of text over which those attributes apply.
+ */
+ final class AttributeRange
+ {
+
+ /** A Map of the attributes */
+ Map attribs;
+
+ /** The beginning index of the attributes */
+ int begin_index;
+
+ /** The ending index of the attributes */
+ int end_index;
+
+ /**
+ * Creates a new attribute range.
+ *
+ * @param attribs the attributes.
+ * @param begin_index the start index.
+ * @param end_index the end index.
+ */
+ AttributeRange(Map attribs, int begin_index, int end_index)
+ {
+ this.attribs = attribs;
+ this.begin_index = begin_index;
+ this.end_index = end_index;
}
- while(c != CharacterIterator.DONE);
-
- attribs = new AttributeRange[accum.size()];
- attribs = (AttributeRange[]) accum.toArray(attribs);
-
- sci = new StringCharacterIterator(sb.toString());
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * This method adds a new attribute that will cover the entire string.
- *
- * @param attrib The attribute to add.
- * @param value The value of the attribute.
- */
-public void
-addAttribute(AttributedCharacterIterator.Attribute attrib, Object value)
-{
- addAttribute(attrib, value, 0, sci.getEndIndex());
-}
-
-/*************************************************************************/
-
-/**
- * This method adds a new attribute that will cover the specified subrange
- * of the string.
- *
- * @param attrib The attribute to add.
- * @param value The value of the attribute, which may be null.
- * @param begin_index The beginning index of the subrange.
- * @param end_index The ending index of the subrange.
- *
- * @exception IllegalArgumentException If attribute is <code>null</code> or the subrange is not valid.
- */
-public void
-addAttribute(AttributedCharacterIterator.Attribute attrib, Object value,
- int begin_index, int end_index)
-{
- if (attrib == null)
- throw new IllegalArgumentException("null attribute");
-
- HashMap hm = new HashMap();
- hm.put(attrib, value);
- addAttributes(hm, begin_index, end_index);
-}
-
-/*************************************************************************/
-
-/**
- * This method adds all of the attributes in the specified list to the
- * specified subrange of the string.
- *
- * @param attributes The list of attributes.
- * @param begin_index The beginning index.
- * @param end_index The ending index
- *
- * @param IllegalArgumentException If the list is <code>null</code> or the subrange is not valid.
- */
-public void
-addAttributes(Map attributes, int begin_index, int end_index)
-{
- if (attributes == null)
- throw new IllegalArgumentException("null attribute");
-
- if ((begin_index < 0) || (end_index > sci.getEndIndex()) ||
- (end_index < begin_index))
- throw new IllegalArgumentException("bad range");
-
- AttributeRange[] new_list = new AttributeRange[attribs.length + 1];
- System.arraycopy(attribs, 0, new_list, 0, attribs.length);
- attribs = new_list;
- attribs[attribs.length - 1] = new AttributeRange(attributes, begin_index,
- end_index);
-}
-
-/*************************************************************************/
-
-/**
- * This method returns an <code>AttributedCharacterIterator</code> that
- * will iterate over the entire string.
- *
- * @return An <code>AttributedCharacterIterator</code> for the entire string.
- */
-public AttributedCharacterIterator
-getIterator()
-{
- return(new AttributedStringIterator(sci, attribs, 0, sci.getEndIndex(), null));
-}
-
-/*************************************************************************/
-
-/**
- * This method returns an <code>AttributedCharacterIterator</code> that
- * will iterate over the entire string. This iterator will return information
- * about the list of attributes in the specified array. Attributes not in
- * the array may or may not be returned by the iterator. If the specified
- * array is <code>null</code>, all attributes will be returned.
- *
- * @param attributes A list of attributes to include in the returned iterator.
- *
- * @return An <code>AttributedCharacterIterator</code> for this string.
- */
-public AttributedCharacterIterator
-getIterator(AttributedCharacterIterator.Attribute[] attributes)
-{
- return(getIterator(attributes, 0, sci.getEndIndex()));
-}
-
-/*************************************************************************/
-
-/**
- * This method returns an <code>AttributedCharacterIterator</code> that
- * will iterate over the specified subrange. This iterator will return information
- * about the list of attributes in the specified array. Attributes not in
- * the array may or may not be returned by the iterator. If the specified
- * array is <code>null</code>, all attributes will be returned.
- *
- * @param attributes A list of attributes to include in the returned iterator.
- * @param begin_index The beginning index of the subrange.
- * @param end_index The ending index of the subrange.
- *
- * @return An <code>AttributedCharacterIterator</code> for this string.
- */
-public AttributedCharacterIterator
-getIterator(AttributedCharacterIterator.Attribute[] attributes,
- int begin_index, int end_index)
-{
- if ((begin_index < 0) || (end_index > sci.getEndIndex()) ||
- (end_index < begin_index))
- throw new IllegalArgumentException("bad range");
-
- return(new AttributedStringIterator(sci, attribs, begin_index, end_index,
- attributes));
-}
+ } // Inner class AttributeRange
+
+ /** The string we are representing. */
+ private StringCharacterIterator sci;
+
+ /** The attribute information */
+ private AttributeRange[] attribs;
+
+ /**
+ * Creates a new instance of <code>AttributedString</code>
+ * that represents the specified <code>String</code> with no attributes.
+ *
+ * @param str The <code>String</code> to be attributed (<code>null</code> not
+ * permitted).
+ *
+ * @throws NullPointerException if <code>str</code> is <code>null</code>.
+ */
+ public AttributedString(String str)
+ {
+ sci = new StringCharacterIterator(str);
+ attribs = new AttributeRange[0];
+ }
+
+ /**
+ * Creates a new instance of <code>AttributedString</code>
+ * that represents that specified <code>String</code> with the specified
+ * attributes over the entire length of the <code>String</code>.
+ *
+ * @param str The <code>String</code> to be attributed.
+ * @param attributes The attribute list.
+ */
+ public AttributedString(String str, Map attributes)
+ {
+ this(str);
+
+ attribs = new AttributeRange[1];
+ attribs[0] = new AttributeRange(attributes, 0, str.length());
+ }
+
+ /**
+ * Initializes a new instance of <code>AttributedString</code>
+ * that will use the text and attribute information from the specified
+ * <code>AttributedCharacterIterator</code>.
+ *
+ * @param aci The <code>AttributedCharacterIterator</code> containing the
+ * text and attribute information (<code>null</code> not
+ * permitted).
+ *
+ * @throws NullPointerException if <code>aci</code> is <code>null</code>.
+ */
+ public AttributedString(AttributedCharacterIterator aci)
+ {
+ this(aci, aci.getBeginIndex(), aci.getEndIndex(), null);
+ }
+
+ /**
+ * Initializes a new instance of <code>AttributedString</code>
+ * that will use the text and attribute information from the specified
+ * subrange of the specified <code>AttributedCharacterIterator</code>.
+ *
+ * @param aci The <code>AttributedCharacterIterator</code> containing the
+ * text and attribute information.
+ * @param begin_index The beginning index of the text subrange.
+ * @param end_index The ending index of the text subrange.
+ */
+ public AttributedString(AttributedCharacterIterator aci, int begin_index,
+ int end_index)
+ {
+ this(aci, begin_index, end_index, null);
+ }
+
+ /**
+ * Initializes a new instance of <code>AttributedString</code>
+ * that will use the text and attribute information from the specified
+ * subrange of the specified <code>AttributedCharacterIterator</code>.
+ * Only attributes from the source iterator that are present in the
+ * specified array of attributes will be included in the attribute list
+ * for this object.
+ *
+ * @param aci The <code>AttributedCharacterIterator</code> containing the
+ * text and attribute information.
+ * @param begin_index The beginning index of the text subrange.
+ * @param end_index The ending index of the text subrange.
+ * @param attributes A list of attributes to include from the iterator, or
+ * <code>null</code> to include all attributes.
+ */
+ public AttributedString(AttributedCharacterIterator aci, int begin_index,
+ int end_index, AttributedCharacterIterator.Attribute[] attributes)
+ {
+ // Validate some arguments
+ if ((begin_index < 0) || (end_index < begin_index))
+ throw new IllegalArgumentException("Bad index values");
+
+ StringBuffer sb = new StringBuffer("");
+
+ // Get the valid attribute list
+ Set all_attribs = aci.getAllAttributeKeys();
+ if (attributes != null)
+ all_attribs.retainAll(Arrays.asList(attributes));
+
+ // Loop through and extract the attributes
+ char c = aci.setIndex(begin_index);
+
+ ArrayList accum = new ArrayList();
+ do
+ {
+ sb.append(c);
+
+ Iterator iter = all_attribs.iterator();
+ while(iter.hasNext())
+ {
+ Object obj = iter.next();
+
+ // What should we do if this is not true?
+ if (!(obj instanceof AttributedCharacterIterator.Attribute))
+ continue;
+
+ AttributedCharacterIterator.Attribute attrib =
+ (AttributedCharacterIterator.Attribute)obj;
+
+ // Make sure the attribute is defined.
+ int rl = aci.getRunLimit(attrib);
+ if (rl == -1)
+ continue;
+ if (rl > end_index)
+ rl = end_index;
+ rl -= begin_index;
+
+ // Check to see if we already processed this one
+ int rs = aci.getRunStart(attrib);
+ if ((rs < aci.getIndex()) && (aci.getIndex() != begin_index))
+ continue;
+
+ // If the attribute run starts before the beginning index, we
+ // need to junk it if it is an Annotation.
+ Object attrib_obj = aci.getAttribute(attrib);
+ if (rs < begin_index)
+ {
+ if (attrib_obj instanceof Annotation)
+ continue;
+
+ rs = begin_index;
+ }
+ else
+ {
+ rs -= begin_index;
+ }
+
+ // Create a map object. Yes this will only contain one attribute
+ Map new_map = new Hashtable();
+ new_map.put(attrib, attrib_obj);
+
+ // Add it to the attribute list.
+ accum.add(new AttributeRange(new_map, rs, rl));
+ }
+
+ c = aci.next();
+ }
+ while(c != CharacterIterator.DONE);
+
+ attribs = new AttributeRange[accum.size()];
+ attribs = (AttributeRange[]) accum.toArray(attribs);
+
+ sci = new StringCharacterIterator(sb.toString());
+ }
+
+ /**
+ * Adds a new attribute that will cover the entire string.
+ *
+ * @param attrib The attribute to add.
+ * @param value The value of the attribute.
+ */
+ public void addAttribute(AttributedCharacterIterator.Attribute attrib,
+ Object value)
+ {
+ addAttribute(attrib, value, 0, sci.getEndIndex());
+ }
+
+ /**
+ * Adds a new attribute that will cover the specified subrange
+ * of the string.
+ *
+ * @param attrib The attribute to add.
+ * @param value The value of the attribute, which may be <code>null</code>.
+ * @param begin_index The beginning index of the subrange.
+ * @param end_index The ending index of the subrange.
+ *
+ * @exception IllegalArgumentException If attribute is <code>null</code> or
+ * the subrange is not valid.
+ */
+ public void addAttribute(AttributedCharacterIterator.Attribute attrib,
+ Object value, int begin_index, int end_index)
+ {
+ if (attrib == null)
+ throw new IllegalArgumentException("null attribute");
+
+ HashMap hm = new HashMap();
+ hm.put(attrib, value);
+
+ addAttributes(hm, begin_index, end_index);
+ }
+
+ /**
+ * Adds all of the attributes in the specified list to the
+ * specified subrange of the string.
+ *
+ * @param attributes The list of attributes.
+ * @param begin_index The beginning index.
+ * @param end_index The ending index
+ *
+ * @throws IllegalArgumentException If the list is <code>null</code> or the
+ * subrange is not valid.
+ */
+ public void addAttributes(Map attributes, int begin_index, int end_index)
+ {
+ if (attributes == null)
+ throw new IllegalArgumentException("null attribute");
+
+ if ((begin_index < 0) || (end_index > sci.getEndIndex()) ||
+ (end_index < begin_index))
+ throw new IllegalArgumentException("bad range");
+
+ AttributeRange[] new_list = new AttributeRange[attribs.length + 1];
+ System.arraycopy(attribs, 0, new_list, 0, attribs.length);
+ attribs = new_list;
+ attribs[attribs.length - 1] = new AttributeRange(attributes, begin_index,
+ end_index);
+ }
+
+ /**
+ * Returns an <code>AttributedCharacterIterator</code> that
+ * will iterate over the entire string.
+ *
+ * @return An <code>AttributedCharacterIterator</code> for the entire string.
+ */
+ public AttributedCharacterIterator getIterator()
+ {
+ return(new AttributedStringIterator(sci, attribs, 0, sci.getEndIndex(),
+ null));
+ }
+
+ /**
+ * Returns an <code>AttributedCharacterIterator</code> that
+ * will iterate over the entire string. This iterator will return information
+ * about the list of attributes in the specified array. Attributes not in
+ * the array may or may not be returned by the iterator. If the specified
+ * array is <code>null</code>, all attributes will be returned.
+ *
+ * @param attributes A list of attributes to include in the returned iterator.
+ *
+ * @return An <code>AttributedCharacterIterator</code> for this string.
+ */
+ public AttributedCharacterIterator getIterator(
+ AttributedCharacterIterator.Attribute[] attributes)
+ {
+ return(getIterator(attributes, 0, sci.getEndIndex()));
+ }
+
+ /**
+ * Returns an <code>AttributedCharacterIterator</code> that
+ * will iterate over the specified subrange. This iterator will return
+ * information about the list of attributes in the specified array.
+ * Attributes not in the array may or may not be returned by the iterator.
+ * If the specified array is <code>null</code>, all attributes will be
+ * returned.
+ *
+ * @param attributes A list of attributes to include in the returned iterator.
+ * @param begin_index The beginning index of the subrange.
+ * @param end_index The ending index of the subrange.
+ *
+ * @return An <code>AttributedCharacterIterator</code> for this string.
+ */
+ public AttributedCharacterIterator getIterator(
+ AttributedCharacterIterator.Attribute[] attributes,
+ int begin_index, int end_index)
+ {
+ if ((begin_index < 0) || (end_index > sci.getEndIndex()) ||
+ (end_index < begin_index))
+ throw new IllegalArgumentException("bad range");
+
+ return(new AttributedStringIterator(sci, attribs, begin_index, end_index,
+ attributes));
+ }
} // class AttributedString
-
diff --git a/libjava/classpath/java/text/AttributedStringIterator.java b/libjava/classpath/java/text/AttributedStringIterator.java
index 7d7bf27..7fba5d6 100644
--- a/libjava/classpath/java/text/AttributedStringIterator.java
+++ b/libjava/classpath/java/text/AttributedStringIterator.java
@@ -55,129 +55,102 @@ import java.util.Set;
class AttributedStringIterator implements AttributedCharacterIterator
{
-/*************************************************************************/
-
-/**
- * Instance Variables
- */
-
-/**
- * The character iterator containing the text
- */
-private CharacterIterator ci;
-
-/**
- * The list of attributes and ranges
- */
-private AttributedString.AttributeRange[] attribs;
-
-/**
- * The list of attributes that the user is interested in. We may,
- * at our option, not return any other attributes.
- */
-private AttributedCharacterIterator.Attribute[] restricts;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-AttributedStringIterator(StringCharacterIterator sci,
- AttributedString.AttributeRange[] attribs,
- int begin_index, int end_index,
- AttributedCharacterIterator.Attribute[] restricts)
-{
- this.ci = new StringCharacterIterator(sci, begin_index, end_index);
- this.attribs = attribs;
- this.restricts = restricts;
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-// First we have a bunch of stupid redirects. If StringCharacterIterator
-// weren't final, I just would have extended that for this class. Alas, no.
-
-public Object
-clone()
-{
- return(ci.clone());
-}
-
-public char
-current()
-{
- return(ci.current());
-}
-
-public char
-next()
-{
- return(ci.next());
-}
-
-public char
-previous()
-{
- return(ci.previous());
-}
-
-public char
-first()
-{
- return(ci.first());
-}
-
-public char
-last()
-{
- return(ci.last());
-}
-
-public int
-getIndex()
-{
- return(ci.getIndex());
-}
-
-public char
-setIndex(int index)
-{
- return(ci.setIndex(index));
-}
-
-public int
-getBeginIndex()
-{
- return(ci.getBeginIndex());
-}
-
-public int
-getEndIndex()
-{
- return(ci.getEndIndex());
-}
-
-/*
- * Here is where the AttributedCharacterIterator methods start.
- */
-
-/*************************************************************************/
-
-/**
- * Returns a list of all the attribute keys that are defined anywhere
- * on this string.
- */
-public Set
-getAllAttributeKeys()
-{
- HashSet s = new HashSet();
- if (attribs == null)
- return(s);
+ /*************************************************************************/
+
+ /** The character iterator containing the text */
+ private CharacterIterator ci;
+
+ /** The list of attributes and ranges */
+ private AttributedString.AttributeRange[] attribs;
+
+ /**
+ * The list of attributes that the user is interested in. We may,
+ * at our option, not return any other attributes.
+ */
+ private AttributedCharacterIterator.Attribute[] restricts;
+
+ /*************************************************************************/
+
+ AttributedStringIterator(StringCharacterIterator sci,
+ AttributedString.AttributeRange[] attribs,
+ int begin_index, int end_index,
+ AttributedCharacterIterator.Attribute[] restricts)
+ {
+ this.ci = new StringCharacterIterator(sci, begin_index, end_index);
+ this.attribs = attribs;
+ this.restricts = restricts;
+ }
+
+ /*************************************************************************/
+
+ // First we have a bunch of stupid redirects. If StringCharacterIterator
+ // weren't final, I just would have extended that for this class. Alas, no.
+
+ public Object clone()
+ {
+ return(ci.clone());
+ }
+
+ public char current()
+ {
+ return(ci.current());
+ }
+
+ public char next()
+ {
+ return(ci.next());
+ }
+
+ public char previous()
+ {
+ return(ci.previous());
+ }
+
+ public char first()
+ {
+ return(ci.first());
+ }
+
+ public char last()
+ {
+ return(ci.last());
+ }
+
+ public int getIndex()
+ {
+ return(ci.getIndex());
+ }
+
+ public char setIndex(int index)
+ {
+ return(ci.setIndex(index));
+ }
+
+ public int getBeginIndex()
+ {
+ return(ci.getBeginIndex());
+ }
+
+ public int getEndIndex()
+ {
+ return(ci.getEndIndex());
+ }
+
+ /*
+ * Here is where the AttributedCharacterIterator methods start.
+ */
+
+ /*************************************************************************/
+
+ /**
+ * Returns a list of all the attribute keys that are defined anywhere
+ * on this string.
+ */
+ public Set getAllAttributeKeys()
+ {
+ HashSet s = new HashSet();
+ if (attribs == null)
+ return(s);
for (int i = 0; i < attribs.length; i++)
{
@@ -193,156 +166,146 @@ getAllAttributeKeys()
}
}
- return(s);
-}
-
-/*************************************************************************/
-
-/**
- * Various methods that determine how far the run extends for various
- * attribute combinations.
- */
-
-public int
-getRunLimit()
-{
- return(getRunLimit(getAttributes().keySet()));
-}
-
-public int
-getRunLimit(AttributedCharacterIterator.Attribute attrib)
-{
- HashSet s = new HashSet();
- s.add(attrib);
-
- return(getRunLimit(s));
-}
-
-public synchronized int
-getRunLimit(Set attribute_set)
-{
- boolean hit = false;
- int runLimit = ci.getEndIndex ();
- int pos = ci.getIndex ();
-
- for (int i = 0; i < attribs.length; ++i)
- {
- if (pos >= attribs[i].begin_index &&
- pos < attribs[i].end_index)
- {
- Iterator iter = attribute_set.iterator();
- while(iter.hasNext())
- if (attribs[i].attribs.containsKey(iter.next()))
- {
- hit = true;
- runLimit = Math.min(runLimit, attribs[i].end_index);
- }
- }
- }
- if (hit)
- return runLimit;
- else
- return ci.getEndIndex();
-}
-
-/*************************************************************************/
-
-/**
- * Various methods that determine where the run begins for various
- * attribute combinations.
- */
-
-public int
-getRunStart()
-{
- return(getRunStart(getAttributes().keySet()));
-}
-
-public int
-getRunStart(AttributedCharacterIterator.Attribute attrib)
-{
- HashSet s = new HashSet();
- s.add(attrib);
-
- return(getRunStart(s));
-}
-
-public int
-getRunStart(Set attribute_set)
-{
- boolean hit = false;
- int runBegin = 0;
- int pos = ci.getIndex ();
-
- for (int i = 0; i < attribs.length; ++i)
- {
- if (pos >= attribs[i].begin_index &&
- pos <= attribs[i].end_index)
- {
- Iterator iter = attribute_set.iterator();
- while(iter.hasNext())
- if (attribs[i].attribs.containsKey(iter.next()))
- {
- hit = true;
- runBegin = Math.max(runBegin, attribs[i].begin_index);
- }
- }
- }
- if (hit)
- return runBegin;
- else
- return -1;
-}
+ return(s);
+ }
+
+ /*************************************************************************/
+
+ /**
+ * Various methods that determine how far the run extends for various
+ * attribute combinations.
+ */
+
+ public int getRunLimit()
+ {
+ return(getRunLimit(getAttributes().keySet()));
+ }
+
+ public int getRunLimit(AttributedCharacterIterator.Attribute attrib)
+ {
+ HashSet s = new HashSet();
+ s.add(attrib);
+ return(getRunLimit(s));
+ }
+
+ public synchronized int getRunLimit(Set attribute_set)
+ {
+ boolean hit = false;
+ int runLimit = ci.getEndIndex ();
+ int pos = ci.getIndex ();
+
+ for (int i = 0; i < attribs.length; ++i)
+ {
+ if (pos >= attribs[i].begin_index &&
+ pos < attribs[i].end_index)
+ {
+ Iterator iter = attribute_set.iterator();
+ while(iter.hasNext())
+ if (attribs[i].attribs.containsKey(iter.next()))
+ {
+ hit = true;
+ runLimit = Math.min(runLimit, attribs[i].end_index);
+ }
+ }
+ }
+ if (hit)
+ return runLimit;
+ else
+ return ci.getEndIndex();
+ }
+
+ /*************************************************************************/
+
+ /**
+ * Various methods that determine where the run begins for various
+ * attribute combinations.
+ */
+
+ public int getRunStart()
+ {
+ return(getRunStart(getAttributes().keySet()));
+ }
+
+ public int getRunStart(AttributedCharacterIterator.Attribute attrib)
+ {
+ HashSet s = new HashSet();
+ s.add(attrib);
+
+ return(getRunStart(s));
+ }
+
+ public int getRunStart(Set attribute_set)
+ {
+ boolean hit = false;
+ int runBegin = 0;
+ int pos = ci.getIndex();
+
+ for (int i = 0; i < attribs.length; ++i)
+ {
+ if (pos >= attribs[i].begin_index &&
+ pos <= attribs[i].end_index)
+ {
+ Iterator iter = attribute_set.iterator();
+ while(iter.hasNext())
+ if (attribs[i].attribs.containsKey(iter.next()))
+ {
+ hit = true;
+ runBegin = Math.max(runBegin, attribs[i].begin_index);
+ }
+ }
+ }
+ if (hit)
+ return runBegin;
+ else
+ return -1;
+ }
+
+ /*************************************************************************/
+
+ public Object getAttribute(AttributedCharacterIterator.Attribute attrib)
+ {
+ if (attribs == null)
+ return(null);
-/*************************************************************************/
+ for (int i = 0; i < attribs.length; i++)
+ {
+ Set key_set = attribs[i].attribs.keySet();
+ Iterator iter = key_set.iterator();
+ while (iter.hasNext())
+ {
+ Object obj = iter.next();
+
+ // Check for attribute match and range match
+ if (obj.equals(attrib))
+ if ((ci.getIndex() >= attribs[i].begin_index) &&
+ (ci.getIndex() < attribs[i].end_index))
+ return(attribs[i].attribs.get(obj));
+ }
+ }
-public Object
-getAttribute(AttributedCharacterIterator.Attribute attrib)
-{
- if (attribs == null)
return(null);
-
- for (int i = 0; i < attribs.length; i++)
- {
- Set key_set = attribs[i].attribs.keySet();
- Iterator iter = key_set.iterator();
- while (iter.hasNext())
- {
- Object obj = iter.next();
-
- // Check for attribute match and range match
- if (obj.equals(attrib))
- if ((ci.getIndex() >= attribs[i].begin_index) &&
- (ci.getIndex() < attribs[i].end_index))
- return(attribs[i].attribs.get(obj));
- }
- }
-
- return(null);
-}
-
-/*************************************************************************/
-
-/**
- * Return a list of all the attributes and values defined for this
- * character
- */
-public Map
-getAttributes()
-{
- HashMap m = new HashMap();
- if (attribs == null)
- return(m);
+ }
+
+ /*************************************************************************/
+
+ /**
+ * Return a list of all the attributes and values defined for this
+ * character
+ */
+ public Map getAttributes()
+ {
+ HashMap m = new HashMap();
+ if (attribs == null)
+ return(m);
- for (int i = 0; i < attribs.length; i++)
- {
- if ((ci.getIndex() >= attribs[i].begin_index) &&
- (ci.getIndex() < attribs[i].end_index))
- m.putAll(attribs[i].attribs);
- }
+ for (int i = 0; i < attribs.length; i++)
+ {
+ if ((ci.getIndex() >= attribs[i].begin_index) &&
+ (ci.getIndex() < attribs[i].end_index))
+ m.putAll(attribs[i].attribs);
+ }
- return(m);
-}
+ return(m);
+ }
} // class AttributedStringIterator
-
diff --git a/libjava/classpath/java/text/BreakIterator.java b/libjava/classpath/java/text/BreakIterator.java
index d021dce..7ba1168 100644
--- a/libjava/classpath/java/text/BreakIterator.java
+++ b/libjava/classpath/java/text/BreakIterator.java
@@ -114,9 +114,9 @@ public abstract class BreakIterator implements Cloneable
* This methdod returns the offset of the text element boundary following
* the specified offset.
*
- * @param offset The text index from which to find the next text boundary.
+ * @param pos The text index from which to find the next text boundary.
*
- * @param The next text boundary following the specified index.
+ * @return The next text boundary following the specified index.
*/
public abstract int following (int pos);
@@ -186,9 +186,9 @@ public abstract class BreakIterator implements Cloneable
*
* @return A <code>BreakIterator</code> instance for the default locale.
*/
- public static BreakIterator getCharacterInstance (Locale loc)
+ public static BreakIterator getCharacterInstance (Locale locale)
{
- BreakIterator r = getInstance ("CharacterIterator", loc);
+ BreakIterator r = getInstance ("CharacterIterator", locale);
if (r == null)
r = new gnu.java.text.CharacterBreakIterator ();
return r;
@@ -214,9 +214,9 @@ public abstract class BreakIterator implements Cloneable
*
* @return A <code>BreakIterator</code> instance for the default locale.
*/
- public static BreakIterator getLineInstance (Locale loc)
+ public static BreakIterator getLineInstance (Locale locale)
{
- BreakIterator r = getInstance ("LineIterator", loc);
+ BreakIterator r = getInstance ("LineIterator", locale);
if (r == null)
r = new gnu.java.text.LineBreakIterator ();
return r;
@@ -242,9 +242,9 @@ public abstract class BreakIterator implements Cloneable
*
* @return A <code>BreakIterator</code> instance for the default locale.
*/
- public static BreakIterator getSentenceInstance (Locale loc)
+ public static BreakIterator getSentenceInstance (Locale locale)
{
- BreakIterator r = getInstance ("SentenceIterator", loc);
+ BreakIterator r = getInstance ("SentenceIterator", locale);
if (r == null)
r = new gnu.java.text.SentenceBreakIterator ();
return r;
@@ -254,7 +254,7 @@ public abstract class BreakIterator implements Cloneable
* This method returns the text this object is iterating over as a
* <code>CharacterIterator</code>.
*
- * @param The text being iterated over.
+ * @return The text being iterated over.
*/
public abstract CharacterIterator getText ();
@@ -278,9 +278,9 @@ public abstract class BreakIterator implements Cloneable
*
* @return A <code>BreakIterator</code> instance for the default locale.
*/
- public static BreakIterator getWordInstance (Locale loc)
+ public static BreakIterator getWordInstance (Locale locale)
{
- BreakIterator r = getInstance ("WordIterator", loc);
+ BreakIterator r = getInstance ("WordIterator", locale);
if (r == null)
r = new gnu.java.text.WordBreakIterator ();
return r;
@@ -290,7 +290,7 @@ public abstract class BreakIterator implements Cloneable
* This method tests whether or not the specified position is a text
* element boundary.
*
- * @param offset The text position to test.
+ * @param pos The text position to test.
*
* @return <code>true</code> if the position is a boundary,
* <code>false</code> otherwise.
@@ -332,8 +332,7 @@ public abstract class BreakIterator implements Cloneable
* This methdod returns the offset of the text element boundary preceding
* the specified offset.
*
- * @param offset The text index from which to find the preceding
- * text boundary.
+ * @param pos The text index from which to find the preceding text boundary.
*
* @returns The next text boundary preceding the specified index.
*/
@@ -357,7 +356,7 @@ public abstract class BreakIterator implements Cloneable
/**
* This method sets the text string to iterate over.
*
- * @param str The <code>String</code> to iterate over.
+ * @param newText The <code>String</code> to iterate over.
*/
public void setText (String newText)
{
@@ -368,7 +367,7 @@ public abstract class BreakIterator implements Cloneable
* This method sets the text to iterate over from the specified
* <code>CharacterIterator</code>.
*
- * @param ci The desired <code>CharacterIterator</code>.
+ * @param newText The desired <code>CharacterIterator</code>.
*/
public abstract void setText (CharacterIterator newText);
}
diff --git a/libjava/classpath/java/text/CharacterIterator.java b/libjava/classpath/java/text/CharacterIterator.java
index 6b3f951..58d6ddc 100644
--- a/libjava/classpath/java/text/CharacterIterator.java
+++ b/libjava/classpath/java/text/CharacterIterator.java
@@ -1,5 +1,5 @@
/* CharacterIterator.java -- Iterate over a character range
- Copyright (C) 1998, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,8 +64,8 @@ public interface CharacterIterator extends Cloneable
/**
* This method increments the current index and then returns the character
- * at the new index value. If the index is already at <code>getEndIndex() - 1</code>,
- * it will not be incremented.
+ * at the new index value. If the index is already at
+ * <code>getEndIndex() - 1</code>, it will not be incremented.
*
* @return The character at the position of the incremented index value,
* or <code>DONE</code> if the index has reached getEndIndex() - 1
@@ -78,7 +78,8 @@ public interface CharacterIterator extends Cloneable
* index, it will not be decremented.
*
* @return The character at the position of the decremented index value,
- * or <code>DONE</code> if index was already equal to the beginning index value.
+ * or {@link #DONE} if index was already equal to the beginning index
+ * value.
*/
char previous();
@@ -86,7 +87,8 @@ public interface CharacterIterator extends Cloneable
* This method sets the index value to the beginning of the range and returns
* the character there.
*
- * @return The character at the beginning of the range, or <code>DONE</code> if the range is empty.
+ * @return The character at the beginning of the range, or {@link #DONE} if
+ * the range is empty.
*/
char first();
@@ -95,7 +97,8 @@ public interface CharacterIterator extends Cloneable
* returns the character there. If the range is empty, then the index value
* will be set equal to the beginning index.
*
- * @return The character at the end of the range, or <code>DONE</code> if the range is empty.
+ * @return The character at the end of the range, or {@link #DONE} if the
+ * range is empty.
*/
char last();
@@ -112,7 +115,8 @@ public interface CharacterIterator extends Cloneable
*
* @param index The new index value.
*
- * @return The character at the new index value or <code>DONE</code> if the index value is equal to <code>getEndIndex</code>.
+ * @return The character at the new index value or {@link #DONE} if the index
+ * value is equal to {@link #getEndIndex()}.
*/
char setIndex (int index) throws IllegalArgumentException;
diff --git a/libjava/classpath/java/text/ChoiceFormat.java b/libjava/classpath/java/text/ChoiceFormat.java
index 23c8a8c..94c13a2 100644
--- a/libjava/classpath/java/text/ChoiceFormat.java
+++ b/libjava/classpath/java/text/ChoiceFormat.java
@@ -86,7 +86,7 @@ public class ChoiceFormat extends NumberFormat
* object based on the specified pattern. This pattern is of the form
* "term#string|term#string...". For example "1#Sunday|2#Monday|#Tuesday".
*
- * @param pattern The pattern of terminators and format strings.
+ * @param newPattern The pattern of terminators and format strings.
*
* @exception IllegalArgumentException If the pattern is not valid
*/
@@ -170,7 +170,7 @@ public class ChoiceFormat extends NumberFormat
* This is the same pattern type used by the <code>applyPattern</code>
* method.
*
- * @param pattern The pattern of terminators and format strings.
+ * @param newPattern The pattern of terminators and format strings.
*
* @exception IllegalArgumentException If the pattern is not valid
*/
@@ -229,10 +229,11 @@ public class ChoiceFormat extends NumberFormat
* <code>StringBuffer</code> based on the supplied <code>long</code>
* argument.
*
- * @param number The number used for determine (based on the range
+ * @param num The number used for determine (based on the range
* terminators) which format string to append.
- * @param sb The <code>StringBuffer</code> to append the format string to.
- * @param status Unused.
+ * @param appendBuf The <code>StringBuffer</code> to append the format string
+ * to.
+ * @param pos Unused.
*
* @return The <code>StringBuffer</code> with the format string appended.
*/
@@ -247,10 +248,10 @@ public class ChoiceFormat extends NumberFormat
* <code>StringBuffer</code> based on the supplied <code>double</code>
* argument.
*
- * @param number The number used for determine (based on the range
+ * @param num The number used for determine (based on the range
* terminators) which format string to append.
- * @param sb The <code>StringBuffer</code> to append the format string to.
- * @param status Unused.
+ * @param appendBuf The <code>StringBuffer</code> to append the format string to.
+ * @param pos Unused.
*
* @return The <code>StringBuffer</code> with the format string appended.
*/
@@ -333,7 +334,7 @@ public class ChoiceFormat extends NumberFormat
* double less than the specified double will be returned.
*
* @param d The specified double
- * @param positive <code>true</code> to return the next highest
+ * @param next <code>true</code> to return the next highest
* double, <code>false</code> otherwise.
*
* @return The next highest or lowest double value.
diff --git a/libjava/classpath/java/text/CollationElementIterator.java b/libjava/classpath/java/text/CollationElementIterator.java
index 60b148e..45c7914 100644
--- a/libjava/classpath/java/text/CollationElementIterator.java
+++ b/libjava/classpath/java/text/CollationElementIterator.java
@@ -177,9 +177,11 @@ public final class CollationElementIterator
* This method returns the primary order value for the given collation
* value.
*
- * @param value The collation value returned from <code>next()</code> or <code>previous()</code>.
+ * @param order The collation value returned from <code>next()</code> or
+ * <code>previous()</code>.
*
- * @return The primary order value of the specified collation value. This is the high 16 bits.
+ * @return The primary order value of the specified collation value. This is
+ * the high 16 bits.
*/
public static int primaryOrder(int order)
{
@@ -201,9 +203,11 @@ public final class CollationElementIterator
* This method returns the secondary order value for the given collation
* value.
*
- * @param value The collation value returned from <code>next()</code> or <code>previous()</code>.
+ * @param order The collation value returned from <code>next()</code> or
+ * <code>previous()</code>.
*
- * @return The secondary order value of the specified collation value. This is the bits 8-15.
+ * @return The secondary order value of the specified collation value. This
+ * is the bits 8-15.
*/
public static short secondaryOrder(int order)
{
@@ -215,9 +219,11 @@ public final class CollationElementIterator
* This method returns the tertiary order value for the given collation
* value.
*
- * @param value The collation value returned from <code>next()</code> or <code>previous()</code>.
+ * @param order The collation value returned from <code>next()</code> or
+ * <code>previous()</code>.
*
- * @return The tertiary order value of the specified collation value. This is the low eight bits.
+ * @return The tertiary order value of the specified collation value. This
+ * is the low eight bits.
*/
public static short tertiaryOrder(int order)
{
@@ -458,7 +464,7 @@ public final class CollationElementIterator
*
* @param value The collation order value
*
- * @param The maximum length of an expansion sequence.
+ * @return The maximum length of an expansion sequence.
*/
public int getMaxExpansion(int value)
{
diff --git a/libjava/classpath/java/text/CollationKey.java b/libjava/classpath/java/text/CollationKey.java
index f7e3a24..a467869 100644
--- a/libjava/classpath/java/text/CollationKey.java
+++ b/libjava/classpath/java/text/CollationKey.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package java.text;
+import java.util.Arrays;
+
/* Written using "Java Class Libraries", 2nd edition, plus online
* API docs for JDK 1.2 from http://www.javasoft.com.
* Status: Believed complete and correct.
@@ -154,7 +156,7 @@ public final class CollationKey implements Comparable
if (!ck.getSourceString ().equals (getSourceString ()))
return false;
- if (!ck.toByteArray ().equals (toByteArray ()))
+ if (! Arrays.equals (ck.toByteArray (), toByteArray ()))
return false;
return true;
@@ -190,7 +192,7 @@ public final class CollationKey implements Comparable
/**
* This method returns the collation bit sequence as a byte array.
*
- * @param A byte array containing the collation bit sequence.
+ * @return A byte array containing the collation bit sequence.
*/
public byte[] toByteArray()
{
diff --git a/libjava/classpath/java/text/Collator.java b/libjava/classpath/java/text/Collator.java
index 633bc67..7dea83f 100644
--- a/libjava/classpath/java/text/Collator.java
+++ b/libjava/classpath/java/text/Collator.java
@@ -150,8 +150,8 @@ public abstract class Collator implements Comparator, Cloneable
* <code>Collator</code> and the strength and decomposition rules in
* effect.
*
- * @param str1 The first object to compare
- * @param str2 The second object to compare
+ * @param source The first object to compare
+ * @param target The second object to compare
*
* @return A negative integer if str1 &lt; str2, 0 if str1 == str2, or
* a positive integer if str1 &gt; str2.
@@ -164,8 +164,8 @@ public abstract class Collator implements Comparator, Cloneable
* equal to, or greater than the second argument. These two objects
* must be <code>String</code>'s or an exception will be thrown.
*
- * @param obj1 The first object to compare
- * @param obj2 The second object to compare
+ * @param o1 The first object to compare
+ * @param o2 The second object to compare
*
* @return A negative integer if obj1 &lt; obj2, 0 if obj1 == obj2, or
* a positive integer if obj1 &gt; obj2.
@@ -208,8 +208,8 @@ public abstract class Collator implements Comparator, Cloneable
* according to the collation rules for the locale of this object and
* the current strength and decomposition settings.
*
- * @param str1 The first <code>String</code> to compare
- * @param str2 The second <code>String</code> to compare
+ * @param source The first <code>String</code> to compare
+ * @param target The second <code>String</code> to compare
*
* @return <code>true</code> if the two strings are equal,
* <code>false</code> otherwise.
@@ -256,7 +256,7 @@ public abstract class Collator implements Comparator, Cloneable
* comparisons against a string might be performed multiple times, such
* as during a sort operation.
*
- * @param str The <code>String</code> to convert.
+ * @param source The <code>String</code> to convert.
*
* @return A <code>CollationKey</code> for the specified <code>String</code>.
*/
@@ -292,7 +292,7 @@ public abstract class Collator implements Comparator, Cloneable
* specified locale. If no <code>Collator</code> exists for the desired
* locale, a <code>Collator</code> for the default locale will be returned.
*
- * @param locale The desired localed to load a <code>Collator</code> for.
+ * @param loc The desired localed to load a <code>Collator</code> for.
*
* @return A <code>Collator</code> for the requested locale
*/
@@ -347,7 +347,7 @@ public abstract class Collator implements Comparator, Cloneable
* exception will be thrown. See the documentation for those
* contants for an explanation of this setting.
*
- * @param decmp The new decomposition setting.
+ * @param mode The new decomposition setting.
*
* @exception IllegalArgumentException If the requested
* decomposition setting is not valid.
diff --git a/libjava/classpath/java/text/DateFormat.java b/libjava/classpath/java/text/DateFormat.java
index f6dfceb..5d412aa 100644
--- a/libjava/classpath/java/text/DateFormat.java
+++ b/libjava/classpath/java/text/DateFormat.java
@@ -405,8 +405,18 @@ public abstract class DateFormat extends Format implements Cloneable
* <ul>
* <li>Is not <code>null</code>.</li>
* <li>Is an instance of <code>DateFormat</code>.</li>
- * <li>Has the same numberFormat field value as this object.</li>
+ * <li>Has equal numberFormat field as this object.</li>
+ * <li>Has equal (Calendar) TimeZone rules as this object.</li>
+ * <li>Has equal (Calendar) isLenient results.</li>
+ * <li>Has equal Calendar first day of week and minimal days in week
+ * values.</li>
* </ul>
+ * Note that not all properties of the Calendar are relevant for a
+ * DateFormat. For formatting only the fact whether or not the
+ * TimeZone has the same rules and whether the calendar is lenient
+ * and has the same week rules is compared for this implementation
+ * of equals. Other properties of the Calendar (such as the time)
+ * are not taken into account.
*
* @param obj The object to test for equality against.
*
@@ -419,8 +429,24 @@ public abstract class DateFormat extends Format implements Cloneable
return false;
DateFormat d = (DateFormat) obj;
-
- return numberFormat.equals(d.numberFormat);
+ TimeZone tz = getTimeZone();
+ TimeZone tzd = d.getTimeZone();
+ if (tz.hasSameRules(tzd))
+ if (isLenient() == d.isLenient())
+ {
+ Calendar c = getCalendar();
+ Calendar cd = d.getCalendar();
+ if ((c == null && cd == null)
+ ||
+ (c.getFirstDayOfWeek() == cd.getFirstDayOfWeek()
+ &&
+ c.getMinimalDaysInFirstWeek()
+ == cd.getMinimalDaysInFirstWeek()))
+ return ((numberFormat == null && d.numberFormat == null)
+ || numberFormat.equals(d.numberFormat));
+ }
+
+ return false;
}
/**
@@ -442,9 +468,9 @@ public abstract class DateFormat extends Format implements Cloneable
* thrown.
*
* @param obj The <code>Object</code> to format.
- * @param toAppendTo The <code>StringBuffer</code> to append the resultant
+ * @param buf The <code>StringBuffer</code> to append the resultant
* <code>String</code> to.
- * @param fieldPosition Is updated to the start and end index of the
+ * @param pos Is updated to the start and end index of the
* specified field.
*
* @return The <code>StringBuffer</code> supplied on input, with the
@@ -479,9 +505,9 @@ public abstract class DateFormat extends Format implements Cloneable
* to the specified <code>StringBuffer</code>.
*
* @param date The <code>Date</code> value to format.
- * @param toAppendTo The <code>StringBuffer</code> to append the resultant
+ * @param buf The <code>StringBuffer</code> to append the resultant
* <code>String</code> to.
- * @param fieldPosition Is updated to the start and end index of the
+ * @param pos Is updated to the start and end index of the
* specified field.
*
* @return The <code>StringBuffer</code> supplied on input, with the
@@ -643,7 +669,7 @@ public abstract class DateFormat extends Format implements Cloneable
* localed will be used in place of the default.
*
* @param style The type of formatting to perform.
- * @param aLocale The desired locale.
+ * @param loc The desired locale.
*
* @return A new <code>DateFormat</code> instance.
*/
@@ -744,7 +770,7 @@ public abstract class DateFormat extends Format implements Cloneable
* localed will be used in place of the default.
*
* @param style The type of formatting to perform.
- * @param aLocale The desired locale.
+ * @param loc The desired locale.
*
* @return A new <code>DateFormat</code> instance.
*/
@@ -818,7 +844,7 @@ public abstract class DateFormat extends Format implements Cloneable
* starting parse position on method entry and the ending parse
* position on method exit.
*
- * @param text The string to parse.
+ * @param source The string to parse.
* @param pos The starting parse position in entry, the ending parse
* position on exit.
*
@@ -848,7 +874,7 @@ public abstract class DateFormat extends Format implements Cloneable
* This method specified the <code>Calendar</code> that should be used
* by this object to parse/format datetimes.
*
- * @param The new <code>Calendar</code> for this object.
+ * @param calendar The new <code>Calendar</code> for this object.
*
* @see java.util.Calendar
*/
@@ -873,7 +899,7 @@ public abstract class DateFormat extends Format implements Cloneable
* This method specifies the <code>NumberFormat</code> object that should
* be used by this object to parse/format times.
*
- * @param The <code>NumberFormat</code> in use by this object.
+ * @param numberFormat The <code>NumberFormat</code> in use by this object.
*/
public void setNumberFormat (NumberFormat numberFormat)
{
@@ -883,7 +909,7 @@ public abstract class DateFormat extends Format implements Cloneable
/**
* This method sets the time zone that should be used by this object.
*
- * @param The new time zone.
+ * @param timeZone The new time zone.
*/
public void setTimeZone (TimeZone timeZone)
{
diff --git a/libjava/classpath/java/text/DateFormatSymbols.java b/libjava/classpath/java/text/DateFormatSymbols.java
index 543a5c1..6a20b4c 100644
--- a/libjava/classpath/java/text/DateFormatSymbols.java
+++ b/libjava/classpath/java/text/DateFormatSymbols.java
@@ -41,7 +41,6 @@ package java.text;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-import java.util.StringTokenizer;
/**
* This class acts as container for locale specific date/time formatting
@@ -289,7 +288,7 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* This is a two element <code>String</code> array indexed by
* <code>Calendar.AM</code> and <code>Calendar.PM</code>
*
- * @param ampms The new list of AM/PM display strings.
+ * @param value The new list of AM/PM display strings.
*/
public void setAmPmStrings (String[] value)
{
@@ -302,11 +301,11 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* This is a two element <code>String</code>
* array indexed by <code>Calendar.BC</code> and <code>Calendar.AD</code>.
*
- * @param eras The new list of era disply strings.
+ * @param labels The new list of era display strings.
*/
- public void setEras (String[] value)
+ public void setEras (String[] labels)
{
- eras = value;
+ eras = labels;
}
/**
@@ -340,11 +339,11 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* <li>17 - time zone (z)</li>
* </ul>
*
- * @param localPatternChars The new format patter characters
+ * @param chars The new format pattern characters
*/
- public void setLocalPatternChars (String value)
+ public void setLocalPatternChars (String chars)
{
- localPatternChars = value;
+ localPatternChars = chars;
}
/**
@@ -354,11 +353,11 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* <code>Calendar.UNDECEMBER</code>. Note that there are thirteen
* elements because some calendars have thriteen months.
*
- * @param months The list of month display strings.
+ * @param labels The list of month display strings.
*/
- public void setMonths (String[] value)
+ public void setMonths (String[] labels)
{
- months = value;
+ months = labels;
}
/**
@@ -369,11 +368,11 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* through <code>Calendar.UNDECEMBER</code>. Note that there are thirteen
* elements because some calendars have thirteen months.
*
- * @param shortMonths The new list of abbreviated month display strings.
+ * @param labels The new list of abbreviated month display strings.
*/
- public void setShortMonths (String[] value)
+ public void setShortMonths (String[] labels)
{
- shortMonths = value;
+ shortMonths = labels;
}
/**
@@ -384,11 +383,11 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* through <code>Calendar.SATURDAY</code>. Note that the first element
* of this array is ignored.
*
- * @param shortWeekdays This list of abbreviated weekday display strings.
+ * @param labels This list of abbreviated weekday display strings.
*/
- public void setShortWeekdays (String[] value)
+ public void setShortWeekdays (String[] labels)
{
- shortWeekdays = value;
+ shortWeekdays = labels;
}
/**
@@ -398,11 +397,11 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* through <code>Calendar.SATURDAY</code>. Note that the first element
* of this array is ignored.
*
- * @param weekdays This list of weekday display strings.
+ * @param labels This list of weekday display strings.
*/
- public void setWeekdays (String[] value)
+ public void setWeekdays (String[] labels)
{
- weekdays = value;
+ weekdays = labels;
}
/**
@@ -418,11 +417,11 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* <li>4 - the short name of the time zone (daylight savings time).</li>
* </ul>
*
- * @return The list of time zone display strings.
+ * @params zones The list of time zone display strings.
*/
- public void setZoneStrings (String[][] value)
+ public void setZoneStrings (String[][] zones)
{
- zoneStrings = value;
+ zoneStrings = zones;
}
/* Does a "deep" equality test - recurses into arrays. */
@@ -492,7 +491,7 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
/**
* Returns a new copy of this object.
*
- * @param A copy of this object
+ * @return A copy of this object
*/
public Object clone ()
{
diff --git a/libjava/classpath/java/text/DecimalFormatSymbols.java b/libjava/classpath/java/text/DecimalFormatSymbols.java
index 81ea001..a8735d3 100644
--- a/libjava/classpath/java/text/DecimalFormatSymbols.java
+++ b/libjava/classpath/java/text/DecimalFormatSymbols.java
@@ -139,7 +139,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
* locales (those with no specified country), such as
* <code>Locale.ENGLISH</code>.
*
- * @param locale The local to load symbols for.
+ * @param loc The local to load symbols for.
* @throws NullPointerException if the locale is null.
*/
public DecimalFormatSymbols (Locale loc)
@@ -422,7 +422,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
/**
* This method sets the currency symbol to the specified value.
*
- * @param currencySymbol The new currency symbol
+ * @param currency The new currency symbol
*/
public void setCurrencySymbol (String currency)
{
@@ -432,7 +432,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
/**
* This method sets the decimal point character to the specified value.
*
- * @param decimalSeparator The new decimal point character
+ * @param decimalSep The new decimal point character
*/
public void setDecimalSeparator (char decimalSep)
{
@@ -464,7 +464,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
/**
* This method sets the character used to separate groups of digits.
*
- * @param groupingSeparator The character used to separate groups of digits.
+ * @param groupSep The character used to separate groups of digits.
*/
public void setGroupingSeparator (char groupSep)
{
@@ -523,8 +523,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
* This method sets the character used for the decimal point in currency
* values.
*
- * @param monetarySeparator The decimal point character used in
- * currency values.
+ * @param decimalSep The decimal point character used in currency values.
*/
public void setMonetaryDecimalSeparator (char decimalSep)
{
@@ -535,7 +534,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
* This method sets the string used to represent the NaN (not a
* number) value.
*
- * @param NaN The string used to represent NaN
+ * @param nan The string used to represent NaN
*/
public void setNaN (String nan)
{
@@ -546,7 +545,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
* This method sets the character used to separate positive and negative
* subpatterns in a format pattern.
*
- * @param patternSeparator The character used to separate positive and
+ * @param patternSep The character used to separate positive and
* negative subpatterns in a format pattern.
*/
public void setPatternSeparator (char patternSep)
diff --git a/libjava/classpath/java/text/MessageFormat.java b/libjava/classpath/java/text/MessageFormat.java
index f7a9f16..f59cfd5 100644
--- a/libjava/classpath/java/text/MessageFormat.java
+++ b/libjava/classpath/java/text/MessageFormat.java
@@ -334,7 +334,7 @@ public class MessageFormat extends Format
/**
* Applies the specified pattern to this MessageFormat.
*
- * @param aPattern The Pattern
+ * @param newPattern The Pattern
*/
public void applyPattern (String newPattern)
{
@@ -378,7 +378,6 @@ public class MessageFormat extends Format
/**
* A convinience method to format patterns.
*
- * @param aPattern The pattern used when formatting.
* @param arguments The array containing the objects to be formatted.
*/
public AttributedCharacterIterator formatToCharacterIterator (Object arguments)
@@ -394,7 +393,7 @@ public class MessageFormat extends Format
/**
* A convinience method to format patterns.
*
- * @param aPattern The pattern used when formatting.
+ * @param pattern The pattern used when formatting.
* @param arguments The array containing the objects to be formatted.
*/
public static String format (String pattern, Object arguments[])
@@ -408,8 +407,8 @@ public class MessageFormat extends Format
/**
* Returns the pattern with the formatted objects.
*
- * @param source The array containing the objects to be formatted.
- * @param result The StringBuffer where the text is appened.
+ * @param arguments The array containing the objects to be formatted.
+ * @param appendBuf The StringBuffer where the text is appened.
* @param fp A FieldPosition object (it is ignored).
*/
public final StringBuffer format (Object arguments[], StringBuffer appendBuf,
@@ -709,8 +708,8 @@ public class MessageFormat extends Format
* Sets the format for the argument at an specified
* index.
*
- * @param index The index.
- * @format The Format object.
+ * @param variableNum The index.
+ * @param newFormat The Format object.
*/
public void setFormat (int variableNum, Format newFormat)
{
@@ -720,7 +719,7 @@ public class MessageFormat extends Format
/**
* Sets the formats for the arguments.
*
- * @param formats An array of Format objects.
+ * @param newFormats An array of Format objects.
*/
public void setFormats (Format[] newFormats)
{
@@ -735,7 +734,7 @@ public class MessageFormat extends Format
/**
* Sets the locale.
*
- * @param locale A Locale
+ * @param loc A Locale
*/
public void setLocale (Locale loc)
{
diff --git a/libjava/classpath/java/text/NumberFormat.java b/libjava/classpath/java/text/NumberFormat.java
index a2c3997..5fede9e 100644
--- a/libjava/classpath/java/text/NumberFormat.java
+++ b/libjava/classpath/java/text/NumberFormat.java
@@ -237,7 +237,8 @@ public abstract class NumberFormat extends Format implements Cloneable
* a <code>StringBuffer</code>.
*
* @param number The <code>double</code> to format.
- * @param sb The <code>StringBuffer</code> to append the formatted number to.
+ * @param sbuf The <code>StringBuffer</code> to append the formatted number
+ * to.
* @param pos The desired <code>FieldPosition</code>.
*
* @return The <code>StringBuffer</code> with the appended number.
@@ -250,7 +251,8 @@ public abstract class NumberFormat extends Format implements Cloneable
* a <code>StringBuffer</code>.
*
* @param number The <code>long</code> to format.
- * @param sb The <code>StringBuffer</code> to append the formatted number to.
+ * @param sbuf The <code>StringBuffer</code> to append the formatted number
+ * to.
* @param pos The desired <code>FieldPosition</code>.
*
* @return The <code>StringBuffer</code> with the appended number.
@@ -371,7 +373,7 @@ public abstract class NumberFormat extends Format implements Cloneable
* will be a concrete subclass of <code>NumberFormat</code>, but the
* actual class returned is dependent on the locale.
*
- * @param locale The desired locale.
+ * @param loc The desired locale.
*
* @return An instance of the default <code>NumberFormat</code> class.
*/
@@ -434,8 +436,6 @@ public abstract class NumberFormat extends Format implements Cloneable
* will be a concrete subclass of <code>NumberFormat</code>, but the
* actual class returned is dependent on the locale.
*
- * @param locale The desired locale.
- *
* @return An instance of the default <code>NumberFormat</code> class.
*/
public static final NumberFormat getNumberInstance ()
@@ -502,7 +502,7 @@ public abstract class NumberFormat extends Format implements Cloneable
* This method returns an instance of <code>NumberFormat</code> suitable
* for formatting and parsing percentage values in the specified locale.
*
- * @param locale The desired locale.
+ * @param loc The desired locale.
*
* @return An instance of <code>NumberFormat</code> for handling percentages.
*/
@@ -571,8 +571,8 @@ public abstract class NumberFormat extends Format implements Cloneable
* <code>Double</code>. If no number can be parsed, no exception is
* thrown. Instead, the parse position remains at its initial index.
*
- * @param str The string to parse.
- * @param pp The desired <code>ParsePosition</code>.
+ * @param sourceStr The string to parse.
+ * @param pos The desired <code>ParsePosition</code>.
*
* @return The parsed <code>Number</code>
*/
@@ -584,7 +584,7 @@ public abstract class NumberFormat extends Format implements Cloneable
* <code>Double</code>. If no number can be parsed, an exception will be
* thrown.
*
- * @param str The string to parse.
+ * @param sourceStr The string to parse.
*
* @return The parsed <code>Number</code>
*
@@ -610,8 +610,8 @@ public abstract class NumberFormat extends Format implements Cloneable
* <code>Double</code>. If no number can be parsed, no exception is
* thrown. Instead, the parse position remains at its initial index.
*
- * @param str The string to parse.
- * @param pp The desired <code>ParsePosition</code>.
+ * @param sourceStr The string to parse.
+ * @param pos The desired <code>ParsePosition</code>.
*
* @return The parsed <code>Object</code>
*/
@@ -629,7 +629,7 @@ public abstract class NumberFormat extends Format implements Cloneable
* might appear as "1,000,000". (Both of these assume the US English
* locale).
*
- * @param groupingUsed <code>true</code> to enable grouping,
+ * @param newValue <code>true</code> to enable grouping,
* <code>false</code> to disable it.
*/
public void setGroupingUsed (boolean newValue)
@@ -643,11 +643,11 @@ public abstract class NumberFormat extends Format implements Cloneable
* current minimum allowed digits, the minimum allowed digits value will
* be lowered to be equal to the new maximum allowed digits value.
*
- * @param maximumFractionDigits The new maximum fraction digits value.
+ * @param digits The new maximum fraction digits value.
*/
- public void setMaximumFractionDigits (int newValue)
+ public void setMaximumFractionDigits (int digits)
{
- maximumFractionDigits = newValue;
+ maximumFractionDigits = digits;
if (getMinimumFractionDigits () > maximumFractionDigits)
setMinimumFractionDigits (maximumFractionDigits);
}
@@ -658,11 +658,11 @@ public abstract class NumberFormat extends Format implements Cloneable
* current minimum allowed digits, the minimum allowed digits value will
* be lowered to be equal to the new maximum allowed digits value.
*
- * @param maximumIntegerDigits The new maximum integer digits value.
+ * @param digits The new maximum integer digits value.
*/
- public void setMaximumIntegerDigits (int newValue)
+ public void setMaximumIntegerDigits (int digits)
{
- maximumIntegerDigits = newValue;
+ maximumIntegerDigits = digits;
if (getMinimumIntegerDigits () > maximumIntegerDigits)
setMinimumIntegerDigits (maximumIntegerDigits);
}
@@ -673,11 +673,11 @@ public abstract class NumberFormat extends Format implements Cloneable
* current maximum allowed digits, the maximum allowed digits value will
* be raised to be equal to the new minimum allowed digits value.
*
- * @param minimumFractionDigits The new minimum fraction digits value.
+ * @param digits The new minimum fraction digits value.
*/
- public void setMinimumFractionDigits (int newValue)
+ public void setMinimumFractionDigits (int digits)
{
- minimumFractionDigits = newValue;
+ minimumFractionDigits = digits;
if (getMaximumFractionDigits () < minimumFractionDigits)
setMaximumFractionDigits (minimumFractionDigits);
}
@@ -688,11 +688,11 @@ public abstract class NumberFormat extends Format implements Cloneable
* current maximum allowed digits, the maximum allowed digits value will
* be raised to be equal to the new minimum allowed digits value.
*
- * @param minimumIntegerDigits The new minimum integer digits value.
+ * @param digits The new minimum integer digits value.
*/
- public void setMinimumIntegerDigits (int newValue)
+ public void setMinimumIntegerDigits (int digits)
{
- minimumIntegerDigits = newValue;
+ minimumIntegerDigits = digits;
if (getMaximumIntegerDigits () < minimumIntegerDigits)
setMaximumIntegerDigits (minimumIntegerDigits);
}
@@ -701,7 +701,7 @@ public abstract class NumberFormat extends Format implements Cloneable
* This method sets the parsing behavior of this object to parse only
* integers or not.
*
- * @param parseIntegerOnly <code>true</code> to parse only integers,
+ * @param value <code>true</code> to parse only integers,
* <code>false</code> otherwise.
*/
public void setParseIntegerOnly (boolean value)
diff --git a/libjava/classpath/java/text/ParseException.java b/libjava/classpath/java/text/ParseException.java
index 6d014ef..4c7ad81 100644
--- a/libjava/classpath/java/text/ParseException.java
+++ b/libjava/classpath/java/text/ParseException.java
@@ -65,7 +65,7 @@ public class ParseException extends Exception
* This method initializes a new instance of <code>ParseException</code>
* with a detailed error message and a error position.
*
- * @param msg the descriptive message describing the error
+ * @param s the descriptive message describing the error
* @param offset the position where the error was encountered
*/
public ParseException(String s, int offset)
diff --git a/libjava/classpath/java/text/SimpleDateFormat.java b/libjava/classpath/java/text/SimpleDateFormat.java
index 789cb83..c0c4cf6 100644
--- a/libjava/classpath/java/text/SimpleDateFormat.java
+++ b/libjava/classpath/java/text/SimpleDateFormat.java
@@ -180,8 +180,8 @@ public class SimpleDateFormat extends DateFormat
* years to be interpreted as representing
* the years between 2004 and 2104.
*
- * @see get2DigitYearStart()
- * @see set2DigitYearStart(java.util.Date)
+ * @see #get2DigitYearStart()
+ * @see #set2DigitYearStart(java.util.Date)
* @see Date
* @serial The start date of the century for parsing two digit years.
* May not be null.
@@ -192,8 +192,8 @@ public class SimpleDateFormat extends DateFormat
* The year at which interpretation of two
* digit years starts.
*
- * @see get2DigitYearStart()
- * @see set2DigitYearStart(java.util.Date)
+ * @see #get2DigitYearStart()
+ * @see #set2DigitYearStart(java.util.Date)
* @serial Ignored.
*/
private transient int defaultCentury;
@@ -204,10 +204,10 @@ public class SimpleDateFormat extends DateFormat
* stored in standardChars. Localized patterns
* are translated to this form.
*
- * @see applyPattern(String)
- * @see applyLocalizedPattern(String)
- * @see toPattern()
- * @see toLocalizedPattern()
+ * @see #applyPattern(String)
+ * @see #applyLocalizedPattern(String)
+ * @see #toPattern()
+ * @see #toLocalizedPattern()
* @serial The non-localized pattern string. May not be null.
*/
private String pattern;
@@ -294,44 +294,73 @@ public class SimpleDateFormat extends DateFormat
int field;
CompiledField current = null;
- for (int i=0; i<pattern.length(); i++) {
- thisChar = pattern.charAt(i);
- field = standardChars.indexOf(thisChar);
- if (field == -1) {
- current = null;
- if ((thisChar >= 'A' && thisChar <= 'Z')
- || (thisChar >= 'a' && thisChar <= 'z')) {
- // Not a valid letter
- throw new IllegalArgumentException("Invalid letter " + thisChar +
- "encountered at character " + i
- + ".");
- } else if (thisChar == '\'') {
- // Quoted text section; skip to next single quote
- pos = pattern.indexOf('\'',i+1);
- if (pos == -1) {
- throw new IllegalArgumentException("Quotes starting at character "
- + i + " not closed.");
+ for (int i = 0; i < pattern.length(); i++)
+ {
+ thisChar = pattern.charAt(i);
+ field = standardChars.indexOf(thisChar);
+ if (field == -1)
+ {
+ current = null;
+ if ((thisChar >= 'A' && thisChar <= 'Z')
+ || (thisChar >= 'a' && thisChar <= 'z'))
+ {
+ // Not a valid letter
+ throw new IllegalArgumentException("Invalid letter "
+ + thisChar +
+ "encountered at character "
+ + i + ".");
+ }
+ else if (thisChar == '\'')
+ {
+ // Quoted text section; skip to next single quote
+ pos = pattern.indexOf('\'', i + 1);
+ // First look for '' -- meaning a single quote.
+ if (pos == i + 1)
+ tokens.add("'");
+ else
+ {
+ // Look for the terminating quote. However, if we
+ // see a '', that represents a literal quote and
+ // we must iterate.
+ StringBuffer buf = new StringBuffer();
+ int oldPos = i + 1;
+ do
+ {
+ if (pos == -1)
+ throw new IllegalArgumentException("Quotes starting at character "
+ + i +
+ " not closed.");
+ buf.append(pattern.substring(oldPos, pos));
+ if (pos + 1 >= pattern.length()
+ || pattern.charAt(pos + 1) != '\'')
+ break;
+ buf.append('\'');
+ oldPos = pos + 2;
+ pos = pattern.indexOf('\'', pos + 2);
+ }
+ while (true);
+ tokens.add(buf.toString());
+ }
+ i = pos;
+ }
+ else
+ {
+ // A special character
+ tokens.add(new Character(thisChar));
+ }
}
- if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) {
- tokens.add(pattern.substring(i+1,pos+1));
- } else {
- tokens.add(pattern.substring(i+1,pos));
+ else
+ {
+ // A valid field
+ if ((current != null) && (field == current.field))
+ current.size++;
+ else
+ {
+ current = new CompiledField(field, 1, thisChar);
+ tokens.add(current);
+ }
}
- i = pos;
- } else {
- // A special character
- tokens.add(new Character(thisChar));
- }
- } else {
- // A valid field
- if ((current != null) && (field == current.field)) {
- current.size++;
- } else {
- current = new CompiledField(field,1,thisChar);
- tokens.add(current);
- }
}
- }
}
/**
@@ -611,7 +640,7 @@ public class SimpleDateFormat extends DateFormat
* <li>Is using the same century for two digit years.</li>
* </ul>
*
- * @param obj The object to compare for equality against.
+ * @param o The object to compare for equality against.
*
* @return <code>true</code> if the specified object is equal to this object,
* <code>false</code> otherwise.
diff --git a/libjava/classpath/java/text/StringCharacterIterator.java b/libjava/classpath/java/text/StringCharacterIterator.java
index e3adc85..e267488 100644
--- a/libjava/classpath/java/text/StringCharacterIterator.java
+++ b/libjava/classpath/java/text/StringCharacterIterator.java
@@ -76,7 +76,10 @@ public final class StringCharacterIterator implements CharacterIterator
* text of the specified <code>String</code>. The initial index
* value will be set to the first character in the string.
*
- * @param text The <code>String</code> to iterate through.
+ * @param text The <code>String</code> to iterate through (<code>null</code>
+ * not permitted).
+ *
+ * @throws NullPointerException if <code>text</code> is <code>null</code>.
*/
public StringCharacterIterator (String text)
{
@@ -113,7 +116,7 @@ public final class StringCharacterIterator implements CharacterIterator
* @param end The ending position in the character range.
* @param index The initial index position.
*
- * @param IllegalArgumentException If any of the range values are
+ * @throws IllegalArgumentException If any of the range values are
* invalid.
*/
public StringCharacterIterator (String text, int begin, int end, int index)
diff --git a/libjava/classpath/java/util/Observable.java b/libjava/classpath/java/util/Observable.java
index 4c2cddb..916abe4 100644
--- a/libjava/classpath/java/util/Observable.java
+++ b/libjava/classpath/java/util/Observable.java
@@ -77,6 +77,8 @@ public class Observable
*/
public synchronized void addObserver(Observer observer)
{
+ if (observer == null)
+ throw new NullPointerException("can't add null observer");
observers.add(observer);
}
diff --git a/libjava/classpath/java/util/Properties.java b/libjava/classpath/java/util/Properties.java
index c7c19b3..f00615b 100644
--- a/libjava/classpath/java/util/Properties.java
+++ b/libjava/classpath/java/util/Properties.java
@@ -209,8 +209,12 @@ label = Name:\\u0020</pre>
{
if (pos == line.length())
{
- // The line continues on the next line.
+ // The line continues on the next line. If there
+ // is no next line, just treat it as a key with an
+ // empty value.
line = reader.readLine();
+ if (line == null)
+ line = "";
pos = 0;
while (pos < line.length()
&& Character.isWhitespace(c = line.charAt(pos)))
@@ -410,7 +414,17 @@ label = Name:\\u0020</pre>
*/
public String getProperty(String key)
{
- return getProperty(key, null);
+ Properties prop = this;
+ // Eliminate tail recursion.
+ do
+ {
+ String value = (String) prop.get(key);
+ if (value != null)
+ return value;
+ prop = prop.defaults;
+ }
+ while (prop != null);
+ return null;
}
/**
@@ -429,17 +443,10 @@ label = Name:\\u0020</pre>
*/
public String getProperty(String key, String defaultValue)
{
- Properties prop = this;
- // Eliminate tail recursion.
- do
- {
- String value = (String) prop.get(key);
- if (value != null)
- return value;
- prop = prop.defaults;
- }
- while (prop != null);
- return defaultValue;
+ String prop = getProperty(key);
+ if (prop == null)
+ prop = defaultValue;
+ return prop;
}
/**
diff --git a/libjava/classpath/java/util/TimeZone.java b/libjava/classpath/java/util/TimeZone.java
index 99df11d..95117af 100644
--- a/libjava/classpath/java/util/TimeZone.java
+++ b/libjava/classpath/java/util/TimeZone.java
@@ -197,6 +197,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
timezones0.put("MST", tz);
timezones0.put("MST7MDT", tz);
timezones0.put("America/Boise", tz);
+ timezones0.put("America/Cambridge_Bay", tz);
timezones0.put("America/Chihuahua", tz);
timezones0.put("America/Denver", tz);
timezones0.put("America/Edmonton", tz);
@@ -216,15 +217,15 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
timezones0.put("CST", tz);
timezones0.put("CST6CDT", tz);
- timezones0.put("America/Cambridge_Bay", tz);
timezones0.put("America/Cancun", tz);
timezones0.put("America/Chicago", tz);
timezones0.put("America/Menominee", tz);
timezones0.put("America/Merida", tz);
timezones0.put("America/Mexico_City", tz);
timezones0.put("America/Monterrey", tz);
+ timezones0.put("America/North_Dakota/Center", tz);
timezones0.put("America/Rainy_River", tz);
- timezones0.put("America/Winnipeg", tz);
+ timezones0.put("America/Rankin_Inlet", tz);
tz = new SimpleTimeZone(-6000 * 3600, "America/Belize");
timezones0.put("America/Belize", tz);
timezones0.put("America/Costa_Rica", tz);
@@ -236,15 +237,24 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
timezones0.put("America/Tegucigalpa", tz);
timezones0.put("Pacific/Galapagos", tz);
tz = new SimpleTimeZone
+ (-6000 * 3600, "America/Winnipeg",
+ Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
+ timezones0.put("America/Winnipeg", tz);
+ tz = new SimpleTimeZone
(-6000 * 3600, "Pacific/Easter",
- Calendar.OCTOBER, 9, -Calendar.SUNDAY, 0 * 3600,
- Calendar.MARCH, 9, -Calendar.SUNDAY, 0 * 3600);
+ Calendar.OCTOBER, 2, Calendar.SATURDAY, 23000 * 3600,
+ Calendar.MARCH, 2, Calendar.SATURDAY, 22000 * 3600);
timezones0.put("Pacific/Easter", tz);
tz = new SimpleTimeZone
(-5000 * 3600, "America/Grand_Turk",
Calendar.APRIL, 1, Calendar.SUNDAY, 0 * 3600,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
timezones0.put("America/Grand_Turk", tz);
+ tz = new SimpleTimeZone
+ (-5000 * 3600, "America/Havana",
+ Calendar.APRIL, 1, Calendar.SUNDAY, 1000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 1000 * 3600);
timezones0.put("America/Havana", tz);
tz = new SimpleTimeZone(-5000 * 3600, "EST5");
timezones0.put("EST5", tz);
@@ -258,14 +268,11 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
timezones0.put("America/Indiana/Marengo", tz);
timezones0.put("America/Indiana/Vevay", tz);
timezones0.put("America/Indianapolis", tz);
- timezones0.put("America/Iqaluit", tz);
timezones0.put("America/Jamaica", tz);
timezones0.put("America/Lima", tz);
timezones0.put("America/Panama", tz);
- timezones0.put("America/Pangnirtung", tz);
timezones0.put("America/Port-au-Prince", tz);
- timezones0.put("America/Porto_Acre", tz);
- timezones0.put("America/Rankin_Inlet", tz);
+ timezones0.put("America/Rio_Branco", tz);
tz = new SimpleTimeZone
(-5000 * 3600, "EST",
Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
@@ -273,6 +280,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
timezones0.put("EST", tz);
timezones0.put("EST5EDT", tz);
timezones0.put("America/Detroit", tz);
+ timezones0.put("America/Iqaluit", tz);
timezones0.put("America/Kentucky/Louisville", tz);
timezones0.put("America/Kentucky/Monticello", tz);
timezones0.put("America/Louisville", tz);
@@ -280,7 +288,9 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
timezones0.put("America/Nassau", tz);
timezones0.put("America/New_York", tz);
timezones0.put("America/Nipigon", tz);
+ timezones0.put("America/Pangnirtung", tz);
timezones0.put("America/Thunder_Bay", tz);
+ timezones0.put("America/Toronto", tz);
tz = new SimpleTimeZone(-4000 * 3600, "PRT");
timezones0.put("PRT", tz);
timezones0.put("America/Anguilla", tz);
@@ -309,13 +319,14 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
timezones0.put("America/Tortola", tz);
tz = new SimpleTimeZone
(-4000 * 3600, "America/Asuncion",
- Calendar.OCTOBER, 1, Calendar.SUNDAY, 0 * 3600,
- Calendar.FEBRUARY, -1, Calendar.SUNDAY, 0 * 3600);
+ Calendar.OCTOBER, 3, Calendar.SUNDAY, 0 * 3600,
+ Calendar.MARCH, 2, Calendar.SUNDAY, 0 * 3600);
timezones0.put("America/Asuncion", tz);
tz = new SimpleTimeZone
- (-4000 * 3600, "America/Cuiaba",
- Calendar.OCTOBER, 2, Calendar.SUNDAY, 0 * 3600,
+ (-4000 * 3600, "America/Campo_Grande",
+ Calendar.OCTOBER, 3, Calendar.SUNDAY, 0 * 3600,
Calendar.FEBRUARY, 3, Calendar.SUNDAY, 0 * 3600);
+ timezones0.put("America/Campo_Grande", tz);
timezones0.put("America/Cuiaba", tz);
tz = new SimpleTimeZone
(-4000 * 3600, "America/Goose_Bay",
@@ -323,6 +334,11 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
Calendar.OCTOBER, -1, Calendar.SUNDAY, 60000);
timezones0.put("America/Goose_Bay", tz);
tz = new SimpleTimeZone
+ (-4000 * 3600, "America/Santiago",
+ Calendar.OCTOBER, 9, -Calendar.SUNDAY, 1000 * 3600,
+ Calendar.MARCH, 9, -Calendar.SUNDAY, 0 * 3600);
+ timezones0.put("America/Santiago", tz);
+ tz = new SimpleTimeZone
(-4000 * 3600, "America/Glace_Bay",
Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
@@ -331,15 +347,14 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
timezones0.put("America/Thule", tz);
timezones0.put("Atlantic/Bermuda", tz);
tz = new SimpleTimeZone
- (-4000 * 3600, "America/Santiago",
+ (-4000 * 3600, "Antarctica/Palmer",
Calendar.OCTOBER, 9, -Calendar.SUNDAY, 0 * 3600,
Calendar.MARCH, 9, -Calendar.SUNDAY, 0 * 3600);
- timezones0.put("America/Santiago", tz);
timezones0.put("Antarctica/Palmer", tz);
tz = new SimpleTimeZone
(-4000 * 3600, "Atlantic/Stanley",
- Calendar.SEPTEMBER, 2, Calendar.SUNDAY, 0 * 3600,
- Calendar.APRIL, 16, -Calendar.SUNDAY, 0 * 3600);
+ Calendar.SEPTEMBER, 1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.APRIL, 3, Calendar.SUNDAY, 2000 * 3600);
timezones0.put("Atlantic/Stanley", tz);
tz = new SimpleTimeZone
(-3500 * 3600, "CNT",
@@ -348,48 +363,54 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
timezones0.put("CNT", tz);
timezones0.put("America/St_Johns", tz);
tz = new SimpleTimeZone
- (-3000 * 3600, "America/Araguaina",
- Calendar.OCTOBER, 2, Calendar.SUNDAY, 0 * 3600,
+ (-3000 * 3600, "America/Godthab",
+ Calendar.MARCH, 30, -Calendar.SATURDAY, 23000 * 3600,
+ Calendar.OCTOBER, 30, -Calendar.SATURDAY, 23000 * 3600);
+ timezones0.put("America/Godthab", tz);
+ tz = new SimpleTimeZone
+ (-3000 * 3600, "America/Miquelon",
+ Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
+ timezones0.put("America/Miquelon", tz);
+ tz = new SimpleTimeZone
+ (-3000 * 3600, "America/Sao_Paulo",
+ Calendar.OCTOBER, 3, Calendar.SUNDAY, 0 * 3600,
Calendar.FEBRUARY, 3, Calendar.SUNDAY, 0 * 3600);
- timezones0.put("America/Araguaina", tz);
timezones0.put("America/Sao_Paulo", tz);
tz = new SimpleTimeZone(-3000 * 3600, "AGT");
timezones0.put("AGT", tz);
+ timezones0.put("America/Araguaina", tz);
+ timezones0.put("America/Argentina/Buenos_Aires", tz);
+ timezones0.put("America/Argentina/Catamarca", tz);
+ timezones0.put("America/Argentina/ComodRivadavia", tz);
+ timezones0.put("America/Argentina/Cordoba", tz);
+ timezones0.put("America/Argentina/Jujuy", tz);
+ timezones0.put("America/Argentina/La_Rioja", tz);
+ timezones0.put("America/Argentina/Mendoza", tz);
+ timezones0.put("America/Argentina/Rio_Gallegos", tz);
+ timezones0.put("America/Argentina/San_Juan", tz);
+ timezones0.put("America/Argentina/Tucuman", tz);
+ timezones0.put("America/Argentina/Ushuaia", tz);
+ timezones0.put("America/Bahia", tz);
timezones0.put("America/Belem", tz);
- timezones0.put("America/Buenos_Aires", tz);
- timezones0.put("America/Catamarca", tz);
timezones0.put("America/Cayenne", tz);
- timezones0.put("America/Cordoba", tz);
timezones0.put("America/Fortaleza", tz);
- timezones0.put("America/Jujuy", tz);
timezones0.put("America/Maceio", tz);
- timezones0.put("America/Mendoza", tz);
timezones0.put("America/Montevideo", tz);
timezones0.put("America/Paramaribo", tz);
timezones0.put("America/Recife", tz);
- timezones0.put("America/Rosario", tz);
- tz = new SimpleTimeZone
- (-3000 * 3600, "America/Godthab",
- Calendar.MARCH, 30, -Calendar.SATURDAY, 22000 * 3600,
- Calendar.OCTOBER, 30, -Calendar.SATURDAY, 22000 * 3600);
- timezones0.put("America/Godthab", tz);
- tz = new SimpleTimeZone
- (-3000 * 3600, "America/Miquelon",
- Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
- timezones0.put("America/Miquelon", tz);
+ timezones0.put("Antarctica/Rothera", tz);
tz = new SimpleTimeZone(-2000 * 3600, "America/Noronha");
timezones0.put("America/Noronha", tz);
timezones0.put("Atlantic/South_Georgia", tz);
tz = new SimpleTimeZone
(-1000 * 3600, "America/Scoresbysund",
- Calendar.MARCH, -1, Calendar.SUNDAY, 0 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
+ Calendar.MARCH, -1, Calendar.SUNDAY, 1000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 1000 * 3600);
timezones0.put("America/Scoresbysund", tz);
timezones0.put("Atlantic/Azores", tz);
tz = new SimpleTimeZone(-1000 * 3600, "Atlantic/Cape_Verde");
timezones0.put("Atlantic/Cape_Verde", tz);
- timezones0.put("Atlantic/Jan_Mayen", tz);
tz = new SimpleTimeZone(0 * 3600, "GMT");
timezones0.put("GMT", tz);
timezones0.put("UTC", tz);
@@ -409,6 +430,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
timezones0.put("Africa/Ouagadougou", tz);
timezones0.put("Africa/Sao_Tome", tz);
timezones0.put("Africa/Timbuktu", tz);
+ timezones0.put("America/Danmarkshavn", tz);
timezones0.put("Atlantic/Reykjavik", tz);
timezones0.put("Atlantic/St_Helena", tz);
timezones0.put("Europe/Belfast", tz);
@@ -416,8 +438,8 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
timezones0.put("Europe/London", tz);
tz = new SimpleTimeZone
(0 * 3600, "WET",
- Calendar.MARCH, -1, Calendar.SUNDAY, 1000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 1000 * 3600);
+ Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
timezones0.put("WET", tz);
timezones0.put("Atlantic/Canary", tz);
timezones0.put("Atlantic/Faeroe", tz);
@@ -444,14 +466,14 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
timezones0.put("Africa/Windhoek", tz);
tz = new SimpleTimeZone
(1000 * 3600, "CET",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
+ Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
timezones0.put("CET", tz);
- timezones0.put("CEST", tz);
timezones0.put("ECT", tz);
timezones0.put("MET", tz);
timezones0.put("Africa/Ceuta", tz);
timezones0.put("Arctic/Longyearbyen", tz);
+ timezones0.put("Atlantic/Jan_Mayen", tz);
timezones0.put("Europe/Amsterdam", tz);
timezones0.put("Europe/Andorra", tz);
timezones0.put("Europe/Belgrade", tz);
@@ -483,8 +505,8 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
timezones0.put("Europe/Zurich", tz);
tz = new SimpleTimeZone
(2000 * 3600, "ART",
- Calendar.APRIL, -1, Calendar.FRIDAY, 0 * 3600,
- Calendar.SEPTEMBER, -1, Calendar.THURSDAY, 23000 * 3600);
+ Calendar.APRIL, -1, Calendar.FRIDAY, 1000 * 3600,
+ Calendar.SEPTEMBER, -1, Calendar.THURSDAY, 24000 * 3600);
timezones0.put("ART", tz);
timezones0.put("Africa/Cairo", tz);
tz = new SimpleTimeZone(2000 * 3600, "CAT");
@@ -501,13 +523,11 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
timezones0.put("Africa/Maseru", tz);
timezones0.put("Africa/Mbabane", tz);
timezones0.put("Africa/Tripoli", tz);
- timezones0.put("Europe/Riga", tz);
- timezones0.put("Europe/Tallinn", tz);
- timezones0.put("Europe/Vilnius", tz);
+ timezones0.put("Asia/Jerusalem", tz);
tz = new SimpleTimeZone
(2000 * 3600, "Asia/Amman",
- Calendar.MARCH, -1, Calendar.THURSDAY, 0 * 3600,
- Calendar.SEPTEMBER, -1, Calendar.THURSDAY, 0 * 3600);
+ Calendar.MARCH, -1, Calendar.THURSDAY, 1000 * 3600,
+ Calendar.SEPTEMBER, -1, Calendar.THURSDAY, 1000 * 3600);
timezones0.put("Asia/Amman", tz);
tz = new SimpleTimeZone
(2000 * 3600, "Asia/Beirut",
@@ -525,14 +545,9 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
Calendar.OCTOBER, 3, Calendar.FRIDAY, 0 * 3600);
timezones0.put("Asia/Gaza", tz);
tz = new SimpleTimeZone
- (2000 * 3600, "Asia/Jerusalem",
- Calendar.APRIL, 1, 0, 1000 * 3600,
- Calendar.OCTOBER, 1, 0, 1000 * 3600);
- timezones0.put("Asia/Jerusalem", tz);
- tz = new SimpleTimeZone
(2000 * 3600, "EET",
- Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
+ Calendar.MARCH, -1, Calendar.SUNDAY, 4000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 4000 * 3600);
timezones0.put("EET", tz);
timezones0.put("Asia/Istanbul", tz);
timezones0.put("Asia/Nicosia", tz);
@@ -542,28 +557,32 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
timezones0.put("Europe/Helsinki", tz);
timezones0.put("Europe/Istanbul", tz);
timezones0.put("Europe/Kiev", tz);
+ timezones0.put("Europe/Mariehamn", tz);
timezones0.put("Europe/Nicosia", tz);
+ timezones0.put("Europe/Riga", tz);
timezones0.put("Europe/Simferopol", tz);
timezones0.put("Europe/Sofia", tz);
+ timezones0.put("Europe/Tallinn", tz);
timezones0.put("Europe/Uzhgorod", tz);
+ timezones0.put("Europe/Vilnius", tz);
timezones0.put("Europe/Zaporozhye", tz);
tz = new SimpleTimeZone
(2000 * 3600, "Europe/Kaliningrad",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
+ Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
timezones0.put("Europe/Kaliningrad", tz);
timezones0.put("Europe/Minsk", tz);
tz = new SimpleTimeZone
(3000 * 3600, "Asia/Baghdad",
- Calendar.APRIL, 1, 0, 3000 * 3600,
- Calendar.OCTOBER, 1, 0, 3000 * 3600);
+ Calendar.APRIL, 1, 0, 4000 * 3600,
+ Calendar.OCTOBER, 1, 0, 4000 * 3600);
timezones0.put("Asia/Baghdad", tz);
tz = new SimpleTimeZone
- (3000 * 3600, "Europe/Moscow",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
+ (3000 * 3600, "Asia/Tbilisi",
+ Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
+ timezones0.put("Asia/Tbilisi", tz);
timezones0.put("Europe/Moscow", tz);
- timezones0.put("Europe/Tiraspol", tz);
tz = new SimpleTimeZone(3000 * 3600, "EAT");
timezones0.put("EAT", tz);
timezones0.put("Africa/Addis_Ababa", tz);
@@ -591,49 +610,40 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1000 * 3600);
timezones0.put("Asia/Baku", tz);
tz = new SimpleTimeZone
- (4000 * 3600, "Asia/Aqtau",
- Calendar.MARCH, -1, Calendar.SUNDAY, 0 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
- timezones0.put("Asia/Aqtau", tz);
- timezones0.put("Asia/Tbilisi", tz);
- tz = new SimpleTimeZone
(4000 * 3600, "Asia/Yerevan",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
+ Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
timezones0.put("Asia/Yerevan", tz);
timezones0.put("Europe/Samara", tz);
tz = new SimpleTimeZone(4000 * 3600, "NET");
timezones0.put("NET", tz);
+ timezones0.put("Asia/Aqtau", tz);
timezones0.put("Asia/Dubai", tz);
timezones0.put("Asia/Muscat", tz);
+ timezones0.put("Asia/Oral", tz);
timezones0.put("Indian/Mahe", tz);
timezones0.put("Indian/Mauritius", tz);
timezones0.put("Indian/Reunion", tz);
tz = new SimpleTimeZone(4500 * 3600, "Asia/Kabul");
timezones0.put("Asia/Kabul", tz);
tz = new SimpleTimeZone
- (5000 * 3600, "Asia/Aqtobe",
- Calendar.MARCH, -1, Calendar.SUNDAY, 0 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
- timezones0.put("Asia/Aqtobe", tz);
- tz = new SimpleTimeZone
(5000 * 3600, "Asia/Bishkek",
Calendar.MARCH, -1, Calendar.SUNDAY, 2500 * 3600,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2500 * 3600);
timezones0.put("Asia/Bishkek", tz);
tz = new SimpleTimeZone
(5000 * 3600, "Asia/Yekaterinburg",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
+ Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
timezones0.put("Asia/Yekaterinburg", tz);
tz = new SimpleTimeZone(5000 * 3600, "PLT");
timezones0.put("PLT", tz);
+ timezones0.put("Asia/Aqtobe", tz);
timezones0.put("Asia/Ashgabat", tz);
timezones0.put("Asia/Dushanbe", tz);
timezones0.put("Asia/Karachi", tz);
timezones0.put("Asia/Samarkand", tz);
timezones0.put("Asia/Tashkent", tz);
- timezones0.put("Indian/Chagos", tz);
timezones0.put("Indian/Kerguelen", tz);
timezones0.put("Indian/Maldives", tz);
tz = new SimpleTimeZone(5500 * 3600, "IST");
@@ -644,18 +654,17 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
tz = new SimpleTimeZone(6000 * 3600, "BST");
timezones0.put("BST", tz);
timezones0.put("Antarctica/Mawson", tz);
+ timezones0.put("Antarctica/Vostok", tz);
+ timezones0.put("Asia/Almaty", tz);
timezones0.put("Asia/Colombo", tz);
timezones0.put("Asia/Dhaka", tz);
+ timezones0.put("Asia/Qyzylorda", tz);
timezones0.put("Asia/Thimphu", tz);
- tz = new SimpleTimeZone
- (6000 * 3600, "Asia/Almaty",
- Calendar.MARCH, -1, Calendar.SUNDAY, 0 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
- timezones0.put("Asia/Almaty", tz);
+ timezones0.put("Indian/Chagos", tz);
tz = new SimpleTimeZone
(6000 * 3600, "Asia/Novosibirsk",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
+ Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
timezones0.put("Asia/Novosibirsk", tz);
timezones0.put("Asia/Omsk", tz);
tz = new SimpleTimeZone(6500 * 3600, "Asia/Rangoon");
@@ -665,41 +674,55 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
timezones0.put("VST", tz);
timezones0.put("Antarctica/Davis", tz);
timezones0.put("Asia/Bangkok", tz);
- timezones0.put("Asia/Hovd", tz);
timezones0.put("Asia/Jakarta", tz);
timezones0.put("Asia/Phnom_Penh", tz);
+ timezones0.put("Asia/Pontianak", tz);
timezones0.put("Asia/Saigon", tz);
timezones0.put("Asia/Vientiane", tz);
timezones0.put("Indian/Christmas", tz);
tz = new SimpleTimeZone
+ (7000 * 3600, "Asia/Hovd",
+ Calendar.MARCH, -1, Calendar.SATURDAY, 2000 * 3600,
+ Calendar.SEPTEMBER, -1, Calendar.SATURDAY, 2000 * 3600);
+ timezones0.put("Asia/Hovd", tz);
+ tz = new SimpleTimeZone
(7000 * 3600, "Asia/Krasnoyarsk",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
+ Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
timezones0.put("Asia/Krasnoyarsk", tz);
tz = new SimpleTimeZone(8000 * 3600, "CTT");
timezones0.put("CTT", tz);
timezones0.put("Antarctica/Casey", tz);
timezones0.put("Asia/Brunei", tz);
- timezones0.put("Asia/Chungking", tz);
+ timezones0.put("Asia/Chongqing", tz);
timezones0.put("Asia/Harbin", tz);
timezones0.put("Asia/Hong_Kong", tz);
timezones0.put("Asia/Kashgar", tz);
timezones0.put("Asia/Kuala_Lumpur", tz);
timezones0.put("Asia/Kuching", tz);
- timezones0.put("Asia/Macao", tz);
+ timezones0.put("Asia/Macau", tz);
+ timezones0.put("Asia/Makassar", tz);
timezones0.put("Asia/Manila", tz);
timezones0.put("Asia/Shanghai", tz);
timezones0.put("Asia/Singapore", tz);
timezones0.put("Asia/Taipei", tz);
- timezones0.put("Asia/Ujung_Pandang", tz);
- timezones0.put("Asia/Ulaanbaatar", tz);
timezones0.put("Asia/Urumqi", tz);
timezones0.put("Australia/Perth", tz);
tz = new SimpleTimeZone
(8000 * 3600, "Asia/Irkutsk",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
+ Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
timezones0.put("Asia/Irkutsk", tz);
+ tz = new SimpleTimeZone
+ (8000 * 3600, "Asia/Ulaanbaatar",
+ Calendar.MARCH, -1, Calendar.SATURDAY, 2000 * 3600,
+ Calendar.SEPTEMBER, -1, Calendar.SATURDAY, 2000 * 3600);
+ timezones0.put("Asia/Ulaanbaatar", tz);
+ tz = new SimpleTimeZone
+ (9000 * 3600, "Asia/Choibalsan",
+ Calendar.MARCH, -1, Calendar.SATURDAY, 2000 * 3600,
+ Calendar.SEPTEMBER, -1, Calendar.SATURDAY, 2000 * 3600);
+ timezones0.put("Asia/Choibalsan", tz);
tz = new SimpleTimeZone(9000 * 3600, "JST");
timezones0.put("JST", tz);
timezones0.put("Asia/Dili", tz);
@@ -710,13 +733,13 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
timezones0.put("Pacific/Palau", tz);
tz = new SimpleTimeZone
(9000 * 3600, "Asia/Yakutsk",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
+ Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
timezones0.put("Asia/Yakutsk", tz);
tz = new SimpleTimeZone
(9500 * 3600, "Australia/Adelaide",
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600);
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600,
+ Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600);
timezones0.put("Australia/Adelaide", tz);
timezones0.put("Australia/Broken_Hill", tz);
tz = new SimpleTimeZone(9500 * 3600, "ACT");
@@ -732,31 +755,32 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
timezones0.put("Pacific/Truk", tz);
timezones0.put("Pacific/Yap", tz);
tz = new SimpleTimeZone
- (10000 * 3600, "Asia/Vladivostok",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
+ (10000 * 3600, "Asia/Sakhalin",
+ Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
+ timezones0.put("Asia/Sakhalin", tz);
timezones0.put("Asia/Vladivostok", tz);
tz = new SimpleTimeZone
(10000 * 3600, "Australia/Hobart",
- Calendar.OCTOBER, 1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600);
+ Calendar.OCTOBER, 1, Calendar.SUNDAY, 3000 * 3600,
+ Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600);
timezones0.put("Australia/Hobart", tz);
tz = new SimpleTimeZone
(10000 * 3600, "AET",
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600);
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600,
+ Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600);
timezones0.put("AET", tz);
timezones0.put("Australia/Melbourne", tz);
timezones0.put("Australia/Sydney", tz);
tz = new SimpleTimeZone
(10500 * 3600, "Australia/Lord_Howe",
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600, 500 * 3600);
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600, 500 * 3600);
timezones0.put("Australia/Lord_Howe", tz);
tz = new SimpleTimeZone
(11000 * 3600, "Asia/Magadan",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
+ Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
timezones0.put("Asia/Magadan", tz);
tz = new SimpleTimeZone(11000 * 3600, "SST");
timezones0.put("SST", tz);
@@ -769,16 +793,16 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
timezones0.put("Pacific/Norfolk", tz);
tz = new SimpleTimeZone
(12000 * 3600, "NST",
- Calendar.OCTOBER, 1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.MARCH, 3, Calendar.SUNDAY, 2000 * 3600);
+ Calendar.OCTOBER, 1, Calendar.SUNDAY, 3000 * 3600,
+ Calendar.MARCH, 3, Calendar.SUNDAY, 3000 * 3600);
timezones0.put("NST", tz);
timezones0.put("Antarctica/McMurdo", tz);
timezones0.put("Antarctica/South_Pole", tz);
timezones0.put("Pacific/Auckland", tz);
tz = new SimpleTimeZone
(12000 * 3600, "Asia/Anadyr",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
+ Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
timezones0.put("Asia/Anadyr", tz);
timezones0.put("Asia/Kamchatka", tz);
tz = new SimpleTimeZone(12000 * 3600, "Pacific/Fiji");
@@ -792,8 +816,8 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
timezones0.put("Pacific/Wallis", tz);
tz = new SimpleTimeZone
(12750 * 3600, "Pacific/Chatham",
- Calendar.OCTOBER, 1, Calendar.SUNDAY, 2750 * 3600,
- Calendar.MARCH, 3, Calendar.SUNDAY, 2750 * 3600);
+ Calendar.OCTOBER, 1, Calendar.SUNDAY, 3750 * 3600,
+ Calendar.MARCH, 3, Calendar.SUNDAY, 3750 * 3600);
timezones0.put("Pacific/Chatham", tz);
tz = new SimpleTimeZone(13000 * 3600, "Pacific/Enderbury");
timezones0.put("Pacific/Enderbury", tz);
diff --git a/libjava/classpath/java/util/Vector.java b/libjava/classpath/java/util/Vector.java
index e26d7aa..67549f0 100644
--- a/libjava/classpath/java/util/Vector.java
+++ b/libjava/classpath/java/util/Vector.java
@@ -164,10 +164,10 @@ public class Vector extends AbstractList
}
/**
- * Copies the contents of a provided array into the Vector. If the
- * array is too large to fit in the Vector, an IndexOutOfBoundsException
- * is thrown without modifying the array. Old elements in the Vector are
- * overwritten by the new elements.
+ * Copies the contents of the Vector into the provided array. If the
+ * array is too small to fit all the elements in the Vector, an
+ * {@link IndexOutOfBoundsException} is thrown without modifying the array.
+ * Old elements in the array are overwritten by the new elements.
*
* @param a target array for the copy
* @throws IndexOutOfBoundsException the array is not large enough
diff --git a/libjava/classpath/java/util/jar/JarFile.java b/libjava/classpath/java/util/jar/JarFile.java
index a9ad21e..7ccbc60 100644
--- a/libjava/classpath/java/util/jar/JarFile.java
+++ b/libjava/classpath/java/util/jar/JarFile.java
@@ -1,5 +1,5 @@
/* JarFile.java - Representation of a jar file
- Copyright (C) 2000, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -351,7 +351,7 @@ public class JarFile extends ZipFile
synchronized(jarfile)
{
- if (!jarfile.signaturesRead)
+ if (jarfile.verify && !jarfile.signaturesRead)
try
{
jarfile.readSignatures();
@@ -408,7 +408,7 @@ public class JarFile extends ZipFile
jarEntry.attr = manifest.getAttributes(name);
}
- if (!signaturesRead)
+ if (verify && !signaturesRead)
try
{
readSignatures();
diff --git a/libjava/classpath/java/util/logging/Logger.java b/libjava/classpath/java/util/logging/Logger.java
index ae985a9..367faad 100644
--- a/libjava/classpath/java/util/logging/Logger.java
+++ b/libjava/classpath/java/util/logging/Logger.java
@@ -577,7 +577,8 @@ public class Logger
public void log(Level level, String message)
{
- log(level, message, (Object[]) null);
+ if (isLoggable(level))
+ log(level, message, (Object[]) null);
}
@@ -585,12 +586,15 @@ public class Logger
String message,
Object param)
{
- StackTraceElement caller = getCallerStackFrame();
- logp(level,
- caller != null ? caller.getClassName() : "<unknown>",
- caller != null ? caller.getMethodName() : "<unknown>",
- message,
- param);
+ if (isLoggable(level))
+ {
+ StackTraceElement caller = getCallerStackFrame();
+ logp(level,
+ caller != null ? caller.getClassName() : "<unknown>",
+ caller != null ? caller.getMethodName() : "<unknown>",
+ message,
+ param);
+ }
}
@@ -598,12 +602,15 @@ public class Logger
String message,
Object[] params)
{
- StackTraceElement caller = getCallerStackFrame();
- logp(level,
- caller != null ? caller.getClassName() : "<unknown>",
- caller != null ? caller.getMethodName() : "<unknown>",
- message,
- params);
+ if (isLoggable(level))
+ {
+ StackTraceElement caller = getCallerStackFrame();
+ logp(level,
+ caller != null ? caller.getClassName() : "<unknown>",
+ caller != null ? caller.getMethodName() : "<unknown>",
+ message,
+ params);
+ }
}
@@ -611,12 +618,15 @@ public class Logger
String message,
Throwable thrown)
{
- StackTraceElement caller = getCallerStackFrame();
- logp(level,
- caller != null ? caller.getClassName() : "<unknown>",
- caller != null ? caller.getMethodName() : "<unknown>",
- message,
- thrown);
+ if (isLoggable(level))
+ {
+ StackTraceElement caller = getCallerStackFrame();
+ logp(level,
+ caller != null ? caller.getClassName() : "<unknown>",
+ caller != null ? caller.getMethodName() : "<unknown>",
+ message,
+ thrown);
+ }
}
diff --git a/libjava/classpath/java/util/zip/DeflaterHuffman.java b/libjava/classpath/java/util/zip/DeflaterHuffman.java
index d040dde..32c10b6 100644
--- a/libjava/classpath/java/util/zip/DeflaterHuffman.java
+++ b/libjava/classpath/java/util/zip/DeflaterHuffman.java
@@ -1,5 +1,5 @@
/* DeflaterHuffman.java --
- Copyright (C) 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -59,7 +59,7 @@ class DeflaterHuffman
private static final int[] BL_ORDER =
{ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 };
- private static String bit4Reverse =
+ private static final String bit4Reverse =
"\000\010\004\014\002\012\006\016\001\011\005\015\003\013\007\017";
class Tree {
diff --git a/libjava/classpath/java/util/zip/DeflaterOutputStream.java b/libjava/classpath/java/util/zip/DeflaterOutputStream.java
index b10100d..4321c0f 100644
--- a/libjava/classpath/java/util/zip/DeflaterOutputStream.java
+++ b/libjava/classpath/java/util/zip/DeflaterOutputStream.java
@@ -1,5 +1,5 @@
/* DeflaterOutputStream.java - Output filter for compressing.
- Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -100,7 +100,7 @@ public class DeflaterOutputStream extends FilterOutputStream
*/
public DeflaterOutputStream(OutputStream out)
{
- this(out, new Deflater(), 512);
+ this(out, new Deflater(), 4096);
}
/**
@@ -111,7 +111,7 @@ public class DeflaterOutputStream extends FilterOutputStream
*/
public DeflaterOutputStream(OutputStream out, Deflater defl)
{
- this(out, defl, 512);
+ this(out, defl, 4096);
}
/**
diff --git a/libjava/classpath/java/util/zip/ZipEntry.java b/libjava/classpath/java/util/zip/ZipEntry.java
index ae21997..9b7afa0 100644
--- a/libjava/classpath/java/util/zip/ZipEntry.java
+++ b/libjava/classpath/java/util/zip/ZipEntry.java
@@ -39,7 +39,6 @@ exception statement from your version. */
package java.util.zip;
import java.util.Calendar;
-import java.util.Date;
/**
* This class represents a member of a zip archive. ZipFile and
@@ -173,7 +172,7 @@ public class ZipEntry implements ZipConstants, Cloneable
Calendar cal = getCalendar();
synchronized (cal)
{
- cal.setTime(new Date(time));
+ cal.setTimeInMillis(time);
dostime = (cal.get(Calendar.YEAR) - 1980 & 0x7f) << 25
| (cal.get(Calendar.MONTH) + 1) << 21
| (cal.get(Calendar.DAY_OF_MONTH)) << 16
@@ -190,12 +189,12 @@ public class ZipEntry implements ZipConstants, Cloneable
*/
public long getTime()
{
+ // The extra bytes might contain the time (posix/unix extension)
+ parseExtra();
+
if ((known & KNOWN_TIME) == 0)
return -1;
- // The extra bytes might contain the time (posix/unix extension)
- parseExtra ();
-
int sec = 2 * (dostime & 0x1f);
int min = (dostime >> 5) & 0x3f;
int hrs = (dostime >> 11) & 0x1f;
@@ -209,7 +208,7 @@ public class ZipEntry implements ZipConstants, Cloneable
synchronized (cal)
{
cal.set(year, mon, day, hrs, min, sec);
- return cal.getTime().getTime();
+ return cal.getTimeInMillis();
}
}
catch (RuntimeException ex)
@@ -367,10 +366,10 @@ public class ZipEntry implements ZipConstants, Cloneable
catch (ArrayIndexOutOfBoundsException ex)
{
/* be lenient */
- return;
}
known |= KNOWN_EXTRA;
+ return;
}
/**
diff --git a/libjava/classpath/java/util/zip/ZipFile.java b/libjava/classpath/java/util/zip/ZipFile.java
index 33f67c7..0243abe 100644
--- a/libjava/classpath/java/util/zip/ZipFile.java
+++ b/libjava/classpath/java/util/zip/ZipFile.java
@@ -48,6 +48,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
+import java.io.UnsupportedEncodingException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
@@ -284,7 +285,15 @@ public class ZipFile implements ZipConstants
buffer = new byte[needBuffer];
raf.readFully(buffer, 0, nameLen);
- String name = new String(buffer, 0, 0, nameLen);
+ String name;
+ try
+ {
+ name = new String(buffer, 0, nameLen, "UTF-8");
+ }
+ catch (UnsupportedEncodingException uee)
+ {
+ throw new AssertionError(uee);
+ }
ZipEntry entry = new ZipEntry(name);
entry.setMethod(method);
@@ -301,7 +310,14 @@ public class ZipFile implements ZipConstants
if (commentLen > 0)
{
raf.readFully(buffer, 0, commentLen);
- entry.setComment(new String(buffer, 0, commentLen));
+ try
+ {
+ entry.setComment(new String(buffer, 0, commentLen, "UTF-8"));
+ }
+ catch (UnsupportedEncodingException uee)
+ {
+ throw new AssertionError(uee);
+ }
}
entry.offset = offset;
entries.put(name, entry);
@@ -317,6 +333,10 @@ public class ZipFile implements ZipConstants
*/
public void close() throws IOException
{
+ RandomAccessFile raf = this.raf;
+ if (raf == null)
+ return;
+
synchronized (raf)
{
closed = true;
diff --git a/libjava/classpath/java/util/zip/ZipInputStream.java b/libjava/classpath/java/util/zip/ZipInputStream.java
index 5732523..4539828 100644
--- a/libjava/classpath/java/util/zip/ZipInputStream.java
+++ b/libjava/classpath/java/util/zip/ZipInputStream.java
@@ -1,5 +1,5 @@
/* ZipInputStream.java --
- Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,7 @@ package java.util.zip;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
/**
* This is a FilterInputStream that reads the files in an zip archive
@@ -171,7 +172,15 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
byte[] buffer = new byte[nameLen];
readFully(buffer);
- String name = new String(buffer);
+ String name;
+ try
+ {
+ name = new String(buffer, "UTF-8");
+ }
+ catch (UnsupportedEncodingException uee)
+ {
+ throw new AssertionError(uee);
+ }
entry = createZipEntry(name);
entryAtEOF = false;
diff --git a/libjava/classpath/java/util/zip/ZipOutputStream.java b/libjava/classpath/java/util/zip/ZipOutputStream.java
index 5699ff0..5c593b2 100644
--- a/libjava/classpath/java/util/zip/ZipOutputStream.java
+++ b/libjava/classpath/java/util/zip/ZipOutputStream.java
@@ -1,5 +1,5 @@
/* ZipOutputStream.java --
- Copyright (C) 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,6 +40,7 @@ package java.util.zip;
import java.io.IOException;
import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
import java.util.Enumeration;
import java.util.Vector;
@@ -102,7 +103,14 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
public void setComment(String comment)
{
byte[] commentBytes;
- commentBytes = comment.getBytes();
+ try
+ {
+ commentBytes = comment.getBytes("UTF-8");
+ }
+ catch (UnsupportedEncodingException uee)
+ {
+ throw new AssertionError(uee);
+ }
if (commentBytes.length > 0xffff)
throw new IllegalArgumentException("Comment too long.");
zipComment = commentBytes;
@@ -226,7 +234,15 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
writeLeInt(0);
writeLeInt(0);
}
- byte[] name = entry.getName().getBytes();
+ byte[] name;
+ try
+ {
+ name = entry.getName().getBytes("UTF-8");
+ }
+ catch (UnsupportedEncodingException uee)
+ {
+ throw new AssertionError(uee);
+ }
if (name.length > 0xffff)
throw new ZipException("Name too long.");
byte[] extra = entry.getExtra();
@@ -357,15 +373,30 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
writeLeInt((int)entry.getCompressedSize());
writeLeInt((int)entry.getSize());
- byte[] name = entry.getName().getBytes();
+ byte[] name;
+ try
+ {
+ name = entry.getName().getBytes("UTF-8");
+ }
+ catch (UnsupportedEncodingException uee)
+ {
+ throw new AssertionError(uee);
+ }
if (name.length > 0xffff)
throw new ZipException("Name too long.");
byte[] extra = entry.getExtra();
if (extra == null)
extra = new byte[0];
- String strComment = entry.getComment();
- byte[] comment = strComment != null
- ? strComment.getBytes() : new byte[0];
+ String str = entry.getComment();
+ byte[] comment;
+ try
+ {
+ comment = str != null ? str.getBytes("UTF-8") : new byte[0];
+ }
+ catch (UnsupportedEncodingException uee)
+ {
+ throw new AssertionError(uee);
+ }
if (comment.length > 0xffff)
throw new ZipException("Comment too long.");
diff --git a/libjava/classpath/javax/imageio/spi/IIORegistry.java b/libjava/classpath/javax/imageio/spi/IIORegistry.java
index a0e1112..3e9b2c2 100644
--- a/libjava/classpath/javax/imageio/spi/IIORegistry.java
+++ b/libjava/classpath/javax/imageio/spi/IIORegistry.java
@@ -63,6 +63,7 @@ public final class IIORegistry extends ServiceRegistry
public static synchronized IIORegistry getDefaultInstance()
{
+ // XXX: This leaks memory if a ThreadGroup isn't available anymore.
ThreadGroup group = Thread.currentThread().getThreadGroup();
IIORegistry registry = (IIORegistry) instances.get(group);
diff --git a/libjava/classpath/javax/imageio/stream/ImageInputStream.java b/libjava/classpath/javax/imageio/stream/ImageInputStream.java
index ec39fd3..a2af6c3 100644
--- a/libjava/classpath/javax/imageio/stream/ImageInputStream.java
+++ b/libjava/classpath/javax/imageio/stream/ImageInputStream.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package javax.imageio.stream;
import java.io.DataInput;
+import java.io.EOFException;
import java.io.IOException;
import java.nio.ByteOrder;
diff --git a/libjava/classpath/javax/security/auth/x500/X500Principal.java b/libjava/classpath/javax/security/auth/x500/X500Principal.java
index 31f870d..78c35ad 100644
--- a/libjava/classpath/javax/security/auth/x500/X500Principal.java
+++ b/libjava/classpath/javax/security/auth/x500/X500Principal.java
@@ -1,5 +1,5 @@
/* X500Principal.java -- X.500 principal.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -209,7 +209,7 @@ public final class X500Principal implements Principal, Serializable
str.append ("OU");
else if (oid.equals (DC) && rfc2253)
str.append ("DC");
- else if (oid.equals ("UID") && rfc2253)
+ else if (oid.equals (UID) && rfc2253)
str.append ("UID");
else
str.append (oid.toString());
@@ -274,7 +274,7 @@ public final class X500Principal implements Principal, Serializable
Set rdn = new HashSet();
for (Iterator it2 = m.entrySet().iterator(); it2.hasNext(); )
{
- Map.Entry e = (Map.Entry) it.next();
+ Map.Entry e = (Map.Entry) it2.next();
ArrayList atav = new ArrayList(2);
atav.add(new DERValue(DER.OBJECT_IDENTIFIER, e.getKey()));
atav.add(new DERValue(DER.UTF8_STRING, e.getValue()));
@@ -300,6 +300,8 @@ public final class X500Principal implements Principal, Serializable
putComponent(key, value);
if (sep == ',')
newRelativeDistinguishedName();
+ if (sep == -1)
+ break;
}
}
@@ -312,7 +314,7 @@ public final class X500Principal implements Principal, Serializable
if (ch == -1)
{
if (buf.length() > 0)
- throw new EOFException();
+ throw new EOFException("partial name read: " + buf);
return null;
}
if (ch > 127)
@@ -416,10 +418,12 @@ public final class X500Principal implements Principal, Serializable
case ';':
throw new IOException("illegal character: " + (char) ch);
case -1:
- throw new EOFException();
+ sep = -1;
+ return buf.toString ();
default:
buf.append((char) ch);
}
+ ch = in.read ();
}
}
}
@@ -484,6 +488,10 @@ public final class X500Principal implements Principal, Serializable
putComponent(STREET, value);
else if (name.equals("st"))
putComponent(ST, value);
+ else if (name.equals ("o"))
+ putComponent (O, value);
+ else if (name.equals ("ou"))
+ putComponent (OU, value);
else if (name.equals("dc"))
putComponent(DC, value);
else if (name.equals("uid"))
diff --git a/libjava/classpath/javax/security/sasl/Sasl.java b/libjava/classpath/javax/security/sasl/Sasl.java
index 27ac701..058e4f6 100644
--- a/libjava/classpath/javax/security/sasl/Sasl.java
+++ b/libjava/classpath/javax/security/sasl/Sasl.java
@@ -448,7 +448,7 @@ public class Sasl
HashSet names = new HashSet();
Provider[] providers = Security.getProviders();
Iterator it;
- if (providers == null)
+ if (providers != null)
{
Provider p;
String key;
@@ -640,7 +640,7 @@ public class Sasl
HashSet names = new HashSet();
Provider[] providers = Security.getProviders();
Iterator it;
- if (providers == null)
+ if (providers != null)
{
Provider p;
String key;
diff --git a/libjava/classpath/javax/swing/AbstractAction.java b/libjava/classpath/javax/swing/AbstractAction.java
index 6bb42339..da65bdd 100644
--- a/libjava/classpath/javax/swing/AbstractAction.java
+++ b/libjava/classpath/javax/swing/AbstractAction.java
@@ -50,8 +50,7 @@ import javax.swing.event.SwingPropertyChangeSupport;
/**
* A base class for implementing the {@link Action} interface.
*
- * @author Andrew Selkirk
- * @version 1.0
+ * @author Andrew Selkirk
*/
public abstract class AbstractAction
implements Action, Cloneable, Serializable
diff --git a/libjava/classpath/javax/swing/AbstractButton.java b/libjava/classpath/javax/swing/AbstractButton.java
index 0b5859b..21c4fc0 100644
--- a/libjava/classpath/javax/swing/AbstractButton.java
+++ b/libjava/classpath/javax/swing/AbstractButton.java
@@ -47,9 +47,10 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
-import java.io.Serializable;
+import java.awt.image.ImageObserver;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.io.Serializable;
import javax.accessibility.AccessibleAction;
import javax.accessibility.AccessibleIcon;
@@ -64,18 +65,13 @@ import javax.swing.text.AttributeSet;
/**
- * <p>The purpose of this class is to serve as a facade over a number of
- * classes which collectively represent the semantics of a button: the
- * button's model, its listeners, its action, and its look and feel. Some
- * parts of a button's state are stored explicitly in this class, other
- * parts are delegates to the model. Some methods related to buttons are
- * implemented in this class, other methods pass through to the current
- * model or look and feel.</p>
+ * Provides an abstract implementation of common button behaviour,
+ * data model and look &amp; feel.
*
- * <p>Furthermore this class is supposed to serve as a base class for
+ * <p>This class is supposed to serve as a base class for
* several kinds of buttons with similar but non-identical semantics:
- * toggle buttons (radio buttons and checkboxes), simple "push" buttons,
- * menu items.</p>
+ * toggle buttons (radio buttons and checkboxes), simple push buttons,
+ * menu items, etc.</p>
*
* <p>Buttons have many properties, some of which are stored in this class
* while others are delegated to the button's model. The following properties
@@ -571,7 +567,9 @@ public abstract class AbstractButton extends JComponent
if(text != null)
this.text = text;
- default_icon = icon;
+ if (icon != null)
+ default_icon = icon;
+
actionListener = createActionListener();
changeListener = createChangeListener();
itemListener = createItemListener();
@@ -724,7 +722,7 @@ public abstract class AbstractButton extends JComponent
}
/**
- * Calls {@link ItemListener.itemStateChanged} on each ItemListener in
+ * Calls {@link ItemListener#itemStateChanged} on each ItemListener in
* the button's listener list.
*
* @param e The event signifying that the button's model changed state
@@ -739,7 +737,7 @@ public abstract class AbstractButton extends JComponent
}
/**
- * Calls {@link ActionListener.actionPerformed} on each {@link
+ * Calls {@link ActionListener#actionPerformed} on each {@link
* ActionListener} in the button's listener list.
*
* @param e The event signifying that the button's model was clicked
@@ -762,7 +760,7 @@ public abstract class AbstractButton extends JComponent
}
/**
- * Calls {@link ChangeEvent.stateChanged} on each {@link ChangeListener}
+ * Calls {@link ChangeListener#stateChanged} on each {@link ChangeListener}
* in the button's listener list.
*/
protected void fireStateChanged()
@@ -1130,7 +1128,7 @@ public abstract class AbstractButton extends JComponent
* PropertyChangeListener.</p>
*
* <p>This method also configures several of the button's properties from
- * the Action, by calling {@link configurePropertiesFromAction}, and
+ * the Action, by calling {@link #configurePropertiesFromAction}, and
* subscribes the button to the Action as a PropertyChangeListener.
* Subsequent changes to the Action will thus reconfigure the button
* automatically.</p>
@@ -1363,7 +1361,7 @@ public abstract class AbstractButton extends JComponent
* <code>null</code>, in which case an icon is constructed, based on the
* default icon.
*
- * @param disabledIcon The new "disabledIcon" property
+ * @param d The new "disabledIcon" property
*/
public void setDisabledIcon(Icon d)
{
@@ -1393,7 +1391,7 @@ public abstract class AbstractButton extends JComponent
* focused, but no special decoration is painted to indicate the presence
* of focus.
*
- * @param b The new "paintFocus" property
+ * @param p The new "paintFocus" property
*/
public void setFocusPainted(boolean p)
{
@@ -1421,8 +1419,8 @@ public abstract class AbstractButton extends JComponent
*
* @throws IllegalArgumentException If key is not one of the valid constants
*
- * @see setHorizontalTextPosition()
- * @see setHorizontalAlignment()
+ * @see #setHorizontalTextPosition(int)
+ * @see #setHorizontalAlignment(int)
*/
protected int checkHorizontalKey(int key, String exception)
{
@@ -1453,8 +1451,8 @@ public abstract class AbstractButton extends JComponent
*
* @throws IllegalArgumentException If key is not one of the valid constants
*
- * @see setVerticalTextPosition()
- * @see setVerticalAlignment()
+ * @see #setVerticalTextPosition(int)
+ * @see #setVerticalAlignment(int)
*/
protected int checkVerticalKey(int key, String exception)
{
@@ -1527,7 +1525,7 @@ public abstract class AbstractButton extends JComponent
* <p>A factory method which should return an {@link ActionListener} that
* propagates events from the button's {@link ButtonModel} to any of the
* button's ActionListeners. By default, this is an inner class which
- * calls {@link AbstractButton.fireActionPerformed} with a modified copy
+ * calls {@link AbstractButton#fireActionPerformed} with a modified copy
* of the incoming model {@link ActionEvent}.</p>
*
* <p>The button calls this method during construction, stores the
@@ -1553,10 +1551,10 @@ public abstract class AbstractButton extends JComponent
* <p>A factory method which should return a {@link PropertyChangeListener}
* that accepts changes to the specified {@link Action} and reconfigure
* the {@link AbstractButton}, by default using the {@link
- * configurePropertiesFromAction} method.</p>
+ * #configurePropertiesFromAction} method.</p>
*
* <p>The button calls this method whenever a new Action is assigned to
- * the button's "action" property, via {@link setAction}, and stores the
+ * the button's "action" property, via {@link #setAction}, and stores the
* resulting PropertyChangeListener in its
* <code>actionPropertyChangeListener</code> member field. The button
* then subscribes the listener to the button's new action. If the
@@ -1600,7 +1598,7 @@ public abstract class AbstractButton extends JComponent
* AbstractButton may wish to override the listener used to subscribe to
* such ChangeEvents. By default, the listener just propagates the
* {@link ChangeEvent} to the button's ChangeListeners, via the {@link
- * AbstractButton.fireStateChanged} method.</p>
+ * AbstractButton#fireStateChanged} method.</p>
*
* <p>The button calls this method during construction, stores the
* resulting ChangeListener in its <code>changeListener</code> member
@@ -1628,7 +1626,7 @@ public abstract class AbstractButton extends JComponent
* AbstractButton may wish to override the listener used to subscribe to
* such ItemEvents. By default, the listener just propagates the
* {@link ItemEvent} to the button's ItemListeners, via the {@link
- * AbstractButton.fireItemStateChanged} method.</p>
+ * AbstractButton#fireItemStateChanged} method.</p>
*
* <p>The button calls this method during construction, stores the
* resulting ItemListener in its <code>changeListener</code> member
@@ -1737,7 +1735,7 @@ public abstract class AbstractButton extends JComponent
* paint this icon when the "rolloverEnabled" property of the button is
* <code>true</code> and the mouse rolls over the button.
*
- * @param rolloverIcon The new rollover icon
+ * @param r The new rollover icon
*/
public void setRolloverIcon(Icon r)
{
@@ -1770,7 +1768,7 @@ public abstract class AbstractButton extends JComponent
* is <code>true</code>, the "selected" property of the button's model is
* <code>true</code>, and the mouse rolls over the button.
*
- * @param rolloverSelectedIcon The new rollover selected icon
+ * @param r The new rollover selected icon
*/
public void setRolloverSelectedIcon(Icon r)
{
@@ -1805,7 +1803,7 @@ public abstract class AbstractButton extends JComponent
* button is <code>false</code> or the mouse is not currently rolled
* over the button.
*
- * @param selectedIcon The new selected icon
+ * @param s The new selected icon
*/
public void setSelectedIcon(Icon s)
{
diff --git a/libjava/classpath/javax/swing/AbstractCellEditor.java b/libjava/classpath/javax/swing/AbstractCellEditor.java
index 86d3017..4ed1580 100644
--- a/libjava/classpath/javax/swing/AbstractCellEditor.java
+++ b/libjava/classpath/javax/swing/AbstractCellEditor.java
@@ -46,11 +46,10 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.EventListenerList;
/**
- * The abstract superclass for table and tree cells. This provides some
+ * An abstract superclass for table and tree cell editors. This provides some
* common shared functionality.
*
- * @author Andrew Selkirk
- * @version 1.0
+ * @author Andrew Selkirk
*/
public abstract class AbstractCellEditor
implements CellEditor, Serializable
diff --git a/libjava/classpath/javax/swing/AbstractListModel.java b/libjava/classpath/javax/swing/AbstractListModel.java
index a924b73a..8973e52 100644
--- a/libjava/classpath/javax/swing/AbstractListModel.java
+++ b/libjava/classpath/javax/swing/AbstractListModel.java
@@ -46,11 +46,10 @@ import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
/**
- * AbstractListModel
+ * Provides standard implementations of some methods in {@link ListModel}.
*
* @author Ronald Veldema
* @author Andrew Selkirk
- * @version 1.0
*/
public abstract class AbstractListModel implements ListModel, Serializable
{
@@ -88,7 +87,7 @@ public abstract class AbstractListModel implements ListModel, Serializable
/**
* Call {@link ListDataListener#contentsChanged} on each element of the
- * {@link listenerList} which is a {@link ListDataListener}. The event
+ * {@link #listenerList} which is a {@link ListDataListener}. The event
* fired has type {@ListDataEvent.CONTENTS_CHANGED} and represents a
* change to the data elements in the range [startIndex, endIndex]
* inclusive.
@@ -110,7 +109,7 @@ public abstract class AbstractListModel implements ListModel, Serializable
/**
* Call {@link ListDataListener#intervalAdded} on each element of the
- * {@link listenerList} which is a {@link ListDataListener}. The event
+ * {@link #listenerList} which is a {@link ListDataListener}. The event
* fired has type {@ListDataEvent.INTERVAL_ADDED} and represents an
* addition of the data elements in the range [startIndex, endIndex]
* inclusive.
@@ -132,7 +131,7 @@ public abstract class AbstractListModel implements ListModel, Serializable
/**
* Call {@link ListDataListener#intervalRemoved} on each element of the
- * {@link listenerList} which is a {@link ListDataListener}. The event
+ * {@link #listenerList} which is a {@link ListDataListener}. The event
* fired has type {@ListDataEvent.INTERVAL_REMOVED} and represents a
* removal of the data elements in the range [startIndex, endIndex]
* inclusive.
@@ -155,7 +154,7 @@ public abstract class AbstractListModel implements ListModel, Serializable
/**
* Return the subset of {@link EventListener} objects found in this
- * object's {@link listenerList} which are elements of the specified
+ * object's {@link #listenerList} which are elements of the specified
* type.
*
* @param listenerType The type of listeners to select
@@ -170,7 +169,7 @@ public abstract class AbstractListModel implements ListModel, Serializable
/**
* A synonym for <code>getListeners(ListDataListener.class)</code>.
*
- * @return The set of ListDataListeners found in the {@link listenerList}
+ * @return The set of ListDataListeners found in the {@link #listenerList}
*/
public ListDataListener[] getListDataListeners()
{
diff --git a/libjava/classpath/javax/swing/AbstractSpinnerModel.java b/libjava/classpath/javax/swing/AbstractSpinnerModel.java
index 05a9892..d61113b 100644
--- a/libjava/classpath/javax/swing/AbstractSpinnerModel.java
+++ b/libjava/classpath/javax/swing/AbstractSpinnerModel.java
@@ -45,9 +45,10 @@ import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
/**
- * AbstractSpinnerModel
- * @author Ka-Hing Cheung
- * @version 1.0
+ * Provides standard implementations for some of the methods in
+ * {@link SpinnerModel}.
+ *
+ * @author Ka-Hing Cheung
*/
public abstract class AbstractSpinnerModel implements SpinnerModel
{
diff --git a/libjava/classpath/javax/swing/Action.java b/libjava/classpath/javax/swing/Action.java
index 17168c3..3dd6353 100644
--- a/libjava/classpath/javax/swing/Action.java
+++ b/libjava/classpath/javax/swing/Action.java
@@ -41,7 +41,7 @@ import java.awt.event.ActionListener;
import java.beans.PropertyChangeListener;
/**
- * An action provides a convenient central point of control for some task
+ * Provides a convenient central point of control for some task
* that can be triggered by more than one control in a Swing user interface
* (for example, a menu item and a toolbar button).
*
diff --git a/libjava/classpath/javax/swing/ActionMap.java b/libjava/classpath/javax/swing/ActionMap.java
index c609257..c14bafd 100644
--- a/libjava/classpath/javax/swing/ActionMap.java
+++ b/libjava/classpath/javax/swing/ActionMap.java
@@ -49,6 +49,14 @@ import java.util.Set;
/**
+ * Maps arbitrary keys (usually Strings) to {@link Action} instances. This
+ * is used in combination with {@link InputMap}s.
+ *
+ * If a component receives an input event, this is looked up in
+ * the component's <code>InputMap</code>. The result is an object which
+ * serves as a key to the components <code>ActionMap</code>. Finally
+ * the <code>Action</code> that is stored is executed.
+ *
* @author Andrew Selkirk
* @author Michael Koch
*/
diff --git a/libjava/classpath/javax/swing/BorderFactory.java b/libjava/classpath/javax/swing/BorderFactory.java
index b084b61..45cf3bb 100644
--- a/libjava/classpath/javax/swing/BorderFactory.java
+++ b/libjava/classpath/javax/swing/BorderFactory.java
@@ -50,6 +50,11 @@ import javax.swing.border.LineBorder;
import javax.swing.border.MatteBorder;
import javax.swing.border.TitledBorder;
+/**
+ * A factory for commonly used borders.
+ *
+ * @author original author unknown
+ */
public class BorderFactory
{
private BorderFactory()
@@ -257,7 +262,7 @@ public class BorderFactory
* justification (left) and using the default font and text color determined
* by the current look and feel.
*
- * @param order The Border object to add the title to
+ * @param border The Border object to add the title to
* @param title A String containing the text of the title
*
* @return The TitledBorder object
diff --git a/libjava/classpath/javax/swing/BoundedRangeModel.java b/libjava/classpath/javax/swing/BoundedRangeModel.java
index 5f85000..5ca5a7e 100644
--- a/libjava/classpath/javax/swing/BoundedRangeModel.java
+++ b/libjava/classpath/javax/swing/BoundedRangeModel.java
@@ -1,5 +1,5 @@
/* BoundedRangeModel.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,10 +38,17 @@ exception statement from your version. */
package javax.swing;
+import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
/**
- * The data model that is used in components that display a range of values,
+ * The data model that represents a <i>range</i> that is constrained to fit
+ * within specified <i>bounds</i>. The range is defined as <code>value</code>
+ * to <code>value + extent</code>, where both <code>value</code> and
+ * <code>extent</code> are integers, and <code>extent >= 0</code>. The bounds
+ * are defined by integers <code>minimum</code> and <code>maximum</code>.
+ * <p>
+ * This type of model is used in components that display a range of values,
* like {@link JProgressBar} and {@link JSlider}.
*
* @author Andrew Selkirk
@@ -49,16 +56,18 @@ import javax.swing.event.ChangeListener;
public interface BoundedRangeModel
{
/**
- * getValue
+ * Returns the current value for the model.
*
- * @return int
+ * @return The current value for the model.
*
* @see #setValue(int)
*/
int getValue();
/**
- * setValue
+ * Sets the value for the model and sends a {@link ChangeEvent} to
+ * all registered listeners. The new value must satisfy the constraint
+ * <code>min <= value <= value + extent <= max</code>.
*
* @param value the value
*
@@ -67,16 +76,20 @@ public interface BoundedRangeModel
void setValue(int value);
/**
- * getMinimum
+ * Returns the lower bound for the model. The start of the model's range
+ * (see {@link #getValue()}) cannot be less than this lower bound.
*
- * @return int
+ * @return The lower bound for the model.
*
* @see #setMinimum(int)
+ * @see #getMaximum()
*/
int getMinimum();
/**
- * setMinimum
+ * Sets the lower bound for the model and sends a {@link ChangeEvent} to all
+ * registered listeners. The new minimum must be less than or equal to the
+ * start value of the model's range (as returned by {@link #getValue()}).
*
* @param minimum the minimum value
*
@@ -85,16 +98,22 @@ public interface BoundedRangeModel
void setMinimum(int minimum);
/**
- * getMaximum
+ * Returns the upper bound for the model. This sets an upper limit for the
+ * end value of the model's range ({@link #getValue()} +
+ * {@link #getExtent()}).
*
- * @return int
+ * @return The upper bound for the model.
*
* @see #setMaximum(int)
+ * @see #getMinimum()
*/
int getMaximum();
/**
- * setMaximum
+ * Sets the upper bound for the model and sends a {@link ChangeEvent} to all
+ * registered listeners. The new maximum must be greater than or equal to the
+ * end value of the model's range (as returned by {@link #getValue()} +
+ * {@link #getExtent()}).
*
* @param maximum the maximum value
*
@@ -108,12 +127,12 @@ public interface BoundedRangeModel
* @return <code>true</code> if value is adjusting,
* otherwise <code>false</code>
*
- * @see setValueIsAdjusting(boolean)
+ * @see #setValueIsAdjusting(boolean)
*/
boolean getValueIsAdjusting();
/**
- * setValueIsAdjusting
+ * Sets the <code>valueIsAdjusting</code> property.
*
* @param adjusting <code>true</code> if adjusting,
* <code>false</code> otherwise
@@ -132,7 +151,8 @@ public interface BoundedRangeModel
int getExtent();
/**
- * setExtent
+ * Sets the extent, which is the length of the model's range, and sends a
+ * {@link ChangeEvent} to all registered listeners.
*
* @param extent the extent
*
@@ -141,12 +161,14 @@ public interface BoundedRangeModel
void setExtent(int extent);
/**
- * setRangeProperties
+ * Sets all the properties for the model in a single call.
+ *
* @param value the value
* @param extent the extent
* @param minnimum the minimum value
* @param maximum the maximum value
- * @param adjusting TODO
+ * @param adjusting a flag that indicates the model is being adjusted
+ * continuously.
*/
void setRangeProperties(int value, int extent, int minimum, int maximum,
boolean adjusting);
@@ -156,7 +178,7 @@ public interface BoundedRangeModel
*
* @param listener the listener to add
*
- * @see #removeChangeListener(javax.swing.event.ChangeListener)
+ * @see #removeChangeListener(ChangeListener)
*/
void addChangeListener(ChangeListener listener);
@@ -165,7 +187,7 @@ public interface BoundedRangeModel
*
* @param listener the listener to remove
*
- * @see #addChangeListener(javax.swing.event.ChangeListener)
+ * @see #addChangeListener(ChangeListener)
*/
void removeChangeListener(ChangeListener listener);
}
diff --git a/libjava/classpath/javax/swing/Box.java b/libjava/classpath/javax/swing/Box.java
index 546a282..b2cb44a 100644
--- a/libjava/classpath/javax/swing/Box.java
+++ b/libjava/classpath/javax/swing/Box.java
@@ -60,6 +60,9 @@ public class Box extends JComponent implements Accessible
{
private static final long serialVersionUID = 1525417495883046342L;
+ /**
+ * Provides accessibility support for <code>Box</code>es.
+ */
// FIXME: disable to make libjava compile; visibility rules are broken
protected class AccessibleBox // extends Container.AccessibleAWTContainer
{
@@ -82,6 +85,9 @@ public class Box extends JComponent implements Accessible
{
private static final long serialVersionUID = -1204263191910183998L;
+ /**
+ * Provides accessibility support for <code>Box.Filler</code>.
+ */
// FIXME: disable to make libjava compile; visibility rules are broken
protected class AccessibleBoxFiller // extends Component.AccessibleAWTComponent
{
diff --git a/libjava/classpath/javax/swing/BoxLayout.java b/libjava/classpath/javax/swing/BoxLayout.java
index 5dfe1d6..28bb539 100644
--- a/libjava/classpath/javax/swing/BoxLayout.java
+++ b/libjava/classpath/javax/swing/BoxLayout.java
@@ -53,7 +53,8 @@ import java.util.Vector;
import gnu.java.awt.AWTUtilities;
/**
- * A layout for swing components.
+ * A layout that stacks the children of a container in a Box, either
+ * horizontally or vertically.
*
* @author Ronald Veldema (rveldema@cs.vu.nl)
* @author Roman Kennke (roman@kennke.org)
@@ -150,7 +151,8 @@ public class BoxLayout implements LayoutManager2, Serializable
* direction. This will be <code>insets.top</code> for vertical direction
* and <code>insets.left</code> for horizontal direction.
*
- * @param the {@link Insets} object from which to return the lower bounds
+ * @param insets the {@link Insets} object from which to return the lower
+ * bounds
*
* @return the lower bounds of the {@link Insets} object according to this
* direction
@@ -226,7 +228,8 @@ public class BoxLayout implements LayoutManager2, Serializable
* direction. This will be <code>insets.top</code> for vertical direction
* and <code>insets.left</code> for horizontal direction.
*
- * @param the {@link Insets} object from which to return the lower bounds
+ * @param insets the {@link Insets} object from which to return the lower
+ * bounds
*
* @return the lower bounds of the {@link Insets} object according to this
* direction
diff --git a/libjava/classpath/javax/swing/ButtonGroup.java b/libjava/classpath/javax/swing/ButtonGroup.java
index bea8aea..3de1d4b 100644
--- a/libjava/classpath/javax/swing/ButtonGroup.java
+++ b/libjava/classpath/javax/swing/ButtonGroup.java
@@ -43,7 +43,25 @@ import java.util.Vector;
/**
- * DOCUMENT ME!
+ * Logically groups a set of buttons, so that only one of the buttons in
+ * a <code>ButtonGroup</code> can be selected at the same time. If one
+ * button in a <code>ButtonGroup</code> is selected, all other buttons
+ * are automatically deselected.
+ *
+ * While <code>ButtonGroup</code> can be used for all buttons that are derived
+ * from {@link AbstractButton}, it is normally only used for
+ * {@link JRadioButton}s, {@link JRadioButtonMenuItem}s and
+ * {@link JToggleButton}s.
+ *
+ * You could use it for {@link JCheckBox}es, but for the sake of usability
+ * this is strongly discouraged because the common expectation of checkboxes
+ * is that the user is allowed to make multiple selections.
+ *
+ * It makes no sense to put {@link JButton}s or {@link JMenuItem}s in
+ * a <code>ButtonGroup</code> because they don't implement the
+ * <code>selected</code> semantics.
+ *
+ * @author original author unknown
*/
public class ButtonGroup implements Serializable
{
diff --git a/libjava/classpath/javax/swing/CellRendererPane.java b/libjava/classpath/javax/swing/CellRendererPane.java
index db7a143..886d5c5 100644
--- a/libjava/classpath/javax/swing/CellRendererPane.java
+++ b/libjava/classpath/javax/swing/CellRendererPane.java
@@ -48,12 +48,11 @@ import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
/**
- * The CellRendererPane's purpose is to paint the cells of JList, JTable and
- * JTree. It intercepts the usual paint tree, so that we don't walk up and
+ * Paints the cells of JList, JTable and JTree.
+ * It intercepts the usual paint tree, so that we don't walk up and
* repaint everything.
*
- * @author Andrew Selkirk
- * @version 1.0
+ * @author Andrew Selkirk
*/
public class CellRendererPane
extends Container
@@ -62,7 +61,7 @@ public class CellRendererPane
private static final long serialVersionUID = -7642183829532984273L;
/**
- * AccessibleCellRendererPane
+ * Provides accessibility support for CellRendererPanes.
*/
protected class AccessibleCellRendererPane extends AccessibleAWTContainer
{
@@ -70,7 +69,6 @@ public class CellRendererPane
/**
* Constructor AccessibleCellRendererPane
- * @param component TODO
*/
protected AccessibleCellRendererPane()
{
diff --git a/libjava/classpath/javax/swing/ComponentInputMap.java b/libjava/classpath/javax/swing/ComponentInputMap.java
index 4ecc058..f95c310 100644
--- a/libjava/classpath/javax/swing/ComponentInputMap.java
+++ b/libjava/classpath/javax/swing/ComponentInputMap.java
@@ -39,6 +39,9 @@ package javax.swing;
/**
+ * An {@link InputMap} that is associated with a particular {@link JComponent}.
+ * The component is notified when its <code>ComponentInputMap</code> changes.
+ *
* @author Andrew Selkirk
* @author Michael Koch
*/
@@ -70,7 +73,7 @@ public class ComponentInputMap extends InputMap
* If actionMapKey is null an existing entry will be removed.
*
* @param keystroke the keystroke for the entry
- * @param actionMapKey the action.
+ * @param value the action.
*/
public void put(KeyStroke keystroke, Object value)
{
@@ -90,7 +93,7 @@ public class ComponentInputMap extends InputMap
/**
* Remove an entry from the <code>InputMap</code>.
*
- * @param key the key of the entry to remove
+ * @param keystroke the key of the entry to remove
*/
public void remove(KeyStroke keystroke)
{
@@ -103,7 +106,7 @@ public class ComponentInputMap extends InputMap
*
* @param parentMap the new parent
*
- * @exception IllegalArgument if parentMap is not a
+ * @exception IllegalArgumentException if parentMap is not a
* <code>ComponentInputMap</code> or not associated with the same component
*/
public void setParent(InputMap parentMap)
diff --git a/libjava/classpath/javax/swing/DebugGraphics.java b/libjava/classpath/javax/swing/DebugGraphics.java
index e73c120..137b823 100644
--- a/libjava/classpath/javax/swing/DebugGraphics.java
+++ b/libjava/classpath/javax/swing/DebugGraphics.java
@@ -50,9 +50,11 @@ import java.text.AttributedCharacterIterator;
/**
- * DebugGraphics
- * @author Andrew Selkirk
- * @version 1.0
+ * An extension of {@link Graphics} that can be used for debugging
+ * custom Swing widgets. <code>DebugGraphics</code> has the ability to
+ * draw slowly and can log drawing actions.
+ *
+ * @author Andrew Selkirk
*/
public class DebugGraphics extends Graphics
{
diff --git a/libjava/classpath/javax/swing/DefaultBoundedRangeModel.java b/libjava/classpath/javax/swing/DefaultBoundedRangeModel.java
index 53c0fb3..10de4b9 100644
--- a/libjava/classpath/javax/swing/DefaultBoundedRangeModel.java
+++ b/libjava/classpath/javax/swing/DefaultBoundedRangeModel.java
@@ -47,7 +47,7 @@ import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
/**
- * A default implementation of <code>BoundedRangeModel</code>.
+ * The default implementation of <code>BoundedRangeModel</code>.
*
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
@@ -413,7 +413,7 @@ public class DefaultBoundedRangeModel
/**
* Retrieves the current listeners of the specified class.
*
- * @param c the class of listeners; usually {@link
+ * @param listenerType the class of listeners; usually {@link
* ChangeListener}<code>.class</code>.
*
* @return an array with the currently subscribed listeners, or
diff --git a/libjava/classpath/javax/swing/DefaultButtonModel.java b/libjava/classpath/javax/swing/DefaultButtonModel.java
index 2cfb9e9..f7d09d5 100644
--- a/libjava/classpath/javax/swing/DefaultButtonModel.java
+++ b/libjava/classpath/javax/swing/DefaultButtonModel.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package javax.swing;
+import java.awt.ItemSelectable;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
@@ -51,7 +52,8 @@ import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
/**
- * The pUrpose of this class is to model the dynamic state of an abstract
+ * The default implementation of {@link ButtonModel}.
+ * The purpose of this class is to model the dynamic state of an abstract
* button. The concrete button type holding this state may be a a "toggle"
* button (checkbox, radio button) or a "push" button (menu button, button).
* If the model is disabled, only the "selected" property can be changed. An
@@ -265,9 +267,9 @@ public class DefaultButtonModel implements ButtonModel, Serializable
}
/**
- * Inform each ItemListener in the {@link listenerList} that an ItemEvent
+ * Inform each ItemListener in the {@link #listenerList} that an ItemEvent
* has occurred. This happens in response to any change to the {@link
- * stateMask} field.
+ * #stateMask} field.
*
* @param e The ItemEvent to fire
*/
@@ -280,9 +282,9 @@ public class DefaultButtonModel implements ButtonModel, Serializable
}
/**
- * Inform each ActionListener in the {@link listenerList} that an
+ * Inform each ActionListener in the {@link #listenerList} that an
* ActionEvent has occurred. This happens in response to the any change to
- * the {@link stateMask} field which makes the enabled, armed and pressed
+ * the {@link #stateMask} field which makes the enabled, armed and pressed
* properties all simultaneously <code>true</code>.
*
* @param e The ActionEvent to fire
@@ -296,7 +298,7 @@ public class DefaultButtonModel implements ButtonModel, Serializable
}
/**
- * Inform each ChangeListener in the {@link listenerList} that a ChangeEvent
+ * Inform each ChangeListener in the {@link #listenerList} that a ChangeEvent
* has occurred. This happens in response to the any change to a property
* of the model.
*/
@@ -395,13 +397,13 @@ public class DefaultButtonModel implements ButtonModel, Serializable
else
stateMask = stateMask & (~PRESSED);
- // notify interested ChangeListeners
- fireStateChanged();
-
// if button is armed and was released, fire action event
if (!p && isArmed())
fireActionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
actionCommand));
+
+ // notify interested ChangeListeners
+ fireStateChanged();
}
/**
diff --git a/libjava/classpath/javax/swing/DefaultCellEditor.java b/libjava/classpath/javax/swing/DefaultCellEditor.java
index e67e2f5..00e0086 100644
--- a/libjava/classpath/javax/swing/DefaultCellEditor.java
+++ b/libjava/classpath/javax/swing/DefaultCellEditor.java
@@ -43,16 +43,24 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
+import java.awt.event.MouseEvent;
import java.io.Serializable;
import java.util.EventObject;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.event.CellEditorListener;
import javax.swing.table.TableCellEditor;
import javax.swing.tree.TreeCellEditor;
/**
- * DefaultCellEditor
- * @author Andrew Selkirk
- * @version 1.0
+ * The default implementation of {@link TableCellEditor} and
+ * {@link TreeCellEditor}. It provides editor components for
+ * some standard object types.
+ *
+ * @author Andrew Selkirk
+ *
+ * @status mostly unimplemented
*/
public class DefaultCellEditor
extends AbstractCellEditor
@@ -61,7 +69,9 @@ public class DefaultCellEditor
private static final long serialVersionUID = 3564035141373880027L;
/**
- * EditorDelegate
+ * Delegates a couple of method calls (such as {@link #isCellEditable)
+ * to the component it contains and listens for events that indicate
+ * that editing has stopped.
*/
protected class EditorDelegate
implements ActionListener, ItemListener, Serializable
@@ -75,8 +85,6 @@ public class DefaultCellEditor
/**
* Constructor EditorDelegate
- *
- * @param value0 TODO
*/
protected EditorDelegate()
{
@@ -87,8 +95,10 @@ public class DefaultCellEditor
*
* @param event TODO
*/
- public void setValue(Object event)
+ public void setValue(Object value)
{
+ // TODO: should be setting the value in the editorComp
+ this.value = value;
}
/**
@@ -98,7 +108,8 @@ public class DefaultCellEditor
*/
public Object getCellEditorValue()
{
- return null; // TODO
+ // TODO: should be getting the updated value from the editorComp
+ return value;
} // getCellEditorValue()
/**
@@ -110,7 +121,10 @@ public class DefaultCellEditor
*/
public boolean isCellEditable(EventObject event)
{
- return false; // TODO
+ if (event == null || !(event instanceof MouseEvent) ||
+ (((MouseEvent) event).getClickCount() >= getClickCountToStart()))
+ return true;
+ return false;
} // isCellEditable()
/**
@@ -122,7 +136,8 @@ public class DefaultCellEditor
*/
public boolean shouldSelectCell(EventObject event)
{
- return false; // TODO
+ // return true to indicate that the editing cell may be selected
+ return true;
} // shouldSelectCell()
/**
@@ -132,7 +147,8 @@ public class DefaultCellEditor
*/
public boolean stopCellEditing()
{
- return false; // TODO
+ fireEditingStopped();
+ return true;
} // stopCellEditing()
/**
@@ -140,7 +156,7 @@ public class DefaultCellEditor
*/
public void cancelCellEditing()
{
- // TODO
+ fireEditingCanceled();
} // cancelCellEditing()
/**
@@ -152,7 +168,8 @@ public class DefaultCellEditor
*/
public boolean startCellEditing(EventObject event)
{
- return false; // TODO
+ // return true to indicate that editing has begun
+ return true;
} // startCellEditing()
/**
@@ -162,7 +179,7 @@ public class DefaultCellEditor
*/
public void actionPerformed(ActionEvent event)
{
- // TODO
+ stopCellEditing();
} // actionPerformed()
/**
@@ -172,9 +189,23 @@ public class DefaultCellEditor
*/
public void itemStateChanged(ItemEvent event)
{
- // TODO
+ stopCellEditing();
} // itemStateChanged()
+ void fireEditingStopped()
+ {
+ CellEditorListener[] listeners = getCellEditorListeners();
+ for (int index = 0; index < listeners.length; index++)
+ listeners[index].editingStopped(changeEvent);
+
+ }
+
+ void fireEditingCanceled()
+ {
+ CellEditorListener[] listeners = getCellEditorListeners();
+ for (int index = 0; index < listeners.length; index++)
+ listeners[index].editingCanceled(changeEvent);
+ }
} // EditorDelegate
/**
@@ -199,7 +230,8 @@ public class DefaultCellEditor
*/
public DefaultCellEditor(JTextField textfield)
{
- // TODO
+ editorComponent = textfield;
+ clickCountToStart = 3;
} // DefaultCellEditor()
/**
@@ -209,7 +241,8 @@ public class DefaultCellEditor
*/
public DefaultCellEditor(JCheckBox checkbox)
{
- // TODO
+ editorComponent = checkbox;
+ clickCountToStart = 1;
} // DefaultCellEditor()
/**
@@ -219,7 +252,8 @@ public class DefaultCellEditor
*/
public DefaultCellEditor(JComboBox combobox)
{
- // TODO
+ editorComponent = combobox;
+ clickCountToStart = 1;
} // DefaultCellEditor()
/**
@@ -229,7 +263,7 @@ public class DefaultCellEditor
*/
public Component getComponent()
{
- return null; // TODO
+ return editorComponent;
} // getComponent()
/**
@@ -239,7 +273,7 @@ public class DefaultCellEditor
*/
public int getClickCountToStart()
{
- return 0; // TODO
+ return clickCountToStart;
} // getClickCountToStart()
/**
@@ -249,7 +283,7 @@ public class DefaultCellEditor
*/
public void setClickCountToStart(int count)
{
- // TODO
+ clickCountToStart = count;
} // setClickCountToStart()
/**
@@ -259,7 +293,7 @@ public class DefaultCellEditor
*/
public Object getCellEditorValue()
{
- return null; // TODO
+ return delegate.getCellEditorValue();
} // getCellEditorValue()
/**
@@ -271,7 +305,7 @@ public class DefaultCellEditor
*/
public boolean isCellEditable(EventObject event)
{
- return false; // TODO
+ return delegate.isCellEditable(event);
} // isCellEditable()
/**
@@ -283,7 +317,7 @@ public class DefaultCellEditor
*/
public boolean shouldSelectCell(EventObject event)
{
- return false; // TODO
+ return delegate.shouldSelectCell(event);
} // shouldSelectCell()
/**
@@ -293,7 +327,7 @@ public class DefaultCellEditor
*/
public boolean stopCellEditing()
{
- return false; // TODO
+ return delegate.stopCellEditing();
} // stopCellEditing()
/**
@@ -301,27 +335,53 @@ public class DefaultCellEditor
*/
public void cancelCellEditing()
{
- // TODO
+ delegate.cancelCellEditing();
} // cancelCellEditing()
/**
- * getTreeCellEditorComponent
+ * Sets an initial value for the editor.
+ * This will cause the editor to stopEditing and lose any partially
+ * edited value if the editor is editing when this method is called.
+ * Returns the component that should be added to the client's Component
+ * hierarchy. Once installed in the client's hierarchy this component will
+ * then be able to draw and receive user input.
*
- * @param tree TODO
- * @param value TODO
- * @param isSelected TODO
- * @param expanded TODO
- * @param leaf TODO
- * @param row TODO
+ * @param tree - the JTree that is asking the editor to edit; this
+ * parameter can be null
+ * @param value - the value of the cell to be edited
+ * @param isSelected - true is the cell is to be renderer with selection
+ * highlighting
+ * @param expanded - true if the node is expanded
+ * @param leaf - true if the node is a leaf node
+ * @param row - the row index of the node being edited
*
- * @returns Component
+ * @returns Component the component for editing
*/
public Component getTreeCellEditorComponent(JTree tree, Object value,
boolean isSelected,
boolean expanded, boolean leaf,
int row)
{
- return null; // TODO
+ if (editorComponent instanceof JTextField)
+ {
+ ((JTextField)editorComponent).setText(value.toString());
+ delegate = new EditorDelegate();
+ ((JTextField)editorComponent).addActionListener(delegate);
+ }
+ else if (editorComponent instanceof JCheckBox)
+ {
+ ((JCheckBox)editorComponent).setText(value.toString());
+ delegate = new EditorDelegate();
+ ((JCheckBox)editorComponent).addActionListener(delegate);
+ }
+ else if (editorComponent instanceof JComboBox)
+ {
+ ((JComboBox)editorComponent).setSelectedItem(value.toString());
+ delegate = new EditorDelegate();
+ ((JComboBox)editorComponent).addActionListener(delegate);
+ }
+
+ return editorComponent;
} // getTreeCellEditorComponent()
/**
@@ -335,10 +395,30 @@ public class DefaultCellEditor
*
* @returns Component
*/
- public Component getTableCellEditorComponent(JTable tree, Object value,
+ public Component getTableCellEditorComponent(JTable table, Object value,
boolean isSelected, int row,
int column)
{
- return null; // TODO
+ // NOTE: as specified by Sun, we don't call new() everytime, we return
+ // editorComponent on each call to getTableCellEditorComponent or
+ // getTreeCellEditorComponent. However, currently JTextFields have a
+ // problem with getting rid of old text, so without calling new() there
+ // are some strange results. If you edit more than one cell in the table
+ // text from previously edited cells may unexpectedly show up in the
+ // cell you are currently editing. This will be fixed automatically
+ // when JTextField is fixed.
+ if (editorComponent instanceof JTextField)
+ {
+ ((JTextField)editorComponent).setText(value.toString());
+ delegate = new EditorDelegate();
+ ((JTextField)editorComponent).addActionListener(delegate);
+ }
+ else
+ {
+ // TODO
+ }
+ return editorComponent;
} // getTableCellEditorComponent()
+
+
}
diff --git a/libjava/classpath/javax/swing/DefaultComboBoxModel.java b/libjava/classpath/javax/swing/DefaultComboBoxModel.java
index 1cea886..b48b968 100644
--- a/libjava/classpath/javax/swing/DefaultComboBoxModel.java
+++ b/libjava/classpath/javax/swing/DefaultComboBoxModel.java
@@ -43,7 +43,8 @@ import java.util.Vector;
/**
- * DefaultComboBoxModel is a data model for JComboBox. This model keeps track
+ * The default implementation of {@link MutableComboBoxModel}.
+ * This model keeps track
* of elements contained in the JComboBox as well as the current combo box
* selection. Whenever selection in the JComboBox changes, the ComboBoxModel
* will fire ListDataEvents to ComboBox's ListDataListeners.
@@ -51,7 +52,6 @@ import java.util.Vector;
* @author Andrew Selkirk
* @author Olga Rodimina
* @author Robert Schuster
- * @version 1.0
*/
public class DefaultComboBoxModel extends AbstractListModel
implements MutableComboBoxModel, Serializable
diff --git a/libjava/classpath/javax/swing/DefaultDesktopManager.java b/libjava/classpath/javax/swing/DefaultDesktopManager.java
index 15ed262..2b8977e 100644
--- a/libjava/classpath/javax/swing/DefaultDesktopManager.java
+++ b/libjava/classpath/javax/swing/DefaultDesktopManager.java
@@ -49,8 +49,8 @@ import java.io.Serializable;
import javax.swing.JInternalFrame.JDesktopIcon;
/**
- * DefaultDesktopManager is the default implementation of DesktopManager for
- * swing. It implements the basic beaviours for JInternalFrames in arbitrary
+ * The default implementation of DesktopManager for
+ * Swing. It implements the basic beaviours for JInternalFrames in arbitrary
* parents. The methods provided by the class are not meant to be called by
* the user, instead, the JInternalFrame methods will call these methods.
*/
diff --git a/libjava/classpath/javax/swing/DefaultFocusManager.java b/libjava/classpath/javax/swing/DefaultFocusManager.java
index dd8e604..08db651 100644
--- a/libjava/classpath/javax/swing/DefaultFocusManager.java
+++ b/libjava/classpath/javax/swing/DefaultFocusManager.java
@@ -43,9 +43,11 @@ import java.awt.event.KeyEvent;
import java.util.Stack;
/**
- * DefaultFocusManager
- * @author Andrew Selkirk
- * @version 1.0
+ * This class has been obsoleted by the new
+ * {@link java.awt.KeyboardFocusManager} and
+ * {@link java.awt.DefaultKeyboardFocusManager} API.
+ *
+ * @author Andrew Selkirk
*/
public class DefaultFocusManager extends FocusManager {
diff --git a/libjava/classpath/javax/swing/DefaultListCellRenderer.java b/libjava/classpath/javax/swing/DefaultListCellRenderer.java
index 0f2417d..5a34ba7 100644
--- a/libjava/classpath/javax/swing/DefaultListCellRenderer.java
+++ b/libjava/classpath/javax/swing/DefaultListCellRenderer.java
@@ -46,17 +46,23 @@ import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
/**
- * DefaultListCellRenderer. This class is responsible for rendering list
- * cells.
+ * The default implementation {@link ListCellRenderer}. It provides a standard
+ * renderer for data objects of all types via {@link Object#toString()}.
*
* @author Andrew Selkirk
- * @version 1.0
*/
public class DefaultListCellRenderer extends JLabel
implements ListCellRenderer, Serializable
{
private static final long serialVersionUID = 7708947179685189462L;
+ /**
+ * Subclasses <code>DefaultListCellRenderers</code> and implements
+ * {@link javax.swing.plaf.UIResource}. This is used by
+ * {@link javax.swing.plaf.ListUI} subclasses to provide a default for
+ * the <code>List.cellRenderer</code> property. If you want to override
+ * this property, use <code>DefaultListCellRenderer</code> or a subclass.
+ */
public static class UIResource extends DefaultListCellRenderer
implements javax.swing.plaf.UIResource
{
diff --git a/libjava/classpath/javax/swing/DefaultListModel.java b/libjava/classpath/javax/swing/DefaultListModel.java
index d7ff259..fdbbb56 100644
--- a/libjava/classpath/javax/swing/DefaultListModel.java
+++ b/libjava/classpath/javax/swing/DefaultListModel.java
@@ -41,7 +41,7 @@ import java.util.Enumeration;
import java.util.Vector;
/**
- * This is a default subclass of the {@link AbstractListModel}, used by
+ * The default implementation of {@link AbstractListModel}, used by
* {@link javax.swing.JList} and similar objects as the model of a list of
* values. The implementation is based on an underlying {@link
* java.util.Vector}.
diff --git a/libjava/classpath/javax/swing/DefaultListSelectionModel.java b/libjava/classpath/javax/swing/DefaultListSelectionModel.java
index d08ca6f..f8d544d 100644
--- a/libjava/classpath/javax/swing/DefaultListSelectionModel.java
+++ b/libjava/classpath/javax/swing/DefaultListSelectionModel.java
@@ -1,5 +1,5 @@
/* DefaultListSelectionModel.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,10 +47,10 @@ import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
/**
- * <p>This class provides a default implementation of {@link
- * ListSelectioModel}, which is used by {@link javax.swing.JList} and
+ * The default implementation of {@link ListSelectionModel},
+ * which is used by {@link javax.swing.JList} and
* similar classes to manage the selection status of a number of data
- * elements. </p>
+ * elements.
*
* <p>The class is organized <em>abstractly</em> as a set of intervals of
* integers. Each interval indicates an inclusive range of indices in a
@@ -104,7 +104,7 @@ public class DefaultListSelectionModel implements Cloneable,
* controls the range of indices provided in any {@link
* ListSelectionEvent} fired by the selectionModel. Let
* <code>[A,L]</code> be the range of indices between {@link
- * anchorSelectionIndex} and {@link leadSelectionIndex} inclusive, and
+ * #anchorSelectionIndex} and {@link #leadSelectionIndex} inclusive, and
* let <code>[i0,i1]</code> be the range of indices changed in a given
* call which generates a {@link ListSelectionEvent}. Then when this
* property is <code>true</code>, the {@link ListSelectionEvent} contains
@@ -232,7 +232,7 @@ public class DefaultListSelectionModel implements Cloneable,
* which changed selection status between the beginning and end of the
* method.</p>
*
- * @param anchorIndex The new property value
+ * @param leadIndex The new property value
*
* @see #getAnchorSelectionIndex
*/
@@ -292,9 +292,9 @@ public class DefaultListSelectionModel implements Cloneable,
/**
* Sets the value of the {@link #leadAnchorNotificationEnabled} property.
*
- * @param flag The new property value
+ * @param l The new property value
*
- * @see #getLeadAnchorNotificationEnabled
+ * @see #isLeadAnchorNotificationEnabled
*/
public void setLeadAnchorNotificationEnabled(boolean l)
{
@@ -588,7 +588,7 @@ public class DefaultListSelectionModel implements Cloneable,
* indicate that a series of adjustment has just ended.
*
* The values of {@link #getMinSelectionIndex} and
- * {@link getMaxSelectionIndex} are used in the {@link ListSelectionEvent}
+ * {@link #getMaxSelectionIndex} are used in the {@link ListSelectionEvent}
* that gets fired.
*
* @param isAdjusting <code>true</code> if this is the final change
@@ -636,8 +636,8 @@ public class DefaultListSelectionModel implements Cloneable,
*
* @param listener The listener to add
*
- * @see removeListSelectionListener
- * @see getListSelectionListeners
+ * @see #removeListSelectionListener
+ * @see #getListSelectionListeners
*/
public void addListSelectionListener(ListSelectionListener listener)
{
@@ -649,8 +649,8 @@ public class DefaultListSelectionModel implements Cloneable,
*
* @param listener The listener to remove
*
- * @see addListSelectionListener
- * @see getListSelectionListeners
+ * @see #addListSelectionListener
+ * @see #getListSelectionListeners
*/
public void removeListSelectionListener(ListSelectionListener listener)
{
@@ -664,7 +664,7 @@ public class DefaultListSelectionModel implements Cloneable,
*
* @return The array
*
- * @see getListSelectionListener
+ * @see #getListSelectionListeners
* @since 1.3
*/
public EventListener[] getListeners(Class listenerType)
@@ -677,9 +677,9 @@ public class DefaultListSelectionModel implements Cloneable,
*
* @return the array
*
- * @see addListSelectionListener
- * @see removeListSelectionListener
- * @see getListeners
+ * @see #addListSelectionListener
+ * @see #removeListSelectionListener
+ * @see #getListeners
* @since 1.4
*/
public ListSelectionListener[] getListSelectionListeners()
diff --git a/libjava/classpath/javax/swing/DefaultSingleSelectionModel.java b/libjava/classpath/javax/swing/DefaultSingleSelectionModel.java
index 039883e..8f4d405 100644
--- a/libjava/classpath/javax/swing/DefaultSingleSelectionModel.java
+++ b/libjava/classpath/javax/swing/DefaultSingleSelectionModel.java
@@ -46,7 +46,8 @@ import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
/**
- * DefaultSingleSelectionModel
+ * The default implementation of {@link SingleSelectionModel}, used in
+ * {@link JTabbedPane}, {@link JMenuBar} and {@link JPopupMenu}.
*
* @author Andrew Selkirk
*/
diff --git a/libjava/classpath/javax/swing/FocusManager.java b/libjava/classpath/javax/swing/FocusManager.java
index 9f898e6..179fa6f 100644
--- a/libjava/classpath/javax/swing/FocusManager.java
+++ b/libjava/classpath/javax/swing/FocusManager.java
@@ -44,9 +44,11 @@ import java.awt.KeyboardFocusManager;
import java.awt.event.KeyEvent;
/**
- * FocusManager
- * @author Andrew Selkirk
- * @version 1.0
+ * This class has been obsoleted by the new
+ * {@link java.awt.KeyboardFocusManager} and
+ * {@link java.awt.DefaultKeyboardFocusManager} API.
+ *
+ * @author Andrew Selkirk
*/
public abstract class FocusManager
extends DefaultKeyboardFocusManager
diff --git a/libjava/classpath/javax/swing/GrayFilter.java b/libjava/classpath/javax/swing/GrayFilter.java
index 1a88f6f..b920b08 100644
--- a/libjava/classpath/javax/swing/GrayFilter.java
+++ b/libjava/classpath/javax/swing/GrayFilter.java
@@ -43,6 +43,12 @@ import java.awt.Toolkit;
import java.awt.image.FilteredImageSource;
import java.awt.image.RGBImageFilter;
+/**
+ * Produces grayscale images out of colored images. This is used to provide
+ * default disabled icons for buttons.
+ *
+ * @author original author unknown
+ */
public class GrayFilter extends RGBImageFilter
{
private boolean b;
diff --git a/libjava/classpath/javax/swing/Icon.java b/libjava/classpath/javax/swing/Icon.java
index c00eee4..c73ad2d 100644
--- a/libjava/classpath/javax/swing/Icon.java
+++ b/libjava/classpath/javax/swing/Icon.java
@@ -1,5 +1,5 @@
/* Icon.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,28 @@ import java.awt.Graphics;
*/
public interface Icon
{
+ /**
+ * Returns the height of the icon.
+ *
+ * @return The height of the icon.
+ */
int getIconHeight();
+
+ /**
+ * Returns the width of the icon.
+ *
+ * @return The width of the icon.
+ */
int getIconWidth();
+
+ /**
+ * Draws the icon at the location (x, y) on the specified graphics device.
+ *
+ * @param c a component related to the icon in some way (can be ignored by
+ some implementing classes).
+ * @param g the graphics device.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ */
void paintIcon(Component c, Graphics g, int x, int y);
}
diff --git a/libjava/classpath/javax/swing/ImageIcon.java b/libjava/classpath/javax/swing/ImageIcon.java
index 36f23d2..b650cd8 100644
--- a/libjava/classpath/javax/swing/ImageIcon.java
+++ b/libjava/classpath/javax/swing/ImageIcon.java
@@ -53,6 +53,9 @@ import javax.accessibility.AccessibleIcon;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleStateSet;
+/**
+ * An {@link Icon} implementation that is backed by an {@link Image}.
+ */
public class ImageIcon
implements Icon, Serializable, Accessible
{
@@ -219,92 +222,181 @@ public class ImageIcon
/** The AccessibleContext of this ImageIcon. */
private AccessibleContext accessibleContext;
+ /**
+ * Creates an ImageIcon without any properties set.
+ */
public ImageIcon()
{
}
-
- public ImageIcon(String file)
+
+ /**
+ * Constructs an ImageIcon given a filename. The icon's description
+ * is initially set to the filename itself. A filename of "" means
+ * create a blank icon.
+ *
+ * @param filename name of file to load or "" for a blank icon
+ */
+ public ImageIcon(String filename)
{
- this(file, file);
+ this(filename, filename);
}
- public ImageIcon(String file, String description)
+ /**
+ * Constructs an ImageIcon from the given filename, setting its
+ * description to the given description. A filename of "" means
+ * create a blank icon.
+ *
+ * @param filename name of file to load or "" for a blank icon
+ * @param description human-readable description of this icon
+ */
+ public ImageIcon(String filename, String description)
{
- this(Toolkit.getDefaultToolkit().getImage(file), description);
+ this(Toolkit.getDefaultToolkit().getImage(filename), description);
}
+ /**
+ * Creates an ImageIcon from the given byte array without any
+ * description set.
+ */
public ImageIcon(byte[] imageData)
{
this(imageData, null);
}
+ /**
+ * Creates an ImageIcon from the given byte array and sets the given
+ * description.
+ */
public ImageIcon(byte[] imageData, String description)
{
this(Toolkit.getDefaultToolkit().createImage(imageData), description);
}
+ /**
+ * Creates an ImageIcon from the given URL without any description
+ * set.
+ */
public ImageIcon(URL url)
{
this(url, null);
}
+ /**
+ * Creates an ImageIcon from the given URL and sets the given
+ * description.
+ */
public ImageIcon(URL url, String description)
{
this(Toolkit.getDefaultToolkit().getImage(url), description);
}
+ /**
+ * Creates an ImageIcon from the given Image without any description
+ * set.
+ */
public ImageIcon(Image image)
{
this(image, null);
}
+ /**
+ * Creates an ImageIcon from the given Image and sets the given
+ * description.
+ */
public ImageIcon(Image image, String description)
{
setImage(image);
setDescription(description);
}
-
+
+ /**
+ * Returns the ImageObserver that is used for all Image
+ * operations. Defaults to null when not explicitly set.
+ */
public ImageObserver getImageObserver()
{
return observer;
}
+ /**
+ * Sets the ImageObserver that will be used for all Image
+ * operations. Can be set to null (the default) when no observer is
+ * needed.
+ */
public void setImageObserver(ImageObserver newObserver)
{
observer = newObserver;
}
+ /**
+ * Returns the backing Image for this ImageIcon. Might be set to
+ * null in which case no image is shown.
+ */
public Image getImage()
{
return image;
}
+ /**
+ * Explicitly sets the backing Image for this ImageIcon. Will call
+ * loadImage() to make sure that the Image is completely loaded
+ * before returning.
+ */
public void setImage(Image image)
{
loadImage(image);
this.image = image;
}
+ /**
+ * Returns a human readable description for this ImageIcon or null
+ * when no description is set or available.
+ */
public String getDescription()
{
return description;
}
+ /**
+ * Sets a human readable description for this ImageIcon. Can be set
+ * to null when no description is available.
+ */
public void setDescription(String description)
{
this.description = description;
}
+ /**
+ * Returns the the height of the backing Image, or -1 if the backing
+ * Image is null. The getHeight() method of the Image will be called
+ * with the set observer of this ImageIcon.
+ */
public int getIconHeight()
{
+ if (image == null)
+ return -1;
+
return image.getHeight(observer);
}
+ /**
+ * Returns the the width of the backing Image, or -1 if the backing
+ * Image is null. The getWidth() method of the Image will be called
+ * with the set observer of this ImageIcon.
+ */
public int getIconWidth()
{
+ if (image == null)
+ return -1;
+
return image.getWidth(observer);
}
+ /**
+ * Calls <code>g.drawImage()</code> on the backing Image using the
+ * set observer of this ImageIcon. If the set observer is null, the
+ * given Component is used as observer.
+ */
public void paintIcon(Component c, Graphics g, int x, int y)
{
g.drawImage(image, x, y, observer != null ? observer : c);
@@ -338,9 +430,9 @@ public class ImageIcon
*
* @return the load status of the icon image
*
- * @see {@link MediaTracker.COMPLETE}
- * @see {@link MediaTracker.ABORTED}
- * @see {@link MediaTracker.ERRORED}
+ * @see MediaTracker#COMPLETE
+ * @see MediaTracker#ABORTED
+ * @see MediaTracker#ERRORED
*/
public int getImageLoadStatus()
{
diff --git a/libjava/classpath/javax/swing/InputMap.java b/libjava/classpath/javax/swing/InputMap.java
index afc431d..a7ec38c 100644
--- a/libjava/classpath/javax/swing/InputMap.java
+++ b/libjava/classpath/javax/swing/InputMap.java
@@ -49,6 +49,14 @@ import java.util.Set;
/**
+ * Maps {@link KeyStroke}s to arbitrary objects, usually Strings. This
+ * is used in combination with {@link ActionMap}s.
+ *
+ * If a component receives an input event, this is looked up in
+ * the component's <code>InputMap</code>. The result is an object which
+ * serves as a key to the components <code>ActionMap</code>. Finally
+ * the <code>Action</code> that is stored is executed.
+ *
* @author Andrew Selkirk
* @author Michael Koch
*
@@ -80,7 +88,7 @@ public class InputMap
/**
* Returns the binding for keystroke.
*
- * @param key the key of the enty
+ * @param keystroke the key of the enty
*
* @return the binding associated with keystroke may be null
*/
@@ -111,7 +119,7 @@ public class InputMap
/**
* Remove an entry from the <code>InputMap</code>.
*
- * @param key the key of the entry to remove
+ * @param keystroke the key of the entry to remove
*/
public void remove(KeyStroke keystroke)
{
diff --git a/libjava/classpath/javax/swing/InputVerifier.java b/libjava/classpath/javax/swing/InputVerifier.java
index 836c1a5..8e02ab8 100644
--- a/libjava/classpath/javax/swing/InputVerifier.java
+++ b/libjava/classpath/javax/swing/InputVerifier.java
@@ -39,9 +39,12 @@ package javax.swing;
/**
- * InputVerifier
+ * Verifies the user input on a component before the focus is shifted.
+ * It is sometimes necessary that input components have a valid state before
+ * they loose focus. Such components can have a <code>InputVerifier</code>
+ * subclass registered, that permits or vetos a focus change request.
+ *
* @author Andrew Selkirk
- * @version 1.0
*/
public abstract class InputVerifier
{
diff --git a/libjava/classpath/javax/swing/InternalFrameFocusTraversalPolicy.java b/libjava/classpath/javax/swing/InternalFrameFocusTraversalPolicy.java
index 0609f09..4780a67 100644
--- a/libjava/classpath/javax/swing/InternalFrameFocusTraversalPolicy.java
+++ b/libjava/classpath/javax/swing/InternalFrameFocusTraversalPolicy.java
@@ -42,11 +42,16 @@ import java.awt.Component;
import java.awt.FocusTraversalPolicy;
/**
+ * A {@link FocusTraversalPolicy} that provides the additional capability
+ * to determine a {@link JInternalFrame}'s initially focused component
+ * when it is selected.
+ *
* @author Michael Koch
*
* @since 1.4
*/
-public abstract class InternalFrameFocusTraversalPolicy extends FocusTraversalPolicy
+public abstract class InternalFrameFocusTraversalPolicy
+ extends FocusTraversalPolicy
{
public Component getInitialComponent(JInternalFrame frame)
{
diff --git a/libjava/classpath/javax/swing/JApplet.java b/libjava/classpath/javax/swing/JApplet.java
index 95a05c0..cafb2da 100644
--- a/libjava/classpath/javax/swing/JApplet.java
+++ b/libjava/classpath/javax/swing/JApplet.java
@@ -49,6 +49,11 @@ import java.awt.event.KeyEvent;
import javax.accessibility.AccessibleContext;
+/**
+ * A top-level container that is usually used in web browsers.
+ *
+ * @author original author unknown
+ */
public class JApplet extends Applet
implements RootPaneContainer
{
diff --git a/libjava/classpath/javax/swing/JButton.java b/libjava/classpath/javax/swing/JButton.java
index 0234e47..5653fbf 100644
--- a/libjava/classpath/javax/swing/JButton.java
+++ b/libjava/classpath/javax/swing/JButton.java
@@ -39,21 +39,45 @@ package javax.swing;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
import javax.swing.plaf.ButtonUI;
/**
- * An instance of JButton can be added to a panel, frame etc
+ * A general purpose push button. <code>JButton</code>s can display a label,
+ * an {@link Icon} or both.
*
* @author Ronald Veldema (rveldema@cs.vu.nl)
*/
public class JButton extends AbstractButton
implements Accessible
{
+
+ /**
+ * Accessibility support for JButtons.
+ */
+ protected class AccessibleJButton
+ extends AbstractButton.AccessibleAbstractButton
+ {
+ /**
+ * Returns the accessible role that this component represents.
+ * This is {@link AccessibleRole#PUSH_BUTTON} for <code>JButton</code>s.
+ *
+ * @return the accessible role that this component represents
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.PUSH_BUTTON;
+ }
+ }
+
private static final long serialVersionUID = -1907255238954382202L;
boolean def;
boolean is_def;
+ /** The AccessibleContext for this JButton. */
+ AccessibleJButton accessibleContext;
+
public JButton()
{
this(null, null);
@@ -96,8 +120,9 @@ public class JButton extends AbstractButton
public AccessibleContext getAccessibleContext()
{
- // Gets the AccessibleContext associated with this JButton.
- return null;
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJButton();
+ return accessibleContext;
}
public String getUIClassID()
diff --git a/libjava/classpath/javax/swing/JCheckBox.java b/libjava/classpath/javax/swing/JCheckBox.java
index 5e7e80c..a743308 100644
--- a/libjava/classpath/javax/swing/JCheckBox.java
+++ b/libjava/classpath/javax/swing/JCheckBox.java
@@ -41,7 +41,16 @@ package javax.swing;
import javax.accessibility.AccessibleContext;
/**
- * An instance of JCheckbox can be added to a panel, frame etc
+ * A small box that displays a check or not, depending on it's
+ * <code>selected</code> state. This works very similar to
+ * {@link JToggleButton} and {@link JRadioButton}, but in UI design it
+ * has different semantics. <code>JCheckBox</code>es are usually
+ * used in multiple-choice scenarios, where a user can select 0..n
+ * of n different options. (This is in contrast to the general RadioButton
+ * semantics where the user can select exactly one of n options).
+ *
+ * Note however that this semantics is in no way enforced by the
+ * <code>JCheckBox</code>.
*
* @author Ronald Veldema (rveldema@cs.vu.nl)
*/
diff --git a/libjava/classpath/javax/swing/JCheckBoxMenuItem.java b/libjava/classpath/javax/swing/JCheckBoxMenuItem.java
index 46a42ad..f9dd565 100644
--- a/libjava/classpath/javax/swing/JCheckBoxMenuItem.java
+++ b/libjava/classpath/javax/swing/JCheckBoxMenuItem.java
@@ -46,11 +46,14 @@ import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
/**
- * This class represents JCheckBoxMenuItem. Its behaviour is very similar
- * to JCheckBoxButton. Just like the JCheckBoxButton, user can check and
- * uncheck this menu item by clicking on it. Also setSelected()/setState()
- * can be use used for the same purpose. JCheckBoxMenuItem uses
- * ToggleButtonModel to keep track of its selection.
+ * A menu item that displays a checkbox. Its behaviour is very similar
+ * to {@link JCheckBox}. Just like the <code>JCheckBox</code>, user can check
+ * and uncheck this menu item by clicking on it. Also {@link #setSelected()}
+ * and {@link #setState()} can be use used for the same purpose.
+ * <code>JCheckBoxMenuItem</code> uses
+ * <code>ToggleButtonModel</code> to keep track of its selection.
+ *
+ * @author original author unknown
*/
public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
Accessible
@@ -146,6 +149,7 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
super(text, icon);
setModel(new JToggleButton.ToggleButtonModel());
this.state = state;
+ this.setVisible(true);
}
private void writeObject(ObjectOutputStream stream) throws IOException
@@ -232,6 +236,9 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
return accessibleContext;
}
+ /**
+ * Accessibility support for <code>JCheckBoxMenuItem</code>.
+ */
protected class AccessibleJCheckBoxMenuItem extends AccessibleJMenuItem
{
private static final long serialVersionUID = 1079958073579370777L;
diff --git a/libjava/classpath/javax/swing/JColorChooser.java b/libjava/classpath/javax/swing/JColorChooser.java
index e16b981..4016b82 100644
--- a/libjava/classpath/javax/swing/JColorChooser.java
+++ b/libjava/classpath/javax/swing/JColorChooser.java
@@ -58,13 +58,15 @@ import javax.swing.plaf.ColorChooserUI;
/**
- * The JColorChooser is a Swing widget that offers users different ways to
+ * A Swing widget that offers users different ways to
* select a color. By default, three different panels are presented to the
* user that are capable of changing the selected color. There are three ways
* to utilize JColorChooser. The first is to build a JColorChooser and add it
* to the content pane. The second is to use the createDialog method to
* create a JDialog that holds a JColorChooser. The third is to show a
* JColorChooser in a JDialog directly using the showDialog method.
+ *
+ * @author original author unknown
*/
public class JColorChooser extends JComponent implements Accessible
{
@@ -72,7 +74,7 @@ public class JColorChooser extends JComponent implements Accessible
private static final long serialVersionUID = 9168066781620640889L;
/**
- * AccessibleJColorChooser
+ * Accessibility support for <code>JColorChooser</code>.
*/
protected class AccessibleJColorChooser
extends JComponent.AccessibleJComponent
diff --git a/libjava/classpath/javax/swing/JComboBox.java b/libjava/classpath/javax/swing/JComboBox.java
index 4284ec8..47d18323 100644
--- a/libjava/classpath/javax/swing/JComboBox.java
+++ b/libjava/classpath/javax/swing/JComboBox.java
@@ -61,10 +61,10 @@ import javax.swing.event.PopupMenuListener;
import javax.swing.plaf.ComboBoxUI;
/**
- * JComboBox. JComboBox is a container, that keeps track of elements added to
- * it by the user. JComboBox allows user to select any item in its list and
- * displays the selected item to the user. JComboBox also can show/hide popup
- * menu containing its list of item whenever the mouse is pressed over it.
+ * A component that allows a user to select any item in its list and
+ * displays the selected item to the user. JComboBox also can show/hide a
+ * popup menu containing its list of item whenever the mouse is pressed
+ * over it.
*
* @author Andrew Selkirk
* @author Olga Rodimina
@@ -1138,7 +1138,7 @@ public class JComboBox extends JComponent implements ItemSelectable,
}
/**
- * AccessibleJComboBox
+ * Accessibility support for <code>JComboBox</code>.
*/
protected class AccessibleJComboBox extends AccessibleJComponent
implements AccessibleAction, AccessibleSelection
diff --git a/libjava/classpath/javax/swing/JComponent.java b/libjava/classpath/javax/swing/JComponent.java
index 42a5317..dc7689b 100644
--- a/libjava/classpath/javax/swing/JComponent.java
+++ b/libjava/classpath/javax/swing/JComponent.java
@@ -38,12 +38,14 @@ exception statement from your version. */
package javax.swing;
+import java.applet.Applet;
import java.awt.AWTEvent;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
+import java.awt.FocusTraversalPolicy;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
@@ -51,6 +53,7 @@ import java.awt.Image;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.Window;
import java.awt.dnd.DropTarget;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -71,6 +74,7 @@ import java.io.Serializable;
import java.util.EventListener;
import java.util.Hashtable;
import java.util.Locale;
+import java.util.Set;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
@@ -86,7 +90,7 @@ import javax.swing.event.SwingPropertyChangeSupport;
import javax.swing.plaf.ComponentUI;
/**
- * Every component in swing inherits from this class (JLabel, JButton, etc).
+ * The base class of all Swing components.
* It contains generic methods to manage events, properties and sizes. Actual
* drawing of the component is channeled to a look-and-feel class that is
* implemented elsewhere.
@@ -103,10 +107,17 @@ public abstract class JComponent extends Container implements Serializable
*/
protected AccessibleContext accessibleContext;
+ /**
+ * Basic accessibility support for <code>JComponent</code> derived
+ * widgets.
+ */
public abstract class AccessibleJComponent
extends AccessibleAWTContainer
implements AccessibleExtendedComponent
{
+ /**
+ * Accessibility support for <code>JComponent</code>'s focus handler.
+ */
protected class AccessibleFocusHandler
implements FocusListener
{
@@ -115,6 +126,9 @@ public abstract class JComponent extends Container implements Serializable
public void focusLost(FocusEvent valevent){}
}
+ /**
+ * Accessibility support for <code>JComponent</code>'s container handler.
+ */
protected class AccessibleContainerHandler
implements ContainerListener
{
@@ -273,7 +287,7 @@ public abstract class JComponent extends Container implements Serializable
* repainting of the component are usually delegated to this object.
*
* @see #setUI
- * @see #getUI
+ * @see #getUIClassID
* @see #updateUI
*/
protected ComponentUI ui;
@@ -361,7 +375,7 @@ public abstract class JComponent extends Container implements Serializable
* Constant used to indicate that no condition has been assigned to a
* particular action.
*
- * @see #registerKeyboardAction
+ * @see #registerKeyboardAction(ActionListener, KeyStroke, int)
*/
public static final int UNDEFINED_CONDITION = -1;
@@ -369,7 +383,7 @@ public abstract class JComponent extends Container implements Serializable
* Constant used to indicate that an action should be performed only when
* the component has focus.
*
- * @see #registerKeyboardAction
+ * @see #registerKeyboardAction(ActionListener, KeyStroke, int)
*/
public static final int WHEN_FOCUSED = 0;
@@ -377,7 +391,7 @@ public abstract class JComponent extends Container implements Serializable
* Constant used to indicate that an action should be performed only when
* the component is an ancestor of the component which has focus.
*
- * @see #registerKeyboardAction
+ * @see #registerKeyboardAction(ActionListener, KeyStroke, int)
*/
public static final int WHEN_ANCESTOR_OF_FOCUSED_COMPONENT = 1;
@@ -385,7 +399,7 @@ public abstract class JComponent extends Container implements Serializable
* Constant used to indicate that an action should be performed only when
* the component is in the window which has focus.
*
- * @see #registerKeyboardAction
+ * @see #registerKeyboardAction(ActionListener, KeyStroke, int)
*/
public static final int WHEN_IN_FOCUSED_WINDOW = 2;
@@ -449,7 +463,10 @@ public abstract class JComponent extends Container implements Serializable
*/
public final void putClientProperty(Object key, Object value)
{
- getClientProperties().put(key, value);
+ if (value != null)
+ getClientProperties().put(key, value);
+ else
+ getClientProperties().remove(key);
}
/**
@@ -457,7 +474,7 @@ public abstract class JComponent extends Container implements Serializable
*
* @param listener The listener to unregister
*
- * @see addAncestorListener
+ * @see #addAncestorListener
*/
public void removeAncestorListener(AncestorListener listener)
{
@@ -469,7 +486,7 @@ public abstract class JComponent extends Container implements Serializable
*
* @param listener The listener to register
*
- * @see #addPropertyChangeListener
+ * @see #addPropertyChangeListener(PropertyChangeListener)
* @see #changeSupport
*/
public void removePropertyChangeListener(PropertyChangeListener listener)
@@ -484,7 +501,7 @@ public abstract class JComponent extends Container implements Serializable
* @param propertyName The property name to unregister the listener from
* @param listener The listener to unregister
*
- * @see #addPropertyChangeListener
+ * @see #addPropertyChangeListener(String, PropertyChangeListener)
* @see #changeSupport
*/
public void removePropertyChangeListener(String propertyName,
@@ -526,7 +543,7 @@ public abstract class JComponent extends Container implements Serializable
*
* @param listener The listener to register
*
- * @see #removePropertyChangeListener
+ * @see #removePropertyChangeListener(PropertyChangeListener)
* @see #changeSupport
*/
public void addPropertyChangeListener(PropertyChangeListener listener)
@@ -544,7 +561,7 @@ public abstract class JComponent extends Container implements Serializable
* @param propertyName The property name to listen to
* @param listener The listener to register
*
- * @see #removePropertyChangeListener
+ * @see #removePropertyChangeListener(String, PropertyChangeListener)
* @see #changeSupport
*/
public void addPropertyChangeListener(String propertyName,
@@ -712,8 +729,8 @@ public abstract class JComponent extends Container implements Serializable
* @param newValue The new value of the property
*
* @see #changeSupport
- * @see #addPropertyChangeListener
- * @see #removePropertyChangeListener
+ * @see #addPropertyChangeListener(PropertyChangeListener)
+ * @see #removePropertyChangeListener(PropertyChangeListener)
*/
protected void firePropertyChange(String propertyName, Object oldValue,
Object newValue)
@@ -745,8 +762,8 @@ public abstract class JComponent extends Container implements Serializable
*
* @throws PropertyVetoException if the change was vetoed by a listener
*
- * @see addVetoableChangeListener
- * @see removeVetoableChangeListener
+ * @see #addVetoableChangeListener
+ * @see #removeVetoableChangeListener
*/
protected void fireVetoableChange(String propertyName, Object oldValue,
Object newValue)
@@ -945,7 +962,7 @@ public abstract class JComponent extends Container implements Serializable
/**
* Get the component's maximum size. If the {@link #maximumSize} property
* has been explicitly set, it is returned. If the {@link #maximumSize}
- * property has not been set but the {@link ui} property has been, the
+ * property has not been set but the {@link #ui} property has been, the
* result of {@link ComponentUI#getMaximumSize} is returned. If neither
* property has been set, the result of {@link Container#getMaximumSize}
* is returned.
@@ -974,7 +991,7 @@ public abstract class JComponent extends Container implements Serializable
/**
* Get the component's minimum size. If the {@link #minimumSize} property
* has been explicitly set, it is returned. If the {@link #minimumSize}
- * property has not been set but the {@link ui} property has been, the
+ * property has not been set but the {@link #ui} property has been, the
* result of {@link ComponentUI#getMinimumSize} is returned. If neither
* property has been set, the result of {@link Container#getMinimumSize}
* is returned.
@@ -1003,7 +1020,7 @@ public abstract class JComponent extends Container implements Serializable
/**
* Get the component's preferred size. If the {@link #preferredSize}
* property has been explicitly set, it is returned. If the {@link
- * #preferredSize} property has not been set but the {@link ui} property
+ * #preferredSize} property has not been set but the {@link #ui} property
* has been, the result of {@link ComponentUI#getPreferredSize} is
* returned. If neither property has been set, the result of {@link
* Container#getPreferredSize} is returned.
@@ -1077,7 +1094,7 @@ public abstract class JComponent extends Container implements Serializable
}
/**
- * Return the value of the {@link #nextFocusableComponent} property.
+ * Return the value of the <code>nextFocusableComponent</code> property.
*
* @return The current value of the property, or <code>null</code>
* if none has been set.
@@ -1132,7 +1149,7 @@ public abstract class JComponent extends Container implements Serializable
}
/**
- * Return the {@link #toolTip} property of this component, creating it and
+ * Return the <code>toolTip</code> property of this component, creating it and
* setting it if it is currently <code>null</code>. This method can be
* overridden in subclasses which wish to control the exact form of
* tooltip created.
@@ -1149,7 +1166,7 @@ public abstract class JComponent extends Container implements Serializable
}
/**
- * Return the location at which the {@link #toolTip} property should be
+ * Return the location at which the {@link #toolTipText} property should be
* displayed, when triggered by a particular mouse event.
*
* @param event The event the tooltip is being presented in response to
@@ -1167,7 +1184,7 @@ public abstract class JComponent extends Container implements Serializable
*
* @param text The new property value
*
- * @see #getToolTipText
+ * @see #getToolTipText()
*/
public void setToolTipText(String text)
{
@@ -1218,7 +1235,7 @@ public abstract class JComponent extends Container implements Serializable
/**
* Return the top level ancestral container (usually a {@link
- * java.awt.Window} or {@link java.awt.Applet}) which this component is
+ * java.awt.Window} or {@link java.applet.Applet}) which this component is
* contained within, or <code>null</code> if no ancestors exist.
*
* @return The top level container, if it exists
@@ -1275,9 +1292,9 @@ public abstract class JComponent extends Container implements Serializable
* displayable, focusable, visible components.</p>
*
* <p>This method should not be called by clients; it is intended for
- * focus implementations. Use {@link Component#requestFocus} instead.</p>
+ * focus implementations. Use {@link Component#requestFocus()} instead.</p>
*
- * @see {@link Component#requestFocus}
+ * @see Component#requestFocus()
*/
public void grabFocus()
{
@@ -1317,8 +1334,8 @@ public abstract class JComponent extends Container implements Serializable
* @return <code>true</code> if you want this component to manage its own
* focus, otherwise (by default) <code>false</code>
*
- * @deprecated 1.4 Use {@link Component.setFocusTraversalKeys(int,Set)} and
- * {@link Container.setFocusCycleRoot(boolean)} instead
+ * @deprecated 1.4 Use {@link Component#setFocusTraversalKeys(int, Set)} and
+ * {@link Container#setFocusCycleRoot(boolean)} instead
*/
public boolean isManagingFocus()
{
@@ -1326,7 +1343,7 @@ public abstract class JComponent extends Container implements Serializable
}
/**
- * Return the current value of the {@link opaque} property.
+ * Return the current value of the {@link #opaque} property.
*
* @return The current property value
*/
@@ -1370,10 +1387,10 @@ public abstract class JComponent extends Container implements Serializable
/**
* Return <code>true</code> if this component is a validation root; this
- * will cause calls to {@link #invalidate} in this component's children
+ * will cause calls to {@link #invalidate()} in this component's children
* to be "captured" at this component, and not propagate to its parents.
* For most components this should return <code>false</code>, but some
- * components such as {@link JViewPort} will want to return
+ * components such as {@link JViewport} will want to return
* <code>true</code>.
*
* @return Whether this component is a validation root
@@ -1386,7 +1403,7 @@ public abstract class JComponent extends Container implements Serializable
/**
* <p>Paint the component. This is a delicate process, and should only be
* called from the repaint thread, under control of the {@link
- * RepaintManager}. Client code should usually call {@link #repaint} to
+ * RepaintManager}. Client code should usually call {@link #repaint()} to
* trigger painting.</p>
*
* <p>This method will acquire a double buffer from the {@link
@@ -1410,7 +1427,7 @@ public abstract class JComponent extends Container implements Serializable
*
* @param g The graphics context to paint with
*
- * @see #paintImmediately
+ * @see #paintImmediately(Rectangle)
*/
public void paint(Graphics g)
{
@@ -1633,18 +1650,18 @@ public abstract class JComponent extends Container implements Serializable
* to fetch mapping tables from keystrokes to commands, and commands to
* actions, respectively, and modify those mappings directly.
*
- * @param anAction The action to be registered
- * @param aCommand The command to deliver in the delivered {@link
- * java.awt.ActionEvent}
- * @param aKeyStroke The keystroke to register on
- * @param aCondition One of the values {@link #UNDEFINED_CONDITION},
+ * @param act The action to be registered
+ * @param cmd The command to deliver in the delivered {@link
+ * java.awt.event.ActionEvent}
+ * @param stroke The keystroke to register on
+ * @param cond One of the values {@link #UNDEFINED_CONDITION},
* {@link #WHEN_ANCESTOR_OF_FOCUSED_COMPONENT}, {@link #WHEN_FOCUSED}, or
* {@link #WHEN_IN_FOCUSED_WINDOW}, indicating the condition which must
* be met for the action to be fired
*
* @see #unregisterKeyboardAction
- * @see #getConditionForKeystroke
- * @see #resetKeyboardActiond
+ * @see #getConditionForKeyStroke
+ * @see #resetKeyboardActions
*/
public void registerKeyboardAction(ActionListener act,
String cmd,
@@ -1724,7 +1741,7 @@ public abstract class JComponent extends Container implements Serializable
* Return the condition that determines whether a registered action
* occurs in response to the specified keystroke.
*
- * @param aKeyStroke The keystroke to return the condition of
+ * @param ks The keystroke to return the condition of
*
* @return One of the values {@link #UNDEFINED_CONDITION}, {@link
* #WHEN_ANCESTOR_OF_FOCUSED_COMPONENT}, {@link #WHEN_FOCUSED}, or {@link
@@ -1733,9 +1750,9 @@ public abstract class JComponent extends Container implements Serializable
* @deprecated As of 1.3 KeyStrokes can be registered with multiple
* simultaneous conditions.
*
- * @see #registerKeyboardAction
+ * @see #registerKeyboardAction(ActionListener, KeyStroke, int)
* @see #unregisterKeyboardAction
- * @see #resetKeyboardActiond
+ * @see #resetKeyboardActions
*/
public int getConditionForKeyStroke(KeyStroke ks)
{
@@ -1756,7 +1773,7 @@ public abstract class JComponent extends Container implements Serializable
* Get the ActionListener (typically an {@link Action} object) which is
* associated with a particular keystroke.
*
- * @param aKeyStroke The keystroke to retrieve the action of
+ * @param ks The keystroke to retrieve the action of
*
* @return The action associated with the specified keystroke
*
@@ -1796,12 +1813,52 @@ public abstract class JComponent extends Container implements Serializable
super.processKeyEvent(e);
processComponentKeyEvent(e);
- // FIXME: this needs to be elaborated significantly, to do all the
- // focus / ancestor / window searching for the various binding modes.
- if (! e.isConsumed() &&
- processKeyBinding(KeyStroke.getKeyStrokeForEvent(e),
+ if (e.isConsumed())
+ return;
+
+ // Input maps are checked in this order:
+ // 1. The focused component's WHEN_FOCUSED map is checked.
+ // 2. The focused component's WHEN_ANCESTOR_OF_FOCUSED_COMPONENT map.
+ // 3. The WHEN_ANCESTOR_OF_FOCUSED_COMPONENT maps of the focused
+ // component's parent, then its parent's parent, and so on.
+ // Note: Input maps for disabled components are skipped.
+ // 4. The WHEN_IN_FOCUSED_WINDOW maps of all the enabled components in
+ // the focused window are searched.
+
+ if (processKeyBinding(KeyStroke.getKeyStrokeForEvent(e),
e, WHEN_FOCUSED, e.getID() == KeyEvent.KEY_PRESSED))
+ // This is step 1 from above comment.
e.consume();
+ else if (processKeyBinding(KeyStroke.getKeyStrokeForEvent(e),
+ e, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
+ e.getID() == KeyEvent.KEY_PRESSED))
+ // This is step 2 from above comment.
+ e.consume();
+ else
+ {
+ // This is step 3 from above comment.
+ Container current = this;
+ while ((current = current.getParent()) instanceof JComponent)
+ {
+ if (((JComponent)current).processKeyBinding
+ (KeyStroke.getKeyStrokeForEvent(e), e,
+ WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
+ e.getID() == KeyEvent.KEY_PRESSED))
+ {
+ e.consume();
+ break;
+ }
+ if (current instanceof Window || current instanceof Applet
+ || current instanceof JInternalFrame)
+ break;
+ }
+ if (e.isConsumed())
+ return;
+
+ // This is step 4 from above comment.
+ // FIXME: Implement. Note, should use ComponentInputMaps rather
+ // than walking the entire containment hierarchy.
+ }
}
protected boolean processKeyBinding(KeyStroke ks,
@@ -1833,11 +1890,11 @@ public abstract class JComponent extends Container implements Serializable
/**
* Remove a keyboard action registry.
*
- * @param stroke The keystroke to unregister
+ * @param aKeyStroke The keystroke to unregister
*
- * @see #registerKeyboardAction
- * @see #getConditionForKeystroke
- * @see #resetKeyboardActiond
+ * @see #registerKeyboardAction(ActionListener, KeyStroke, int)
+ * @see #getConditionForKeyStroke
+ * @see #resetKeyboardActions
*/
public void unregisterKeyboardAction(KeyStroke aKeyStroke)
{
@@ -1848,9 +1905,9 @@ public abstract class JComponent extends Container implements Serializable
/**
* Reset all keyboard action registries.
*
- * @see #registerKeyboardAction
+ * @see #registerKeyboardAction(ActionListener, KeyStroke, int)
* @see #unregisterKeyboardAction
- * @see #getConditionForKeystroke
+ * @see #getConditionForKeyStroke
*/
public void resetKeyboardActions()
{
@@ -1902,7 +1959,7 @@ public abstract class JComponent extends Container implements Serializable
* Request focus on the default component of this component's {@link
* FocusTraversalPolicy}.
*
- * @return The result of {@link #requestFocus}
+ * @return The result of {@link #requestFocus()}
*
* @deprecated Use {@link #requestFocus()} on the default component provided
* from the {@link FocusTraversalPolicy} instead.
@@ -1986,7 +2043,7 @@ public abstract class JComponent extends Container implements Serializable
}
/**
- * Set the value of the {@link #enabled} property.
+ * Set the value of the <code>enabled</code> property.
*
* @param enable The new value of the property
*/
@@ -1998,7 +2055,7 @@ public abstract class JComponent extends Container implements Serializable
}
/**
- * Set the value of the {@link #font} property.
+ * Set the value of the <code>font</code> property.
*
* @param f The new value of the property
*/
@@ -2008,7 +2065,7 @@ public abstract class JComponent extends Container implements Serializable
}
/**
- * Set the value of the {@link #background} property.
+ * Set the value of the <code>background</code> property.
*
* @param bg The new value of the property
*/
@@ -2018,7 +2075,7 @@ public abstract class JComponent extends Container implements Serializable
}
/**
- * Set the value of the {@link #foreground} property.
+ * Set the value of the <code>foreground</code> property.
*
* @param fg The new value of the property
*/
@@ -2091,7 +2148,7 @@ public abstract class JComponent extends Container implements Serializable
*
* @return The current value of the property
*
- * @see ComponentUI#setTransferHandler
+ * @see #setTransferHandler
*/
public TransferHandler getTransferHandler()
@@ -2104,7 +2161,7 @@ public abstract class JComponent extends Container implements Serializable
*
* @param newHandler The new value of the property
*
- * @see ComponentUI#getTransferHandler
+ * @see #getTransferHandler
*/
public void setTransferHandler(TransferHandler newHandler)
@@ -2142,7 +2199,7 @@ public abstract class JComponent extends Container implements Serializable
}
/**
- * Call {@link paint}.
+ * Call {@link #paint}.
*
* @param g The graphics context to paint into
*/
@@ -2155,7 +2212,7 @@ public abstract class JComponent extends Container implements Serializable
* Get the value of the UIClassID property. This property should be a key
* in the {@link UIDefaults} table managed by {@link UIManager}, the
* value of which is the name of a class to load for the component's
- * {@link ui} property.
+ * {@link #ui} property.
*
* @return A "symbolic" name which will map to a class to use for the
* component's UI, such as <code>"ComponentUI"</code>
@@ -2169,10 +2226,10 @@ public abstract class JComponent extends Container implements Serializable
}
/**
- * Install a new UI delegate as the component's {@link ui} property. In
- * the process, this will call {@link ComponentUI.uninstallUI} on any
- * existing value for the {@link ui} property, and {@link
- * ComponentUI.installUI} on the new UI delegate.
+ * Install a new UI delegate as the component's {@link #ui} property. In
+ * the process, this will call {@link ComponentUI#uninstallUI} on any
+ * existing value for the {@link #ui} property, and {@link
+ * ComponentUI#installUI} on the new UI delegate.
*
* @param newUI The new UI delegate to install
*
@@ -2198,7 +2255,7 @@ public abstract class JComponent extends Container implements Serializable
* This method should be overridden in subclasses. In JComponent, the
* method does nothing. In subclasses, it should a UI delegate
* (corresponding to the symbolic name returned from {@link
- * getUIClassID}) from the {@link UIManager}, and calls {@link setUI}
+ * #getUIClassID}) from the {@link UIManager}, and calls {@link #setUI}
* with the new delegate.
*/
public void updateUI()
@@ -2273,9 +2330,9 @@ public abstract class JComponent extends Container implements Serializable
* situations in which it is not possible to get the focus. So developers
* should not assume that the component has the focus until it receives
* a {@link java.awt.event.FocusEvent} with a value of
- * {@link java.awt.event.FocusEvent.FOCUS_GAINED}.
+ * {@link java.awt.event.FocusEvent#FOCUS_GAINED}.
*
- * @see {@link Component#requestFocus()}
+ * @see Component#requestFocus()
*/
public void requestFocus()
{
@@ -2288,15 +2345,15 @@ public abstract class JComponent extends Container implements Serializable
* by look and feel implementations.
*
* You should not use this method directly. Instead you are strongly
- * encouraged to call {@link #requestFocus} or {@link #requestFocusInWindow}
- * instead.
+ * encouraged to call {@link #requestFocus()} or
+ * {@link #requestFocusInWindow()} instead.
*
* @param temporary if the focus change is temporary
*
* @return <code>false</code> if the focus change request will definitly
* fail, <code>true</code> if it will likely succeed
*
- * @see {@link Component#requestFocus(boolean)}
+ * @see Component#requestFocus(boolean)
*
* @since 1.4
*/
@@ -2317,12 +2374,12 @@ public abstract class JComponent extends Container implements Serializable
* situations in which it is not possible to get the focus. So developers
* should not assume that the component has the focus until it receives
* a {@link java.awt.event.FocusEvent} with a value of
- * {@link java.awt.event.FocusEvent.FOCUS_GAINED}.
+ * {@link java.awt.event.FocusEvent#FOCUS_GAINED}.
*
* @return <code>false</code> if the focus change request will definitly
* fail, <code>true</code> if it will likely succeed
*
- * @see {@link Component#requestFocusInWindow()}
+ * @see Component#requestFocusInWindow()
*/
public boolean requestFocusInWindow()
{
@@ -2337,15 +2394,15 @@ public abstract class JComponent extends Container implements Serializable
* by look and feel implementations.
*
* You should not use this method directly. Instead you are strongly
- * encouraged to call {@link #requestFocus} or {@link #requestFocusInWindow}
- * instead.
+ * encouraged to call {@link #requestFocus()} or
+ * {@link #requestFocusInWindow()} instead.
*
* @param temporary if the focus change is temporary
*
* @return <code>false</code> if the focus change request will definitly
* fail, <code>true</code> if it will likely succeed
*
- * @see {@link Component#requestFocus(boolean)}
+ * @see Component#requestFocus(boolean)
*
* @since 1.4
*/
@@ -2426,7 +2483,8 @@ public abstract class JComponent extends Container implements Serializable
* has changed.
*
* This method is called before the component is actually removed from
- * its parent, so the parent is still visible through {@link #getParent}.
+ * its parent, so the parent is still visible through
+ * {@link Component#getParent}.
*/
public void removeNotify()
{
@@ -2585,7 +2643,7 @@ public abstract class JComponent extends Container implements Serializable
/**
* Prints this component to the given Graphics context. A call to this
* method results in calls to the methods {@link #printComponent},
- * {@link #printBorder} and {@link printChildren} in this order.
+ * {@link #printBorder} and {@link #printChildren} in this order.
*
* Double buffering is temporarily turned off so the painting goes directly
* to the supplied Graphics context.
diff --git a/libjava/classpath/javax/swing/JDesktopPane.java b/libjava/classpath/javax/swing/JDesktopPane.java
index ff51211..f4c80ec 100644
--- a/libjava/classpath/javax/swing/JDesktopPane.java
+++ b/libjava/classpath/javax/swing/JDesktopPane.java
@@ -48,7 +48,7 @@ import javax.swing.plaf.DesktopPaneUI;
/**
* JDesktopPane is a container (usually for JInternalFrames) that simulates a
- * desktop. Typically, the user will create JInternalFrames and place thme in
+ * desktop. Typically, the user will create JInternalFrames and place them in
* a JDesktopPane. The user can then interact with JInternalFrames like they
* usually would with JFrames. The actions (minimize, maximize, close, etc)
* are done by using a DesktopManager that is associated with the
diff --git a/libjava/classpath/javax/swing/JDialog.java b/libjava/classpath/javax/swing/JDialog.java
index 83865f8..0f528ab 100644
--- a/libjava/classpath/javax/swing/JDialog.java
+++ b/libjava/classpath/javax/swing/JDialog.java
@@ -53,10 +53,15 @@ import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
/**
- * Unlike JComponent derivatives, JDialog inherits from java.awt.Dialog. But
- * also lets a look-and-feel component to its work.
+ * A dialog window. This is an extension of {@link java.awt.Dialog} that
+ * provides support for the Swing architecture. Most importantly it contains a
+ * {@link JRootPane} as it's only top-level child, that manages the content
+ * pane, the menu and a glass pane.
*
- * @author Ronald Veldema (rveldema_AT_cs.vu.nl)
+ * Also, unlike <code>java.awt.Dialog</code>s, JDialogs support the
+ * Swing Pluggable Look &amp; Feel architecture.
+ *
+ * @author Ronald Veldema (rveldema@cs.vu.nl)
*/
public class JDialog extends Dialog implements Accessible, WindowConstants,
RootPaneContainer
diff --git a/libjava/classpath/javax/swing/JEditorPane.java b/libjava/classpath/javax/swing/JEditorPane.java
index 63c79ff..e2f1319 100644
--- a/libjava/classpath/javax/swing/JEditorPane.java
+++ b/libjava/classpath/javax/swing/JEditorPane.java
@@ -39,7 +39,6 @@ exception statement from your version. */
package javax.swing;
import java.awt.Dimension;
-import java.awt.event.KeyEvent;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@@ -52,7 +51,29 @@ import javax.swing.text.DefaultEditorKit;
import javax.swing.text.EditorKit;
import javax.swing.text.JTextComponent;
-
+/**
+ * A powerful text editor component that can handle different types of
+ * content.
+ *
+ * The JEditorPane text component is driven by an instance of
+ * {@link EditorKit}. The editor kit is responsible for providing
+ * a default {@link Document} implementation, a mechanism for loading
+ * and saving documents of its supported content type and providing
+ * a set of {@link Action}s for manipulating the content.
+ *
+ * By default the following content types are supported:
+ * <ul>
+ * <li><code>text/plain</code>: Plain text, handled by
+ * {@link javax.swing.text.DefaultEditorKit}.</li>
+ * <li><code>text/html</code>: HTML 4.0 styled text, handled by
+ * {@link javax.swing.text.html.HTMLEditorKit}.</li>
+ * <li><code>text/rtf</code>: RTF text, handled by
+ * {@link javax.swing.text.rtf.RTFEditorKit}.</li>
+ * </ul>
+ *
+ * @author original author unknown
+ * @author Roman Kennke (roman@kennke.org)
+ */
public class JEditorPane extends JTextComponent
{
private static final long serialVersionUID = 3140472492599046285L;
diff --git a/libjava/classpath/javax/swing/JFileChooser.java b/libjava/classpath/javax/swing/JFileChooser.java
index 17292fa..7569061 100644
--- a/libjava/classpath/javax/swing/JFileChooser.java
+++ b/libjava/classpath/javax/swing/JFileChooser.java
@@ -54,7 +54,17 @@ import javax.swing.plaf.FileChooserUI;
/**
- * DOCUMENT ME!
+ * A component that provides the user a dialog box to browse through a
+ * filesystem and choose one or more files or directories.
+ *
+ * A JFileChooser can be configured to filter the displayed file list
+ * by adding a {@link FileFilter} instance using
+ * {@link #addChoosableFileFilter(FileFilter)}. Additional components can
+ * be embedded in the file chooser using {@link #setAccessory(JComponent)}.
+ * The JFileChooser properties also provide mechanisms to customize the
+ * behaviour of the file chooser.
+ *
+ * @author Kim Ho (kho@luxsci.net)
*/
public class JFileChooser extends JComponent implements Accessible
{
@@ -415,7 +425,8 @@ public class JFileChooser extends JComponent implements Accessible
*/
public void changeToParentDirectory()
{
- setCurrentDirectory(fsv.getParentDirectory(currentDir));
+ if (fsv.getParentDirectory(currentDir) != null)
+ setCurrentDirectory(fsv.getParentDirectory(currentDir));
}
/**
diff --git a/libjava/classpath/javax/swing/JFormattedTextField.java b/libjava/classpath/javax/swing/JFormattedTextField.java
index f8230f6..9890df2 100644
--- a/libjava/classpath/javax/swing/JFormattedTextField.java
+++ b/libjava/classpath/javax/swing/JFormattedTextField.java
@@ -51,13 +51,29 @@ import javax.swing.text.DocumentFilter;
import javax.swing.text.NavigationFilter;
/**
+ * A text field that makes use of a formatter to display and edit a specific
+ * type of data. The value that is displayed can be an arbitrary object. The
+ * formatter is responsible for displaying the value in a textual form and
+ * it may allow editing of the value.
+ *
+ * Formatters are usually obtained using an instance of
+ * {@link AbstractFormatterFactory}. This factory is responsible for providing
+ * an instance of {@link AbstractFormatter} that is able to handle the
+ * formatting of the value of the JFormattedTextField.
+ *
* @author Michael Koch
+ *
* @since 1.4
*/
public class JFormattedTextField extends JTextField
{
private static final long serialVersionUID = 5464657870110180632L;
+ /**
+ * An abstract base implementation for a formatter that can be used by
+ * a JTextField. A formatter can display a specific type of object and
+ * may provide a way to edit this value.
+ */
public abstract static class AbstractFormatter implements Serializable
{
private static final long serialVersionUID = -5193212041738979680L;
@@ -124,7 +140,11 @@ public class JFormattedTextField extends JTextField
public abstract String valueToString (Object value)
throws ParseException;
}
-
+
+ /**
+ * Delivers instances of an {@link AbstractFormatter} for
+ * a specific value type for a JFormattedTextField.
+ */
public abstract static class AbstractFormatterFactory
{
public AbstractFormatterFactory ()
diff --git a/libjava/classpath/javax/swing/JFrame.java b/libjava/classpath/javax/swing/JFrame.java
index d8b10d5..7081f59 100644
--- a/libjava/classpath/javax/swing/JFrame.java
+++ b/libjava/classpath/javax/swing/JFrame.java
@@ -53,9 +53,15 @@ import java.awt.event.WindowEvent;
import javax.accessibility.AccessibleContext;
/**
- * Unlike JComponent derivatives, JFrame inherits from
- * java.awt.Frame. But also lets a look-and-feel component to its work.
+ * A window that supports window decorations (titlebar and borders).
+ * This is an extension of {@link java.awt.Frame} that provides support
+ * for the Swing architecture. Most importantly it contains a {@link JRootPane}
+ * as it's only top-level child, that manages the content pane, the menu and
+ * a glass pane.
*
+ * Also, unlike <code>java.awt.Frame</code>s, JFrames support the
+ * Swing Pluggable Look &amp; Feel architecture.
+ *
* @author Ronald Veldema (rveldema@cs.vu.nl)
*/
public class JFrame extends Frame
@@ -98,7 +104,7 @@ public class JFrame extends Frame
* @param gc the <code>GraphicsConfiguration</code> that is used for
* the new <code>JFrame</code>
*
- * @see Frame(GraphicsConfiguration)
+ * @see Frame#Frame(GraphicsConfiguration)
*/
public JFrame(GraphicsConfiguration gc)
{
@@ -114,7 +120,7 @@ public class JFrame extends Frame
* @param gc the <code>GraphicsConfiguration</code> that is used for
* the new <code>JFrame</code>
*
- * @see Frame(String, GraphicsConfiguration)
+ * @see Frame#Frame(String, GraphicsConfiguration)
*/
public JFrame(String title, GraphicsConfiguration gc)
{
diff --git a/libjava/classpath/javax/swing/JLabel.java b/libjava/classpath/javax/swing/JLabel.java
index 088f7d6..2e7ad98 100644
--- a/libjava/classpath/javax/swing/JLabel.java
+++ b/libjava/classpath/javax/swing/JLabel.java
@@ -41,17 +41,257 @@ package javax.swing;
import java.awt.Component;
import java.awt.Font;
import java.awt.Image;
+import java.awt.Point;
+import java.awt.Rectangle;
import java.awt.event.KeyEvent;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleExtendedComponent;
+import javax.accessibility.AccessibleText;
import javax.swing.plaf.LabelUI;
+import javax.swing.text.AttributeSet;
+import javax.swing.text.SimpleAttributeSet;
/**
* A swing widget that displays a text message and/or an icon.
*/
public class JLabel extends JComponent implements Accessible, SwingConstants
{
+
+ /**
+ * Accessibility support for JLabel.
+ */
+ protected class AccessibleJLabel
+ extends JComponent.AccessibleJComponent
+ implements AccessibleText, AccessibleExtendedComponent
+ {
+ /**
+ * Returns the selected text. This is an empty string since JLabels
+ * are not selectable.
+ *
+ * @return the selected text
+ */
+ public String getSelectedText()
+ {
+ // We return "" here since JLabel's text is not selectable.
+ return "";
+ }
+
+ /**
+ * Returns the start index of the selected text.
+ *
+ * @return the start index of the selected text
+ */
+ public int getSelectionStart()
+ {
+ // TODO: Figure out what should be returned here, because JLabels don't
+ // allow selection. I guess -1 for now.
+ return -1;
+ }
+
+ /**
+ * Returns the end index of the selected text.
+ *
+ * @return the end index of the selected text
+ */
+ public int getSelectionEnd()
+ {
+ // TODO: Figure out what should be returned here, because JLabels don't
+ // allow selection. I guess -1 for now.
+ return -1;
+ }
+
+ /**
+ * Returns an {@link AttributeSet} that reflects the text attributes of
+ * the specified character. We return an empty
+ * <code>AttributeSet</code> here, because JLabels don't support text
+ * attributes (at least not yet).
+ *
+ * @param index the index of the character
+ *
+ * @return an {@link AttributeSet} that reflects the text attributes of
+ * the specified character
+ */
+ public AttributeSet getCharacterAttribute(int index)
+ {
+ return new SimpleAttributeSet();
+ }
+
+ /**
+ * Returns the character, word or sentence at the specified index. The
+ * <code>part</code> parameter determines what is returned, the character,
+ * word or sentence after the index.
+ *
+ * @param part one of {@link AccessibleText#CHARACTER},
+ * {@link AccessibleText#WORD} or
+ * {@link AccessibleText#SENTENCE}, specifying what is returned
+ * @param index the index
+ *
+ * @return the character, word or sentence after <code>index</code>
+ */
+ public String getAtIndex(int part, int index)
+ {
+ String result = "";
+ int startIndex = -1;
+ int endIndex = -1;
+ switch(part)
+ {
+ case AccessibleText.CHARACTER:
+ result = String.valueOf(text.charAt(index));
+ break;
+ case AccessibleText.WORD:
+ startIndex = text.lastIndexOf(' ', index);
+ endIndex = text.indexOf(' ', startIndex + 1);
+ if (endIndex == -1)
+ endIndex = startIndex + 1;
+ result = text.substring(startIndex + 1, endIndex);
+ break;
+ case AccessibleText.SENTENCE:
+ default:
+ startIndex = text.lastIndexOf('.', index);
+ endIndex = text.indexOf('.', startIndex + 1);
+ if (endIndex == -1)
+ endIndex = startIndex + 1;
+ result = text.substring(startIndex + 1, endIndex);
+ break;
+ }
+ return result;
+ }
+
+ /**
+ * Returns the character, word or sentence after the specified index. The
+ * <code>part</code> parameter determines what is returned, the character,
+ * word or sentence after the index.
+ *
+ * @param part one of {@link AccessibleText#CHARACTER},
+ * {@link AccessibleText#WORD} or
+ * {@link AccessibleText#SENTENCE}, specifying what is returned
+ * @param index the index
+ *
+ * @return the character, word or sentence after <code>index</code>
+ */
+ public String getAfterIndex(int part, int index)
+ {
+ String result = "";
+ int startIndex = -1;
+ int endIndex = -1;
+ switch(part)
+ {
+ case AccessibleText.CHARACTER:
+ result = String.valueOf(text.charAt(index + 1));
+ break;
+ case AccessibleText.WORD:
+ startIndex = text.indexOf(' ', index);
+ endIndex = text.indexOf(' ', startIndex + 1);
+ if (endIndex == -1)
+ endIndex = startIndex + 1;
+ result = text.substring(startIndex + 1, endIndex);
+ break;
+ case AccessibleText.SENTENCE:
+ default:
+ startIndex = text.indexOf('.', index);
+ endIndex = text.indexOf('.', startIndex + 1);
+ if (endIndex == -1)
+ endIndex = startIndex + 1;
+ result = text.substring(startIndex + 1, endIndex);
+ break;
+ }
+ return result;
+ }
+
+ /**
+ * Returns the character, word or sentence before the specified index. The
+ * <code>part</code> parameter determines what is returned, the character,
+ * word or sentence before the index.
+ *
+ * @param part one of {@link AccessibleText#CHARACTER},
+ * {@link AccessibleText#WORD} or
+ * {@link AccessibleText#SENTENCE}, specifying what is returned
+ * @param index the index
+ *
+ * @return the character, word or sentence before <code>index</code>
+ */
+ public String getBeforeIndex(int part, int index)
+ {
+ String result = "";
+ int startIndex = -1;
+ int endIndex = -1;
+ switch(part)
+ {
+ case AccessibleText.CHARACTER:
+ result = String.valueOf(text.charAt(index - 1));
+ break;
+ case AccessibleText.WORD:
+ endIndex = text.lastIndexOf(' ', index);
+ if (endIndex == -1)
+ endIndex = 0;
+ startIndex = text.lastIndexOf(' ', endIndex - 1);
+ result = text.substring(startIndex + 1, endIndex);
+ break;
+ case AccessibleText.SENTENCE:
+ default:
+ endIndex = text.lastIndexOf('.', index);
+ if (endIndex == -1)
+ endIndex = 0;
+ startIndex = text.lastIndexOf('.', endIndex - 1);
+ result = text.substring(startIndex + 1, endIndex);
+ break;
+ }
+ return result;
+ }
+
+ /**
+ * Returns the caret position. This method returns -1 because JLabel don't
+ * have a caret.
+ *
+ * @return the caret position
+ */
+ public int getCaretPosition()
+ {
+ return -1;
+ }
+
+ /**
+ * Returns the number of characters that are displayed by the JLabel.
+ *
+ * @return the number of characters that are displayed by the JLabel
+ */
+ public int getCharCount()
+ {
+ return text.length();
+ }
+
+ /**
+ * Returns the bounding box of the character at the specified index.
+ *
+ * @param index the index of the character that we return the
+ * bounds for
+ *
+ * @return the bounding box of the character at the specified index
+ */
+ public Rectangle getCharacterBounds(int index)
+ {
+ // FIXME: Implement this correctly.
+ return new Rectangle();
+ }
+
+ /**
+ * Returns the index of the character that is located at the specified
+ * point.
+ *
+ * @param point the location that we lookup the character for
+ *
+ * @return the index of the character that is located at the specified
+ * point
+ */
+ public int getIndexAtPoint(Point point)
+ {
+ // FIXME: Implement this correctly.
+ return 0;
+ }
+ }
+
/** DOCUMENT ME! */
private static final long serialVersionUID = 5496508283662221534L;
@@ -62,7 +302,7 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
protected Component labelFor;
/** The label's text. */
- private transient String text;
+ transient String text;
/** Where the label will be positioned horizontally. */
private transient int horizontalAlignment = LEADING;
@@ -91,6 +331,9 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
/** The gap between the icon and the text. */
private transient int iconTextGap = 4;
+ /** The accessible context for this JLabel. */
+ private AccessibleJLabel accessibleContext;
+
/**
* Creates a new vertically centered, horizontally on the leading edge
* JLabel object with text and no icon.
@@ -638,10 +881,12 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
/**
* DOCUMENT ME!
*
- * @return
+ * @return The accessible context.
*/
public AccessibleContext getAccessibleContext()
{
- return null;
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJLabel();
+ return accessibleContext;
}
}
diff --git a/libjava/classpath/javax/swing/JLayeredPane.java b/libjava/classpath/javax/swing/JLayeredPane.java
index c9a4fd4..1ea39dc 100644
--- a/libjava/classpath/javax/swing/JLayeredPane.java
+++ b/libjava/classpath/javax/swing/JLayeredPane.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package javax.swing;
import java.awt.Component;
+import java.awt.Container;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
@@ -47,21 +48,43 @@ import java.util.TreeMap;
import javax.accessibility.Accessible;
/**
- * <p>The "Layered Pane" is a container which divides its children into 6 (or
- * more) disjoint sets. the pre-defined sets are:</p>
+ * A container that adds depth to the usual <code>Container</code> semantics.
+ * Each child component of a <code>Layered Pane</code> is placed within one
+ * of several layers. <code>JLayeredPane</code> defines a set of standard
+ * layers. The pre-defined sets are (in the order from button to top):
*
- * <ul>
- * <li>"Frame Content"</li>
- * <li>"Default"</li>
- * <li>"Palette"</li>
- * <li>"Modal"</li>
- * <li>"Popup"</li>
- * <li>"Drag"</li>
- * </ul>
+ * <dl>
+ * <dt>{@link #DEFAULT_LAYER}</dt>
+ * <dd>The layer where most of the normal components are placed. This
+ * is the bottommost layer.</dd>
+ *
+ * <dt>{@link #PALETTE_LAYER}</dt>
+ * <dd>Palette windows are placed in this layer.</dd>
+ *
+ * <dt>{@link #MODAL_LAYER}</dt>
+ * <dd>The layer where internal modal dialog windows are placed.</dd>
+ *
+ * <dt>{@link #POPUP_LAYER}</dt>
+ * <dd>The layer for popup menus</dd>
+ *
+ * <dt>{@link #DRAG_LAYER}</dt>
+ * <dd>Components that are beeing dragged are temporarily placed in
+ * this layer.</dd>
+ * </dl>
*
* <p>A child is in exactly one of these layers at any time, though there may
* be other layers if someone creates them.</p>
*
+ * <p>You can add a component to a specific layer using the
+ * {@link Container#add(Component, Object)} method. I.e.
+ * <code>layeredPane.add(comp, JLayeredPane.MODAL_LAYER)</code> will add the
+ * component <code>comp</code> to the modal layer of <code>layeredPane</code>.
+ * </p>
+ *
+ * <p>To change the layer of a component that is already a child of
+ * a <code>JLayeredPane</code>, use the {@link #setLayer(Component, int)}
+ * method.</p>
+ *
* <p>The purpose of this class is to translate this view of "layers" into a
* contiguous array of components: the one held in our ancestor,
* {@link java.awt.Container}.</p>
@@ -283,7 +306,7 @@ public class JLayeredPane extends JComponent implements Accessible
* @param c the component to move to the front of its layer.
* @throws IllegalArgumentException if the component is not a child of
* this container.
- * @see #moveToBack()
+ * @see #moveToBack
*/
public void moveToFront(Component c)
{
@@ -302,7 +325,7 @@ public class JLayeredPane extends JComponent implements Accessible
* @param c the component to move to the back of its layer.
* @throws IllegalArgumentException if the component is not a child of
* this container.
- * @see #moveToFront()
+ * @see #moveToFront
*/
public void moveToBack(Component c)
{
@@ -317,7 +340,7 @@ public class JLayeredPane extends JComponent implements Accessible
* @param c the component to get the position of.
* @throws IllegalArgumentException if the component is not a child of
* this container.
- * @see #setPosition()
+ * @see #setPosition
*/
public int getPosition(Component c)
{
@@ -344,7 +367,7 @@ public class JLayeredPane extends JComponent implements Accessible
* @param position the position to assign the component to.
* @throws IllegalArgumentException if the component is not a child of
* this container.
- * @see #getPosition()
+ * @see #getPosition
*/
public void setPosition(Component c, int position)
{
diff --git a/libjava/classpath/javax/swing/JList.java b/libjava/classpath/javax/swing/JList.java
index fb8d18b..92fe1cc 100644
--- a/libjava/classpath/javax/swing/JList.java
+++ b/libjava/classpath/javax/swing/JList.java
@@ -574,7 +574,7 @@ public class JList extends JComponent implements Accessible, Scrollable
ComponentOrientation or = getComponentOrientation();
Rectangle r = getVisibleRect();
if (or == ComponentOrientation.RIGHT_TO_LEFT)
- r.translate((int) r.getWidth(), 0);
+ r.translate((int) r.getWidth() - 1, 0);
return getUI().locationToIndex(this, r.getLocation());
}
@@ -596,8 +596,7 @@ public class JList extends JComponent implements Accessible, Scrollable
* @return location of the cell located at the specified index in the list.
*/
public Point indexToLocation(int index){
- //FIXME: Need to implement.
- return null;
+ return getCellBounds(index, index).getLocation();
}
/**
@@ -605,17 +604,20 @@ public class JList extends JComponent implements Accessible, Scrollable
* {@link #visibleRect} property, depending on the {@link
* #componentOrientation} property.
*
- * @return The index of the first visible list cell, or <code>-1</code>
+ * @return The index of the last visible list cell, or <code>-1</code>
* if none is visible.
*/
public int getLastVisibleIndex()
{
ComponentOrientation or = getComponentOrientation();
Rectangle r = getVisibleRect();
- r.translate(0, (int) r.getHeight());
+ r.translate(0, (int) r.getHeight() - 1);
if (or == ComponentOrientation.LEFT_TO_RIGHT)
- r.translate((int) r.getWidth(), 0);
- return getUI().locationToIndex(this, r.getLocation());
+ r.translate((int) r.getWidth() - 1, 0);
+ if (getUI().locationToIndex(this, r.getLocation()) == -1
+ && indexToLocation(getModel().getSize() - 1).y < r.y)
+ return getModel().getSize() - 1;
+ return getUI().locationToIndex(this, r.getLocation());
}
/**
@@ -1030,20 +1032,41 @@ public class JList extends JComponent implements Accessible, Scrollable
*/
public Dimension getPreferredScrollableViewportSize()
{
+ //If the layout orientation is not VERTICAL, then this will
+ //return the value from getPreferredSize. The current ListUI is
+ //expected to override getPreferredSize to return an appropriate value.
+ if (getLayoutOrientation() != VERTICAL)
+ return getPreferredSize();
+
+ if (fixedCellHeight != -1 && fixedCellWidth != -1)
+ return new Dimension(fixedCellWidth, getModel().getSize() *
+ fixedCellHeight);
- Dimension retVal = getPreferredSize();
- if (getLayoutOrientation() == VERTICAL)
+ int prefWidth, prefHeight;
+ if (fixedCellWidth != -1)
+ prefWidth = fixedCellWidth;
+ else
{
- if (fixedCellHeight != -1)
- {
- if (fixedCellWidth != -1)
- {
- int size = getModel().getSize();
- retVal = new Dimension(fixedCellWidth, size * fixedCellHeight);
- } // TODO: add else clause (preferredSize is ok for now)
- } // TODO: add else clause (preferredSize is ok for now)
+ prefWidth = 0;
+ int size = getModel().getSize();
+ for (int i = 0; i < size; i++)
+ if (getCellBounds(i, i).width > prefWidth)
+ prefWidth = getCellBounds(i, i).width;
}
- return retVal;
+
+ if (getModel().getSize() == 0 && fixedCellWidth == -1)
+ return new Dimension(256, 16 * getVisibleRowCount());
+ else if (getModel().getSize() == 0)
+ return new Dimension (fixedCellWidth, 16 * getVisibleRowCount());
+
+ if (fixedCellHeight != -1)
+ prefHeight = fixedCellHeight;
+ else
+ {
+ prefHeight = getVisibleRowCount() * getCellBounds
+ (getFirstVisibleIndex(), getFirstVisibleIndex()).height;
+ }
+ return new Dimension (prefWidth, prefHeight);
}
/**
diff --git a/libjava/classpath/javax/swing/JMenuBar.java b/libjava/classpath/javax/swing/JMenuBar.java
index a464fff..eebb1a0 100644
--- a/libjava/classpath/javax/swing/JMenuBar.java
+++ b/libjava/classpath/javax/swing/JMenuBar.java
@@ -326,7 +326,7 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
* Process key events forwarded from MenuSelectionManager. This method
* doesn't do anything. It is here to conform to the MenuElement interface.
*
- * @param event event forwarded from MenuSelectionManager
+ * @param e event forwarded from MenuSelectionManager
* @param path path to the menu element from which event was generated
* @param manager MenuSelectionManager for the current menu hierarchy
*
diff --git a/libjava/classpath/javax/swing/JOptionPane.java b/libjava/classpath/javax/swing/JOptionPane.java
index 88fa993..ad0772a 100644
--- a/libjava/classpath/javax/swing/JOptionPane.java
+++ b/libjava/classpath/javax/swing/JOptionPane.java
@@ -384,8 +384,8 @@ public class JOptionPane extends JComponent implements Accessible
}
/**
- * This method creates a new JInternalFrame that is in the JDesktopPane
- * which contains the parentComponent given. If no suitable JDesktopPane
+ * This method creates a new JInternalFrame that is in the JLayeredPane
+ * which contains the parentComponent given. If no suitable JLayeredPane
* can be found from the parentComponent given, a RuntimeException will be
* thrown.
*
@@ -395,25 +395,42 @@ public class JOptionPane extends JComponent implements Accessible
* @return A new JInternalFrame based on the JOptionPane configuration.
*
* @throws RuntimeException If no suitable JDesktopPane is found.
+ *
+ * @specnote The specification says that the internal frame is placed
+ * in the nearest <code>JDesktopPane</code> that is found in
+ * <code>parent</code>'s ancestors. The behaviour of the JDK
+ * is that it actually looks up the nearest
+ * <code>JLayeredPane</code> in <code>parent</code>'s ancestors.
+ * So do we.
*/
public JInternalFrame createInternalFrame(Component parentComponent,
String title)
throws RuntimeException
{
- JDesktopPane toUse = getDesktopPaneForComponent(parentComponent);
+ // Try to find a JDesktopPane.
+ JLayeredPane toUse = getDesktopPaneForComponent(parentComponent);
+ // If we don't have a JDesktopPane, we try to find a JLayeredPane.
+ if (toUse == null)
+ toUse = JLayeredPane.getLayeredPaneAbove(parentComponent);
+ // If this still fails, we throw a RuntimeException.
if (toUse == null)
- throw new RuntimeException("parentComponent does not have a valid parent");
+ throw new RuntimeException
+ ("parentComponent does not have a valid parent");
JInternalFrame frame = new JInternalFrame(title);
inputValue = UNINITIALIZED_VALUE;
value = UNINITIALIZED_VALUE;
+ frame.setContentPane(this);
frame.setClosable(true);
+
toUse.add(frame);
+ frame.setLayer(JLayeredPane.MODAL_LAYER);
+
+ frame.pack();
+ frame.setVisible(true);
- // FIXME: JLayeredPane broken? See bug # 16576
- // frame.setLayer(JLayeredPane.MODAL_LAYER);
return frame;
}
@@ -1102,7 +1119,7 @@ public class JOptionPane extends JComponent implements Accessible
JOptionPane pane = new JOptionPane(message);
JInternalFrame frame = pane.createInternalFrame(parentComponent, null);
- startModal(frame, pane);
+ startModal(frame);
return ((Integer) pane.getValue()).intValue();
}
@@ -1127,7 +1144,7 @@ public class JOptionPane extends JComponent implements Accessible
JOptionPane pane = new JOptionPane(message, PLAIN_MESSAGE, optionType);
JInternalFrame frame = pane.createInternalFrame(parentComponent, title);
- startModal(frame, pane);
+ startModal(frame);
return ((Integer) pane.getValue()).intValue();
}
@@ -1153,7 +1170,7 @@ public class JOptionPane extends JComponent implements Accessible
JOptionPane pane = new JOptionPane(message, messageType, optionType);
JInternalFrame frame = pane.createInternalFrame(parentComponent, title);
- startModal(frame, pane);
+ startModal(frame);
return ((Integer) pane.getValue()).intValue();
}
@@ -1181,7 +1198,7 @@ public class JOptionPane extends JComponent implements Accessible
JOptionPane pane = new JOptionPane(message, messageType, optionType, icon);
JInternalFrame frame = pane.createInternalFrame(parentComponent, title);
- startModal(frame, pane);
+ startModal(frame);
return ((Integer) pane.getValue()).intValue();
}
@@ -1204,7 +1221,7 @@ public class JOptionPane extends JComponent implements Accessible
pane.setWantsInput(true);
JInternalFrame frame = pane.createInternalFrame(parentComponent, null);
- startModal(frame, pane);
+ startModal(frame);
return (String) pane.getInputValue();
}
@@ -1230,7 +1247,7 @@ public class JOptionPane extends JComponent implements Accessible
pane.setWantsInput(true);
JInternalFrame frame = pane.createInternalFrame(parentComponent, title);
- startModal(frame, pane);
+ startModal(frame);
return (String) pane.getInputValue();
}
@@ -1265,7 +1282,7 @@ public class JOptionPane extends JComponent implements Accessible
pane.setInitialSelectionValue(initialSelectionValue);
JInternalFrame frame = pane.createInternalFrame(parentComponent, title);
- startModal(frame, pane);
+ startModal(frame);
return (String) pane.getInputValue();
}
@@ -1284,7 +1301,7 @@ public class JOptionPane extends JComponent implements Accessible
JOptionPane pane = new JOptionPane(message);
JInternalFrame frame = pane.createInternalFrame(parentComponent, null);
- startModal(frame, pane);
+ startModal(frame);
}
/**
@@ -1304,7 +1321,7 @@ public class JOptionPane extends JComponent implements Accessible
JOptionPane pane = new JOptionPane(message, messageType);
JInternalFrame frame = pane.createInternalFrame(parentComponent, title);
- startModal(frame, pane);
+ startModal(frame);
}
/**
@@ -1326,7 +1343,7 @@ public class JOptionPane extends JComponent implements Accessible
pane.setIcon(icon);
JInternalFrame frame = pane.createInternalFrame(parentComponent, title);
- startModal(frame, pane);
+ startModal(frame);
}
/**
@@ -1358,7 +1375,7 @@ public class JOptionPane extends JComponent implements Accessible
JInternalFrame frame = pane.createInternalFrame(parentComponent, title);
- startModal(frame, pane);
+ startModal(frame);
return ((Integer) pane.getValue()).intValue();
}
@@ -1509,15 +1526,8 @@ public class JOptionPane extends JComponent implements Accessible
* @param f The JInternalFrame to make modal.
* @param pane The JOptionPane to add to the JInternalFrame.
*/
- private static void startModal(JInternalFrame f, JOptionPane pane)
+ private static void startModal(JInternalFrame f)
{
- f.getContentPane().add(pane);
- f.pack();
- f.show();
-
- Dimension pref = f.getPreferredSize();
- f.setBounds(0, 0, pref.width, pref.height);
-
synchronized (f)
{
final JInternalFrame tmp = f;
diff --git a/libjava/classpath/javax/swing/JPasswordField.java b/libjava/classpath/javax/swing/JPasswordField.java
index f9df102..151d248 100644
--- a/libjava/classpath/javax/swing/JPasswordField.java
+++ b/libjava/classpath/javax/swing/JPasswordField.java
@@ -50,6 +50,7 @@ import javax.swing.text.Document;
* class JPasswordField
*
* @author Andrew Selkirk
+ * @author Lillian Angel
* @version 1.0
*/
public class JPasswordField extends JTextField
@@ -178,14 +179,15 @@ public class JPasswordField extends JTextField
}
/**
- * echoCharIsSet
+ * Returns true if this JPasswordField has a character set for echoing.
+ * A character is considered to be set if the echo character is not 0.
*
* @return <code>true</code> if the echo char is set,
* <code>false</code> otherwise.
*/
public boolean echoCharIsSet()
{
- return echoChar == 0;
+ return echoChar != 0;
}
/**
@@ -207,7 +209,8 @@ public class JPasswordField extends JTextField
}
/**
- * getText
+ * Returns the text contained in this TextComponent. If the
+ * underlying document is null, will give a NullPointerException.
*
* @return String
*
@@ -215,11 +218,21 @@ public class JPasswordField extends JTextField
*/
public String getText()
{
- return null; // TODO
+ try
+ {
+ return getDocument().getText(0, getDocument().getLength());
+ }
+ catch (BadLocationException ble)
+ {
+ // This should never happen.
+ throw new AssertionError(ble);
+ }
}
/**
- * getText
+ * Fetches a portion of the text represented by the component.
+ * Returns an empty string if length is 0. If the
+ * underlying document is null, will give a NullPointerException.
*
* @param offset TODO
* @param length TODO
@@ -232,27 +245,40 @@ public class JPasswordField extends JTextField
*/
public String getText(int offset, int length) throws BadLocationException
{
- return null; // TODO
+ return getDocument().getText(offset, length);
}
/**
- * getPassword
+ * Returns the text contained in this TextComponent. If the underlying
+ * document is null, will give a NullPointerException.
+ * For stronger security, it is recommended that the returned character
+ * array be cleared after use by setting each character to zero.
*
* @return char[]
*/
public char[] getPassword()
{
- return new char[0]; // TODO
+ return getText().toCharArray();
}
/**
- * paramString
+ * Returns a string representation of this JPasswordField. This method is
+ * intended to be used only for debugging purposes,
+ * and the content and format of the returned string may vary between
+ * implementations. The returned string may be empty but may not be null.
*
* @return String
*/
protected String paramString()
{
- return null; // TODO
+ try
+ {
+ return getText();
+ }
+ catch (NullPointerException npe)
+ {
+ return "";
+ }
}
/**
diff --git a/libjava/classpath/javax/swing/JPopupMenu.java b/libjava/classpath/javax/swing/JPopupMenu.java
index a0a7359..c4ee5fe 100644
--- a/libjava/classpath/javax/swing/JPopupMenu.java
+++ b/libjava/classpath/javax/swing/JPopupMenu.java
@@ -232,6 +232,7 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
constraints.gridy = i;
super.add(items[i], constraints, i);
}
+ this.setSize(this.getPreferredSize());
}
/**
@@ -276,6 +277,7 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
super.add(items[i], constraints, i);
}
}
+ this.setSize(this.getPreferredSize());
}
/**
@@ -908,13 +910,13 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
*/
private class LightWeightPopup extends Container implements Popup
{
+ private Component c;
+
/**
* Creates a new LightWeightPopup menu
*
* @param c Container containing menu items
*/
- private Component c;
-
public LightWeightPopup(Container c)
{
this.c = c;
diff --git a/libjava/classpath/javax/swing/JScrollBar.java b/libjava/classpath/javax/swing/JScrollBar.java
index caed92c..a2cc76c 100644
--- a/libjava/classpath/javax/swing/JScrollBar.java
+++ b/libjava/classpath/javax/swing/JScrollBar.java
@@ -69,8 +69,6 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
/**
* Creates a new AccessibleJSlider object.
- *
- * @param value0 DOCUMENT ME!
*/
protected AccessibleJScrollBar()
{
diff --git a/libjava/classpath/javax/swing/JScrollPane.java b/libjava/classpath/javax/swing/JScrollPane.java
index 377f05a..e83513f 100644
--- a/libjava/classpath/javax/swing/JScrollPane.java
+++ b/libjava/classpath/javax/swing/JScrollPane.java
@@ -571,8 +571,6 @@ public class JScrollPane
* Creates a new <code>JScrollPane</code> without a view. The scrollbar
* policy is set to {@link #VERTICAL_SCROLLBAR_AS_NEEDED} and
* {@link #HORIZONTAL_SCROLLBAR_AS_NEEDED}.
- *
- * @param view the component that is embedded inside the JScrollPane
*/
public JScrollPane()
{
@@ -600,12 +598,12 @@ public class JScrollPane
* @param vsbPolicy the vertical scrollbar policy to set
* @param hsbPolicy the vertical scrollbar policy to set
*
- * @see {@link ScrollPaneConstants#HORIZONTAL_SCROLLBAR_ALWAYS}
- * @see {@link ScrollPaneConstants#HORIZONTAL_SCROLLBAR_AS_NEEDED}
- * @see {@link ScrollPaneConstants#HORIZONTAL_SCROLLBAR_NEVER}
- * @see {@link ScrollPaneConstants#VERTICAL_SCROLLBAR_ALWAYS}
- * @see {@link ScrollPaneConstants#VERTICAL_SCROLLBAR_AS_NEEDED}
- * @see {@link ScrollPaneConstants#VERTICAL_SCROLLBAR_NEVER}
+ * @see ScrollPaneConstants#HORIZONTAL_SCROLLBAR_ALWAYS
+ * @see ScrollPaneConstants#HORIZONTAL_SCROLLBAR_AS_NEEDED
+ * @see ScrollPaneConstants#HORIZONTAL_SCROLLBAR_NEVER
+ * @see ScrollPaneConstants#VERTICAL_SCROLLBAR_ALWAYS
+ * @see ScrollPaneConstants#VERTICAL_SCROLLBAR_AS_NEEDED
+ * @see ScrollPaneConstants#VERTICAL_SCROLLBAR_NEVER
*/
public JScrollPane(int vsbPolicy, int hsbPolicy)
{
@@ -620,12 +618,12 @@ public class JScrollPane
* @param vsbPolicy the vertical scrollbar policy to set
* @param hsbPolicy the vertical scrollbar policy to set
*
- * @see {@link ScrollPaneConstants#HORIZONTAL_SCROLLBAR_ALWAYS}
- * @see {@link ScrollPaneConstants#HORIZONTAL_SCROLLBAR_AS_NEEDED}
- * @see {@link ScrollPaneConstants#HORIZONTAL_SCROLLBAR_NEVER}
- * @see {@link ScrollPaneConstants#VERTICAL_SCROLLBAR_ALWAYS}
- * @see {@link ScrollPaneConstants#VERTICAL_SCROLLBAR_AS_NEEDED}
- * @see {@link ScrollPaneConstants#VERTICAL_SCROLLBAR_NEVER}
+ * @see ScrollPaneConstants#HORIZONTAL_SCROLLBAR_ALWAYS
+ * @see ScrollPaneConstants#HORIZONTAL_SCROLLBAR_AS_NEEDED
+ * @see ScrollPaneConstants#HORIZONTAL_SCROLLBAR_NEVER
+ * @see ScrollPaneConstants#VERTICAL_SCROLLBAR_ALWAYS
+ * @see ScrollPaneConstants#VERTICAL_SCROLLBAR_AS_NEEDED
+ * @see ScrollPaneConstants#VERTICAL_SCROLLBAR_NEVER
*/
public JScrollPane(Component view, int vsbPolicy, int hsbPolicy)
{
diff --git a/libjava/classpath/javax/swing/JSeparator.java b/libjava/classpath/javax/swing/JSeparator.java
index 064c465..6a3b97d 100644
--- a/libjava/classpath/javax/swing/JSeparator.java
+++ b/libjava/classpath/javax/swing/JSeparator.java
@@ -59,8 +59,6 @@ public class JSeparator extends JComponent implements SwingConstants,
/**
* Constructor AccessibleJSeparator
- *
- * @param component TODO
*/
protected AccessibleJSeparator()
{
diff --git a/libjava/classpath/javax/swing/JSlider.java b/libjava/classpath/javax/swing/JSlider.java
index 7f99511..2caf509 100644
--- a/libjava/classpath/javax/swing/JSlider.java
+++ b/libjava/classpath/javax/swing/JSlider.java
@@ -41,6 +41,7 @@ package javax.swing;
import java.awt.Dimension;
import java.awt.MenuContainer;
import java.awt.image.ImageObserver;
+import java.beans.PropertyChangeEvent;
import java.io.Serializable;
import java.util.Dictionary;
import java.util.Enumeration;
@@ -124,8 +125,6 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
/**
* Creates a new AccessibleJSlider object.
- *
- * @param value0 DOCUMENT ME!
*/
protected AccessibleJSlider()
{
@@ -229,7 +228,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
protected int minorTickSpacing;
/** Whether the slider snaps its values to ticks. */
- protected boolean snapToTicks = true;
+ protected boolean snapToTicks = false;
/** The orientation of the slider. */
protected int orientation = HORIZONTAL;
@@ -256,7 +255,11 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
* Creates a new JSlider object with the given orientation and a minimum of
* 0, a maximum of 100, and a value of 50.
*
- * @param orientation The orientation of the slider.
+ * @param orientation The orientation of the slider ({@link #HORIZONTAL} or
+ * {@link #VERTICAL}).
+ *
+ * @throws IllegalArgumentException if <code>orientation</code> is not one of
+ * the specified values.
*/
public JSlider(int orientation)
{
@@ -293,10 +296,14 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
* Creates a new JSlider object with the given orientation, minimum,
* maximum, and value.
*
- * @param orientation The orientation of the JSlider.
+ * @param orientation The orientation of the slider ({@link #HORIZONTAL} or
+ * {@link #VERTICAL}).
* @param minimum The minimum value of the JSlider.
* @param maximum The maximum value of the JSlider.
* @param value The initial value of the JSlider.
+ *
+ * @throws IllegalArgumentException if <code>orientation</code> is not one of
+ * the specified values.
*/
public JSlider(int orientation, int minimum, int maximum, int value)
{
@@ -312,14 +319,13 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
/**
* Creates a new horizontal JSlider object with the given model.
*
- * @param model The model the slider will be created with.
+ * @param model The model (<code>null</code> not permitted).
+ *
+ * @throws NullPointerException if <code>model</code> is <code>null</code>.
*/
public JSlider(BoundedRangeModel model)
{
- if (model == null)
- sliderModel = new DefaultBoundedRangeModel(50, 0, 0, 100);
- else
- sliderModel = model;
+ sliderModel = model;
changeListener = createChangeListener();
sliderModel.addChangeListener(changeListener);
updateUI();
@@ -504,7 +510,10 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
*/
public void setMinimum(int minimum)
{
+ int old = sliderModel.getMinimum();
sliderModel.setMinimum(minimum);
+ if (minimum != old)
+ firePropertyChange("minimum", old, minimum);
}
/**
@@ -524,7 +533,10 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
*/
public void setMaximum(int maximum)
{
+ int old = sliderModel.getMaximum();
sliderModel.setMaximum(maximum);
+ if (maximum != old)
+ firePropertyChange("maximum", old, maximum);
}
/**
@@ -643,9 +655,12 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
* minimum and increase by the increment. Each label will have a text
* string indicating their integer value.
*
- * @param increment The increment to between labels.
+ * @param increment The increment between labels (must be > 0).
*
* @return A hashtable with the labels and their keys.
+ *
+ * @throws IllegalArgumentException if <code>increment</code> is not greater
+ * than zero.
*/
public Hashtable createStandardLabels(int increment)
{
@@ -656,15 +671,23 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
* Creates a hashtable of (Integer, JLabel) pairs that can be used as a
* label table for this slider. The labels will start from the given start
* value and increase by the increment. Each label will have a text string
- * indicating their integer value.
+ * indicating its integer value.
*
- * @param increment The increment to between labels.
+ * @param increment The increment between labels (must be > 0).
* @param start The value to start from.
*
* @return A hashtable with the labels and their keys.
+ *
+ * @throws IllegalArgumentException if <code>increment</code> is not greater
+ * than zero, or <code>start</code> is not within the range of the
+ * model.
*/
public Hashtable createStandardLabels(int increment, int start)
{
+ if (increment <= 0)
+ throw new IllegalArgumentException("Requires 'increment' > 0.");
+ if (start < getMinimum() || start > getMaximum())
+ throw new IllegalArgumentException("The 'start' value is out of range.");
Hashtable table = new Hashtable();
JLabel label;
Dimension dim;
@@ -801,7 +824,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
if (snap != snapToTicks)
{
snapToTicks = snap;
- fireStateChanged();
+ firePropertyChange("snapToTicks", !snap, snap);
}
}
@@ -847,13 +870,19 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method sets whether the track will be painted.
+ * Sets the flag that controls whether or not the track is painted, and
+ * sends a {@link PropertyChangeEvent} (for the "paintTrack" property) to all
+ * registered listeners.
*
* @param paint Whether the track will be painted.
*/
public void setPaintTrack(boolean paint)
{
- paintTrack = paint;
+ if (paintTrack != paint)
+ {
+ paintTrack = paint;
+ firePropertyChange("paintTrack", !paint, paint);
+ }
}
/**
@@ -875,9 +904,10 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
{
if (paint != paintLabels)
{
- boolean oldPaintLabels = paintLabels;
paintLabels = paint;
- firePropertyChange("paintLabels", oldPaintLabels, paintLabels);
+ if (paint && majorTickSpacing > 0)
+ labelTable = createStandardLabels(majorTickSpacing);
+ firePropertyChange("paintLabels", !paint, paint);
}
}
diff --git a/libjava/classpath/javax/swing/JSpinner.java b/libjava/classpath/javax/swing/JSpinner.java
index 96fe10f..fc2b13e 100644
--- a/libjava/classpath/javax/swing/JSpinner.java
+++ b/libjava/classpath/javax/swing/JSpinner.java
@@ -49,7 +49,6 @@ import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
-import javax.swing.border.EtchedBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.SpinnerUI;
@@ -297,7 +296,7 @@ public class JSpinner extends JComponent
* create a <code>DateEditor</code> instance
* @param dateFormatPattern the date format to use
*
- * @see SimpleDateFormat(String)
+ * @see SimpleDateFormat#SimpleDateFormat(String)
*/
public DateEditor(JSpinner spinner, String dateFormatPattern)
{
diff --git a/libjava/classpath/javax/swing/JSplitPane.java b/libjava/classpath/javax/swing/JSplitPane.java
index d7abce9..cea5afe 100644
--- a/libjava/classpath/javax/swing/JSplitPane.java
+++ b/libjava/classpath/javax/swing/JSplitPane.java
@@ -66,8 +66,6 @@ public class JSplitPane extends JComponent implements Accessible
/**
* Creates a new AccessibleJSplitPane object.
- *
- * @param value0 DOCUMENT ME!
*/
protected AccessibleJSplitPane()
{
diff --git a/libjava/classpath/javax/swing/JTable.java b/libjava/classpath/javax/swing/JTable.java
index 505a460..21680d5 100644
--- a/libjava/classpath/javax/swing/JTable.java
+++ b/libjava/classpath/javax/swing/JTable.java
@@ -43,9 +43,14 @@ import java.awt.Component;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.util.Date;
+import java.util.EventObject;
import java.util.Hashtable;
import java.util.Vector;
@@ -69,6 +74,7 @@ import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel;
+import javax.swing.text.Caret;
public class JTable extends JComponent
implements TableModelListener, Scrollable, TableColumnModelListener,
@@ -351,6 +357,7 @@ public class JTable extends JComponent
*/
protected transient Component editorComp;
+
/**
* Whether or not the table should automatically compute a matching
* {@link TableColumnModel} and assign it to the {@link #columnModel}
@@ -555,7 +562,27 @@ public class JTable extends JComponent
*/
protected JTableHeader tableHeader;
-
+ /**
+ * The row of the cell being edited.
+ */
+ int rowBeingEdited = -1;
+
+ /**
+ * The column of the cell being edited.
+ */
+ int columnBeingEdited = -1;
+
+ /**
+ * The action listener for the editor's Timer.
+ */
+ Timer editorTimer = new EditorUpdateTimer();
+
+ /**
+ * Stores the old value of a cell before it was edited, in case
+ * editing is cancelled
+ */
+ Object oldCellValue;
+
/**
* Creates a new <code>JTable</code> instance.
*/
@@ -618,9 +645,14 @@ public class JTable extends JComponent
{
setModel(dm == null ? createDefaultDataModel() : dm);
setSelectionModel(sm == null ? createDefaultSelectionModel() : sm);
-
+
this.columnModel = cm;
initializeLocalVars();
+ // The next two lines are for compliance with the JDK which starts
+ // the JLists associated with a JTable with both lead selection
+ // indices at 0, rather than -1 as in regular JLists
+ selectionModel.setLeadSelectionIndex(0);
+ columnModel.getSelectionModel().setLeadSelectionIndex(0);
updateUI();
}
@@ -641,7 +673,7 @@ public class JTable extends JComponent
this.defaultEditorsByColumnClass = new Hashtable();
createDefaultEditors();
- this.autoResizeMode = AUTO_RESIZE_ALL_COLUMNS;
+ this.autoResizeMode = AUTO_RESIZE_SUBSEQUENT_COLUMNS;
this.rowHeight = 16;
this.rowMargin = 1;
this.rowSelectionAllowed = true;
@@ -668,6 +700,51 @@ public class JTable extends JComponent
this(new DefaultTableModel(data, columnNames));
}
+ /**
+ * The timer that updates the editor component.
+ */
+ private class EditorUpdateTimer
+ extends Timer
+ implements ActionListener
+ {
+ /**
+ * Creates a new EditorUpdateTimer object with a default delay of 0.5 seconds.
+ */
+ public EditorUpdateTimer()
+ {
+ super(500, null);
+ addActionListener(this);
+ }
+
+ /**
+ * Lets the caret blink and repaints the table.
+ */
+ public void actionPerformed(ActionEvent ev)
+ {
+ Caret c = ((JTextField)JTable.this.editorComp).getCaret();
+ if (c != null)
+ c.setVisible(!c.isVisible());
+ JTable.this.repaint();
+ }
+
+ /**
+ * Updates the blink delay according to the current caret.
+ */
+ public void update()
+ {
+ stop();
+ Caret c = ((JTextField)JTable.this.editorComp).getCaret();
+ if (c != null)
+ {
+ setDelay(c.getBlinkRate());
+ if (((JTextField)JTable.this.editorComp).isEditable())
+ start();
+ else
+ c.setVisible(false);
+ }
+ }
+ }
+
public void addColumn(TableColumn column)
{
if (column.getHeaderValue() == null)
@@ -769,11 +846,40 @@ public class JTable extends JComponent
public void editingCanceled (ChangeEvent event)
{
+ if (rowBeingEdited > -1 && columnBeingEdited > -1)
+ {
+ if (getValueAt(rowBeingEdited, columnBeingEdited) instanceof JTextField)
+ {
+ remove ((Component)getValueAt(rowBeingEdited, columnBeingEdited));
+ setValueAt(oldCellValue, rowBeingEdited, columnBeingEdited);
+ }
+ rowBeingEdited = -1;
+ columnBeingEdited = -1;
+ }
+ editorTimer.stop();
+ editorComp = null;
+ cellEditor = null;
+ requestFocusInWindow(false);
repaint();
}
public void editingStopped (ChangeEvent event)
{
+ if (rowBeingEdited > -1 && columnBeingEdited > -1)
+ {
+ if (getValueAt(rowBeingEdited, columnBeingEdited) instanceof JTextField)
+ {
+ remove((Component)getValueAt(rowBeingEdited, columnBeingEdited));
+ setValueAt(((JTextField)editorComp).getText(),
+ rowBeingEdited, columnBeingEdited);
+ }
+ rowBeingEdited = -1;
+ columnBeingEdited = -1;
+ }
+ editorTimer.stop();
+ editorComp = null;
+ cellEditor = null;
+ requestFocusInWindow(false);
repaint();
}
@@ -804,20 +910,23 @@ public class JTable extends JComponent
*/
public int columnAtPoint(Point point)
{
- int x0 = getLocation().x;
- int ncols = getColumnCount();
- Dimension gap = getIntercellSpacing();
- TableColumnModel cols = getColumnModel();
- int x = point.x;
-
- for (int i = 0; i < ncols; ++i)
+ if (point != null)
{
- int width = cols.getColumn(i).getWidth() + (gap == null ? 0 : gap.width);
- if (0 <= x && x < width)
- return i;
- x -= width;
+ int x0 = getLocation().x;
+ int ncols = getColumnCount();
+ Dimension gap = getIntercellSpacing();
+ TableColumnModel cols = getColumnModel();
+ int x = point.x;
+
+ for (int i = 0; i < ncols; ++i)
+ {
+ int width = cols.getColumn(i).getWidth()
+ + (gap == null ? 0 : gap.width);
+ if (0 <= x && x < width)
+ return i;
+ x -= width;
+ }
}
-
return -1;
}
@@ -831,19 +940,21 @@ public class JTable extends JComponent
*/
public int rowAtPoint(Point point)
{
- int y0 = getLocation().y;
- int nrows = getRowCount();
- Dimension gap = getIntercellSpacing();
- int height = getRowHeight() + (gap == null ? 0 : gap.height);
- int y = point.y;
-
- for (int i = 0; i < nrows; ++i)
+ if (point != null)
{
- if (0 <= y && y < height)
- return i;
- y -= height;
+ int y0 = getLocation().y;
+ int nrows = getRowCount();
+ Dimension gap = getIntercellSpacing();
+ int height = getRowHeight() + (gap == null ? 0 : gap.height);
+ int y = point.y;
+
+ for (int i = 0; i < nrows; ++i)
+ {
+ if (0 <= y && y < height)
+ return i;
+ y -= height;
+ }
}
-
return -1;
}
@@ -867,7 +978,7 @@ public class JTable extends JComponent
int column,
boolean includeSpacing)
{
- int height = getHeight();
+ int height = getRowHeight(row);
int width = columnModel.getColumn(column).getWidth();
int x_gap = columnModel.getColumnMargin();
int y_gap = rowMargin;
@@ -975,7 +1086,7 @@ public class JTable extends JComponent
if (editor == null)
editor = getDefaultEditor(dataModel.getColumnClass(column));
-
+
return editor;
}
@@ -1095,6 +1206,19 @@ public class JTable extends JComponent
}
/**
+ * Get the height of the specified row.
+ *
+ * @param row the row whose height to return
+ */
+ public int getRowHeight(int row)
+ {
+ // FIXME: return the height of the specified row
+ // which may be different from the general rowHeight
+ return rowHeight;
+ }
+
+
+ /**
* Get the value of the {@link #rowMargin} property.
*
* @return The current value of the property
@@ -1457,14 +1581,27 @@ public class JTable extends JComponent
*/
public void setRowHeight(int r)
{
- if (rowHeight < 1)
+ if (r < 1)
throw new IllegalArgumentException();
rowHeight = r;
revalidate();
repaint();
}
-
+
+ /**
+ * Sets the value of the rowHeight property for the specified
+ * row.
+ *
+ * @param rh is the new rowHeight
+ * @param row is the row to change the rowHeight of
+ */
+ public void setRowHeight(int row, int rh)
+ {
+ setRowHeight(rh);
+ // FIXME: not implemented
+ }
+
/**
* Set the value of the {@link #rowMargin} property.
*
@@ -2065,8 +2202,17 @@ public class JTable extends JComponent
public void selectAll()
{
+ // rowLead and colLead store the current lead selection indices
+ int rowLead = selectionModel.getLeadSelectionIndex();
+ int colLead = getColumnModel().getSelectionModel().getLeadSelectionIndex();
+ // the following calls to setSelectionInterval change the lead selection
+ // indices
setColumnSelectionInterval(0, getColumnCount() - 1);
setRowSelectionInterval(0, getRowCount() - 1);
+ // the following addSelectionInterval calls restore the lead selection
+ // indices to their previous values
+ addColumnSelectionInterval(colLead,colLead);
+ addRowSelectionInterval(rowLead, rowLead);
}
public Object getValueAt(int row, int column)
@@ -2076,6 +2222,11 @@ public class JTable extends JComponent
public void setValueAt(Object value, int row, int column)
{
+ if (!isCellEditable(row, column))
+ return;
+
+ if (value instanceof Component)
+ add((Component)value);
dataModel.setValueAt(value, row, convertColumnIndexToModel(column));
}
@@ -2167,4 +2318,58 @@ public class JTable extends JComponent
}
}
+
+ /**
+ * Programmatically starts editing the specified cell.
+ *
+ * @param row the row of the cell to edit.
+ * @param column the column of the cell to edit.
+ */
+ public boolean editCellAt (int row, int column)
+ {
+ oldCellValue = getValueAt(row, column);
+ setCellEditor(getCellEditor(row, column));
+ editorComp = prepareEditor(cellEditor, row, column);
+ cellEditor.addCellEditorListener(this);
+ rowBeingEdited = row;
+ columnBeingEdited = column;
+ setValueAt(editorComp, row, column);
+ ((JTextField)editorComp).requestFocusInWindow(false);
+ editorTimer.start();
+ return true;
+ }
+
+ /**
+ * Programmatically starts editing the specified cell.
+ *
+ * @param row the row of the cell to edit.
+ * @param column the column of the cell to edit.
+ */
+ public boolean editCellAt (int row, int column, EventObject e)
+ {
+ return editCellAt(row, column);
+ }
+
+ /**
+ * Discards the editor object.
+ */
+ public void removeEditor()
+ {
+ editingStopped(new ChangeEvent(this));
+ }
+
+ /**
+ * Prepares the editor by querying for the value and selection state of the
+ * cell at (row, column).
+ *
+ * @param editor the TableCellEditor to set up
+ * @param row the row of the cell to edit
+ * @param column the column of the cell to edit
+ * @return the Component being edited
+ */
+ public Component prepareEditor (TableCellEditor editor, int row, int column)
+ {
+ return editor.getTableCellEditorComponent
+ (this, getValueAt(row, column), isCellSelected(row, column), row, column);
+ }
}
diff --git a/libjava/classpath/javax/swing/JTextArea.java b/libjava/classpath/javax/swing/JTextArea.java
index fb35eb3..53591ff 100644
--- a/libjava/classpath/javax/swing/JTextArea.java
+++ b/libjava/classpath/javax/swing/JTextArea.java
@@ -80,13 +80,13 @@ import javax.swing.text.View;
* @author Michael Koch (konqueror@gmx.de)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @see java.awt.TextArea
- * @see javax.swing.JTextComponent
+ * @see javax.swing.text.JTextComponent
* @see javax.swing.JTextField
* @see javax.swing.JTextPane
* @see javax.swing.JEditorPane
* @see javax.swing.text.Document
- * @see javax.swing.text.DocumentEvent
- * @see javax.swing.text.DocumentListener
+ * @see javax.swing.event.DocumentEvent
+ * @see javax.swing.event.DocumentListener
*/
public class JTextArea extends JTextComponent
@@ -166,7 +166,7 @@ public class JTextArea extends JTextComponent
/**
* Creates a new <code>JTextArea</code> object.
*
- * @param the document model to use
+ * @param doc the document model to use
*/
public JTextArea(Document doc)
{
@@ -176,7 +176,7 @@ public class JTextArea extends JTextComponent
/**
* Creates a new <code>JTextArea</code> object.
*
- * @param the document model to use
+ * @param doc the document model to use
* @param text the initial text
* @param rows the number of rows
* @param columns the number of cols
@@ -235,12 +235,12 @@ public class JTextArea extends JTextComponent
/**
* Returns the increment that is needed to expose exactly one new line
* of text. This is implemented here to return the values of
- * {@link #getRowHeight} and {@link getColumnWidth}, depending on
+ * {@link #getRowHeight} and {@link #getColumnWidth}, depending on
* the value of the argument <code>direction</code>.
*
* @param visibleRect the view area that is visible in the viewport
- * @param orientation either {@link SwingConstants.VERTICAL} or
- * {@link SwingConstants.HORIZONTAL}
+ * @param orientation either {@link SwingConstants#VERTICAL} or
+ * {@link SwingConstants#HORIZONTAL}
* @param direction less than zero for up/left scrolling, greater
* than zero for down/right scrolling
*
@@ -329,7 +329,7 @@ public class JTextArea extends JTextComponent
/**
* Sets the number of rows.
*
- * @param columns number of columns
+ * @param rows number of rows
*
* @exception IllegalArgumentException if rows is negative
*/
@@ -355,7 +355,7 @@ public class JTextArea extends JTextComponent
/**
* Enables/disables line wrapping.
*
- * @param wrapping <code>true</code> to enable line wrapping,
+ * @param flag <code>true</code> to enable line wrapping,
* <code>false</code> otherwise
*/
public void setLineWrap(boolean flag)
diff --git a/libjava/classpath/javax/swing/JTextField.java b/libjava/classpath/javax/swing/JTextField.java
index 7d8407f..5ae9c9f 100644
--- a/libjava/classpath/javax/swing/JTextField.java
+++ b/libjava/classpath/javax/swing/JTextField.java
@@ -197,7 +197,7 @@ public class JTextField extends JTextComponent
public void insertString(int offset, String str, AttributeSet a)
throws BadLocationException
{
- if (str.indexOf('\n') == -1)
+ if (str != null && str.indexOf('\n') == -1)
super.insertString(offset, str, a);
}
};
diff --git a/libjava/classpath/javax/swing/JTextPane.java b/libjava/classpath/javax/swing/JTextPane.java
index 5321812..80632ff 100644
--- a/libjava/classpath/javax/swing/JTextPane.java
+++ b/libjava/classpath/javax/swing/JTextPane.java
@@ -1,5 +1,5 @@
-/* JTextPane.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* JTextPane.java -- A powerful text widget supporting styled text
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,228 +43,373 @@ import java.io.IOException;
import java.io.ObjectOutputStream;
import javax.swing.text.AttributeSet;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Caret;
import javax.swing.text.Document;
import javax.swing.text.EditorKit;
+import javax.swing.text.Element;
import javax.swing.text.MutableAttributeSet;
+import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.Style;
import javax.swing.text.StyledDocument;
import javax.swing.text.StyledEditorKit;
/**
- * JTextPane
- * @author Andrew Selkirk
- * @version 1.0
+ * A powerful text component that supports styled content as well as
+ * embedding images and components. It is entirely based on a
+ * {@link StyledDocument} content model and a {@link StyledEditorKit}.
+ *
+ * @author Roman Kennke (roman@kennke.org)
+ * @author Andrew Selkirk
*/
-public class JTextPane extends JEditorPane {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * uiClassID
- */
- private static final String uiClassID = "TextPaneUI";
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor JTextPane
- */
- public JTextPane() {
- // TODO
- } // JTextPane()
-
- /**
- * Constructor JTextPane
- * @param document TODO
- */
- public JTextPane(StyledDocument document) {
- // TODO
- } // JTextPane()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getUIClassID
- * @returns String
- */
- public String getUIClassID() {
- return uiClassID;
- } // getUIClassID()
-
- /**
- * setDocument
- * @param document TODO
- */
- public void setDocument(Document document) {
- super.setDocument(document); // TODO
- } // setDocument()
-
- /**
- * getStyledDocument
- * @returns StyledDocument
- */
- public StyledDocument getStyledDocument() {
- return null; // TODO
- } // getStyledDocument()
-
- /**
- * setStyledDocument
- * @param document TODO
- */
- public void setStyledDocument(StyledDocument document) {
- // TODO
- } // setStyledDocument()
-
- /**
- * replaceSelection
- * @param content TODO
- */
- public void replaceSelection(String content) {
- super.replaceSelection(content); // TODO
- } // replaceSelection()
-
- /**
- * insertComponent
- * @param component TODO
- */
- public void insertComponent(Component component) {
- // TODO
- } // insertComponent()
-
- /**
- * insertIcon
- * @param icon TODO
- */
- public void insertIcon(Icon icon) {
- // TODO
- } // insertIcon()
-
- /**
- * addStyle
- * @param nm TODO
- * @param parent TODO
- * @returns Style
- */
- public Style addStyle(String nm, Style parent) {
- return null; // TODO
- } // addStyle()
-
- /**
- * removeStyle
- * @param nm TODO
- */
- public void removeStyle(String nm) {
- // TODO
- } // removeStyle()
-
- /**
- * getStyle
- * @param nm TODO
- * @returns Style
- */
- public Style getStyle(String nm) {
- return null; // TODO
- } // getStyle()
-
- /**
- * getLogicalStyle
- * @returns Style
- */
- public Style getLogicalStyle() {
- return null; // TODO
- } // getLogicalStyle()
-
- /**
- * setLogicalStyle
- * @param style TODO
- */
- public void setLogicalStyle(Style style) {
- // TODO
- } // setLogicalStyle()
-
- /**
- * getCharacterAttributes
- * @returns AttributeSet
- */
- public AttributeSet getCharacterAttributes() {
- return null; // TODO
- } // getCharacterAttributes()
-
- /**
- * setCharacterAttributes
- * @param attribute TODO
- * @param replace TODO
- */
- public void setCharacterAttributes(AttributeSet attribute,
- boolean replace) {
- // TODO
- } // setCharacterAttributes()
-
- /**
- * getParagraphAttributes
- * @returns AttributeSet
- */
- public AttributeSet getParagraphAttributes() {
- return null; // TODO
- } // getParagraphAttributes()
-
- /**
- * setParagraphAttributes
- * @param attribute TODO
- * @param replace TODO
- */
- public void setParagraphAttributes(AttributeSet attribute,
- boolean replace) {
- // TODO
- } // setParagraphAttributes()
-
- /**
- * getInputAttributes
- * @returns MutableAttributeSet
- */
- public MutableAttributeSet getInputAttributes() {
- return null; // TODO
- } // getInputAttributes()
-
- /**
- * getStyledEditorKit
- * @returns StyledEditorKit
- */
- protected final StyledEditorKit getStyledEditorKit() {
- return null; // TODO
- } // getStyledEditorKit()
-
- /**
- * createDefaultEditorKit
- * @returns EditorKit
- */
- protected EditorKit createDefaultEditorKit() {
- return super.createDefaultEditorKit(); // TODO
- } // createDefaultEditorKit()
-
- /**
- * setEditorKit
- * @param editor TODO
- */
- public final void setEditorKit(EditorKit editor) {
- super.setEditorKit(editor); // TODO
- } // setEditorKit()
-
- /**
- * paramString
- * @returns String
- */
- protected String paramString() {
- return super.paramString(); // TODO
- } // paramString()
-
-
-} // JTextPane
+public class JTextPane
+ extends JEditorPane
+{
+ /**
+ * Creates a new <code>JTextPane</code> with a <code>null</code> document.
+ */
+ public JTextPane()
+ {
+ super();
+ }
+
+ /**
+ * Creates a new <code>JTextPane</code> and sets the specified
+ * <code>document</code>.
+ *
+ * @param document the content model to use
+ */
+ public JTextPane(StyledDocument document)
+ {
+ this();
+ setStyledDocument(document);
+ }
+
+ /**
+ * Returns the UI class ID. This is <code>TextPaneUI</code>.
+ *
+ * @return <code>TextPaneUI</code>
+ */
+ public String getUIClassID()
+ {
+ return "TextPaneUI";
+ }
+
+ /**
+ * Sets the content model for this <code>JTextPane</code>.
+ * <code>JTextPane</code> can only be used with {@link StyledDocument}s,
+ * if you try to set a different type of <code>Document</code>, an
+ * <code>IllegalArgumentException</code> is thrown.
+ *
+ * @param document the content model to set
+ *
+ * @throws IllegalArgumentException if <code>document</code> is not an
+ * instance of <code>StyledDocument</code>
+ *
+ * @see {@link #setStyledDocument}
+ */
+ public void setDocument(Document document)
+ {
+ if (document != null && !(document instanceof StyledDocument))
+ throw new IllegalArgumentException
+ ("JTextPane can only handle StyledDocuments");
+
+ setStyledDocument((StyledDocument) document);
+ }
+
+ /**
+ * Returns the {@link StyledDocument} that is the content model for
+ * this <code>JTextPane</code>. This is a typed wrapper for
+ * {@link #getDocument}.
+ *
+ * @return the content model of this <code>JTextPane</code>
+ */
+ public StyledDocument getStyledDocument()
+ {
+ return (StyledDocument) super.getDocument();
+ }
+
+ /**
+ * Sets the content model for this <code>JTextPane</code>.
+ *
+ * @param document the content model to set
+ */
+ public void setStyledDocument(StyledDocument document)
+ {
+ super.setDocument(document);
+ }
+
+ /**
+ * Replaces the currently selected text with the specified
+ * <code>content</code>. If there is no selected text, this results
+ * in a simple insertion at the current caret position. If there is
+ * no <code>content</code> specified, this results in the selection
+ * beeing deleted.
+ *
+ * @param content the text with which the selection is replaced
+ */
+ public void replaceSelection(String content)
+ {
+ Caret caret = getCaret();
+ StyledDocument doc = getStyledDocument();
+
+ int dot = caret.getDot();
+ int mark = caret.getMark();
+
+ // If content is empty delete selection.
+ if (content == null)
+ {
+ caret.setDot(dot);
+ return;
+ }
+
+ try
+ {
+ int start = getSelectionStart();
+ int end = getSelectionEnd();
+ int contentLength = content.length();
+
+ // Remove selected text.
+ if (dot != mark)
+ doc.remove(start, end - start);
+
+ // Insert new text.
+ doc.insertString(start, content, null);
+ // Set attributes for inserted text
+ doc.setCharacterAttributes(start, contentLength, getInputAttributes(),
+ true);
+
+ // Set dot to new position.
+ setCaretPosition(start + contentLength);
+ }
+ catch (BadLocationException e)
+ {
+ throw new AssertionError
+ ("No BadLocationException should be thrown here");
+ }
+ }
+
+ /**
+ * Inserts an AWT or Swing component into the text at the current caret
+ * position.
+ *
+ * @param component the component to be inserted
+ */
+ public void insertComponent(Component component)
+ {
+ // TODO: One space must be inserted here with attributes set to indicate
+ // that the component must be displayed here. Have to figure out the
+ // attributes.
+ }
+
+ /**
+ * Inserts an <code>Icon</code> into the text at the current caret position.
+ *
+ * @param icon the <code>Icon</code> to be inserted
+ */
+ public void insertIcon(Icon icon)
+ {
+ // TODO: One space must be inserted here with attributes set to indicate
+ // that the icon must be displayed here. Have to figure out the
+ // attributes.
+ }
+
+ /**
+ * Adds a style into the style hierarchy. Unspecified style attributes
+ * can be resolved in the <code>parent</code> style, if one is specified.
+ *
+ * While it is legal to add nameless styles (<code>nm == null</code),
+ * you must be aware that the client application is then responsible
+ * for managing the style hierarchy, since unnamed styles cannot be
+ * looked up by their name.
+ *
+ * @param nm the name of the style or <code>null</code> if the style should
+ * be unnamed
+ * @param parent the parent in which unspecified style attributes are
+ * resolved, or <code>null</code> if that is not necessary
+ *
+ * @return the newly created <code>Style</code>
+ */
+ public Style addStyle(String nm, Style parent)
+ {
+ return getStyledDocument().addStyle(nm, parent);
+ }
+
+ /**
+ * Removes a named <code>Style</code> from the style hierarchy.
+ *
+ * @param nm the name of the <code>Style</code> to be removed
+ */
+ public void removeStyle(String nm)
+ {
+ getStyledDocument().removeStyle(nm);
+ }
+
+ /**
+ * Looks up and returns a named <code>Style</code>.
+ *
+ * @param nm the name of the <code>Style</code>
+ *
+ * @return the found <code>Style</code> of <code>null</code> if no such
+ * <code>Style</code> exists
+ */
+ public Style getStyle(String nm)
+ {
+ return getStyledDocument().getStyle(nm);
+ }
+
+ /**
+ * Returns the logical style of the paragraph at the current caret position.
+ *
+ * @return the logical style of the paragraph at the current caret position
+ */
+ public Style getLogicalStyle()
+ {
+ return getStyledDocument().getLogicalStyle(getCaretPosition());
+ }
+
+ /**
+ * Sets the logical style for the paragraph at the current caret position.
+ *
+ * @param style the style to set for the current paragraph
+ */
+ public void setLogicalStyle(Style style)
+ {
+ getStyledDocument().setLogicalStyle(getCaretPosition(), style);
+ }
+
+ /**
+ * Returns the text attributes for the character at the current caret
+ * position.
+ *
+ * @return the text attributes for the character at the current caret
+ * position
+ */
+ public AttributeSet getCharacterAttributes()
+ {
+ StyledDocument doc = getStyledDocument();
+ Element el = doc.getCharacterElement(getCaretPosition());
+ return el.getAttributes();
+ }
+
+ /**
+ * Sets text attributes for the current selection. If there is no selection
+ * the text attributes are applied to newly inserted text
+ *
+ * @param attribute the text attributes to set
+ * @param replace if <code>true</code>, the attributes of the current
+ * selection are overridden, otherwise they are merged
+ *
+ * @see {@link #getInputAttributes}
+ */
+ public void setCharacterAttributes(AttributeSet attribute,
+ boolean replace)
+ {
+ int dot = getCaret().getDot();
+ int start = getSelectionStart();
+ int end = getSelectionEnd();
+ if (start == dot && end == dot)
+ // There is no selection, update insertAttributes instead
+ {
+ MutableAttributeSet inputAttributes =
+ getStyledEditorKit().getInputAttributes();
+ inputAttributes.addAttributes(attribute);
+ }
+ else
+ getStyledDocument().setCharacterAttributes(start, end - start, attribute,
+ replace);
+ }
+
+ /**
+ * Returns the text attributes of the paragraph at the current caret
+ * position.
+ *
+ * @return the attributes of the paragraph at the current caret position
+ */
+ public AttributeSet getParagraphAttributes()
+ {
+ StyledDocument doc = getStyledDocument();
+ Element el = doc.getParagraphElement(getCaretPosition());
+ return el.getAttributes();
+ }
+
+ /**
+ * Sets text attributes for the paragraph at the current selection.
+ * If there is no selection the text attributes are applied to
+ * the paragraph at the current caret position.
+ *
+ * @param attribute the text attributes to set
+ * @param replace if <code>true</code>, the attributes of the current
+ * selection are overridden, otherwise they are merged
+ */
+ public void setParagraphAttributes(AttributeSet attribute,
+ boolean replace)
+ {
+ // TODO
+ }
+
+ /**
+ * Returns the attributes that are applied to newly inserted text.
+ * This is a {@link MutableAttributeSet}, so you can easily modify these
+ * attributes.
+ *
+ * @return the attributes that are applied to newly inserted text
+ */
+ public MutableAttributeSet getInputAttributes()
+ {
+ return getStyledEditorKit().getInputAttributes();
+ }
+
+ /**
+ * Returns the {@link StyledEditorKit} that is currently used by this
+ * <code>JTextPane</code>.
+ *
+ * @return the current <code>StyledEditorKit</code> of this
+ * <code>JTextPane</code>
+ */
+ protected final StyledEditorKit getStyledEditorKit()
+ {
+ return (StyledEditorKit) getEditorKit();
+ }
+
+ /**
+ * Creates the default {@link EditorKit} that is used in
+ * <code>JTextPane</code>s. This is an instance of {@link StyledEditorKit}.
+ *
+ * @return the default {@link EditorKit} that is used in
+ * <code>JTextPane</code>s
+ */
+ protected EditorKit createDefaultEditorKit()
+ {
+ return new StyledEditorKit();
+ }
+
+ /**
+ * Sets the {@link EditorKit} to use for this <code>JTextPane</code>.
+ * <code>JTextPane</code>s can only handle {@link StyledEditorKit}s,
+ * if client programs try to set a different type of <code>EditorKit</code>
+ * then an IllegalArgumentException is thrown
+ *
+ * @param editor the <code>EditorKit</code> to set
+ *
+ * @throws IllegalArgumentException if <code>editor</code> is no
+ * <code>StyledEditorKit</code>
+ */
+ public final void setEditorKit(EditorKit editor)
+ {
+ if (!(editor instanceof StyledEditorKit))
+ throw new IllegalArgumentException
+ ("JTextPanes can only handle StyledEditorKits");
+ super.setEditorKit(editor);
+ }
+
+ /**
+ * Returns a param string that can be used for debugging.
+ *
+ * @return a param string that can be used for debugging.
+ */
+ protected String paramString()
+ {
+ return super.paramString(); // TODO
+ }
+}
diff --git a/libjava/classpath/javax/swing/JToggleButton.java b/libjava/classpath/javax/swing/JToggleButton.java
index 0e1b9e6..25d67f5 100644
--- a/libjava/classpath/javax/swing/JToggleButton.java
+++ b/libjava/classpath/javax/swing/JToggleButton.java
@@ -134,7 +134,7 @@ public class JToggleButton extends AbstractButton implements Accessible
* Sets the pressed state of the button. The selected state
* of the button also changes follwing the button being pressed.
*
- * @param b true if the button is pressed down.
+ * @param p true if the button is pressed down.
*/
public void setPressed(boolean p)
{
@@ -145,7 +145,20 @@ public class JToggleButton extends AbstractButton implements Accessible
// if this call does not represent a CHANGE in state, then return
if ((p && isPressed()) || (!p && !isPressed()))
return;
-
+
+ // The JDK first fires events in the following order:
+ // 1. ChangeEvent for selected
+ // 2. ChangeEvent for pressed
+ // 3. ActionEvent
+ // So do we.
+
+ // setPressed(false) == mouse release on us,
+ // if we were armed, we flip the selected state.
+ if (!p && isArmed())
+ {
+ setSelected(! isSelected());
+ }
+
// make the change
if (p)
stateMask = stateMask | PRESSED;
@@ -154,16 +167,14 @@ public class JToggleButton extends AbstractButton implements Accessible
// notify interested ChangeListeners
fireStateChanged();
-
- // setPressed(false) == mouse release on us,
- // if we were armed, we flip the selected state.
+
if (!p && isArmed())
{
fireActionPerformed(new ActionEvent(this,
ActionEvent.ACTION_PERFORMED,
actionCommand));
- setSelected(! isSelected());
}
+
}
}
diff --git a/libjava/classpath/javax/swing/JTree.java b/libjava/classpath/javax/swing/JTree.java
index bccd983..bb24c7a 100644
--- a/libjava/classpath/javax/swing/JTree.java
+++ b/libjava/classpath/javax/swing/JTree.java
@@ -339,7 +339,6 @@ public class JTree
{
setModel(model);
setSelectionModel(EmptySelectionModel.sharedInstance());
- selectionModel.addTreeSelectionListener(selectionRedirector);
setCellRenderer(new DefaultTreeCellRenderer());
updateUI();
}
@@ -564,13 +563,13 @@ public class JTree
}
/**
- * Returns the preferred viewport size..
+ * Returns the preferred viewport size.
*
* @return the preferred size
*/
public Dimension getPreferredScrollableViewportSize()
{
- return null;
+ return new Dimension (getPreferredSize().width, getVisibleRowCount()*getRowHeight());
}
public int getScrollableUnitIncrement(Rectangle visibleRect,
@@ -585,15 +584,19 @@ public class JTree
return 1;
}
- public boolean getScrollableTracksViewportWidth()
- {
- return false;
- }
-
- public boolean getScrollableTracksViewportHeight()
- {
- return false;
- }
+ public boolean getScrollableTracksViewportWidth()
+ {
+ if (getParent() instanceof JViewport)
+ return ((JViewport) getParent()).getHeight() > getPreferredSize().height;
+ return false;
+ }
+
+ public boolean getScrollableTracksViewportHeight()
+ {
+ if (getParent() instanceof JViewport)
+ return ((JViewport) getParent()).getWidth() > getPreferredSize().width;
+ return false;
+ }
/**
* Adds a <code>TreeExpansionListener</code> object to the tree.
@@ -660,7 +663,7 @@ public class JTree
*/
public void addTreeSelectionListener(TreeSelectionListener listener)
{
- listenerList.add(TreeSelectionListener.class, listener);
+ listenerList.add(TreeSelectionListener.class, listener);
}
/**
@@ -692,7 +695,7 @@ public class JTree
protected void fireValueChanged(TreeSelectionEvent event)
{
TreeSelectionListener[] listeners = getTreeSelectionListeners();
-
+
for (int index = 0; index < listeners.length; ++index)
listeners[index].valueChanged(event);
}
@@ -775,16 +778,17 @@ public class JTree
{
if (treeModel == model)
return;
-
- TreeModel oldValue = treeModel;
- treeModel = model;
-
- firePropertyChange(TREE_MODEL_PROPERTY, oldValue, model);
-
+
// add treeModelListener to the new model
if (treeModelListener == null)
treeModelListener = createTreeModelListener();
- model.addTreeModelListener(treeModelListener);
+ if (model != null) // as setModel(null) is allowed
+ model.addTreeModelListener(treeModelListener);
+
+ TreeModel oldValue = treeModel;
+ treeModel = model;
+
+ firePropertyChange(TREE_MODEL_PROPERTY, oldValue, model);
}
/**
@@ -1276,9 +1280,17 @@ public class JTree
}
public void collapsePath(TreePath path)
- {
- setExpandedState(path, false);
- }
+ {
+ try
+ {
+ fireTreeWillCollapse(path);
+ }
+ catch (ExpandVetoException ev)
+ {
+ }
+ setExpandedState(path, false);
+ fireTreeCollapsed(path);
+ }
public void collapseRow(int row)
{
@@ -1292,13 +1304,22 @@ public class JTree
}
public void expandPath(TreePath path)
- {
- // Don't expand if last path component is a leaf node.
- if ((path == null) || (treeModel.isLeaf(path.getLastPathComponent())))
- return;
-
- setExpandedState(path, true);
- }
+ {
+ // Don't expand if last path component is a leaf node.
+ if ((path == null) || (treeModel.isLeaf(path.getLastPathComponent())))
+ return;
+
+ try
+ {
+ fireTreeWillExpand(path);
+ }
+ catch (ExpandVetoException ev)
+ {
+ }
+
+ setExpandedState(path, true);
+ fireTreeExpanded(path);
+ }
public void expandRow(int row)
{
@@ -1502,28 +1523,11 @@ public class JTree
return null;
}
- private void checkExpandParents(TreePath path) throws ExpandVetoException
- {
-
- TreePath parent = path.getParentPath();
-
- if (parent != null)
- checkExpandParents(parent);
-
- fireTreeWillExpand(path);
- }
-
private void doExpandParents(TreePath path, boolean state)
{
- TreePath parent = path.getParentPath();
-
- if (isExpanded(parent))
- {
- nodeStates.put(path, state ? EXPANDED : COLLAPSED);
- return;
- }
-
- if (parent != null)
+ TreePath parent = path.getParentPath();
+
+ if (!isExpanded(parent) && parent != null)
doExpandParents(parent, false);
nodeStates.put(path, state ? EXPANDED : COLLAPSED);
@@ -1533,20 +1537,8 @@ public class JTree
{
if (path == null)
return;
-
TreePath parent = path.getParentPath();
- try
- {
- if (parent != null)
- checkExpandParents(parent);
- }
- catch (ExpandVetoException e)
- {
- // Expansion vetoed.
- return;
- }
-
doExpandParents(path, state);
}
@@ -1729,8 +1721,8 @@ public class JTree
*
* @param prefix the prefix to search for in the cell values
* @param startingRow the index of the row where to start searching from
- * @param bias the search direction, either {@link Position.Bias.Forward} or
- * {@link Position.Bias.Backward}
+ * @param bias the search direction, either {@link Position.Bias#Forward} or
+ * {@link Position.Bias#Backward}
*
* @return the path to the found element or -1 if no such element has been
* found
@@ -1802,7 +1794,7 @@ public class JTree
* it will be removed too.
*
* @param path the path from which selected descendants are to be removed
- * @param includePath if <code>true</code> then <code>path</code> itself
+ * @param includeSelected if <code>true</code> then <code>path</code> itself
* will also be remove if it's selected
*
* @return <code>true</code> if something has been removed,
diff --git a/libjava/classpath/javax/swing/JViewport.java b/libjava/classpath/javax/swing/JViewport.java
index 397cb31..d750bad 100644
--- a/libjava/classpath/javax/swing/JViewport.java
+++ b/libjava/classpath/javax/swing/JViewport.java
@@ -89,7 +89,7 @@ import javax.swing.plaf.ViewportUI;
*
* <p>But in terms of drawing its child, the viewport thinks of itself as
* covering a particular position <em>of the view's coordinate space</em>.
- * For example, the {@link javax.JViewPort.getViewPosition} method returns
+ * For example, the {@link #getViewPosition} method returns
* the position <code>(VX,VY)</code> shown above, which is an position in
* "view space", even though this is <em>implemented</em> by positioning
* the underlying child at position <code>(-VX,-VY)</code></p>
@@ -487,4 +487,45 @@ public class JViewport extends JComponent
{
return new ViewportLayout();
}
+
+ /**
+ * Scrolls the view so that contentRect becomes visible.
+ *
+ * @param contentRect the rectangle to make visible within the view
+ */
+ public void scrollRectToVisible(Rectangle contentRect)
+ {
+ Point pos = getViewPosition();
+ Rectangle viewBounds = getView().getBounds();
+ Rectangle portBounds = getBounds();
+
+ // FIXME: should validate the view if it is not valid, however
+ // this may cause excessive validation when the containment
+ // hierarchy is being created.
+
+ // if contentRect is larger than the portBounds, center the view
+ if (contentRect.height > portBounds.height ||
+ contentRect.width > portBounds.width)
+ {
+ setViewPosition(new Point(contentRect.x, contentRect.y));
+ return;
+ }
+
+ // Y-DIRECTION
+ if (contentRect.y < -viewBounds.y)
+ setViewPosition(new Point(pos.x, contentRect.y));
+ else if (contentRect.y + contentRect.height >
+ -viewBounds.y + portBounds.height)
+ setViewPosition (new Point(pos.x, contentRect.y -
+ (portBounds.height - contentRect.height)));
+
+ // X-DIRECTION
+ pos = getViewPosition();
+ if (contentRect.x < -viewBounds.x)
+ setViewPosition(new Point(contentRect.x, pos.y));
+ else if (contentRect.x + contentRect.width >
+ -viewBounds.x + portBounds.width)
+ setViewPosition (new Point(contentRect.x -
+ (portBounds.width - contentRect.width), pos.y));
+ }
}
diff --git a/libjava/classpath/javax/swing/MenuSelectionManager.java b/libjava/classpath/javax/swing/MenuSelectionManager.java
index acaee97..32d56b9 100644
--- a/libjava/classpath/javax/swing/MenuSelectionManager.java
+++ b/libjava/classpath/javax/swing/MenuSelectionManager.java
@@ -211,17 +211,18 @@ public class MenuSelectionManager
public boolean isComponentPartOfCurrentMenu(Component c)
{
MenuElement[] subElements;
- for (int i = 0; i < selectedPath.size(); i++)
+ for (int i = 0; i < selectedPath.size(); i++)
{
- subElements = ((MenuElement) selectedPath.get(i)).getSubElements();
- for (int j = 0; j < subElements.length; j++)
- {
- if ((subElements[j].getComponent()).equals(c))
- return true;
- }
+ subElements = ((MenuElement) selectedPath.get(i)).getSubElements();
+ for (int j = 0; j < subElements.length; j++)
+ {
+ MenuElement me = subElements[j];
+ if (me != null && (me.getComponent()).equals(c))
+ return true;
+ }
}
- return false;
+ return false;
}
/**
diff --git a/libjava/classpath/javax/swing/RepaintManager.java b/libjava/classpath/javax/swing/RepaintManager.java
index 8c4c323..698dbe8 100644
--- a/libjava/classpath/javax/swing/RepaintManager.java
+++ b/libjava/classpath/javax/swing/RepaintManager.java
@@ -42,6 +42,7 @@ import java.awt.Component;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Rectangle;
+import java.awt.image.VolatileImage;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
@@ -72,7 +73,7 @@ public class RepaintManager
* typically only one of these objects active at any time. When the
* {@link RepaintManager} is told to queue a repaint, it checks to see if
* a {@link RepaintWorker} is "live" in the system event queue, and if
- * not it inserts one using {@link SwingUtilities.invokeLater}.</p>
+ * not it inserts one using {@link SwingUtilities#invokeLater}.</p>
*
* <p>When the {@link RepaintWorker} comes to the head of the system
* event queue, its {@link RepaintWorker#run} method is executed by the
@@ -235,7 +236,7 @@ public class RepaintManager
*
* @param manager The new value of the shared instance
*
- * @see #currentManager
+ * @see #currentManager(JComponent)
*/
public static void setCurrentManager(RepaintManager manager)
{
@@ -501,7 +502,7 @@ public class RepaintManager
*
* @since 1.4
*
- * @see {@link VolatileImage}
+ * @see VolatileImage
*/
public Image getVolatileOffscreenBuffer(Component comp, int proposedWidth,
int proposedHeight)
@@ -542,7 +543,7 @@ public class RepaintManager
*
* @param buffer The new value of the property
*
- * @see #getDoubleBufferingEnabled
+ * @see #isDoubleBufferingEnabled
*/
public void setDoubleBufferingEnabled(boolean buffer)
{
diff --git a/libjava/classpath/javax/swing/SizeRequirements.java b/libjava/classpath/javax/swing/SizeRequirements.java
index 430aeed..77b42db 100644
--- a/libjava/classpath/javax/swing/SizeRequirements.java
+++ b/libjava/classpath/javax/swing/SizeRequirements.java
@@ -295,7 +295,6 @@ public class SizeRequirements implements Serializable
* @param allocated the amount of allocated space
* @param total the total size requirements of the components
* @param children the size requirement of each component
- * @param offsets will hold the offset values for each component
* @param spans will hold the span values for each component
* @param forward whether the components should be placed in the forward
* direction (left-right or top-bottom) or reverse direction
diff --git a/libjava/classpath/javax/swing/SortingFocusTraversalPolicy.java b/libjava/classpath/javax/swing/SortingFocusTraversalPolicy.java
index 48f864b..fada17c 100644
--- a/libjava/classpath/javax/swing/SortingFocusTraversalPolicy.java
+++ b/libjava/classpath/javax/swing/SortingFocusTraversalPolicy.java
@@ -89,7 +89,7 @@ public class SortingFocusTraversalPolicy
* Creates a new <code>SortingFocusTraversalPolicy</code> with the given
* comparator set.
*
- * @param the comparator to set
+ * @param comparator the comparator to set
*/
public SortingFocusTraversalPolicy(Comparator comparator)
{
@@ -306,12 +306,12 @@ public class SortingFocusTraversalPolicy
}
/**
- * Return the current value of the {@link implicitDownCycleTraversal}
+ * Return the current value of the {@link #implicitDownCycleTraversal}
* property.
*
* @return the current value of the property
*
- * @see setImplicitDownCycleTraversal
+ * @see #setImplicitDownCycleTraversal
*/
public boolean getImplicitDownCycleTraversal()
{
@@ -319,12 +319,12 @@ public class SortingFocusTraversalPolicy
}
/**
- * Set the current value of the {@link implicitDownCycleTraversal}
+ * Set the current value of the {@link #implicitDownCycleTraversal}
* property.
*
* @param down the new value of the property
*
- * @see getImplicitDownCycleTraversal
+ * @see #getImplicitDownCycleTraversal
*/
public void setImplicitDownCycleTraversal(boolean down)
{
diff --git a/libjava/classpath/javax/swing/SpinnerListModel.java b/libjava/classpath/javax/swing/SpinnerListModel.java
index a0dc4d1..85dc4ef 100644
--- a/libjava/classpath/javax/swing/SpinnerListModel.java
+++ b/libjava/classpath/javax/swing/SpinnerListModel.java
@@ -42,6 +42,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import javax.swing.event.ChangeEvent;
+
/**
* An implementation of <code>SpinnerModel</code> which uses the values
* contained within a list or an array. The backing list or array is
diff --git a/libjava/classpath/javax/swing/Spring.java b/libjava/classpath/javax/swing/Spring.java
index 4255e86..69c88c7 100644
--- a/libjava/classpath/javax/swing/Spring.java
+++ b/libjava/classpath/javax/swing/Spring.java
@@ -189,9 +189,9 @@ public abstract class Spring
/**
* Creates a new SimpleSpring object.
*
- * @param min the constant minimum value.
- * @param pref the constant preferred value.
- * @param max the constant maximum value.
+ * @param newMin the constant minimum value.
+ * @param newPref the constant preferred value.
+ * @param newMax the constant maximum value.
*/
public SimpleSpring(int newMin, int newPref, int newMax)
{
diff --git a/libjava/classpath/javax/swing/SpringLayout.java b/libjava/classpath/javax/swing/SpringLayout.java
index b45edba..df9ddff 100644
--- a/libjava/classpath/javax/swing/SpringLayout.java
+++ b/libjava/classpath/javax/swing/SpringLayout.java
@@ -152,7 +152,7 @@ public class SpringLayout implements LayoutManager2
/**
* Returns the constraint for the edge with the <code>edgeName</code>.
* This is expected to be one of
- * {@link #EAST}, {@link #WEST}, {@link NORTH} or {@link SOUTH}.
+ * {@link #EAST}, {@link #WEST}, {@link #NORTH} or {@link #SOUTH}.
*
* @param edgeName the name of the edge.
* @return the constraint for the specified edge.
@@ -246,7 +246,7 @@ public class SpringLayout implements LayoutManager2
* the mathematics still hold true.
*
* @param edgeName the name of the edge, one of {@link #EAST},
- * {@link #WEST}, {@link NORTH} or {@link SOUTH}.
+ * {@link #WEST}, {@link #NORTH} or {@link #SOUTH}.
* @param s the constraint to be set.
*/
public void setConstraint(String edgeName, Spring s)
@@ -361,8 +361,8 @@ public class SpringLayout implements LayoutManager2
* Method. This method does nothing, since SpringLayout does not manage
* String-indexed components.
*
- * @param component the component to be added.
- * @param constraint the constraint to be set.
+ * @param name the name.
+ * @param c the component to be added.
*/
public void addLayoutComponent(String name, Component c)
{
@@ -374,7 +374,7 @@ public class SpringLayout implements LayoutManager2
*
* @param c the component from which to get the constraint.
* @param edgeName the name of the edge, one of {@link #EAST},
- * {@link #WEST}, {@link NORTH} or {@link SOUTH}.
+ * {@link #WEST}, {@link #NORTH} or {@link #SOUTH}.
* @return the constraint of the edge <code>edgeName</code> of the
* component c.
*/
diff --git a/libjava/classpath/javax/swing/SwingUtilities.java b/libjava/classpath/javax/swing/SwingUtilities.java
index 69b6345..ee5fa74 100644
--- a/libjava/classpath/javax/swing/SwingUtilities.java
+++ b/libjava/classpath/javax/swing/SwingUtilities.java
@@ -63,7 +63,7 @@ import javax.swing.plaf.ActionMapUIResource;
import javax.swing.plaf.InputMapUIResource;
/**
- * This class contains a number of static utility functions which are
+ * A number of static utility functions which are
* useful when drawing swing components, dispatching events, or calculating
* regions which need painting.
*
@@ -449,7 +449,7 @@ public class SwingUtilities
* @return A component containing <code>(x,y)</code>, or
* <code>null</code>
*
- * @see java.awt.Container#findComponentAt
+ * @see java.awt.Container#findComponentAt(int, int)
*/
public static Component getDeepestComponentAt(Component parent, int x, int y)
{
@@ -473,7 +473,7 @@ public class SwingUtilities
* @param p The point to convert
* @param c The component which the point is expressed in terms of
*
- * @see convertPointFromScreen
+ * @see #convertPointFromScreen
*/
public static void convertPointToScreen(Point p, Component c)
{
@@ -568,7 +568,7 @@ public class SwingUtilities
*
* @see #convertPointToScreen
* @see #convertPointFromScreen
- * @see #convertPoint
+ * @see #convertPoint(Component, int, int, Component)
* @see #getRoot
*/
public static Rectangle convertRectangle(Component source,
@@ -596,7 +596,7 @@ public class SwingUtilities
* component's coordinate space, and with the destination component as
* its source
*
- * @see #convertPoint
+ * @see #convertPoint(Component, int, int, Component)
*/
public static MouseEvent convertMouseEvent(Component source,
MouseEvent sourceEvent,
@@ -938,7 +938,7 @@ public class SwingUtilities
}
/**
- * Calls {@link java.awt.EventQueue.invokeLater} with the
+ * Calls {@link java.awt.EventQueue#invokeLater} with the
* specified {@link Runnable}.
*/
public static void invokeLater(Runnable doRun)
@@ -947,7 +947,7 @@ public class SwingUtilities
}
/**
- * Calls {@link java.awt.EventQueue.invokeAndWait} with the
+ * Calls {@link java.awt.EventQueue#invokeAndWait} with the
* specified {@link Runnable}.
*/
public static void invokeAndWait(Runnable doRun)
@@ -958,7 +958,10 @@ public class SwingUtilities
}
/**
- * Calls {@link java.awt.EventQueue.isEventDispatchThread}.
+ * Calls {@link java.awt.EventQueue#isDispatchThread()}.
+ *
+ * @return <code>true</code> if the current thread is the current AWT event
+ * dispatch thread.
*/
public static boolean isEventDispatchThread()
{
@@ -1262,11 +1265,11 @@ public class SwingUtilities
* Calculates the intersection of two rectangles.
*
* @param x upper-left x coodinate of first rectangle
- * @param x upper-left y coodinate of first rectangle
+ * @param y upper-left y coodinate of first rectangle
* @param w width of first rectangle
* @param h height of first rectangle
* @param rect a Rectangle object of the second rectangle
- * @throws a NullPointerException if rect is null.
+ * @throws NullPointerException if rect is null.
*
* @return a rectangle corresponding to the intersection of the
* two rectangles. A zero rectangle is returned if the rectangles
@@ -1308,11 +1311,11 @@ public class SwingUtilities
* Calculates the union of two rectangles.
*
* @param x upper-left x coodinate of first rectangle
- * @param x upper-left y coodinate of first rectangle
+ * @param y upper-left y coodinate of first rectangle
* @param w width of first rectangle
* @param h height of first rectangle
* @param rect a Rectangle object of the second rectangle
- * @throws a NullPointerException if rect is null.
+ * @throws NullPointerException if rect is null.
*
* @return a rectangle corresponding to the union of the
* two rectangles. A rectangle encompassing both is returned if the
@@ -1361,9 +1364,9 @@ public class SwingUtilities
* maps should be returned, may be
* {@link JComponent#WHEN_IN_FOCUSED_WINDOW},
* {@link JComponent#WHEN_FOCUSED} or
- * {@link JComponent#WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
+ * {@link JComponent#WHEN_ANCESTOR_OF_FOCUSED_COMPONENT}
*
- * @return
+ * @return The input map.
*/
public static InputMap getUIInputMap(JComponent component, int cond)
{
diff --git a/libjava/classpath/javax/swing/UIDefaults.java b/libjava/classpath/javax/swing/UIDefaults.java
index 06fee05..ab78ca6 100644
--- a/libjava/classpath/javax/swing/UIDefaults.java
+++ b/libjava/classpath/javax/swing/UIDefaults.java
@@ -421,9 +421,9 @@ public class UIDefaults extends Hashtable
* @return the font entry for <code>key</code> or null if no such entry
* exists
*/
- public Font getFont(Object key, Locale l)
+ public Font getFont(Object key, Locale locale)
{
- Object o = get(key, l);
+ Object o = get(key, locale);
return o instanceof Font ? (Font) o : null;
}
@@ -450,9 +450,9 @@ public class UIDefaults extends Hashtable
* @return the color entry for <code>key</code> or null if no such entry
* exists
*/
- public Color getColor(Object key, Locale l)
+ public Color getColor(Object key, Locale locale)
{
- Object o = get(key, l);
+ Object o = get(key, locale);
return o instanceof Color ? (Color) o : null;
}
@@ -479,9 +479,9 @@ public class UIDefaults extends Hashtable
* @return the icon entry for <code>key</code> or null if no such entry
* exists
*/
- public Icon getIcon(Object key, Locale l)
+ public Icon getIcon(Object key, Locale locale)
{
- Object o = get(key, l);
+ Object o = get(key, locale);
return o instanceof Icon ? (Icon) o : null;
}
@@ -508,9 +508,9 @@ public class UIDefaults extends Hashtable
* @return the border entry for <code>key</code> or null if no such entry
* exists
*/
- public Border getBorder(Object key, Locale l)
+ public Border getBorder(Object key, Locale locale)
{
- Object o = get(key, l);
+ Object o = get(key, locale);
return o instanceof Border ? (Border) o : null;
}
@@ -537,9 +537,9 @@ public class UIDefaults extends Hashtable
* @return the string entry for <code>key</code> or null if no such entry
* exists
*/
- public String getString(Object key, Locale l)
+ public String getString(Object key, Locale locale)
{
- Object o = get(key, l);
+ Object o = get(key, locale);
return o instanceof String ? (String) o : null;
}
@@ -566,9 +566,9 @@ public class UIDefaults extends Hashtable
* @return the integer entry for <code>key</code> or null if no such entry
* exists
*/
- public int getInt(Object key, Locale l)
+ public int getInt(Object key, Locale locale)
{
- Object o = get(key, l);
+ Object o = get(key, locale);
return o instanceof Integer ? ((Integer) o).intValue() : 0;
}
@@ -594,9 +594,9 @@ public class UIDefaults extends Hashtable
* @return the boolean entry for <code>key</code> or null if no such entry
* exists
*/
- public boolean getBoolean(Object key, Locale l)
+ public boolean getBoolean(Object key, Locale locale)
{
- return Boolean.TRUE.equals(get(key, l));
+ return Boolean.TRUE.equals(get(key, locale));
}
/**
@@ -622,9 +622,9 @@ public class UIDefaults extends Hashtable
* @return the boolean entry for <code>key</code> or null if no such entry
* exists
*/
- public Insets getInsets(Object key, Locale l)
+ public Insets getInsets(Object key, Locale locale)
{
- Object o = get(key, l);
+ Object o = get(key, locale);
return o instanceof Insets ? (Insets) o : null;
}
@@ -651,9 +651,9 @@ public class UIDefaults extends Hashtable
* @return the boolean entry for <code>key</code> or null if no such entry
* exists
*/
- public Dimension getDimension(Object key, Locale l)
+ public Dimension getDimension(Object key, Locale locale)
{
- Object o = get(key, l);
+ Object o = get(key, locale);
return o instanceof Dimension ? (Dimension) o : null;
}
diff --git a/libjava/classpath/javax/swing/UIManager.java b/libjava/classpath/javax/swing/UIManager.java
index 7f6d65e..f4648f1 100644
--- a/libjava/classpath/javax/swing/UIManager.java
+++ b/libjava/classpath/javax/swing/UIManager.java
@@ -47,15 +47,31 @@ import java.io.Serializable;
import java.util.Locale;
import javax.swing.border.Border;
+import javax.swing.event.SwingPropertyChangeSupport;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.metal.MetalLookAndFeel;
+/**
+ * Manages the current {@link LookAndFeel} and any auxiliary {@link LookAndFeel}
+ * instances.
+ */
public class UIManager implements Serializable
{
+ /**
+ * Represents the basic information about a {@link LookAndFeel} (LAF), so
+ * that a list of installed LAFs can be presented without actually loading
+ * the LAF class(es).
+ */
public static class LookAndFeelInfo
{
String name, clazz;
+ /**
+ * Creates a new instance.
+ *
+ * @param name the look and feel name.
+ * @param clazz the look and feel class name.
+ */
public LookAndFeelInfo(String name,
String clazz)
{
@@ -63,11 +79,21 @@ public class UIManager implements Serializable
this.clazz = clazz;
}
+ /**
+ * Returns the name of the look and feel.
+ *
+ * @return The name of the look and feel.
+ */
public String getName()
{
return name;
}
+ /**
+ * Returns the fully qualified class name for the {@link LookAndFeel}.
+ *
+ * @return The fully qualified class name for the {@link LookAndFeel}.
+ */
public String getClassName()
{
return clazz;
@@ -93,13 +119,22 @@ public class UIManager implements Serializable
private static final long serialVersionUID = -5547433830339189365L;
+ /** The installed look and feel(s). */
static LookAndFeelInfo [] installed = {
- new LookAndFeelInfo ("Metal", "javax.swing.plaf.metal.MetalLookAndFeel")
+ new LookAndFeelInfo("Metal", "javax.swing.plaf.metal.MetalLookAndFeel")
};
- static LookAndFeel[] aux_installed;
+ /** The installed auxiliary look and feels. */
+ static LookAndFeel[] auxLookAndFeels;
+
+ /** The current look and feel. */
+ static LookAndFeel currentLookAndFeel;
- static LookAndFeel look_and_feel = new MetalLookAndFeel();
+ static UIDefaults currentUIDefaults;
+
+ /** Property change listener mechanism. */
+ static SwingPropertyChangeSupport listeners
+ = new SwingPropertyChangeSupport(UIManager.class);
static
{
@@ -115,11 +150,19 @@ public class UIManager implements Serializable
catch (Exception ex)
{
System.err.println("cannot initialize Look and Feel: " + defaultlaf);
- System.err.println("errot: " + ex.getMessage());
+ System.err.println("error: " + ex.getMessage());
System.err.println("falling back to Metal Look and Feel");
}
- }
+ currentLookAndFeel = new MetalLookAndFeel();
+ currentLookAndFeel.initialize();
+ currentUIDefaults = currentLookAndFeel.getDefaults();
+ }
+
+ /**
+ * Creates a new instance of the <code>UIManager</code>. There is no need
+ * to construct an instance of this class, since all methods are static.
+ */
public UIManager()
{
// Do nothing here.
@@ -132,7 +175,7 @@ public class UIManager implements Serializable
*/
public static void addPropertyChangeListener(PropertyChangeListener listener)
{
- // FIXME
+ listeners.addPropertyChangeListener(listener);
}
/**
@@ -140,9 +183,10 @@ public class UIManager implements Serializable
*
* @param listener the listener to remove
*/
- public static void removePropertyChangeListener(PropertyChangeListener listener)
+ public static void removePropertyChangeListener(PropertyChangeListener
+ listener)
{
- // FIXME
+ listeners.removePropertyChangeListener(listener);
}
/**
@@ -154,60 +198,117 @@ public class UIManager implements Serializable
*/
public static PropertyChangeListener[] getPropertyChangeListeners()
{
- // FIXME
- throw new Error ("Not implemented");
+ return listeners.getPropertyChangeListeners();
}
/**
- * Add a LookAndFeel to the list of auxiliary look and feels.
+ * Add a {@link LookAndFeel} to the list of auxiliary look and feels.
+ *
+ * @param laf the auxiliary look and feel (<code>null</code> not permitted).
+ *
+ * @throws NullPointerException if <code>laf</code> is <code>null</code>.
+ *
+ * @see #getAuxiliaryLookAndFeels()
*/
- public static void addAuxiliaryLookAndFeel (LookAndFeel l)
+ public static void addAuxiliaryLookAndFeel(LookAndFeel laf)
{
- if (aux_installed == null)
+ if (laf == null)
+ throw new NullPointerException("Null 'laf' argument.");
+ if (auxLookAndFeels == null)
{
- aux_installed = new LookAndFeel[1];
- aux_installed[0] = l;
+ auxLookAndFeels = new LookAndFeel[1];
+ auxLookAndFeels[0] = laf;
return;
}
- LookAndFeel[] T = new LookAndFeel[ aux_installed.length+1 ];
- System.arraycopy(aux_installed, 0, T, 0, aux_installed.length);
- aux_installed = T;
- aux_installed[aux_installed.length-1] = l;
+ LookAndFeel[] temp = new LookAndFeel[auxLookAndFeels.length + 1];
+ System.arraycopy(auxLookAndFeels, 0, temp, 0, auxLookAndFeels.length);
+ auxLookAndFeels = temp;
+ auxLookAndFeels[auxLookAndFeels.length - 1] = laf;
}
+ /**
+ * Removes a {@link LookAndFeel} (LAF) from the list of auxiliary LAFs.
+ *
+ * @param laf the LAF to remove.
+ *
+ * @return <code>true</code> if the LAF was removed, and <code>false</code>
+ * otherwise.
+ */
public static boolean removeAuxiliaryLookAndFeel(LookAndFeel laf)
{
- if (aux_installed == null)
+ if (auxLookAndFeels == null)
return false;
-
- for (int i=0;i<aux_installed.length;i++)
+ int count = auxLookAndFeels.length;
+ if (count == 1 && auxLookAndFeels[0] == laf)
{
- if (aux_installed[i] == laf)
+ auxLookAndFeels = null;
+ return true;
+ }
+ for (int i = 0; i < count; i++)
+ {
+ if (auxLookAndFeels[i] == laf)
{
- aux_installed[ i ] = aux_installed[aux_installed.length-1];
- LookAndFeel[] T = new LookAndFeel[ aux_installed.length-1 ];
- System.arraycopy (aux_installed, 0, T, 0, aux_installed.length-1);
- aux_installed = T;
+ LookAndFeel[] temp = new LookAndFeel[auxLookAndFeels.length - 1];
+ if (i == 0)
+ {
+ System.arraycopy(auxLookAndFeels, 1, temp, 0, count - 1);
+ }
+ else if (i == count - 1)
+ {
+ System.arraycopy(auxLookAndFeels, 0, temp, 0, count - 1);
+ }
+ else
+ {
+ System.arraycopy(auxLookAndFeels, 0, temp, 0, i);
+ System.arraycopy(auxLookAndFeels, i + 1, temp, i,
+ count - i - 1);
+ }
+ auxLookAndFeels = temp;
return true;
}
}
return false;
}
- public static LookAndFeel[] getAuxiliaryLookAndFeels()
+ /**
+ * Returns an array (possibly <code>null</code>) containing the auxiliary
+ * {@link LookAndFeel}s that are in use. These are used by the
+ * {@link javax.swing.plaf.multi.MultiLookAndFeel} class.
+ *
+ * @return The auxiliary look and feels (possibly <code>null</code>).
+ *
+ * @see #addAuxiliaryLookAndFeel(LookAndFeel)
+ */
+ public static LookAndFeel[] getAuxiliaryLookAndFeels()
{
- return aux_installed;
+ return auxLookAndFeels;
}
- public static Object get(Object key)
+ /**
+ * Returns an object from the {@link UIDefaults} table for the current
+ * {@link LookAndFeel}.
+ *
+ * @param key the key.
+ *
+ * @return The object.
+ */
+ public static Object get(Object key)
{
- return getLookAndFeel().getDefaults().get(key);
+ return getLookAndFeelDefaults().get(key);
}
- public static Object get(Object key, Locale locale)
+ /**
+ * Returns an object from the {@link UIDefaults} table for the current
+ * {@link LookAndFeel}.
+ *
+ * @param key the key.
+ *
+ * @return The object.
+ */
+ public static Object get(Object key, Locale locale)
{
- return getLookAndFeel().getDefaults().get(key ,locale);
+ return getLookAndFeelDefaults().get(key ,locale);
}
/**
@@ -218,7 +319,7 @@ public class UIManager implements Serializable
*/
public static boolean getBoolean(Object key)
{
- Boolean value = (Boolean) getLookAndFeel().getDefaults().get(key);
+ Boolean value = (Boolean) getLookAndFeelDefaults().get(key);
return value != null ? value.booleanValue() : false;
}
@@ -230,7 +331,7 @@ public class UIManager implements Serializable
*/
public static boolean getBoolean(Object key, Locale locale)
{
- Boolean value = (Boolean) getLookAndFeel().getDefaults().get(key, locale);
+ Boolean value = (Boolean) getLookAndFeelDefaults().get(key, locale);
return value != null ? value.booleanValue() : false;
}
@@ -239,7 +340,7 @@ public class UIManager implements Serializable
*/
public static Border getBorder(Object key)
{
- return (Border) getLookAndFeel().getDefaults().get(key);
+ return (Border) getLookAndFeelDefaults().get(key);
}
/**
@@ -249,39 +350,44 @@ public class UIManager implements Serializable
*/
public static Border getBorder(Object key, Locale locale)
{
- return (Border) getLookAndFeel().getDefaults().get(key, locale);
+ return (Border) getLookAndFeelDefaults().get(key, locale);
}
/**
* Returns a drawing color from the defaults table.
*/
- public static Color getColor(Object key)
+ public static Color getColor(Object key)
{
- return (Color) getLookAndFeel().getDefaults().get(key);
+ return (Color) getLookAndFeelDefaults().get(key);
}
/**
* Returns a drawing color from the defaults table.
*/
- public static Color getColor(Object key, Locale locale)
+ public static Color getColor(Object key, Locale locale)
{
- return (Color) getLookAndFeel().getDefaults().get(key);
+ return (Color) getLookAndFeelDefaults().get(key);
}
/**
- * this string can be passed to Class.forName()
+ * The fully qualified class name of the cross platform (Metal) look and feel.
+ * This string can be passed to Class.forName()
+ *
+ * @return <code>"javax.swing.plaf.metal.MetalLookAndFeel"</code>
*/
- public static String getCrossPlatformLookAndFeelClassName()
+ public static String getCrossPlatformLookAndFeelClassName()
{
return "javax.swing.plaf.metal.MetalLookAndFeel";
}
/**
* Returns the default values for this look and feel.
+ *
+ * @return The {@link UIDefaults} for the current {@link LookAndFeel}.
*/
public static UIDefaults getDefaults()
{
- return getLookAndFeel().getDefaults();
+ return currentUIDefaults;
}
/**
@@ -289,7 +395,7 @@ public class UIManager implements Serializable
*/
public static Dimension getDimension(Object key)
{
- return (Dimension) getLookAndFeel().getDefaults().get(key);
+ return (Dimension) getLookAndFeelDefaults().get(key);
}
/**
@@ -297,7 +403,7 @@ public class UIManager implements Serializable
*/
public static Dimension getDimension(Object key, Locale locale)
{
- return (Dimension) getLookAndFeel().getDefaults().get(key, locale);
+ return (Dimension) getLookAndFeelDefaults().get(key, locale);
}
/**
@@ -310,7 +416,7 @@ public class UIManager implements Serializable
*/
public static Font getFont(Object key)
{
- return (Font) getLookAndFeel().getDefaults().get(key);
+ return (Font) getLookAndFeelDefaults().get(key);
}
/**
@@ -323,7 +429,7 @@ public class UIManager implements Serializable
*/
public static Font getFont(Object key, Locale locale)
{
- return (Font) getLookAndFeel().getDefaults().get(key ,locale);
+ return (Font) getLookAndFeelDefaults().get(key ,locale);
}
/**
@@ -331,7 +437,7 @@ public class UIManager implements Serializable
*/
public static Icon getIcon(Object key)
{
- return (Icon) getLookAndFeel().getDefaults().get(key);
+ return (Icon) getLookAndFeelDefaults().get(key);
}
/**
@@ -339,7 +445,7 @@ public class UIManager implements Serializable
*/
public static Icon getIcon(Object key, Locale locale)
{
- return (Icon) getLookAndFeel().getDefaults().get(key, locale);
+ return (Icon) getLookAndFeelDefaults().get(key, locale);
}
/**
@@ -347,7 +453,7 @@ public class UIManager implements Serializable
*/
public static Insets getInsets(Object key)
{
- return (Insets) getLookAndFeel().getDefaults().getInsets(key);
+ return getLookAndFeelDefaults().getInsets(key);
}
/**
@@ -355,9 +461,15 @@ public class UIManager implements Serializable
*/
public static Insets getInsets(Object key, Locale locale)
{
- return (Insets) getLookAndFeel().getDefaults().getInsets(key, locale);
+ return getLookAndFeelDefaults().getInsets(key, locale);
}
+ /**
+ * Returns an array containing information about the {@link LookAndFeel}s
+ * that are installed.
+ *
+ * @return A list of the look and feels that are available (installed).
+ */
public static LookAndFeelInfo[] getInstalledLookAndFeels()
{
return installed;
@@ -365,7 +477,7 @@ public class UIManager implements Serializable
public static int getInt(Object key)
{
- Integer x = (Integer) getLookAndFeel().getDefaults().get(key);
+ Integer x = (Integer) getLookAndFeelDefaults().get(key);
if (x == null)
return 0;
return x.intValue();
@@ -373,24 +485,33 @@ public class UIManager implements Serializable
public static int getInt(Object key, Locale locale)
{
- Integer x = (Integer) getLookAndFeel().getDefaults().get(key, locale);
+ Integer x = (Integer) getLookAndFeelDefaults().get(key, locale);
if (x == null)
return 0;
return x.intValue();
}
+ /**
+ * Returns the current look and feel (which may be <code>null</code>).
+ *
+ * @return The current look and feel.
+ *
+ * @see #setLookAndFeel(LookAndFeel)
+ */
public static LookAndFeel getLookAndFeel()
{
- return look_and_feel;
+ return currentLookAndFeel;
}
/**
* Returns the <code>UIDefaults</code> table of the currently active
* look and feel.
+ *
+ * @return The {@link UIDefaults} for the current {@link LookAndFeel}.
*/
public static UIDefaults getLookAndFeelDefaults()
{
- return getLookAndFeel().getDefaults();
+ return currentUIDefaults;
}
/**
@@ -398,7 +519,7 @@ public class UIManager implements Serializable
*/
public static String getString(Object key)
{
- return (String) getLookAndFeel().getDefaults().get(key);
+ return (String) getLookAndFeelDefaults().get(key);
}
/**
@@ -406,13 +527,17 @@ public class UIManager implements Serializable
*/
public static String getString(Object key, Locale locale)
{
- return (String) getLookAndFeel().getDefaults().get(key, locale);
+ return (String) getLookAndFeelDefaults().get(key, locale);
}
/**
- * Returns the name of the LookAndFeel class that implements the
+ * Returns the name of the {@link LookAndFeel} class that implements the
* native systems look and feel if there is one, otherwise the name
* of the default cross platform LookAndFeel class.
+ *
+ * @return The fully qualified class name for the system look and feel.
+ *
+ * @see #getCrossPlatformLookAndFeelClassName()
*/
public static String getSystemLookAndFeelClassName()
{
@@ -420,18 +545,26 @@ public class UIManager implements Serializable
}
/**
- * Returns the Look and Feel object that renders the target component.
+ * Returns UI delegate from the current {@link LookAndFeel} that renders the
+ * target component.
+ *
+ * @param target the target component.
*/
public static ComponentUI getUI(JComponent target)
{
- return getDefaults().getUI(target);
+ return getLookAndFeelDefaults().getUI(target);
}
/**
* Creates a new look and feel and adds it to the current array.
+ *
+ * @param name the look and feel name.
+ * @param className the fully qualified name of the class that implements the
+ * look and feel.
*/
public static void installLookAndFeel(String name, String className)
{
+ installLookAndFeel(new LookAndFeelInfo(name, className));
}
/**
@@ -440,6 +573,7 @@ public class UIManager implements Serializable
*/
public static void installLookAndFeel(LookAndFeelInfo info)
{
+ // FIXME: not yet implemented
}
/**
@@ -447,7 +581,7 @@ public class UIManager implements Serializable
*/
public static Object put(Object key, Object value)
{
- return getLookAndFeel().getDefaults().put(key,value);
+ return getLookAndFeelDefaults().put(key,value);
}
/**
@@ -455,32 +589,56 @@ public class UIManager implements Serializable
*/
public static void setInstalledLookAndFeels(UIManager.LookAndFeelInfo[] infos)
{
+ // FIXME: not yet implemented.
}
/**
- * Set the current default look.
+ * Sets the current {@link LookAndFeel}.
+ *
+ * @param newLookAndFeel the new look and feel (<code>null</code> permitted).
+ *
+ * @throws UnsupportedLookAndFeelException if the look and feel is not
+ * supported on the current platform.
+ *
+ * @see LookAndFeel#isSupportedLookAndFeel()
*/
public static void setLookAndFeel(LookAndFeel newLookAndFeel)
throws UnsupportedLookAndFeelException
{
- if (! newLookAndFeel.isSupportedLookAndFeel())
+ if (newLookAndFeel != null && ! newLookAndFeel.isSupportedLookAndFeel())
throw new UnsupportedLookAndFeelException(newLookAndFeel.getName());
- if (look_and_feel != null)
- look_and_feel.uninitialize();
+ LookAndFeel oldLookAndFeel = currentLookAndFeel;
+ if (oldLookAndFeel != null)
+ oldLookAndFeel.uninitialize();
// Set the current default look and feel using a LookAndFeel object.
- look_and_feel = newLookAndFeel;
- look_and_feel.initialize();
-
+ currentLookAndFeel = newLookAndFeel;
+ if (newLookAndFeel != null)
+ {
+ newLookAndFeel.initialize();
+ currentUIDefaults = newLookAndFeel.getDefaults();
+ }
+ else
+ {
+ currentUIDefaults = null;
+ }
+ listeners.firePropertyChange("lookAndFeel", oldLookAndFeel, newLookAndFeel);
//revalidate();
//repaint();
}
/**
* Set the current default look and feel using a class name.
+ *
+ * @param className the look and feel class name.
+ *
+ * @throws UnsupportedLookAndFeelException if the look and feel is not
+ * supported on the current platform.
+ *
+ * @see LookAndFeel#isSupportedLookAndFeel()
*/
- public static void setLookAndFeel (String className)
+ public static void setLookAndFeel(String className)
throws ClassNotFoundException, InstantiationException, IllegalAccessException,
UnsupportedLookAndFeelException
{
diff --git a/libjava/classpath/javax/swing/ViewportLayout.java b/libjava/classpath/javax/swing/ViewportLayout.java
index 18b4912..1973583 100644
--- a/libjava/classpath/javax/swing/ViewportLayout.java
+++ b/libjava/classpath/javax/swing/ViewportLayout.java
@@ -69,7 +69,11 @@ public class ViewportLayout implements LayoutManager, Serializable
JViewport vp = (JViewport)parent;
Component view = vp.getView();
if (view != null)
- return view.getPreferredSize();
+ {
+ if (view instanceof Scrollable)
+ return ((Scrollable)view).getPreferredScrollableViewportSize();
+ return view.getPreferredSize();
+ }
else
return new Dimension();
}
@@ -120,7 +124,7 @@ public class ViewportLayout implements LayoutManager, Serializable
JViewport port = (JViewport) parent;
Component view = port.getView();
-
+
if (view == null)
return;
@@ -139,7 +143,8 @@ public class ViewportLayout implements LayoutManager, Serializable
if (portBounds.height >= viewMinimum.height)
{
portBounds.y = 0;
- viewPref.height = portBounds.height;
+ if ( !(view instanceof Scrollable) || ((Scrollable)view).getScrollableTracksViewportHeight())
+ viewPref.height = portBounds.height;
}
else
{
@@ -153,7 +158,8 @@ public class ViewportLayout implements LayoutManager, Serializable
if (portBounds.width >= viewMinimum.width)
{
portBounds.x = 0;
- viewPref.width = portBounds.width;
+ if ( !(view instanceof Scrollable) || ((Scrollable)view).getScrollableTracksViewportWidth())
+ viewPref.width = portBounds.width;
}
else
{
diff --git a/libjava/classpath/javax/swing/border/AbstractBorder.java b/libjava/classpath/javax/swing/border/AbstractBorder.java
index d755b67..951debd 100644
--- a/libjava/classpath/javax/swing/border/AbstractBorder.java
+++ b/libjava/classpath/javax/swing/border/AbstractBorder.java
@@ -118,7 +118,7 @@ public abstract class AbstractBorder
*
* @return the same object that was passed for <code>insets</code>.
*
- * @see #getBorderInsets()
+ * @see #getBorderInsets(Component)
*/
public Insets getBorderInsets (Component c, Insets insets)
{
diff --git a/libjava/classpath/javax/swing/border/BevelBorder.java b/libjava/classpath/javax/swing/border/BevelBorder.java
index e755fdc..fcdc1c6 100644
--- a/libjava/classpath/javax/swing/border/BevelBorder.java
+++ b/libjava/classpath/javax/swing/border/BevelBorder.java
@@ -172,7 +172,7 @@ public class BevelBorder
* @throws NullPointerException if <code>highlight</code> or
* <code>shadow</code> is <code>null</code>.
*
- * @see java.awt.Color.brighter()
+ * @see java.awt.Color#brighter()
*/
public BevelBorder(int bevelType, Color highlight, Color shadow)
{
@@ -289,7 +289,7 @@ public class BevelBorder
*
* @return the same object that was passed for <code>insets</code>.
*
- * @see #getBorderInsets()
+ * @see #getBorderInsets(Component)
*/
public Insets getBorderInsets(Component c, Insets insets)
{
diff --git a/libjava/classpath/javax/swing/border/EtchedBorder.java b/libjava/classpath/javax/swing/border/EtchedBorder.java
index ea2a61d..0bd76ff 100644
--- a/libjava/classpath/javax/swing/border/EtchedBorder.java
+++ b/libjava/classpath/javax/swing/border/EtchedBorder.java
@@ -246,7 +246,7 @@ public class EtchedBorder
*
* @return the same object that was passed for <code>insets</code>.
*
- * @see #getBorderInsets()
+ * @see #getBorderInsets(Component)
*/
public Insets getBorderInsets(Component c, Insets insets)
{
diff --git a/libjava/classpath/javax/swing/border/LineBorder.java b/libjava/classpath/javax/swing/border/LineBorder.java
index 00c1634..c34e38c 100644
--- a/libjava/classpath/javax/swing/border/LineBorder.java
+++ b/libjava/classpath/javax/swing/border/LineBorder.java
@@ -287,7 +287,7 @@ public class LineBorder
*
* @return the same object that was passed for <code>insets</code>.
*
- * @see #getBorderInsets()
+ * @see #getBorderInsets(Component)
*/
public Insets getBorderInsets(Component c, Insets insets)
{
diff --git a/libjava/classpath/javax/swing/border/SoftBevelBorder.java b/libjava/classpath/javax/swing/border/SoftBevelBorder.java
index fa718e3..379ecb6 100644
--- a/libjava/classpath/javax/swing/border/SoftBevelBorder.java
+++ b/libjava/classpath/javax/swing/border/SoftBevelBorder.java
@@ -120,7 +120,7 @@ public class SoftBevelBorder
* @throws NullPointerException if <code>highlight</code> or
* <code>shadow</code> is <code>null</code>.
*
- * @see java.awt.Color.brighter()
+ * @see java.awt.Color#brighter()
*/
public SoftBevelBorder(int bevelType, Color highlight, Color shadow)
{
@@ -235,7 +235,7 @@ public class SoftBevelBorder
*
* @return the same object that was passed for <code>insets</code>.
*
- * @see #getBorderInsets()
+ * @see #getBorderInsets(Component)
*/
public Insets getBorderInsets(Component c, Insets insets)
{
diff --git a/libjava/classpath/javax/swing/border/TitledBorder.java b/libjava/classpath/javax/swing/border/TitledBorder.java
index 30e4bcd..ceae2b1 100644
--- a/libjava/classpath/javax/swing/border/TitledBorder.java
+++ b/libjava/classpath/javax/swing/border/TitledBorder.java
@@ -675,7 +675,7 @@ public class TitledBorder
*
* @return the same object that was passed for <code>insets</code>.
*
- * @see #getBorderInsets()
+ * @see #getBorderInsets(Component)
*/
public Insets getBorderInsets(Component c, Insets insets)
{
@@ -1117,7 +1117,7 @@ public class TitledBorder
/**
* Determines the insets of the nested component when it has a
* TitledBorder as its border. Used by {@link
- * TitledBorder#getBorderInsets()}.
+ * TitledBorder#getBorderInsets(Component, Insets)}.
*
* @param i an Insets object for storing the results into, or
* <code>null</code> to cause the creation of a
@@ -1140,7 +1140,7 @@ public class TitledBorder
/**
* Calculates the minimum size needed for displaying the border
- * and its title. Used by {@link TitledBorder#getMiminumSize()}.
+ * and its title. Used by {@link TitledBorder#getMinimumSize(Component)}.
*/
public Dimension getMinimumSize()
{
diff --git a/libjava/classpath/javax/swing/event/DocumentEvent.java b/libjava/classpath/javax/swing/event/DocumentEvent.java
index 6a005ea..6cd8e61 100644
--- a/libjava/classpath/javax/swing/event/DocumentEvent.java
+++ b/libjava/classpath/javax/swing/event/DocumentEvent.java
@@ -1,5 +1,5 @@
/* DocumentEvent.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,47 +45,38 @@ import javax.swing.text.Element;
* @author Andrew Selkirk
* @author Ronald Veldema
*/
-public interface DocumentEvent {
-
- //-------------------------------------------------------------
- // Classes ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * ElementChange public interface
- */
- public interface ElementChange {
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getIndex
- * @returns int
- */
- int getIndex();
-
- /**
- * getElement
- * @returns Element
- */
- Element getElement();
-
- /**
- * getChildrenRemoved
- * @returns Element[]
- */
- Element[] getChildrenRemoved();
+public interface DocumentEvent
+{
+ /**
+ * ElementChange public interface
+ */
+ public static interface ElementChange
+ {
+ /**
+ * getIndex
+ * @returns int
+ */
+ int getIndex();
- /**
- * getChildrenAdded
- * @returns Element[]
- */
- Element[] getChildrenAdded();
+ /**
+ * getElement
+ * @returns Element
+ */
+ Element getElement();
+ /**
+ * getChildrenRemoved
+ * @returns Element[]
+ */
+ Element[] getChildrenRemoved();
- } // ElementChange
+ /**
+ * getChildrenAdded
+ * @returns Element[]
+ */
+ Element[] getChildrenAdded();
+
+ }
/**
* EventType
@@ -131,36 +122,35 @@ public interface DocumentEvent {
}
}
- /**
- * getType
- * @returns EventType
- */
- EventType getType();
-
- /**
- * getOffset
- * @returns int
- */
- int getOffset();
-
- /**
- * getLength
- * @returns int
- */
- int getLength();
-
- /**
- * getDocument
- * @returns Document
- */
- Document getDocument();
-
- /**
- * getChange
- * @param element TODO
- * @returns ElementChange
- */
- ElementChange getChange(Element element);
-
-
-} // DocumentEvent
+ /**
+ * getType
+ * @returns EventType
+ */
+ EventType getType();
+
+ /**
+ * getOffset
+ * @returns int
+ */
+ int getOffset();
+
+ /**
+ * getLength
+ * @returns int
+ */
+ int getLength();
+
+ /**
+ * getDocument
+ * @returns Document
+ */
+ Document getDocument();
+
+ /**
+ * getChange
+ * @param element TODO
+ * @returns ElementChange
+ */
+ ElementChange getChange(Element element);
+
+}
diff --git a/libjava/classpath/javax/swing/event/EventListenerList.java b/libjava/classpath/javax/swing/event/EventListenerList.java
index ea14d4d..3b9f4c8 100644
--- a/libjava/classpath/javax/swing/event/EventListenerList.java
+++ b/libjava/classpath/javax/swing/event/EventListenerList.java
@@ -133,7 +133,7 @@ public class EventListenerList
* @throws IllegalArgumentException if <code>listener</code> is not
* an instance of <code>t</code> (or a subclass thereof).
*
- * @throws Exception if <code>t</code> is <code>null</code>.
+ * @throws NullPointerException if <code>t</code> is <code>null</code>.
*/
public void add(Class t, EventListener listener)
{
@@ -246,7 +246,7 @@ public class EventListenerList
* @throws IllegalArgumentException if <code>listener</code> is not
* an instance of <code>t</code> (or a subclass thereof).
*
- * @throws Exception if <code>t</code> is <code>null</code>.
+ * @throws NullPointerException if <code>t</code> is <code>null</code>.
*/
public void remove(Class t, EventListener listener)
{
diff --git a/libjava/classpath/javax/swing/event/MenuKeyEvent.java b/libjava/classpath/javax/swing/event/MenuKeyEvent.java
index 48fcb45..511cb22 100644
--- a/libjava/classpath/javax/swing/event/MenuKeyEvent.java
+++ b/libjava/classpath/javax/swing/event/MenuKeyEvent.java
@@ -76,7 +76,7 @@ public class MenuKeyEvent extends KeyEvent {
* @param when Time
* @param modifiers Modifier keys
* @param keyCode Key code
- * @param keyhar Key char
+ * @param keyChar Key char
* @param path Path
* @param manager MenuSelectionManager
*/
diff --git a/libjava/classpath/javax/swing/event/SwingPropertyChangeSupport.java b/libjava/classpath/javax/swing/event/SwingPropertyChangeSupport.java
index ddbb486..408ca95 100644
--- a/libjava/classpath/javax/swing/event/SwingPropertyChangeSupport.java
+++ b/libjava/classpath/javax/swing/event/SwingPropertyChangeSupport.java
@@ -1,5 +1,5 @@
/* SwingPropertyChangeSupport.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,217 +39,299 @@ package javax.swing.event;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeListenerProxy;
import java.beans.PropertyChangeSupport;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
+import java.util.ArrayList;
import java.util.EventListener;
import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
- * SwingPropertyChangeSupport
+ * Provides a mechanism for registering {@link PropertyChangeListener}s and
+ * forwarding {@link PropertyChangeEvent}s to those listeners.
+ *
* @author Andrew Selkirk
-*/
-public final class SwingPropertyChangeSupport
- extends PropertyChangeSupport {
+ */
+public final class SwingPropertyChangeSupport
+ extends PropertyChangeSupport
+{
private static final long serialVersionUID = 7162625831330845068L;
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * listeners
- */
- private transient EventListenerList listeners;
-
- /**
- * propertyListeners
- */
- private Hashtable propertyListeners;
-
- /**
- * source
- */
- private Object source;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor SwingPropertyChangeSupport
- * @param source TODO
- */
- public SwingPropertyChangeSupport(Object source) {
- super(source);
- this.source = source;
- this.listeners = new EventListenerList();
- this.propertyListeners = new Hashtable();
- } // SwingPropertyChangeSupport()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * writeObject
- * @param stream TODO
- * @exception IOException TODO
- */
- private void writeObject(ObjectOutputStream stream) throws IOException {
- // TODO
- } // writeObject()
-
- /**
- * readObject
- * @param stream TODO
- * @exception ClassNotFoundException TODO
- * @exception IOException TODO
- */
- private void readObject(ObjectInputStream stream) throws ClassNotFoundException, IOException {
- // TODO
- } // readObject()
-
- /**
- * addPropertyChangeListener
- * @param listener TODO
- */
- public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
- listeners.add(PropertyChangeListener.class, listener);
- } // addPropertyChangeListener()
-
- /**
- * addPropertyChangeListener
- * @param propertyName TODO
- * @param listener TODO
- */
- public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
-
- // Variables
- EventListenerList list;
-
- // Get Listener list
- list = (EventListenerList) propertyListeners.get(propertyName);
- if (list == null) {
- list = new EventListenerList();
- propertyListeners.put(propertyName, list);
- } // if
-
- // Add Listeners
- list.add(PropertyChangeListener.class, listener);
-
- } // addPropertyChangeListener()
-
- /**
- * removePropertyChangeListener
- * @param listener TODO
- */
- public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
- listeners.remove(PropertyChangeListener.class, listener);
- } // removePropertyChangeListener()
-
- /**
- * removePropertyChangeListener
- * @param propertyName TODO
- * @param listener TODO
- */
- public synchronized void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
-
- // Variables
- EventListenerList list;
-
- // Get Listener list
- list = (EventListenerList) propertyListeners.get(propertyName);
- if (list == null) {
- return;
- } // if
-
- // Remove Listeners
- list.remove(PropertyChangeListener.class, listener);
-
- // Clean up propertyListeners
- if (list.getListenerCount() == 0) {
- propertyListeners.remove(propertyName);
- } // if
-
- } // removePropertyChangeListener()
-
- /**
- * firePropertyChange
- * @param propertyName TODO
- * @param oldValue TODO
- * @param newValue TODO
- */
- public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
-
- // Variables
- PropertyChangeEvent event;
-
- // Create Property Change Event
- event = new PropertyChangeEvent(source, propertyName, oldValue, newValue);
-
- // Fire Event
- firePropertyChange(event);
-
- } // firePropertyChange()
-
- /**
- * firePropertyChange
- * @param event TODO
- */
- public void firePropertyChange(PropertyChangeEvent event) {
-
- // Variables
- EventListenerList list;
- EventListener[] listenerList;
- int index;
- PropertyChangeListener listener;
-
- // Check Values if they are equal
- if (event.getOldValue() == null && event.getNewValue() == null ||
- (event.getOldValue() != null && event.getNewValue() != null &&
- event.getOldValue().equals(event.getNewValue()))) {
- return;
- } // if
-
- // Process Main Listener List
- listenerList = listeners.getListeners(PropertyChangeListener.class);
- for (index = 0; index < listenerList.length; index++) {
- listener = (PropertyChangeListener) listenerList[index];
- listener.propertyChange(event);
- } // for
-
- // Process Property Listener List
- list = (EventListenerList) propertyListeners.get(event.getPropertyName());
- if (list != null) {
- listenerList = list.getListeners(PropertyChangeListener.class);
- for (index = 0; index < listenerList.length; index++) {
- listener = (PropertyChangeListener) listenerList[index];
- listener.propertyChange(event);
- } // for
- } // if
-
- } // firePropertyChange()
-
- /**
- * hasListeners
- * @param propertyName TODO
- * @returns boolean
- */
- public synchronized boolean hasListeners(String propertyName) {
-
- // Get Listener list
- if (propertyListeners.get(propertyName) == null) {
- return false;
- } // if
-
- return true;
-
- } // hasListeners()
-
-
-} // SwingPropertyChangeSupport
+ /**
+ * Storage for the listeners that are not linked to a specific property.
+ */
+ private transient EventListenerList listeners;
+
+ /**
+ * Storage for the listeners that are linked (by name) to a specific property.
+ * The hash table maps <code>String</code> objects (the property names) to
+ * {@link EventListenerList} instances (which record the listener(s) for the
+ * given property).
+ */
+ private Hashtable propertyListeners;
+
+ /**
+ * The object that is used as the default source for the
+ * {@link PropertyChangeEvent}s generated by this class.
+ */
+ private Object source;
+
+ /**
+ * Creates a new instance.
+ *
+ * @param source the source (<code>null</code> not permitted).
+ *
+ * @throws NullPointerException if <code>source</code> is <code>null</code>.
+ */
+ public SwingPropertyChangeSupport(Object source)
+ {
+ super(source);
+ this.source = source;
+ this.listeners = new EventListenerList();
+ this.propertyListeners = new Hashtable();
+ }
+
+ /**
+ * Registers <code>listener</code> to receive notification of any future
+ * {@link PropertyChangeEvent}s generated by this instance.
+ *
+ * @param listener the listener (<code>null</code> is ignored).
+ *
+ * @see #removePropertyChangeListener(PropertyChangeListener)
+ */
+ public synchronized void addPropertyChangeListener(PropertyChangeListener
+ listener)
+ {
+ listeners.add(PropertyChangeListener.class, listener);
+ }
+
+ /**
+ * Registers <code>listener</code> to receive notification of any future
+ * {@link PropertyChangeEvent}s generated by this instance for the named
+ * property.
+ *
+ * @param propertyName the property name.
+ * @param listener the listener.
+ *
+ * @see #removePropertyChangeListener(String, PropertyChangeListener)
+ */
+ public synchronized void addPropertyChangeListener(String propertyName,
+ PropertyChangeListener listener)
+ {
+ EventListenerList list;
+ list = (EventListenerList) propertyListeners.get(propertyName);
+ if (list == null)
+ {
+ list = new EventListenerList();
+ propertyListeners.put(propertyName, list);
+ }
+ list.add(PropertyChangeListener.class, listener);
+ }
+
+ /**
+ * Removes <code>listener</code> from the list of registered listeners, so
+ * that it will no longer receive notification of property change events.
+ *
+ * @param listener the listener to remove.
+ */
+ public synchronized void removePropertyChangeListener(PropertyChangeListener
+ listener)
+ {
+ listeners.remove(PropertyChangeListener.class, listener);
+ }
+
+ /**
+ * Removes <code>listener</code> from the list of registered listeners for
+ * the named property, so that it will no longer receive notification of
+ * property change events.
+ *
+ * @param propertyName the property name.
+ * @param listener the listener to remove.
+ */
+ public synchronized void removePropertyChangeListener(String propertyName,
+ PropertyChangeListener listener)
+ {
+ EventListenerList list;
+ list = (EventListenerList) propertyListeners.get(propertyName);
+ if (list == null)
+ return;
+ list.remove(PropertyChangeListener.class, listener);
+ if (list.getListenerCount() == 0)
+ {
+ propertyListeners.remove(propertyName);
+ }
+ }
+
+ /**
+ * Returns an array of the {@link PropertyChangeListener}s registered with
+ * this <code>SwingPropertyChangeSupport</code> instance.
+ *
+ * @return The array of listeners.
+ *
+ * @since 1.4
+ */
+ public synchronized PropertyChangeListener[] getPropertyChangeListeners()
+ {
+ // fetch the named listeners first so we know how many there are
+ List namedListeners = new ArrayList();
+ Set namedListenerEntries = propertyListeners.entrySet();
+ Iterator iterator = namedListenerEntries.iterator();
+ while (iterator.hasNext())
+ {
+ Map.Entry e = (Map.Entry) iterator.next();
+ String propertyName = (String) e.getKey();
+ EventListenerList ell = (EventListenerList) e.getValue();
+ if (ell != null)
+ {
+ Object[] list = ell.getListenerList();
+ for (int i = 0; i < list.length; i += 2)
+ {
+ namedListeners.add(new PropertyChangeListenerProxy(propertyName,
+ (PropertyChangeListener) list[i + 1]));
+ }
+ }
+ }
+
+ // create an array that can hold everything
+ int size = listeners.getListenerCount() + namedListeners.size();
+ PropertyChangeListener[] result = new PropertyChangeListener[size];
+
+ // copy in the general listeners
+ Object[] list = listeners.getListenerList();
+ int index = 0;
+ for (int i = 0; i < list.length; i += 2)
+ result[index++] = (PropertyChangeListener) list[i + 1];
+
+ // ...and the named listeners
+ Iterator iterator2 = namedListeners.iterator();
+ while (iterator2.hasNext())
+ result[index++] = (PropertyChangeListenerProxy) iterator2.next();
+
+ return result;
+ }
+
+ /**
+ * Returns an array of all listeners that are registered to receive
+ * notification of changes to the named property. This includes the general
+ * listeners as well as those registered specifically for the named
+ * property.
+ *
+ * @param propertyName the property name.
+ *
+ * @return An array of all listeners for the named property.
+ */
+ public synchronized PropertyChangeListener[] getPropertyChangeListeners(
+ String propertyName)
+ {
+ EventListenerList list
+ = (EventListenerList) propertyListeners.get(propertyName);
+ if (list == null)
+ return getPropertyChangeListeners();
+ int size = listeners.getListenerCount() + list.getListenerCount();
+ PropertyChangeListener[] result = new PropertyChangeListener[size];
+
+ // copy in the general listeners
+ int index = 0;
+ for (int i = 0; i < listeners.listenerList.length; i += 2)
+ {
+ result[index++]
+ = (PropertyChangeListener) listeners.listenerList[i + 1];
+ }
+
+ // copy in the specific listeners
+ Object[] specificListeners = list.getListenerList();
+ for (int i = 0; i < specificListeners.length; i += 2)
+ {
+ result[index++] = (PropertyChangeListener) specificListeners[i + 1];
+ }
+ return result;
+ }
+
+ /**
+ * Creates a new {@link PropertyChangeEvent} using the given arguments (and
+ * the default <code>source</code> for this
+ * <code>SwingPropertyChangeSupport</code> instance) and forwards it to all
+ * registered listeners via the
+ * {@link PropertyChangeListener#propertyChange(PropertyChangeEvent)} method.
+ * <p>
+ * Note that if <code>oldValue</code> and <code>newValue</code> are non-null
+ * and equal, no listeners will be notified.
+ *
+ * @param propertyName the property name.
+ * @param oldValue the old value
+ * @param newValue the new value.
+ */
+ public void firePropertyChange(String propertyName, Object oldValue,
+ Object newValue)
+ {
+ PropertyChangeEvent event;
+ event = new PropertyChangeEvent(source, propertyName, oldValue, newValue);
+ firePropertyChange(event);
+ }
+
+ /**
+ * Forwards <code>event</code> to registered listeners.
+ * <p>
+ * Note that if the event's <code>getOldValue()</code> and
+ * <code>getNewValue()</code> methods return non-null and equal values, no
+ * listeners will be notified.
+ *
+ * @param event the event.
+ */
+ public void firePropertyChange(PropertyChangeEvent event)
+ {
+ EventListenerList list;
+ EventListener[] listenerList;
+ int index;
+ PropertyChangeListener listener;
+
+ // Check Values if they are equal
+ if (event.getOldValue() == null && event.getNewValue() == null ||
+ (event.getOldValue() != null && event.getNewValue() != null &&
+ event.getOldValue().equals(event.getNewValue())))
+ return;
+
+ // Process Main Listener List
+ listenerList = listeners.getListeners(PropertyChangeListener.class);
+ for (index = 0; index < listenerList.length; index++)
+ {
+ listener = (PropertyChangeListener) listenerList[index];
+ listener.propertyChange(event);
+ }
+
+ // Process Property Listener List
+ list = (EventListenerList) propertyListeners.get(event.getPropertyName());
+ if (list != null)
+ {
+ listenerList = list.getListeners(PropertyChangeListener.class);
+ for (index = 0; index < listenerList.length; index++)
+ {
+ listener = (PropertyChangeListener) listenerList[index];
+ listener.propertyChange(event);
+ }
+ }
+
+ }
+
+ /**
+ * Tell whether the specified property is being listened on or not. This
+ * will only return <code>true</code> if there are listeners on all
+ * properties or if there is a listener specifically on this property.
+ *
+ * @param propertyName the property that may be listened on
+ * @return whether the property is being listened on
+ * @throws NullPointerException if propertyName is null
+ */
+ public synchronized boolean hasListeners(String propertyName)
+ {
+ if (listeners.getListenerCount() > 0)
+ return true;
+ else
+ return (propertyListeners.get(propertyName) != null);
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/event/TreeSelectionEvent.java b/libjava/classpath/javax/swing/event/TreeSelectionEvent.java
index df4e0ff..9b87667 100644
--- a/libjava/classpath/javax/swing/event/TreeSelectionEvent.java
+++ b/libjava/classpath/javax/swing/event/TreeSelectionEvent.java
@@ -100,8 +100,8 @@ public class TreeSelectionEvent extends EventObject {
/**
* Constructor TreeSelectionEvent
* @param source TODO
- * @param paths TODO
- * @param areNew TODO
+ * @param path TODO
+ * @param isNew TODO
* @param oldLeadSelectionPath TODO
* @param newLeadSelectionPath TODO
*/
diff --git a/libjava/classpath/javax/swing/plaf/BorderUIResource.java b/libjava/classpath/javax/swing/plaf/BorderUIResource.java
index 1bf8540..4402bbb 100644
--- a/libjava/classpath/javax/swing/plaf/BorderUIResource.java
+++ b/libjava/classpath/javax/swing/plaf/BorderUIResource.java
@@ -556,7 +556,7 @@ public class BorderUIResource
* @param shadow the color that will be used for painting
* the shadow part of the border.
*
- * @see #EtchedBorderUIResource(int, Color, Color)
+ * @see EtchedBorderUIResource#EtchedBorderUIResource(int, Color, Color)
*/
public EtchedBorderUIResource(Color highlight, Color shadow)
{
@@ -684,7 +684,7 @@ public class BorderUIResource
* @param left the width of the border at its left edge.
* @param bottom the width of the border at its bottom edge.
* @param right the width of the border at its right edge.
- * @param matteColor the color for filling the border.
+ * @param color the color for filling the border.
*/
public MatteBorderUIResource(int top, int left,
int bottom, int right,
diff --git a/libjava/classpath/javax/swing/plaf/FileChooserUI.java b/libjava/classpath/javax/swing/plaf/FileChooserUI.java
index 87847c4..8b661e3 100644
--- a/libjava/classpath/javax/swing/plaf/FileChooserUI.java
+++ b/libjava/classpath/javax/swing/plaf/FileChooserUI.java
@@ -98,7 +98,7 @@ public abstract class FileChooserUI
* @param chooser the <code>JFileChooser</code> whose
* button text is requested.
*
- * @see javax.swing.JFileChoose#getApproveButtonText
+ * @see javax.swing.JFileChooser#getApproveButtonText
*/
public abstract String getApproveButtonText(JFileChooser chooser);
@@ -111,7 +111,7 @@ public abstract class FileChooserUI
* @param chooser the <code>JFileChooser</code> whose
* dialog title is requested.
*
- * @see javax.swing.JFileChoose#getDialogtitle
+ * @see javax.swing.JFileChooser#getDialogTitle
*/
public abstract String getDialogTitle(JFileChooser chooser);
diff --git a/libjava/classpath/javax/swing/plaf/TextUI.java b/libjava/classpath/javax/swing/plaf/TextUI.java
index 86d1f1f..dcabdfc 100644
--- a/libjava/classpath/javax/swing/plaf/TextUI.java
+++ b/libjava/classpath/javax/swing/plaf/TextUI.java
@@ -40,6 +40,7 @@ package javax.swing.plaf;
import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.Shape;
import javax.swing.text.BadLocationException;
import javax.swing.text.EditorKit;
@@ -83,9 +84,7 @@ public abstract class TextUI
* @throws BadLocationException if <code>pos</code> does not
* designate a valid position in the document model.
*
- * @see javax.swing.text.View#modelToView(int,
- * javax.swing.text.Position.Bias, int,
- * javax.swing.text.position.Bias, java.awt.Shape)
+ * @see javax.swing.text.ComponentView#modelToView(int, Shape, Position.Bias)
*/
public abstract Rectangle modelToView(JTextComponent tc, int pos)
throws BadLocationException;
@@ -113,9 +112,7 @@ public abstract class TextUI
* @throws BadLocationException if <code>pos</code> does not
* designate a valid position in the document model.
*
- * @see javax.swing.text.View#modelToView(int,
- * javax.swing.text.Position.Bias, int,
- * javax.swing.text.position.Bias, java.awt.Shape)
+ * @see javax.swing.text.ComponentView#modelToView(int, Shape, Position.Bias)
*/
public abstract Rectangle modelToView(JTextComponent tc, int pos,
Position.Bias bias)
@@ -126,10 +123,10 @@ public abstract class TextUI
* Finds the caret position which is closest to the specified visual
* location.
*
- * @param tc the <code>JTextComponent</code> for which this
+ * @param t the <code>JTextComponent</code> for which this
* delegate object provides the user interface.
*
- * @param loc the position in view coordinates.
+ * @param pt the position in view coordinates.
*
* @return the caret position which is closest to <code>loc</code>.
*
@@ -191,7 +188,7 @@ public abstract class TextUI
*
* @throws IllegalArgumentException if <code>direction</code>
* is not one of <code>Position.Bias.Forward</code>
- * or <code>Position.Biad.Backward</code>.
+ * or <code>Position.Bias.Backward</code>.
*/
public abstract int getNextVisualPositionFrom(JTextComponent tc,
int pos,
diff --git a/libjava/classpath/javax/swing/plaf/UIResource.java b/libjava/classpath/javax/swing/plaf/UIResource.java
index 1e28280..59edf56 100644
--- a/libjava/classpath/javax/swing/plaf/UIResource.java
+++ b/libjava/classpath/javax/swing/plaf/UIResource.java
@@ -40,7 +40,7 @@ package javax.swing.plaf;
/**
* This public interface is used to designate which objects were created by
- * <code>ComponentUI</code> delegates. When uninstalling the user public interface
+ * {@link ComponentUI} delegates. When uninstalling the user public interface
* renderer with <code>ComponentUI.uninstallUI()</code> the renderer
* property is set to <code>null</code>.
* <br>
@@ -50,6 +50,6 @@ package javax.swing.plaf;
* they are initialized or set to <code>null</code>.
*
* @author Brian Jones
- * @see java.lang.ComponentUI
+ * @see ComponentUI
*/
public interface UIResource { }
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java b/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java
index 4da4691..836ef22 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java
@@ -56,7 +56,7 @@ import javax.swing.border.Border;
public class BasicArrowButton extends JButton implements SwingConstants
{
/** The default size of the Arrow buttons. */
- private static int defaultSize = 10;
+ private static int defaultSize = 12;
/** The Polygon that points up. */
private static Polygon upIcon = new Polygon(new int[] { 0, 5, 9 },
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicButtonUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicButtonUI.java
index d893c5d..6c80f14 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicButtonUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicButtonUI.java
@@ -115,21 +115,21 @@ public class BasicButtonUI extends ButtonUI
*/
protected String getPropertyPrefix()
{
- return "Button";
+ return "Button.";
}
protected void installDefaults(AbstractButton b)
{
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
String prefix = getPropertyPrefix();
- focusColor = defaults.getColor(prefix + ".focus");
- b.setForeground(defaults.getColor(prefix + ".foreground"));
- b.setBackground(defaults.getColor(prefix + ".background"));
- b.setMargin(defaults.getInsets(prefix + ".margin"));
- b.setBorder(defaults.getBorder(prefix + ".border"));
- b.setIconTextGap(defaults.getInt(prefix + ".textIconGap"));
+ focusColor = defaults.getColor(prefix + "focus");
+ b.setForeground(defaults.getColor(prefix + "foreground"));
+ b.setBackground(defaults.getColor(prefix + "background"));
+ b.setMargin(defaults.getInsets(prefix + "margin"));
+ b.setBorder(defaults.getBorder(prefix + "border"));
+ b.setIconTextGap(defaults.getInt(prefix + "textIconGap"));
b.setInputMap(JComponent.WHEN_FOCUSED,
- (InputMap) defaults.get(prefix + ".focusInputMap"));
+ (InputMap) defaults.get(prefix + "focusInputMap"));
b.setOpaque(true);
}
@@ -285,7 +285,8 @@ public class BasicButtonUI extends ButtonUI
paintIcon(g, c, ir);
if (text != null)
paintText(g, b, tr, text);
- paintFocus(g, b, vr, tr, ir);
+ if (b.isFocusOwner())
+ paintFocus(g, b, vr, tr, ir);
}
/**
@@ -306,15 +307,8 @@ public class BasicButtonUI extends ButtonUI
protected void paintFocus(Graphics g, AbstractButton b, Rectangle vr,
Rectangle tr, Rectangle ir)
{
- if (b.hasFocus() && b.isFocusPainted())
- {
- Color saved_color = g.getColor();
- g.setColor(focusColor);
- Rectangle focusRect = ir.union(tr);
- g.drawRect(focusRect.x, focusRect.y,
- focusRect.width, focusRect.height);
- g.setColor(saved_color);
- }
+ // In the BasicLookAndFeel no focus border is drawn. This can be
+ // overridden in subclasses to implement such behaviour.
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
index da11898..945aea5 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
@@ -67,13 +67,13 @@ public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI
}
/**
- * DOCUMENT ME!
+ * Returns the prefix for entries in the {@link UIDefaults} table.
*
- * @return $returnType$ DOCUMENT ME!
+ * @return "CheckBoxMenuItem"
*/
protected String getPropertyPrefix()
{
- return null;
+ return "CheckBoxMenuItem";
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java
index e316732..3cf02a0 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java
@@ -57,14 +57,14 @@ public class BasicCheckBoxUI extends BasicRadioButtonUI
return defaults.getIcon("CheckBox.icon");
}
- public void installUI(final JComponent c) {
- super.installUI(c);
- }
-
- // Overridden to change method access.
+ /**
+ * Returns the prefix for entries in the {@link UIDefaults} table.
+ *
+ * @return "CheckBox."
+ */
public String getPropertyPrefix()
{
- return super.getPropertyPrefix();
+ return "CheckBox.";
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java
index 04296df..dd867f0 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java
@@ -91,7 +91,10 @@ public class BasicComboBoxEditor extends Object implements ComboBoxEditor,
*/
public void setItem(Object item)
{
- editor.setText(item.toString());
+ if (item == null)
+ editor.setText("");
+ else
+ editor.setText(item.toString());
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicDesktopPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicDesktopPaneUI.java
index b15700d..b59261b 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicDesktopPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicDesktopPaneUI.java
@@ -363,7 +363,7 @@ public class BasicDesktopPaneUI extends DesktopPaneUI
{
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- desktop.setBackground(defaults.getColor("Desktop.background"));
+ desktop.setBackground(defaults.getColor("desktop"));
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicEditorPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicEditorPaneUI.java
index 6dd15a8..d5b34d9 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicEditorPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicEditorPaneUI.java
@@ -39,30 +39,69 @@ exception statement from your version. */
package javax.swing.plaf.basic;
import javax.swing.JComponent;
+import javax.swing.JEditorPane;
import javax.swing.plaf.ComponentUI;
+import javax.swing.text.EditorKit;
import javax.swing.text.Element;
+import javax.swing.text.JTextComponent;
import javax.swing.text.PlainView;
import javax.swing.text.View;
+/**
+ * The UI class for {@link JEditorPane}s.
+ *
+ * @author original author unknown
+ * @author Roman Kennke (roman@kennke.org)
+ */
public class BasicEditorPaneUI extends BasicTextUI
{
+ /**
+ * Creates an instance of <code>BasicEditorPaneUI</code> for the text
+ * component <code>comp</code>.
+ *
+ * @param comp the component for which to create an UI
+ *
+ * @return the UI for <code>comp</code>
+ */
public static ComponentUI createUI(JComponent comp)
{
return new BasicEditorPaneUI();
}
+ /**
+ * Creates a new <code>BasicEditorPaneUI</code>
+ */
public BasicEditorPaneUI()
{
// Do nothing here.
}
+ // FIXME: Should not be overridden here but instead be handled by the
+ // JEditorPane's EditorKit. However, as long as we don't have styles in
+ // place this doesn't make much sense.
public View create(Element elem)
{
return new PlainView(elem);
}
+ /**
+ * Returns the property prefix to be used by this UI class. This is
+ * <code>EditorPane</code> in this case.
+ *
+ * @return <code>EditorPane</code>
+ */
protected String getPropertyPrefix()
{
return "EditorPane";
}
+
+ /**
+ * Gets the EditorKit for the text component.
+ *
+ * @param textComponent the text component for which to fetch the editor kit
+ */
+ public EditorKit getEditorKit(JTextComponent textComponent)
+ {
+ return ((JEditorPane) textComponent).getEditorKit();
+ }
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java
index fd34fbd..f74e922 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java
@@ -1090,7 +1090,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
// FIXME: Indent the entries in the combobox
- private void boxEntries()
+ // Made this method package private to access it from within inner classes
+ // with better performance
+ void boxEntries()
{
ArrayList parentFiles = new ArrayList();
File parent = filechooser.getCurrentDirectory();
@@ -1098,12 +1100,12 @@ public class BasicFileChooserUI extends FileChooserUI
parent = filechooser.getFileSystemView().getDefaultDirectory();
while (parent != null)
{
- String name = parent.getName();
- if (name.equals(""))
- name = parent.getAbsolutePath();
+ String name = parent.getName();
+ if (name.equals(""))
+ name = parent.getAbsolutePath();
- parentFiles.add(parentFiles.size(), name);
- parent = parent.getParentFile();
+ parentFiles.add(parentFiles.size(), name);
+ parent = parent.getParentFile();
}
if (parentFiles.size() == 0)
@@ -1509,12 +1511,12 @@ public class BasicFileChooserUI extends FileChooserUI
}
else if (e.getPropertyName().equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY))
{
- //boxEntries();
filelist.clearSelection();
filelist.revalidate();
filelist.repaint();
setDirectorySelected(false);
setDirectory(filechooser.getCurrentDirectory());
+ boxEntries();
}
else if (e.getPropertyName().equals(JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY)
|| e.getPropertyName().equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY))
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java b/libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java
index 78ee62f..757ac47 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java
@@ -609,7 +609,7 @@ public class BasicGraphicsUtils
* LineMetrics, not a FontMetrics argument. But fixing this that
* would change the public API.
*/
- SwingUtilities.layoutCompoundLabel(
+ SwingUtilities.layoutCompoundLabel(
b, // for the component orientation
b.getToolkit().getFontMetrics(b.getFont()), // see comment above
b.getText(),
@@ -630,10 +630,10 @@ public class BasicGraphicsUtils
*/
contentRect = textRect.union(iconRect);
-
+
return new Dimension(insets.left
+ contentRect.width
- + insets.right,
+ + insets.right + b.getHorizontalAlignment(),
insets.top
+ contentRect.height
+ insets.bottom);
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicIconFactory.java b/libjava/classpath/javax/swing/plaf/basic/BasicIconFactory.java
index e7aad89..56a67b0 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicIconFactory.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicIconFactory.java
@@ -1,5 +1,5 @@
/* BasicIconFactory.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,13 +44,11 @@ import java.awt.Graphics;
import java.awt.Polygon;
import java.io.Serializable;
-import javax.swing.AbstractButton;
import javax.swing.Icon;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
+import javax.swing.JCheckBoxMenuItem;
/**
- * STUBBED
+ * Creates icons for the {@link BasicLookAndFeel}.
*/
public class BasicIconFactory implements Serializable
{
@@ -70,13 +68,174 @@ public class BasicIconFactory implements Serializable
}
}
+ /**
+ * The icon used for CheckBoxes in the BasicLookAndFeel. This is an empty
+ * icon with a size of 13x13 pixels.
+ */
+ static class CheckBoxIcon
+ implements Icon
+ {
+ /**
+ * Returns the height of the icon. The BasicLookAndFeel CheckBox icon
+ * has a height of 13 pixels.
+ *
+ * @return the height of the icon
+ */
+ public int getIconHeight()
+ {
+ return 13;
+ }
- public BasicIconFactory()
+ /**
+ * Returns the width of the icon. The BasicLookAndFeel CheckBox icon
+ * has a width of 13 pixels.
+ *
+ * @return the height of the icon
+ */
+ public int getIconWidth()
+ {
+ return 13;
+ }
+
+ /**
+ * Paints the icon. The BasicLookAndFeel CheckBox icon is empty and does
+ * not need to be painted.
+ *
+ * @param c the component to be painted
+ * @param g the Graphics context to be painted with
+ * @param x the x position of the icon
+ * @param y the y position of the icon
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ // The icon is empty and needs no painting.
+ }
+ }
+
+ /**
+ * The icon used for {@link JCheckBoxMenuItem}s in the
+ * {@link BasicLookAndFeel}. This icon has a size of 9x9 pixels.
+ */
+ static class CheckBoxMenuItemIcon
+ implements Icon
{
+ /**
+ * Returns the height of the icon in pixels.
+ *
+ * @return the height of the icon
+ */
+ public int getIconHeight()
+ {
+ return 9;
+ }
+
+ /**
+ * Returns the width of the icon in pixels.
+ *
+ * @return the height of the icon
+ */
+ public int getIconWidth()
+ {
+ return 9;
+ }
+
+ /**
+ * Paints the icon.
+ *
+ * @param c the component to be painted
+ * @param g the Graphics context to be painted with
+ * @param x the x position of the icon
+ * @param y the y position of the icon
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ JCheckBoxMenuItem item = (JCheckBoxMenuItem) c;
+ if (item.isSelected())
+ {
+ // paint the check...
+ g.setColor(Color.black);
+ g.drawLine(x + 1, y + 3, x + 1, y + 4);
+ g.drawLine(x + 2, y + 4, x + 2, y + 5);
+ for (int i = 0; i < 5; i++)
+ g.drawLine(x + 3 + i, y + 5 - i, x + 3 + i, y + 6 - i);
+ }
+ }
}
+
+ /**
+ * The icon used for RadioButtons in the BasicLookAndFeel. This is an empty
+ * icon with a size of 13x13 pixels.
+ */
+ static class RadioButtonIcon
+ implements Icon
+ {
+ /**
+ * Returns the height of the icon. The BasicLookAndFeel RadioButton icon
+ * has a height of 13 pixels.
+ *
+ * @return the height of the icon
+ */
+ public int getIconHeight()
+ {
+ return 13;
+ }
+
+ /**
+ * Returns the width of the icon. The BasicLookAndFeel RadioButton icon
+ * has a width of 13 pixels.
+ *
+ * @return the height of the icon
+ */
+ public int getIconWidth()
+ {
+ return 13;
+ }
+
+ /**
+ * Paints the icon. The BasicLookAndFeel RadioButton icon is empty and does
+ * not need to be painted.
+ *
+ * @param c the component to be painted
+ * @param g the Graphics context to be painted with
+ * @param x the x position of the icon
+ * @param y the y position of the icon
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ // The icon is empty and needs no painting.
+ }
+ }
+ /** The cached CheckBoxIcon instance. */
+ private static CheckBoxIcon checkBoxIcon;
+
+ /** The cached RadioButtonIcon instance. */
+ private static RadioButtonIcon radioButtonIcon;
+
public static Icon getMenuItemCheckIcon()
{
- return new DummyIcon();
+ return new Icon()
+ {
+ public int getIconHeight()
+ {
+ return 13;
+ }
+
+ public int getIconWidth()
+ {
+ return 13;
+ }
+
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color saved = g.getColor();
+ g.setColor(Color.BLACK);
+ g.drawLine(3 + x, 5 + y, 3 + x, 9 + y);
+ g.drawLine(4 + x, 5 + y, 4 + x, 9 + y);
+ g.drawLine(5 + x, 7 + y, 9 + x, 3 + y);
+ g.drawLine(5 + x, 8 + y, 9 + x, 4 + y);
+ g.setColor(saved);
+ }
+ };
}
public static Icon getMenuItemArrowIcon()
{
@@ -114,123 +273,50 @@ public class BasicIconFactory implements Serializable
};
}
+ /**
+ * Returns an icon for CheckBoxes in the BasicLookAndFeel. CheckBox icons
+ * in the Basic L&amp;F are empty and have a size of 13x13 pixels.
+ * This method returns a shared single instance of this icon.
+ *
+ * @return an icon for CheckBoxes in the BasicLookAndFeel
+ */
public static Icon getCheckBoxIcon()
{
- return new Icon()
- {
- public int getIconHeight()
- {
- return 10;
- }
- public int getIconWidth()
- {
- return 10;
- }
- public void paintIcon(Component c, Graphics g, int x, int y)
- {
- if (c instanceof AbstractButton)
- {
- UIDefaults defaults;
- defaults = UIManager.getLookAndFeelDefaults();
- Color hi = defaults.getColor("CheckBox.highlight");
- Color low = defaults.getColor("CheckBox.darkShadow");
- Color sel = defaults.getColor("CheckBox.foreground");
- Color dim = defaults.getColor("CheckBox.shadow");
- Polygon check = new Polygon(new int[] {x+3, x+3, x+8},
- new int[] {y+5, y+9, y+3}, 3);
- AbstractButton b = (AbstractButton) c;
- Color saved = g.getColor();
- if (b.isEnabled())
- {
- g.setColor(low);
- g.drawRect(x, y, 10, 10);
- g.setColor(hi);
- g.drawRect(x+1, y+1, 10, 10);
- if (b.isSelected())
- {
- g.setColor(sel);
- if (b.isSelected())
- {
- g.drawLine(x+3, y+5, x+3, y+8);
- g.drawLine(x+4, y+5, x+4, y+8);
- g.drawLine(x+3, y+8, x+8, y+3);
- g.drawLine(x+4, y+8, x+8, y+3);
- }
- }
- }
- else
- {
- g.setColor(hi);
- g.drawRect(x, y, 10, 10);
- if (b.isSelected())
- {
- g.drawLine(x+3, y+5, x+3, y+9);
- g.drawLine(x+3, y+9, x+8, y+3);
- }
- }
- g.setColor(saved);
- }
- }
- };
+ if (checkBoxIcon == null)
+ checkBoxIcon = new CheckBoxIcon();
+ return checkBoxIcon;
}
+ /**
+ * Returns an icon for RadioButtons in the BasicLookAndFeel. RadioButton
+ * icons in the Basic L&amp;F are empty and have a size of 13x13 pixels.
+ * This method returns a shared single instance of this icon.
+ *
+ * @return an icon for RadioButtons in the BasicLookAndFeel
+ */
public static Icon getRadioButtonIcon()
{
- return new Icon()
- {
- public int getIconHeight()
- {
- return 12;
- }
- public int getIconWidth()
- {
- return 12;
- }
- public void paintIcon(Component c, Graphics g, int x, int y)
- {
- UIDefaults defaults;
- defaults = UIManager.getLookAndFeelDefaults();
- Color hi = defaults.getColor("RadioButton.highlight");
- Color low = defaults.getColor("RadioButton.darkShadow");
- Color sel = defaults.getColor("RadioButton.foreground");
- Color dim = defaults.getColor("RadioButton.shadow");
-
- if (c instanceof AbstractButton)
- {
- AbstractButton b = (AbstractButton) c;
- Color saved = g.getColor();
- if (b.isEnabled())
- {
- g.setColor(low);
- g.drawOval(x, y, 12, 12);
- g.setColor(hi);
- g.drawOval(x+1, y+1, 12, 12);
- if (b.isSelected())
- {
- g.setColor(sel);
- g.fillOval(x+4, y+4, 6, 6);
- }
- }
- else
- {
- g.setColor(hi);
- g.drawOval(x, y, 12, 12);
- if (b.isSelected())
- g.fillOval(x+4, y+4, 6, 6);
- }
- g.setColor(saved);
- }
- }
- };
+ if (radioButtonIcon == null)
+ radioButtonIcon = new RadioButtonIcon();
+ return radioButtonIcon;
}
+
+ /**
+ * Creates and returns an icon used when rendering {@link JCheckBoxMenuItem}
+ * components.
+ *
+ * @return An icon.
+ */
public static Icon getCheckBoxMenuItemIcon()
{
- return getCheckBoxIcon();
+ return new CheckBoxMenuItemIcon();
}
+
public static Icon getRadioButtonMenuItemIcon()
{
return getRadioButtonIcon();
}
+
public static Icon createEmptyFrameIcon()
{
return new DummyIcon();
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java b/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
index 91db0cb..cc26294 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
@@ -47,7 +47,6 @@ import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.LayoutManager;
-import java.awt.Polygon;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
@@ -514,18 +513,6 @@ public class BasicInternalFrameTitlePane extends JComponent
/** The button that maximizes the JInternalFrame. */
protected JButton maxButton;
- /** Active background color. */
- protected Color activeBGColor;
-
- /** Active foreground color. */
- protected Color activeFGColor;
-
- /** Inactive background color. */
- protected Color inactiveBGColor;
-
- /** Inactive foreground color. */
- protected Color inactiveFGColor;
-
/** The icon displayed in the restore button. */
protected Icon minIcon = BasicIconFactory.createEmptyFrameIcon();
@@ -592,6 +579,7 @@ public class BasicInternalFrameTitlePane extends JComponent
setOpaque(true);
setBackground(Color.LIGHT_GRAY);
+ setOpaque(true);
installTitlePane();
}
@@ -679,10 +667,10 @@ public class BasicInternalFrameTitlePane extends JComponent
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
setFont(defaults.getFont("InternalFrame.titleFont"));
- activeFGColor = defaults.getColor("InternalFrame.activeTitleForeground");
- activeBGColor = defaults.getColor("InternalFrame.activeTitleBackground");
- inactiveFGColor = defaults.getColor("InternalFrame.inactiveTitleForeground");
- inactiveBGColor = defaults.getColor("InternalFrame.inactiveTitleBackground");
+ selectedTextColor = defaults.getColor("InternalFrame.activeTitleForeground");
+ selectedTitleColor = defaults.getColor("InternalFrame.activeTitleBackground");
+ notSelectedTextColor = defaults.getColor("InternalFrame.inactiveTitleForeground");
+ notSelectedTitleColor = defaults.getColor("InternalFrame.inactiveTitleBackground");
}
/**
@@ -691,10 +679,10 @@ public class BasicInternalFrameTitlePane extends JComponent
protected void uninstallDefaults()
{
setFont(null);
- activeFGColor = null;
- activeBGColor = null;
- inactiveFGColor = null;
- inactiveBGColor = null;
+ selectedTextColor = null;
+ selectedTitleColor = null;
+ notSelectedTextColor = null;
+ notSelectedTitleColor = null;
}
/**
@@ -714,12 +702,19 @@ public class BasicInternalFrameTitlePane extends JComponent
}
/**
- * This method sets the icons in the buttons. This is a no-op method here, it
- * can be overridden by subclasses to set icons for the minimize-, maximize-
- * and close-buttons.
+ * Set icons for the minimize-, maximize- and close-buttons.
*/
protected void setButtonIcons()
{
+ Icon icon = UIManager.getIcon("InternalFrame.closeIcon");
+ if (icon != null)
+ closeButton.setIcon(icon);
+ icon = UIManager.getIcon("InternalFrame.iconifyIcon");
+ if (icon != null)
+ iconButton.setIcon(icon);
+ icon = UIManager.getIcon("InternalFrame.maximizeIcon");
+ if (icon != null)
+ maxButton.setIcon(icon);
}
/**
@@ -827,9 +822,9 @@ public class BasicInternalFrameTitlePane extends JComponent
{
Color saved = g.getColor();
if (frame.isSelected())
- g.setColor(activeFGColor);
+ g.setColor(selectedTextColor);
else
- g.setColor(inactiveFGColor);
+ g.setColor(notSelectedTextColor);
title.setText(getTitle(frame.getTitle(), fm, title.getBounds().width));
SwingUtilities.paintComponent(g, title, null, title.getBounds());
g.setColor(saved);
@@ -848,9 +843,9 @@ public class BasicInternalFrameTitlePane extends JComponent
Color bg = getBackground();
if (frame.isSelected())
- bg = activeBGColor;
+ bg = selectedTitleColor;
else
- bg = inactiveBGColor;
+ bg = notSelectedTitleColor;
g.setColor(bg);
g.fillRect(0, 0, dims.width, dims.height);
g.setColor(saved);
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java
index 1637966..8f76ea0 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java
@@ -74,7 +74,6 @@ import javax.swing.event.InternalFrameEvent;
import javax.swing.event.InternalFrameListener;
import javax.swing.event.MouseInputAdapter;
import javax.swing.event.MouseInputListener;
-import javax.swing.plaf.BorderUIResource;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.InternalFrameUI;
import javax.swing.plaf.UIResource;
@@ -1150,7 +1149,6 @@ public class BasicInternalFrameUI extends InternalFrameUI
installKeyboardActions();
frame.setOpaque(true);
- titlePane.setOpaque(true);
frame.invalidate();
}
}
@@ -1179,28 +1177,10 @@ public class BasicInternalFrameUI extends InternalFrameUI
*/
protected void installDefaults()
{
- // This is the border of InternalFrames in the BasicLookAndFeel.
- // Note that there exist entries for various border colors in
- // BasicLookAndFeel's defaults, but obviously they differ
- // from the colors that are actually used by the JDK.
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- Color borderColor = defaults.getColor("InternalFrame.borderColor");
- Border inner = BorderFactory.createLineBorder(borderColor, 1);
- Color borderDarkShadow = defaults.getColor
- ("InternalFrame.borderDarkShadow");
- Color borderHighlight = defaults.getColor
- ("InternalFrame.borderHighlight");
- Color borderShadow = defaults.getColor("InternalFrame.borderShadow");
- Color borderLight = defaults.getColor("InternalFrame.borderLight");
- Border outer = BorderFactory.createBevelBorder(BevelBorder.RAISED,
- borderShadow,
- borderHighlight,
- borderDarkShadow,
- borderShadow);
- Border border = new BorderUIResource.CompoundBorderUIResource(outer,
- inner);
+ Border border = defaults.getBorder("InternalFrame.border");
frame.setBorder(border);
-
+ frame.setFrameIcon(defaults.getIcon("InternalFrame.icon"));
// InternalFrames are invisible by default.
frame.setVisible(false);
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java
index e71e82f..bb9ce6c 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java
@@ -1,39 +1,39 @@
/* BasicLabelUI.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., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+ 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., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
package javax.swing.plaf.basic;
@@ -56,12 +56,13 @@ import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.LabelUI;
-
/**
* This is the Basic Look and Feel class for the JLabel. One BasicLabelUI
* object is used to paint all JLabels that utilize the Basic Look and Feel.
*/
-public class BasicLabelUI extends LabelUI implements PropertyChangeListener
+public class BasicLabelUI
+ extends LabelUI
+ implements PropertyChangeListener
{
/** The labelUI that is shared by all labels. */
protected static BasicLabelUI labelUI;
@@ -99,20 +100,20 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
*
* @return The preferred size.
*/
- public Dimension getPreferredSize(JComponent c)
+ public Dimension getPreferredSize(JComponent c)
{
- JLabel lab = (JLabel)c;
+ JLabel lab = (JLabel) c;
Rectangle vr = new Rectangle();
Rectangle ir = new Rectangle();
Rectangle tr = new Rectangle();
- Insets insets = lab.getInsets();
+ Insets insets = lab.getInsets();
FontMetrics fm = lab.getToolkit().getFontMetrics(lab.getFont());
layoutCL(lab, fm, lab.getText(), lab.getIcon(), vr, ir, tr);
Rectangle cr = tr.union(ir);
- return new Dimension(insets.left + cr.width + insets.right,
- insets.top + cr.height + insets.bottom);
-
- }
+ return new Dimension(insets.left + cr.width + insets.right, insets.top
+ + cr.height + insets.bottom);
+
+ }
/**
* This method returns the minimum size of the {@link JComponent} given. If
@@ -144,7 +145,7 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
/**
* The method that paints the label according to its current state.
- *
+ *
* @param g The {@link Graphics} object to paint with.
* @param c The {@link JComponent} to paint.
*/
@@ -169,26 +170,28 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
vr.width = 0;
if (vr.height < 0)
vr.height = 0;
-
+
Icon icon = (b.isEnabled()) ? b.getIcon() : b.getDisabledIcon();
String text = layoutCL(b, fm, b.getText(), icon, vr, ir, tr);
-
+
if (icon != null)
- icon.paintIcon(b, g, ir.x, ir.y);
- if (text != null && ! text.equals(""))
- {
- if (b.isEnabled())
- paintEnabledText(b, g, text, tr.x, tr.y + fm.getAscent());
- else
- paintDisabledText(b, g, text, tr.x, tr.y + fm.getAscent());
- }
+ icon.paintIcon(b, g, ir.x, ir.y);
+
+ if (text != null && !text.equals(""))
+ {
+ if (b.isEnabled())
+ paintEnabledText(b, g, text, tr.x, tr.y + fm.getAscent());
+ else
+ paintDisabledText(b, g, text, tr.x, tr.y + fm.getAscent());
+ }
+
g.setFont(saved_font);
}
/**
* This method is simply calls SwingUtilities's layoutCompoundLabel.
- *
+ *
* @param label The label to lay out.
* @param fontMetrics The FontMetrics for the font used.
* @param text The text to paint.
@@ -196,20 +199,16 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
* @param viewR The entire viewable rectangle.
* @param iconR The icon bounds rectangle.
* @param textR The text bounds rectangle.
- *
+ *
* @return A possibly clipped version of the text.
*/
- protected String layoutCL(JLabel label, FontMetrics fontMetrics,
- String text, Icon icon, Rectangle viewR,
- Rectangle iconR, Rectangle textR)
+ protected String layoutCL(JLabel label, FontMetrics fontMetrics, String text,
+ Icon icon, Rectangle viewR, Rectangle iconR, Rectangle textR)
{
return SwingUtilities.layoutCompoundLabel(label, fontMetrics, text, icon,
- label.getVerticalAlignment(),
- label.getHorizontalAlignment(),
- label.getVerticalTextPosition(),
- label.getHorizontalTextPosition(),
- viewR, iconR, textR,
- label.getIconTextGap());
+ label.getVerticalAlignment(), label.getHorizontalAlignment(), label
+ .getVerticalTextPosition(), label.getHorizontalTextPosition(),
+ viewR, iconR, textR, label.getIconTextGap());
}
/**
@@ -225,7 +224,7 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
* @param textY The y coordinate of the start of the baseline.
*/
protected void paintDisabledText(JLabel l, Graphics g, String s, int textX,
- int textY)
+ int textY)
{
Color saved_color = g.getColor();
@@ -235,14 +234,14 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
if (mnemIndex != -1)
BasicGraphicsUtils.drawStringUnderlineCharAt(g, s, mnemIndex, textX,
- textY);
+ textY);
else
g.drawString(s, textX, textY);
g.setColor(l.getBackground().darker());
if (mnemIndex != -1)
BasicGraphicsUtils.drawStringUnderlineCharAt(g, s, mnemIndex, textX + 1,
- textY + 1);
+ textY + 1);
else
g.drawString(s, textX + 1, textY + 1);
@@ -260,7 +259,7 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
* @param textY The y coordinate of the start of the baseline.
*/
protected void paintEnabledText(JLabel l, Graphics g, String s, int textX,
- int textY)
+ int textY)
{
Color saved_color = g.getColor();
g.setColor(l.getForeground());
@@ -269,7 +268,7 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
if (mnemIndex != -1)
BasicGraphicsUtils.drawStringUnderlineCharAt(g, s, mnemIndex, textX,
- textY);
+ textY);
else
g.drawString(s, textX, textY);
@@ -287,14 +286,14 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
{
super.installUI(c);
if (c instanceof JLabel)
- {
- JLabel l = (JLabel) c;
-
- installComponents(l);
- installDefaults(l);
- installListeners(l);
- installKeyboardActions(l);
- }
+ {
+ JLabel l = (JLabel) c;
+
+ installComponents(l);
+ installDefaults(l);
+ installListeners(l);
+ installKeyboardActions(l);
+ }
}
/**
@@ -308,14 +307,14 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
{
super.uninstallUI(c);
if (c instanceof JLabel)
- {
- JLabel l = (JLabel) c;
-
- uninstallKeyboardActions(l);
- uninstallListeners(l);
- uninstallDefaults(l);
- uninstallComponents(l);
- }
+ {
+ JLabel l = (JLabel) c;
+
+ uninstallKeyboardActions(l);
+ uninstallListeners(l);
+ uninstallDefaults(l);
+ uninstallComponents(l);
+ }
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicListUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicListUI.java
index 24c6cd2..841bd67 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicListUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicListUI.java
@@ -49,6 +49,7 @@ import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
+import java.awt.event.InputEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
@@ -208,12 +209,12 @@ public class BasicListUI extends ListUI
if ((evt.getKeyCode() == KeyEvent.VK_DOWN)
|| (evt.getKeyCode() == KeyEvent.VK_KP_DOWN))
{
- if (!evt.isShiftDown())
+ if (evt.getModifiers() == 0)
{
BasicListUI.this.list.clearSelection();
BasicListUI.this.list.setSelectedIndex(Math.min(lead+1,max));
}
- else
+ else if (evt.getModifiers() == InputEvent.SHIFT_MASK)
{
BasicListUI.this.list.getSelectionModel().
setLeadSelectionIndex(Math.min(lead+1,max));
@@ -222,12 +223,12 @@ public class BasicListUI extends ListUI
else if ((evt.getKeyCode() == KeyEvent.VK_UP)
|| (evt.getKeyCode() == KeyEvent.VK_KP_UP))
{
- if (!evt.isShiftDown())
+ if (evt.getModifiers() == 0)
{
BasicListUI.this.list.clearSelection();
BasicListUI.this.list.setSelectedIndex(Math.max(lead-1,0));
}
- else
+ else if (evt.getModifiers() == InputEvent.SHIFT_MASK)
{
BasicListUI.this.list.getSelectionModel().
setLeadSelectionIndex(Math.max(lead-1,0));
@@ -235,20 +236,53 @@ public class BasicListUI extends ListUI
}
else if (evt.getKeyCode() == KeyEvent.VK_PAGE_UP)
{
- // FIXME: implement, need JList.ensureIndexIsVisible to work
+ int target;
+ if (lead == BasicListUI.this.list.getFirstVisibleIndex())
+ {
+ target = Math.max
+ (0, lead - (BasicListUI.this.list.getLastVisibleIndex() -
+ BasicListUI.this.list.getFirstVisibleIndex() + 1));
+ }
+ else
+ {
+ target = BasicListUI.this.list.getFirstVisibleIndex();
+ }
+ if (evt.getModifiers() == 0)
+ BasicListUI.this.list.setSelectedIndex(target);
+ else if (evt.getModifiers() == InputEvent.SHIFT_MASK)
+ BasicListUI.this.list.getSelectionModel().
+ setLeadSelectionIndex(target);
}
else if (evt.getKeyCode() == KeyEvent.VK_PAGE_DOWN)
{
- // FIXME: implement, need JList.ensureIndexIsVisible to work
+ int target;
+ if (lead == BasicListUI.this.list.getLastVisibleIndex())
+ {
+ target = Math.min
+ (max, lead + (BasicListUI.this.list.getLastVisibleIndex() -
+ BasicListUI.this.list.getFirstVisibleIndex() + 1));
+ }
+ else
+ {
+ target = BasicListUI.this.list.getLastVisibleIndex();
+ }
+ if (evt.getModifiers() == 0)
+ BasicListUI.this.list.setSelectedIndex(target);
+ else if (evt.getModifiers() == InputEvent.SHIFT_MASK)
+ BasicListUI.this.list.getSelectionModel().
+ setLeadSelectionIndex(target);
}
else if (evt.getKeyCode() == KeyEvent.VK_BACK_SLASH
- && evt.isControlDown())
+ && (evt.getModifiers() == InputEvent.CTRL_MASK))
{
BasicListUI.this.list.clearSelection();
}
else if ((evt.getKeyCode() == KeyEvent.VK_HOME)
|| evt.getKeyCode() == KeyEvent.VK_END)
{
+ if (evt.getModifiers() != 0 &&
+ evt.getModifiers() != InputEvent.SHIFT_MASK)
+ return;
// index is either 0 for HOME, or last cell for END
int index = (evt.getKeyCode() == KeyEvent.VK_HOME) ? 0 : max;
@@ -264,16 +298,23 @@ public class BasicListUI extends ListUI
setLeadSelectionIndex(index);
}
else if ((evt.getKeyCode() == KeyEvent.VK_A || evt.getKeyCode()
- == KeyEvent.VK_SLASH) && evt.isControlDown())
+ == KeyEvent.VK_SLASH) && (evt.getModifiers() ==
+ InputEvent.CTRL_MASK))
{
BasicListUI.this.list.setSelectionInterval(0, max);
+ // this next line is to restore the lead selection index to the old
+ // position, because select-all should not change the lead index
+ BasicListUI.this.list.addSelectionInterval(lead, lead);
}
- else if (evt.getKeyCode() == KeyEvent.VK_SPACE && evt.isControlDown())
+ else if (evt.getKeyCode() == KeyEvent.VK_SPACE &&
+ (evt.getModifiers() == InputEvent.CTRL_MASK))
{
BasicListUI.this.list.getSelectionModel().
setLeadSelectionIndex(Math.min(lead+1,max));
}
-
+
+ BasicListUI.this.list.ensureIndexIsVisible
+ (BasicListUI.this.list.getLeadSelectionIndex());
}
}
@@ -295,17 +336,7 @@ public class BasicListUI extends ListUI
int index = BasicListUI.this.locationToIndex(list, click);
if (index == -1)
return;
- if (event.isControlDown())
- {
- if (BasicListUI.this.list.getSelectionMode() ==
- ListSelectionModel.SINGLE_SELECTION)
- BasicListUI.this.list.setSelectedIndex(index);
- else if (BasicListUI.this.list.isSelectedIndex(index))
- BasicListUI.this.list.removeSelectionInterval(index,index);
- else
- BasicListUI.this.list.addSelectionInterval(index,index);
- }
- else if (event.isShiftDown())
+ if (event.isShiftDown())
{
if (BasicListUI.this.list.getSelectionMode() ==
ListSelectionModel.SINGLE_SELECTION)
@@ -329,8 +360,21 @@ public class BasicListUI extends ListUI
BasicListUI.this.list.getSelectionModel().
setLeadSelectionIndex(index);
}
+ else if (event.isControlDown())
+ {
+ if (BasicListUI.this.list.getSelectionMode() ==
+ ListSelectionModel.SINGLE_SELECTION)
+ BasicListUI.this.list.setSelectedIndex(index);
+ else if (BasicListUI.this.list.isSelectedIndex(index))
+ BasicListUI.this.list.removeSelectionInterval(index,index);
+ else
+ BasicListUI.this.list.addSelectionInterval(index,index);
+ }
else
BasicListUI.this.list.setSelectedIndex(index);
+
+ BasicListUI.this.list.ensureIndexIsVisible
+ (BasicListUI.this.list.getLeadSelectionIndex());
}
/**
@@ -843,11 +887,11 @@ public class BasicListUI extends ListUI
ListCellRenderer rend, ListModel data,
ListSelectionModel sel, int lead)
{
- boolean is_sel = list.isSelectedIndex(row);
- boolean has_focus = false;
+ boolean isSel = list.isSelectedIndex(row);
+ boolean hasFocus = (list.getLeadSelectionIndex() == row) && BasicListUI.this.list.hasFocus();
Component comp = rend.getListCellRendererComponent(list,
data.getElementAt(row),
- 0, is_sel, has_focus);
+ 0, isSel, hasFocus);
//comp.setBounds(new Rectangle(0, 0, bounds.width, bounds.height));
//comp.paint(g);
rendererPane.paintComponent(g, comp, list, bounds);
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java b/libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java
index 14fe28f..d35ac9e 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java
@@ -57,6 +57,7 @@ import javax.swing.plaf.BorderUIResource;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.DimensionUIResource;
import javax.swing.plaf.FontUIResource;
+import javax.swing.plaf.IconUIResource;
import javax.swing.plaf.InsetsUIResource;
import javax.swing.text.JTextComponent;
@@ -276,7 +277,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"Button.shadow", new ColorUIResource(Color.GRAY),
"Button.textIconGap", new Integer(4),
"Button.textShiftOffset", new Integer(0),
- "CheckBox.background", new ColorUIResource(light),
+ "CheckBox.background", new ColorUIResource(new Color(204, 204, 204)),
"CheckBox.border", new BorderUIResource.CompoundBorderUIResource(null,
null),
"CheckBox.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
@@ -285,21 +286,43 @@ public abstract class BasicLookAndFeel extends LookAndFeel
}),
"CheckBox.font", new FontUIResource("Dialog", Font.PLAIN, 12),
"CheckBox.foreground", new ColorUIResource(darkShadow),
- "CheckBox.icon", BasicIconFactory.getCheckBoxIcon(),
+ "CheckBox.icon",
+ new UIDefaults.LazyValue()
+ {
+ public Object createValue(UIDefaults def)
+ {
+ return BasicIconFactory.getCheckBoxIcon();
+ }
+ },
+ "CheckBox.checkIcon",
+ new UIDefaults.LazyValue()
+ {
+ public Object createValue(UIDefaults def)
+ {
+ return BasicIconFactory.getMenuItemCheckIcon();
+ }
+ },
"CheckBox.margin",new InsetsUIResource(2, 2, 2, 2),
"CheckBox.textIconGap", new Integer(4),
"CheckBox.textShiftOffset", new Integer(0),
"CheckBoxMenuItem.acceleratorFont", new FontUIResource("Dialog",
Font.PLAIN, 12),
"CheckBoxMenuItem.acceleratorForeground",
- new ColorUIResource(darkShadow),
+ new ColorUIResource(new Color(16, 16, 16)),
"CheckBoxMenuItem.acceleratorSelectionForeground",
new ColorUIResource(Color.white),
"CheckBoxMenuItem.arrowIcon", BasicIconFactory.getMenuItemArrowIcon(),
"CheckBoxMenuItem.background", new ColorUIResource(light),
"CheckBoxMenuItem.border", new BasicBorders.MarginBorder(),
"CheckBoxMenuItem.borderPainted", Boolean.FALSE,
- "CheckBoxMenuItem.checkIcon", BasicIconFactory.getCheckBoxMenuItemIcon(),
+ "CheckBoxMenuItem.checkIcon",
+ new UIDefaults.LazyValue()
+ {
+ public Object createValue(UIDefaults def)
+ {
+ return BasicIconFactory.getCheckBoxMenuItemIcon();
+ }
+ },
"CheckBoxMenuItem.font", new FontUIResource("Dialog", Font.PLAIN, 12),
"CheckBoxMenuItem.foreground", new ColorUIResource(darkShadow),
"CheckBoxMenuItem.margin", new InsetsUIResource(2, 2, 2, 2),
@@ -371,7 +394,6 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"ctrl F10", "maximize",
"ctrl alt shift F6","selectPreviousFrame"
}),
- "Desktop.background", new ColorUIResource(0, 92, 92),
"DesktopIcon.border", new BorderUIResource.CompoundBorderUIResource(null,
null),
"EditorPane.background", new ColorUIResource(Color.white),
@@ -480,15 +502,22 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"InternalFrame.borderLight", new ColorUIResource(Color.LIGHT_GRAY),
"InternalFrame.borderShadow", new ColorUIResource(Color.GRAY),
"InternalFrame.closeIcon", BasicIconFactory.createEmptyFrameIcon(),
- // XXX Don't use gif
-// "InternalFrame.icon", new IconUIResource(new ImageIcon("icons/JavaCup.gif")),
+ // FIXME: Set a nice icon for InternalFrames here.
+ "InternalFrame.icon",
+ new UIDefaults.LazyValue()
+ {
+ public Object createValue(UIDefaults def)
+ {
+ return new IconUIResource(BasicIconFactory.createEmptyFrameIcon());
+ }
+ },
"InternalFrame.iconifyIcon", BasicIconFactory.createEmptyFrameIcon(),
"InternalFrame.inactiveTitleBackground", new ColorUIResource(Color.gray),
"InternalFrame.inactiveTitleForeground",
new ColorUIResource(Color.lightGray),
"InternalFrame.maximizeIcon", BasicIconFactory.createEmptyFrameIcon(),
"InternalFrame.minimizeIcon", BasicIconFactory.createEmptyFrameIcon(),
- "InternalFrame.titleFont", new FontUIResource("Dialog", Font.PLAIN, 12),
+ "InternalFrame.titleFont", new FontUIResource("Dialog", Font.BOLD, 12),
"InternalFrame.windowBindings", new Object[] {
"shift ESCAPE", "showSystemMenu",
"ctrl SPACE", "showSystemMenu",
@@ -524,6 +553,9 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"List.foreground", new ColorUIResource(darkShadow),
"List.selectionBackground", new ColorUIResource(Color.black),
"List.selectionForeground", new ColorUIResource(Color.white),
+ "List.focusCellHighlightBorder",
+ new BorderUIResource.
+ LineBorderUIResource(new ColorUIResource(Color.yellow)),
"Menu.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12),
"Menu.acceleratorForeground", new ColorUIResource(darkShadow),
"Menu.acceleratorSelectionForeground", new ColorUIResource(Color.white),
@@ -613,7 +645,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
null, null),
"PasswordField.caretBlinkRate", new Integer(500),
"PasswordField.caretForeground", new ColorUIResource(Color.black),
- "PasswordField.font", new FontUIResource("MonoSpaced", Font.PLAIN, 12),
+ "PasswordField.font", new FontUIResource("Dialog", Font.PLAIN, 12),
"PasswordField.foreground", new ColorUIResource(Color.black),
"PasswordField.inactiveBackground", new ColorUIResource(light),
"PasswordField.inactiveForeground", new ColorUIResource(Color.gray),
@@ -649,7 +681,14 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"RadioButton.font", new FontUIResource("Dialog", Font.PLAIN, 12),
"RadioButton.foreground", new ColorUIResource(darkShadow),
"RadioButton.highlight", new ColorUIResource(highLight),
- "RadioButton.icon", BasicIconFactory.getRadioButtonIcon(),
+ "RadioButton.icon",
+ new UIDefaults.LazyValue()
+ {
+ public Object createValue(UIDefaults def)
+ {
+ return BasicIconFactory.getRadioButtonIcon();
+ }
+ },
"RadioButton.light", new ColorUIResource(highLight),
"RadioButton.margin", new InsetsUIResource(2, 2, 2, 2),
"RadioButton.shadow", new ColorUIResource(shadow),
@@ -748,7 +787,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"Slider.highlight", new ColorUIResource(highLight),
"Slider.shadow", new ColorUIResource(shadow),
"Slider.thumbHeight", new Integer(20),
- "Slider.thumbWidth", new Integer(10),
+ "Slider.thumbWidth", new Integer(11),
"Slider.tickHeight", new Integer(12),
"Spinner.background", new ColorUIResource(light),
"Spinner.foreground", new ColorUIResource(light),
@@ -838,13 +877,24 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"shift KP_DOWN", "selectNextRowExtendSelection",
"shift KP_LEFT", "selectPreviousColumnExtendSelection",
"ESCAPE", "cancel",
- "ctrl shift PAGE_UP", "scrollRightExtendSelection",
- "shift KP_RIGHT", " selectNextColumnExtendSelection",
+ "ctrl shift PAGE_UP", "scrollLeftExtendSelection",
+ "shift KP_RIGHT", "selectNextColumnExtendSelection",
"ctrl PAGE_UP", "scrollLeftChangeSelection",
"shift PAGE_UP", "scrollUpExtendSelection",
- "ctrl shift PAGE_DOWN", "scrollLeftExtendSelection",
+ "ctrl shift PAGE_DOWN", "scrollRightExtendSelection",
"ctrl PAGE_DOWN", "scrollRightChangeSelection",
- "PAGE_UP", "scrollUpChangeSelection"
+ "PAGE_UP", "scrollUpChangeSelection",
+ "ctrl shift LEFT", "selectPreviousColumnExtendSelection",
+ "shift KP_UP", "selectPreviousRowExtendSelection",
+ "ctrl shift UP", "selectPreviousRowExtendSelection",
+ "ctrl shift RIGHT", "selectNextColumnExtendSelection",
+ "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
+ "ctrl shift DOWN", "selectNextRowExtendSelection",
+ "ctrl BACK_SLASH", "clearSelection",
+ "ctrl shift KP_UP", "selectPreviousRowExtendSelection",
+ "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
+ "ctrl SLASH", "selectAll",
+ "ctrl shift KP_DOWN", "selectNextRowExtendSelection",
}),
"Table.background", new ColorUIResource(light),
"Table.focusCellBackground", new ColorUIResource(light),
@@ -1000,7 +1050,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"shift END", "selectLastExtendSelection",
"HOME", "selectFirst",
"ctrl END", "selectLastChangeLead",
- "ctrl /", "selectAll",
+ "ctrl SLASH", "selectAll",
"LEFT", "selectParent",
"shift HOME", "selectFirstExtendSelection",
"UP", "selectPrevious",
@@ -1027,7 +1077,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"shift KP_DOWN","selectNextExtendSelection",
"ctrl SPACE", "toggleSelectionPreserveAnchor",
"ctrl shift PAGE_UP", "scrollUpExtendSelection",
- "ctrl \\", "clearSelection",
+ "ctrl BACK_SLASH", "clearSelection",
"shift SPACE", "extendSelection",
"ctrl PAGE_UP", "scrollUpChangeLead",
"shift PAGE_UP","scrollUpExtendSelection",
@@ -1046,6 +1096,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"Tree.selectionBackground", new ColorUIResource(Color.black),
"Tree.nonSelectionBackground", new ColorUIResource(new Color(239, 235, 231)),
"Tree.selectionBorderColor", new ColorUIResource(Color.black),
+ "Tree.selectionBorder", new BorderUIResource.LineBorderUIResource(Color.black),
"Tree.selectionForeground", new ColorUIResource(new Color(255, 255, 255)),
"Tree.textBackground", new ColorUIResource(new Color(255, 255, 255)),
"Tree.textForeground", new ColorUIResource(Color.black),
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java
index a5bf082..8aa1193 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java
@@ -295,7 +295,7 @@ public class BasicMenuItemUI extends MenuItemUI
* Returns preferred size for the given menu item.
*
* @param c menu item for which to get preferred size
- * @param checkIcon chech icon displayed in the given menu item
+ * @param checkIcon check icon displayed in the given menu item
* @param arrowIcon arrow icon displayed in the given menu item
* @param defaultTextIconGap space between icon and text in the given menuItem
*
@@ -355,12 +355,18 @@ public class BasicMenuItemUI extends MenuItemUI
*/
public Dimension getPreferredSize(JComponent c)
{
- return getPreferredMenuItemSize(c, checkIcon, arrowIcon, defaultTextIconGap);
+ return getPreferredMenuItemSize(c, checkIcon, arrowIcon,
+ defaultTextIconGap);
}
+ /**
+ * Returns the prefix for entries in the {@link UIDefaults} table.
+ *
+ * @return "MenuItem"
+ */
protected String getPropertyPrefix()
{
- return null;
+ return "MenuItem";
}
/**
@@ -507,7 +513,8 @@ public class BasicMenuItemUI extends MenuItemUI
br.height += insets.top + insets.bottom;
// Menu item is considered to be highlighted when it is selected.
- if (m.isSelected() || m.getModel().isArmed() &&
+ // But we don't want to paint the background of JCheckBoxMenuItems
+ if ((m.isSelected() && checkIcon == null) || m.getModel().isArmed() &&
(m.getParent() instanceof MenuElement))
{
if (m.isContentAreaFilled())
@@ -531,8 +538,7 @@ public class BasicMenuItemUI extends MenuItemUI
SwingUtilities.layoutCompoundLabel(m, fm, null, checkIcon, vertAlign,
horAlign, vertTextPos, horTextPos,
vr, cr, tr, defaultTextIconGap);
- checkIcon.paintIcon(m, g, cr.x, cr.y);
-
+ checkIcon.paintIcon(m, g, cr.x, cr.y);
// We need to calculate position of the menu text and position of
// user menu icon if there exists one relative to the check icon.
// So we need to adjust view rectangle s.t. its starting point is at
@@ -561,7 +567,6 @@ public class BasicMenuItemUI extends MenuItemUI
defaultTextIconGap);
if (i != null)
i.paintIcon(c, g, ir.x, ir.y);
-
paintText(g, m, tr, m.getText());
// paint accelerator
@@ -605,7 +610,8 @@ public class BasicMenuItemUI extends MenuItemUI
if (menuItem.isEnabled())
{
// Menu item is considered to be highlighted when it is selected.
- if (menuItem.isSelected() || menuItem.getModel().isArmed() &&
+ // But not if it's a JCheckBoxMenuItem
+ if ((menuItem.isSelected() && checkIcon == null) || menuItem.getModel().isArmed() &&
(menuItem.getParent() instanceof MenuElement))
g.setColor(selectionForeground);
else
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicMenuUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicMenuUI.java
index 6bd15ed..30be592 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicMenuUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicMenuUI.java
@@ -46,6 +46,7 @@ import java.beans.PropertyChangeListener;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.MenuSelectionManager;
import javax.swing.UIDefaults;
@@ -179,12 +180,23 @@ public class BasicMenuUI extends BasicMenuItemUI
*/
public Dimension getMaximumSize(JComponent c)
{
+ // If this menu is in a popup menu, treat it like a regular JMenuItem
+ if (!((JMenu)c).isTopLevelMenu())
+ {
+ JMenuItem menuItem = new JMenuItem(((JMenu)c).getText(), ((JMenu)c).getIcon());
+ return menuItem.getMaximumSize();
+ }
return c.getPreferredSize();
}
+ /**
+ * Returns the prefix for entries in the {@link UIDefaults} table.
+ *
+ * @return "Menu"
+ */
protected String getPropertyPrefix()
{
- return null;
+ return "Menu";
}
/**
@@ -294,14 +306,17 @@ public class BasicMenuUI extends BasicMenuItemUI
private boolean popupVisible()
{
- JMenuBar mb = (JMenuBar) ((JMenu)menuItem).getParent();
+ JMenuBar mb = (JMenuBar) ((JMenu) menuItem).getParent();
// check if mb.isSelected because if no menus are selected
// we don't have to look through the list for popup menus
if (!mb.isSelected())
return false;
- for (int i=0;i<mb.getMenuCount();i++)
- if (((JMenu)mb.getComponent(i)).isPopupMenuVisible())
+ for (int i = 0; i < mb.getMenuCount(); i++)
+ {
+ JMenu m = mb.getMenu(i);
+ if (m != null && m.isPopupMenuVisible())
return true;
+ }
return false;
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java
index ce29f24..c9f6232 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java
@@ -910,7 +910,9 @@ public class BasicOptionPaneUI extends OptionPaneUI
*/
protected Container createSeparator()
{
- return (Container) Box.createVerticalStrut(17);
+ // FIXME: Figure out what this method is supposed to return and where
+ // this should be added to the OptionPane.
+ return null;
}
/**
@@ -1115,6 +1117,10 @@ public class BasicOptionPaneUI extends OptionPaneUI
optionPane.add(msg);
}
+ // FIXME: Figure out if the separator should be inserted here or what
+ // this thing is supposed to do. Note: The JDK does NOT insert another
+ // component at this place. The JOptionPane only has two panels in it
+ // and there actually are applications that depend on this beeing so.
Container sep = createSeparator();
if (sep != null)
optionPane.add(sep);
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicPanelUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicPanelUI.java
index 0896721..b715c57 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicPanelUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicPanelUI.java
@@ -40,6 +40,8 @@ package javax.swing.plaf.basic;
import javax.swing.JComponent;
import javax.swing.JPanel;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.PanelUI;
@@ -62,6 +64,8 @@ public class BasicPanelUI extends PanelUI
public void installDefaults(JPanel p)
{
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ p.setBackground(defaults.getColor("Panel.background"));
p.setOpaque(true);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
index d5cd7f4..fa74a00 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
@@ -77,13 +77,13 @@ public class BasicRadioButtonMenuItemUI extends BasicMenuItemUI
}
/**
- * DOCUMENT ME!
+ * Returns the prefix for entries in the {@link UIDefaults} table.
*
- * @return $returnType$ DOCUMENT ME!
+ * @return "RadioButtonMenuItem"
*/
protected String getPropertyPrefix()
{
- return null;
+ return "RadioButtonMenuItem";
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java
index 38e117b..fbd2124 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java
@@ -38,50 +38,125 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+
import javax.swing.AbstractButton;
import javax.swing.Icon;
import javax.swing.JComponent;
+import javax.swing.SwingUtilities;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
+/**
+ * The BasicLookAndFeel UI implementation for
+ * {@link javax.swing.JRadioButton}s.
+ */
public class BasicRadioButtonUI extends BasicToggleButtonUI
{
-
+ /**
+ * The default icon for JRadioButtons. The default icon displays the usual
+ * RadioButton and is sensible to the selection state of the button,
+ * and can be used both as normal icon as well as selectedIcon.
+ */
protected Icon icon;
+ /**
+ * Creates and returns a new instance of <code>BasicRadioButtonUI</code>.
+ *
+ * @return a new instance of <code>BasicRadioButtonUI</code>
+ */
public static ComponentUI createUI(final JComponent c) {
return new BasicRadioButtonUI();
}
+ /**
+ * Creates a new instance of <code>BasicButtonUI</code>.
+ */
public BasicRadioButtonUI()
{
icon = getDefaultIcon();
}
- public void installUI(final JComponent c) {
- super.installUI(c);
- if (c instanceof AbstractButton)
- {
- AbstractButton b = (AbstractButton) c;
- b.setIcon(icon);
- }
+ /**
+ * Installs defaults from the Look &amp; Feel table on the specified
+ * button.
+ *
+ * @param b the button on which to install the defaults
+ */
+ protected void installDefaults(AbstractButton b)
+ {
+ super.installDefaults(b);
+ if (b.getIcon() == null)
+ b.setIcon(icon);
+ if (b.getSelectedIcon() == null)
+ b.setSelectedIcon(icon);
}
+ /**
+ * Returns the prefix used for UIDefaults properties. This is
+ * <code>RadioButton</code> in this case.
+ *
+ * @return the prefix used for UIDefaults properties
+ */
+ protected String getPropertyPrefix()
+ {
+ return "RadioButton.";
+ }
+
+ /**
+ * Returns the default icon for JRadioButtons.
+ * The default icon displays the usual
+ * RadioButton and is sensible to the selection state of the button,
+ * and can be used both as normal icon as well as selectedIcon.
+ *
+ * @return the default icon for JRadioButtons
+ */
public Icon getDefaultIcon()
{
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- return defaults.getIcon("RadioButton.icon");
+ return defaults.getIcon(getPropertyPrefix() + "icon");
}
-
-}
-
-
-
-
+ /**
+ * Paints the RadioButton.
+ *
+ * @param g the Graphics context to paint with
+ * @param c the button to paint
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ AbstractButton b = (AbstractButton) c;
+ Rectangle tr = new Rectangle();
+ Rectangle ir = new Rectangle();
+ Rectangle vr = new Rectangle();
+ Font f = c.getFont();
+ g.setFont(f);
+ Icon currentIcon = null;
+ if (b.isSelected())
+ currentIcon = b.getSelectedIcon();
+ else
+ currentIcon = b.getIcon();
+ SwingUtilities.calculateInnerArea(b, vr);
+ String text = SwingUtilities.layoutCompoundLabel
+ (c, g.getFontMetrics(f), b.getText(), currentIcon,
+ b.getVerticalAlignment(), b.getHorizontalAlignment(),
+ b.getVerticalTextPosition(), b.getHorizontalTextPosition(),
+ vr, ir, tr, b.getIconTextGap() + defaultTextShiftOffset);
+
+ if (currentIcon != null)
+ {
+ currentIcon.paintIcon(c, g, ir.x, ir.y);
+ }
+ if (text != null)
+ paintText(g, b, tr, text);
+ paintFocus(g, b, vr, tr, ir);
+ }
+}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java
index 892db2b..22242af 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java
@@ -659,7 +659,6 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
height = Math.max(incrButton.getPreferredSize().height,
decrButton.getPreferredSize().height);
height = Math.max(getMinimumThumbSize().height, height);
- height = Math.max(20, height);
height = Math.min(getMaximumThumbSize().height, height);
}
else
@@ -672,7 +671,6 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
width = Math.max(incrButton.getPreferredSize().width,
decrButton.getPreferredSize().width);
width = Math.max(getMinimumThumbSize().width, width);
- width = Math.max(20, width);
width = Math.min(getMaximumThumbSize().width, width);
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java
index 7bb7acf..bd1576f 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java
@@ -102,14 +102,6 @@ public class BasicScrollPaneUI extends ScrollPaneUI
return sl.minimumLayoutSize(c);
}
- public Dimension getPreferredSize(JComponent c)
- {
- JScrollPane p = (JScrollPane ) c;
- ScrollPaneLayout sl = (ScrollPaneLayout) p.getLayout();
- return sl.preferredLayoutSize(c);
- }
-
-
public void paint(Graphics g, JComponent c)
{
// do nothing; the normal painting-of-children algorithm, along with
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java
index 0a72a62..0b40584 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java
@@ -470,15 +470,6 @@ public class BasicSliderUI extends SliderUI
}
}
- /** The preferred height of the thumb. */
- private transient int thumbHeight;
-
- /** The preferred width of the thumb. */
- private transient int thumbWidth;
-
- /** The preferred height of the tick rectangle. */
- private transient int tickHeight;
-
/** Listener for changes from the model. */
protected ChangeListener changeListener;
@@ -698,11 +689,6 @@ public class BasicSliderUI extends SliderUI
focusColor = defaults.getColor("Slider.focus");
slider.setBorder(defaults.getBorder("Slider.border"));
slider.setOpaque(true);
-
- thumbHeight = defaults.getInt("Slider.thumbHeight");
- thumbWidth = defaults.getInt("Slider.thumbWidth");
- tickHeight = defaults.getInt("Slider.tickHeight");
-
focusInsets = defaults.getInsets("Slider.focusInsets");
}
@@ -899,11 +885,11 @@ public class BasicSliderUI extends SliderUI
width += insets.left + insets.right + focusInsets.left + focusInsets.right;
// Height is determined by the thumb, the ticks and the labels.
- int height = thumbHeight;
+ int height = getThumbSize().height;
if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0
|| slider.getMinorTickSpacing() > 0)
- height += tickHeight;
+ height += getTickLength();
if (slider.getPaintLabels())
height += getHeightOfTallestLabel();
@@ -934,11 +920,11 @@ public class BasicSliderUI extends SliderUI
height += insets.top + insets.bottom + focusInsets.top
+ focusInsets.bottom;
- int width = thumbHeight;
+ int width = getThumbSize().width;
if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0
|| slider.getMinorTickSpacing() > 0)
- width += tickHeight;
+ width += getTickLength();
if (slider.getPaintLabels())
width += getWidthOfWidestLabel();
@@ -956,7 +942,21 @@ public class BasicSliderUI extends SliderUI
*/
public Dimension getMinimumHorizontalSize()
{
- return getPreferredHorizontalSize();
+ Insets insets = slider.getInsets();
+ // Height is determined by the thumb, the ticks and the labels.
+ int height = getThumbSize().height;
+
+ if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0
+ || slider.getMinorTickSpacing() > 0)
+ height += getTickLength();
+
+ if (slider.getPaintLabels())
+ height += getHeightOfTallestLabel();
+
+ height += insets.top + insets.bottom + focusInsets.top
+ + focusInsets.bottom;
+
+ return new Dimension(36, height);
}
/**
@@ -967,7 +967,19 @@ public class BasicSliderUI extends SliderUI
*/
public Dimension getMinimumVerticalSize()
{
- return getPreferredVerticalSize();
+ Insets insets = slider.getInsets();
+ int width = getThumbSize().width;
+
+ if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0
+ || slider.getMinorTickSpacing() > 0)
+ width += getTickLength();
+
+ if (slider.getPaintLabels())
+ width += getWidthOfWidestLabel();
+
+ width += insets.left + insets.right + focusInsets.left + focusInsets.right;
+
+ return new Dimension(width, 36);
}
/**
@@ -999,15 +1011,14 @@ public class BasicSliderUI extends SliderUI
public Dimension getMinimumSize(JComponent c)
{
if (slider.getOrientation() == JSlider.HORIZONTAL)
- return getPreferredHorizontalSize();
+ return getMinimumHorizontalSize();
else
- return getPreferredVerticalSize();
+ return getMinimumVerticalSize();
}
/**
* This method returns the maximum size for this {@link JSlider} for this
- * look and feel. If it returns null, then it is up to the Layout Manager
- * to give the {@link JComponent} a size.
+ * look and feel.
*
* @param c The {@link JComponent} to find a maximum size for.
*
@@ -1015,10 +1026,40 @@ public class BasicSliderUI extends SliderUI
*/
public Dimension getMaximumSize(JComponent c)
{
+ Insets insets = slider.getInsets();
if (slider.getOrientation() == JSlider.HORIZONTAL)
- return getPreferredHorizontalSize();
+ {
+ // Height is determined by the thumb, the ticks and the labels.
+ int height = getThumbSize().height;
+
+ if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0
+ || slider.getMinorTickSpacing() > 0)
+ height += getTickLength();
+
+ if (slider.getPaintLabels())
+ height += getHeightOfTallestLabel();
+
+ height += insets.top + insets.bottom + focusInsets.top
+ + focusInsets.bottom;
+
+ return new Dimension(32767, height);
+ }
else
- return getPreferredVerticalSize();
+ {
+ int width = getThumbSize().width;
+
+ if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0
+ || slider.getMinorTickSpacing() > 0)
+ width += getTickLength();
+
+ if (slider.getPaintLabels())
+ width += getWidthOfWidestLabel();
+
+ width += insets.left + insets.right + focusInsets.left
+ + focusInsets.right;
+
+ return new Dimension(width, 32767);
+ }
}
/**
@@ -1045,7 +1086,6 @@ public class BasicSliderUI extends SliderUI
{
insetCache = slider.getInsets();
focusRect = SwingUtilities.calculateInnerArea(slider, focusRect);
-
if (focusRect.width < 0)
focusRect.width = 0;
if (focusRect.height < 0)
@@ -1058,30 +1098,13 @@ public class BasicSliderUI extends SliderUI
*/
protected void calculateThumbSize()
{
+ Dimension d = getThumbSize();
+ thumbRect.width = d.width;
+ thumbRect.height = d.height;
if (slider.getOrientation() == JSlider.HORIZONTAL)
- {
- if (thumbWidth > contentRect.width)
- thumbRect.width = contentRect.width / 4;
- else
- thumbRect.width = thumbWidth;
- if (thumbHeight > contentRect.height)
- thumbRect.height = contentRect.height;
- else
- thumbRect.height = thumbHeight;
- }
+ thumbRect.y = trackRect.y;
else
- {
- // The thumb gets flipped when inverted, so thumbWidth
- // actually is the height and vice versa.
- if (thumbWidth > contentRect.height)
- thumbRect.height = contentRect.height / 4;
- else
- thumbRect.height = thumbWidth;
- if (thumbHeight > contentRect.width)
- thumbRect.width = contentRect.width;
- else
- thumbRect.width = thumbHeight;
- }
+ thumbRect.x = trackRect.x;
}
/**
@@ -1092,9 +1115,10 @@ public class BasicSliderUI extends SliderUI
{
contentRect.x = focusRect.x + focusInsets.left;
contentRect.y = focusRect.y + focusInsets.top;
+
contentRect.width = focusRect.width - focusInsets.left - focusInsets.right;
- contentRect.height = focusRect.height - focusInsets.top
- - focusInsets.bottom;
+ contentRect.height = focusRect.height - focusInsets.top
+ - focusInsets.bottom;
if (contentRect.width < 0)
contentRect.width = 0;
@@ -1113,11 +1137,11 @@ public class BasicSliderUI extends SliderUI
if (slider.getOrientation() == JSlider.HORIZONTAL)
{
thumbRect.x = xPositionForValue(value) - thumbRect.width / 2;
- thumbRect.y = contentRect.y;
+ thumbRect.y = trackRect.y;
}
else
{
- thumbRect.x = contentRect.x;
+ thumbRect.x = trackRect.x;
thumbRect.y = yPositionForValue(value) - thumbRect.height / 2;
}
}
@@ -1129,9 +1153,9 @@ public class BasicSliderUI extends SliderUI
protected void calculateTrackBuffer()
{
if (slider.getOrientation() == JSlider.HORIZONTAL)
- trackBuffer = thumbRect.width;
+ trackBuffer = thumbRect.width / 2;
else
- trackBuffer = thumbRect.height;
+ trackBuffer = thumbRect.height / 2;
}
/**
@@ -1141,9 +1165,11 @@ public class BasicSliderUI extends SliderUI
*/
protected Dimension getThumbSize()
{
- // This is really just the bounds box for the thumb.
- // The thumb will actually be pointed (like a rectangle + triangle at bottom)
- return thumbRect.getSize();
+ // TODO: shouldn't create new objects every time
+ if (slider.getOrientation() == JSlider.HORIZONTAL)
+ return new Dimension(11, 20);
+ else
+ return new Dimension(20, 11);
}
/**
@@ -1155,13 +1181,21 @@ public class BasicSliderUI extends SliderUI
if (slider.getOrientation() == JSlider.HORIZONTAL)
{
trackRect.x = contentRect.x + trackBuffer;
- trackRect.y = contentRect.y;
+ int h = getThumbSize().height;
+ if (slider.getPaintTicks() && (slider.getMajorTickSpacing() > 0
+ || slider.getMinorTickSpacing() > 0))
+ h += getTickLength();
+ trackRect.y = contentRect.y + (contentRect.height - h) / 2 - 1;
trackRect.width = contentRect.width - 2 * trackBuffer;
trackRect.height = thumbRect.height;
}
else
{
- trackRect.x = contentRect.x;
+ int w = getThumbSize().width;
+ if (slider.getPaintTicks() && (slider.getMajorTickSpacing() > 0
+ || slider.getMinorTickSpacing() > 0))
+ w += getTickLength();
+ trackRect.x = contentRect.x + (contentRect.width - w) / 2 - 1;
trackRect.y = contentRect.y + trackBuffer;
trackRect.width = thumbRect.width;
trackRect.height = contentRect.height - 2 * trackBuffer;
@@ -1180,7 +1214,7 @@ public class BasicSliderUI extends SliderUI
*/
protected int getTickLength()
{
- return tickHeight;
+ return 8;
}
/**
@@ -1536,9 +1570,6 @@ public class BasicSliderUI extends SliderUI
Point c = new Point(a);
Point d = new Point(a);
- Polygon high;
- Polygon shadow;
-
if (slider.getOrientation() == JSlider.HORIZONTAL)
{
width = trackRect.width;
@@ -1591,74 +1622,78 @@ public class BasicSliderUI extends SliderUI
{
if (slider.getOrientation() == JSlider.HORIZONTAL)
{
- double loc = tickRect.x;
+ double loc = tickRect.x + 0.5;
double increment = (max == min) ? 0
- : majorSpace * (double) tickRect.width / (max
- - min);
- if (drawInverted())
+ : majorSpace * (double) (tickRect.width - 1) / (max - min);
+ if (drawInverted())
{
loc += tickRect.width;
increment *= -1;
}
+ g.translate(0, tickRect.y);
for (int i = min; i <= max; i += majorSpace)
{
paintMajorTickForHorizSlider(g, tickRect, (int) loc);
loc += increment;
}
+ g.translate(0, -tickRect.y);
}
else
{
- double loc = tickRect.height + tickRect.y;
+ double loc = tickRect.height + tickRect.y + 0.5;
double increment = (max == min) ? 0
- : -majorSpace * (double) tickRect.height / (max
- - min);
+ : -majorSpace * (double) (tickRect.height - 1) / (max - min);
if (drawInverted())
{
- loc = tickRect.y;
+ loc = tickRect.y + 0.5;
increment *= -1;
}
+ g.translate(tickRect.x, 0);
for (int i = min; i <= max; i += majorSpace)
{
paintMajorTickForVertSlider(g, tickRect, (int) loc);
loc += increment;
}
+ g.translate(-tickRect.x, 0);
}
}
if (minorSpace > 0)
{
if (slider.getOrientation() == JSlider.HORIZONTAL)
{
- double loc = tickRect.x;
+ double loc = tickRect.x + 0.5;
double increment = (max == min) ? 0
- : minorSpace * (double) tickRect.width / (max
- - min);
+ : minorSpace * (double) (tickRect.width - 1) / (max - min);
if (drawInverted())
{
loc += tickRect.width;
increment *= -1;
}
+ g.translate(0, tickRect.y);
for (int i = min; i <= max; i += minorSpace)
{
paintMinorTickForHorizSlider(g, tickRect, (int) loc);
loc += increment;
}
+ g.translate(0, -tickRect.y);
}
else
{
- double loc = tickRect.height + tickRect.y;
+ double loc = tickRect.height + tickRect.y + 0.5;
double increment = (max == min) ? 0
- : -minorSpace * (double) tickRect.height / (max
- - min);
+ : -minorSpace * (double) (tickRect.height - 1) / (max - min);
if (drawInverted())
{
- loc = tickRect.y;
+ loc = tickRect.y + 0.5;
increment *= -1;
}
+ g.translate(tickRect.x, 0);
for (int i = min; i <= max; i += minorSpace)
{
paintMinorTickForVertSlider(g, tickRect, (int) loc);
loc += increment;
}
+ g.translate(-tickRect.x, 0);
}
}
}
@@ -1680,7 +1715,7 @@ public class BasicSliderUI extends SliderUI
protected void paintMinorTickForHorizSlider(Graphics g,
Rectangle tickBounds, int x)
{
- int y = tickRect.y + tickRect.height / 4;
+ int y = tickRect.height / 4;
Color saved = g.getColor();
g.setColor(Color.BLACK);
@@ -1699,7 +1734,7 @@ public class BasicSliderUI extends SliderUI
protected void paintMajorTickForHorizSlider(Graphics g,
Rectangle tickBounds, int x)
{
- int y = tickRect.y + tickRect.height / 4;
+ int y = tickRect.height / 4;
Color saved = g.getColor();
g.setColor(Color.BLACK);
@@ -1718,7 +1753,7 @@ public class BasicSliderUI extends SliderUI
protected void paintMinorTickForVertSlider(Graphics g, Rectangle tickBounds,
int y)
{
- int x = tickRect.x + tickRect.width / 4;
+ int x = tickRect.width / 4;
Color saved = g.getColor();
g.setColor(Color.BLACK);
@@ -1737,7 +1772,7 @@ public class BasicSliderUI extends SliderUI
protected void paintMajorTickForVertSlider(Graphics g, Rectangle tickBounds,
int y)
{
- int x = tickRect.x + tickRect.width / 4;
+ int x = tickRect.width / 4;
Color saved = g.getColor();
g.setColor(Color.BLACK);
@@ -1924,8 +1959,6 @@ public class BasicSliderUI extends SliderUI
{
Color saved_color = g.getColor();
- Polygon thumb = new Polygon();
-
Point a = new Point(thumbRect.x, thumbRect.y);
Point b = new Point(a);
Point c = new Point(a);
@@ -1933,7 +1966,8 @@ public class BasicSliderUI extends SliderUI
Point e = new Point(a);
Polygon bright;
- Polygon dark;
+ Polygon light; // light shadow
+ Polygon dark; // dark shadow
Polygon all;
// This will be in X-dimension if the slider is inverted and y if it isn't.
@@ -1943,36 +1977,42 @@ public class BasicSliderUI extends SliderUI
{
turnPoint = thumbRect.height * 3 / 4;
- b.translate(thumbRect.width, 0);
- c.translate(thumbRect.width, turnPoint);
- d.translate(thumbRect.width / 2, thumbRect.height);
+ b.translate(thumbRect.width - 1, 0);
+ c.translate(thumbRect.width - 1, turnPoint);
+ d.translate(thumbRect.width / 2 - 1, thumbRect.height - 1);
e.translate(0, turnPoint);
- bright = new Polygon(new int[] { b.x, a.x, e.x, d.x },
+ bright = new Polygon(new int[] { b.x - 1, a.x, e.x, d.x },
new int[] { b.y, a.y, e.y, d.y }, 4);
- dark = new Polygon(new int[] { b.x, c.x, d.x },
- new int[] { b.y, c.y, d.y }, 3);
- all = new Polygon(new int[] { a.x + 1, b.x, c.x, d.x, e.x + 1 },
- new int[] { a.y + 1, b.y + 1, c.y, d.y + 1, e.y }, 5);
+ dark = new Polygon(new int[] { b.x, c.x, d.x + 1 },
+ new int[] { b.y, c.y - 1, d.y }, 3);
+
+ light = new Polygon(new int[] { b.x - 1, c.x - 1, d.x + 1 },
+ new int[] { b.y + 1, c.y - 1, d.y - 1 }, 3);
+
+ all = new Polygon(new int[] { a.x + 1, b.x - 2, c.x - 2, d.x, e.x + 1 },
+ new int[] { a.y + 1, b.y + 1, c.y - 1, d.y - 1, e.y }, 5);
}
else
{
- turnPoint = thumbRect.width * 3 / 4;
+ turnPoint = thumbRect.width * 3 / 4 - 1;
b.translate(turnPoint, 0);
- c.translate(thumbRect.width, thumbRect.height / 2);
- d.translate(turnPoint, thumbRect.height);
- e.translate(0, thumbRect.height);
+ c.translate(thumbRect.width - 1, thumbRect.height / 2);
+ d.translate(turnPoint, thumbRect.height - 1);
+ e.translate(0, thumbRect.height - 1);
- bright = new Polygon(new int[] { c.x, b.x, a.x, e.x },
- new int[] { c.y, b.y, a.y, e.y }, 4);
+ bright = new Polygon(new int[] { c.x - 1, b.x, a.x, e.x },
+ new int[] { c.y - 1, b.y, a.y, e.y - 1 }, 4);
- dark = new Polygon(new int[] { c.x, d.x, e.x + 1 },
+ dark = new Polygon(new int[] { c.x, d.x, e.x },
new int[] { c.y, d.y, e.y }, 3);
- all = new Polygon(new int[] { a.x + 1, b.x, c.x - 1, d.x, e.x + 1 },
- new int[] { a.y + 1, b.y + 1, c.y, d.y, e.y }, 5);
+ light = new Polygon(new int[] { c.x - 1, d.x, e.x + 1},
+ new int[] { c.y, d.y - 1, e.y - 1}, 3);
+ all = new Polygon(new int[] { a.x + 1, b.x, c.x - 2, c.x - 2, d.x, e.x + 1 },
+ new int[] { a.y + 1, b.y + 1, c.y - 1, c.y, d.y - 2, e.y - 2 }, 6);
}
g.setColor(Color.WHITE);
@@ -1982,6 +2022,10 @@ public class BasicSliderUI extends SliderUI
g.drawPolyline(dark.xpoints, dark.ypoints, dark.npoints);
g.setColor(Color.GRAY);
+ g.drawPolyline(light.xpoints, light.ypoints, light.npoints);
+
+ g.setColor(Color.LIGHT_GRAY);
+ g.drawPolyline(all.xpoints, all.ypoints, all.npoints);
g.fillPolygon(all);
g.setColor(saved_color);
@@ -2065,8 +2109,7 @@ public class BasicSliderUI extends SliderUI
{
int min = slider.getMinimum();
int max = slider.getMaximum();
- int extent = slider.getExtent();
- int len = trackRect.width;
+ int len = trackRect.width - 1;
int xPos = (max == min) ? 0 : (value - min) * len / (max - min);
@@ -2074,7 +2117,7 @@ public class BasicSliderUI extends SliderUI
xPos += trackRect.x;
else
{
- xPos = trackRect.width - xPos;
+ xPos = len - xPos;
xPos += trackRect.x;
}
return xPos;
@@ -2091,14 +2134,13 @@ public class BasicSliderUI extends SliderUI
{
int min = slider.getMinimum();
int max = slider.getMaximum();
- int extent = slider.getExtent();
- int len = trackRect.height;
+ int len = trackRect.height - 1;
int yPos = (max == min) ? 0 : (value - min) * len / (max - min);
if (! drawInverted())
{
- yPos = trackRect.height - yPos;
+ yPos = len - yPos;
yPos += trackRect.y;
}
else
@@ -2123,8 +2165,9 @@ public class BasicSliderUI extends SliderUI
int value;
- // If the length is 0, you shouldn't be able to even see where the slider is.
- // This really shouldn't ever happen, but just in case, we'll return the middle.
+ // If the length is 0, you shouldn't be able to even see where the slider
+ // is. This really shouldn't ever happen, but just in case, we'll return
+ // the middle.
if (len == 0)
return ((max - min) / 2);
@@ -2158,8 +2201,9 @@ public class BasicSliderUI extends SliderUI
int value;
- // If the length is 0, you shouldn't be able to even see where the slider is.
- // This really shouldn't ever happen, but just in case, we'll return the middle.
+ // If the length is 0, you shouldn't be able to even see where the slider
+ // is. This really shouldn't ever happen, but just in case, we'll return
+ // the middle.
if (len == 0)
return ((max - min) / 2);
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java
index ff7e8ac..ef8e228 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java
@@ -870,7 +870,8 @@ public class BasicSplitPaneUI extends SplitPaneUI
transient int lastDragLocation = -1;
/** The distance the divider is moved when moved by keyboard actions. */
- protected static int KEYBOARD_DIVIDER_MOVE_OFFSET;
+ // Sun defines this as 3
+ protected static int KEYBOARD_DIVIDER_MOVE_OFFSET = 3;
/** The divider that divides this JSplitPane. */
protected BasicSplitPaneDivider divider;
@@ -1337,9 +1338,11 @@ public class BasicSplitPaneUI extends SplitPaneUI
*/
public int getMinimumDividerLocation(JSplitPane jc)
{
- int value = layoutManager.getInitialLocation(jc.getInsets());
- if (layoutManager.components[0] != null)
- value += layoutManager.minimumSizeOfComponent(0);
+ int value = layoutManager.getInitialLocation(jc.getInsets())
+ - layoutManager.getAvailableSize(jc.getSize(), jc.getInsets())
+ + splitPane.getDividerSize();
+ if (layoutManager.components[1] != null)
+ value += layoutManager.minimumSizeOfComponent(1);
return value;
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java
index 8a27f98..7e9d9b9 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java
@@ -1680,18 +1680,6 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
}
/**
- * This method returns the preferred size of the JTabbedPane.
- *
- * @param c The JComponent to find a size for.
- *
- * @return The preferred size.
- */
- public Dimension getPreferredSize(JComponent c)
- {
- return layoutManager.preferredLayoutSize(tabPane);
- }
-
- /**
* This method returns the minimum size of the JTabbedPane.
*
* @param c The JComponent to find a size for.
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java
index 7787436..4559937 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java
@@ -40,26 +40,37 @@ package javax.swing.plaf.basic;
import java.awt.Color;
import java.awt.Component;
+import java.awt.ComponentOrientation;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
+import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
+import javax.swing.AbstractAction;
+import javax.swing.ActionMap;
import javax.swing.BorderFactory;
import javax.swing.CellRendererPane;
+import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.KeyStroke;
import javax.swing.ListSelectionModel;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.border.Border;
+import javax.swing.event.ChangeEvent;
import javax.swing.event.MouseInputListener;
import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.InputMapUIResource;
import javax.swing.plaf.TableUI;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
@@ -85,6 +96,9 @@ public class BasicTableUI
/** The cell border for selected/highlighted cells. */
Border highlightCellBorder;
+ /** The action bound to KeyStrokes. */
+ TableAction action;
+
class FocusHandler implements FocusListener
{
public void focusGained(FocusEvent e)
@@ -95,54 +109,37 @@ public class BasicTableUI
}
}
- class KeyHandler implements KeyListener
- {
- public void keyPressed(KeyEvent e)
- {
- }
- public void keyReleased(KeyEvent e)
- {
- }
- public void keyTyped(KeyEvent e)
- {
- }
- }
-
class MouseInputHandler implements MouseInputListener
{
Point begin, curr;
private void updateSelection(boolean controlPressed)
{
- if (table.getRowSelectionAllowed())
+ // Update the rows
+ int lo_row = table.rowAtPoint(begin);
+ int hi_row = table.rowAtPoint(curr);
+ ListSelectionModel rowModel = table.getSelectionModel();
+ if (lo_row != -1 && hi_row != -1)
{
- int lo_row = table.rowAtPoint(begin);
- int hi_row = table.rowAtPoint(curr);
- ListSelectionModel rowModel = table.getSelectionModel();
- if (lo_row != -1 && hi_row != -1)
- {
- if (controlPressed && rowModel.getSelectionMode()
- != ListSelectionModel.SINGLE_SELECTION)
- rowModel.addSelectionInterval(lo_row, hi_row);
- else
- rowModel.setSelectionInterval(lo_row, hi_row);
- }
+ if (controlPressed && rowModel.getSelectionMode()
+ != ListSelectionModel.SINGLE_SELECTION)
+ rowModel.addSelectionInterval(lo_row, hi_row);
+ else
+ rowModel.setSelectionInterval(lo_row, hi_row);
}
-
- if (table.getColumnSelectionAllowed())
+
+ // Update the columns
+ int lo_col = table.columnAtPoint(begin);
+ int hi_col = table.columnAtPoint(curr);
+ ListSelectionModel colModel = table.getColumnModel().
+ getSelectionModel();
+ if (lo_col != -1 && hi_col != -1)
{
- int lo_col = table.columnAtPoint(begin);
- int hi_col = table.columnAtPoint(curr);
- ListSelectionModel colModel = table.getColumnModel().
- getSelectionModel();
- if (lo_col != -1 && hi_col != -1)
- {
- if (controlPressed && colModel.getSelectionMode() !=
- ListSelectionModel.SINGLE_SELECTION)
- colModel.addSelectionInterval(lo_col, hi_col);
- else
- colModel.setSelectionInterval(lo_col, hi_col);
- }
+ if (controlPressed && colModel.getSelectionMode() !=
+ ListSelectionModel.SINGLE_SELECTION)
+ colModel.addSelectionInterval(lo_col, hi_col);
+ else
+ colModel.setSelectionInterval(lo_col, hi_col);
}
}
@@ -165,6 +162,11 @@ public class BasicTableUI
}
public void mousePressed(MouseEvent e)
{
+ ListSelectionModel rowModel = table.getSelectionModel();
+ ListSelectionModel colModel = table.getColumnModel().getSelectionModel();
+ int rowLead = rowModel.getLeadSelectionIndex();
+ int colLead = colModel.getLeadSelectionIndex();
+
begin = new Point(e.getX(), e.getY());
curr = new Point(e.getX(), e.getY());
//if control is pressed and the cell is already selected, deselect it
@@ -180,7 +182,12 @@ public class BasicTableUI
}
else
updateSelection(e.isControlDown());
-
+
+ // If we were editing, but the moved to another cell, stop editing
+ if (rowLead != rowModel.getLeadSelectionIndex() ||
+ colLead != colModel.getLeadSelectionIndex())
+ if (table.isEditing())
+ table.editingStopped(new ChangeEvent(e));
}
public void mouseReleased(MouseEvent e)
{
@@ -193,23 +200,50 @@ public class BasicTableUI
{
return new FocusHandler();
}
- protected KeyListener createKeyListener()
- {
- return new KeyHandler();
- }
+
protected MouseInputListener createMouseInputListener()
{
return new MouseInputHandler();
}
+ /**
+ * Return the maximum size of the table. The maximum height is the row
+ * height times the number of rows. The maximum width is the sum of
+ * the maximum widths of each column.
+ *
+ * @param comp the component whose maximum size is being queried,
+ * this is ignored.
+ * @return a Dimension object representing the maximum size of the table,
+ * or null if the table has no elements.
+ */
public Dimension getMaximumSize(JComponent comp)
{
- return getPreferredSize(comp);
+ int maxTotalColumnWidth = 0;
+ for (int i = 0; i < table.getColumnCount(); i++)
+ maxTotalColumnWidth += table.getColumnModel().getColumn(i).getMaxWidth();
+ if (maxTotalColumnWidth == 0 || table.getRowCount() == 0)
+ return null;
+ return new Dimension(maxTotalColumnWidth, table.getRowCount()*table.getRowHeight());
}
+ /**
+ * Return the minimum size of the table. The minimum height is the row
+ * height times the number of rows. The minimum width is the sum of
+ * the minimum widths of each column.
+ *
+ * @param comp the component whose minimum size is being queried,
+ * this is ignored.
+ * @return a Dimension object representing the minimum size of the table,
+ * or null if the table has no elements.
+ */
public Dimension getMinimumSize(JComponent comp)
{
- return getPreferredSize(comp);
+ int minTotalColumnWidth = 0;
+ for (int i = 0; i < table.getColumnCount(); i++)
+ minTotalColumnWidth += table.getColumnModel().getColumn(i).getMinWidth();
+ if (minTotalColumnWidth == 0 || table.getRowCount() == 0)
+ return null;
+ return new Dimension(minTotalColumnWidth, table.getRowCount()*table.getRowHeight());
}
public Dimension getPreferredSize(JComponent comp)
@@ -233,8 +267,657 @@ public class BasicTableUI
highlightCellBorder = defaults.getBorder("Table.focusCellHighlightBorder");
cellBorder = BorderFactory.createEmptyBorder(1, 1, 1, 1);
}
+
+ private int convertModifiers(int mod)
+ {
+ if ((mod & KeyEvent.SHIFT_DOWN_MASK) != 0)
+ {
+ mod |= KeyEvent.SHIFT_MASK;
+ mod &= ~KeyEvent.SHIFT_DOWN_MASK;
+ }
+ if ((mod & KeyEvent.CTRL_DOWN_MASK) != 0)
+ {
+ mod |= KeyEvent.CTRL_MASK;
+ mod &= ~KeyEvent.CTRL_DOWN_MASK;
+ }
+ if ((mod & KeyEvent.META_DOWN_MASK) != 0)
+ {
+ mod |= KeyEvent.META_MASK;
+ mod &= ~KeyEvent.META_DOWN_MASK;
+ }
+ if ((mod & KeyEvent.ALT_DOWN_MASK) != 0)
+ {
+ mod |= KeyEvent.ALT_MASK;
+ mod &= ~KeyEvent.ALT_DOWN_MASK;
+ }
+ if ((mod & KeyEvent.ALT_GRAPH_DOWN_MASK) != 0)
+ {
+ mod |= KeyEvent.ALT_GRAPH_MASK;
+ mod &= ~KeyEvent.ALT_GRAPH_DOWN_MASK;
+ }
+ return mod;
+ }
+
protected void installKeyboardActions()
{
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ InputMap ancestorMap = (InputMap)defaults.get("Table.ancestorInputMap");
+ InputMapUIResource parentInputMap = new InputMapUIResource();
+ // FIXME: The JDK uses a LazyActionMap for parentActionMap
+ ActionMap parentActionMap = new ActionMap();
+ action = new TableAction();
+ Object keys[] = ancestorMap.allKeys();
+ // Register key bindings in the UI InputMap-ActionMap pair
+ // Note that we register key bindings with both the old and new modifier
+ // masks: InputEvent.SHIFT_MASK and InputEvent.SHIFT_DOWN_MASK and so on.
+ for (int i = 0; i < keys.length; i++)
+ {
+ parentInputMap.put(KeyStroke.getKeyStroke
+ (((KeyStroke)keys[i]).getKeyCode(), convertModifiers
+ (((KeyStroke)keys[i]).getModifiers())),
+ (String)ancestorMap.get((KeyStroke)keys[i]));
+
+ parentInputMap.put(KeyStroke.getKeyStroke
+ (((KeyStroke)keys[i]).getKeyCode(),
+ ((KeyStroke)keys[i]).getModifiers()),
+ (String)ancestorMap.get((KeyStroke)keys[i]));
+
+ parentActionMap.put
+ ((String)ancestorMap.get((KeyStroke)keys[i]), new ActionListenerProxy
+ (action, (String)ancestorMap.get((KeyStroke)keys[i])));
+
+ }
+ // Set the UI InputMap-ActionMap pair to be the parents of the
+ // JTable's InputMap-ActionMap pair
+ parentInputMap.setParent
+ (table.getInputMap
+ (JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).getParent());
+ parentActionMap.setParent(table.getActionMap().getParent());
+ table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
+ setParent(parentInputMap);
+ table.getActionMap().setParent(parentActionMap);
+ }
+
+ /**
+ * This class is used to mimmic the behaviour of the JDK when registering
+ * keyboard actions. It is the same as the private class used in JComponent
+ * for the same reason. This class receives an action event and dispatches
+ * it to the true receiver after altering the actionCommand property of the
+ * event.
+ */
+ private static class ActionListenerProxy
+ extends AbstractAction
+ {
+ ActionListener target;
+ String bindingCommandName;
+
+ public ActionListenerProxy(ActionListener li,
+ String cmd)
+ {
+ target = li;
+ bindingCommandName = cmd;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ ActionEvent derivedEvent = new ActionEvent(e.getSource(),
+ e.getID(),
+ bindingCommandName,
+ e.getModifiers());
+ target.actionPerformed(derivedEvent);
+ }
+ }
+
+ /**
+ * This class implements the actions that we want to happen
+ * when specific keys are pressed for the JTable. The actionPerformed
+ * method is called when a key that has been registered for the JTable
+ * is received.
+ */
+ class TableAction extends AbstractAction
+ {
+ /**
+ * What to do when this action is called.
+ *
+ * @param e the ActionEvent that caused this action.
+ */
+ public void actionPerformed (ActionEvent e)
+ {
+ ListSelectionModel rowModel = table.getSelectionModel();
+ ListSelectionModel colModel = table.getColumnModel().getSelectionModel();
+
+ int rowLead = rowModel.getLeadSelectionIndex();
+ int rowMax = table.getModel().getRowCount() - 1;
+
+ int colLead = colModel.getLeadSelectionIndex();
+ int colMax = table.getModel().getColumnCount() - 1;
+
+ if (e.getActionCommand().equals("selectPreviousRowExtendSelection"))
+ {
+ rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0));
+ colModel.setLeadSelectionIndex(colLead);
+ }
+ else if (e.getActionCommand().equals("selectLastColumn"))
+ {
+ table.clearSelection();
+ rowModel.setSelectionInterval(rowLead, rowLead);
+ colModel.setSelectionInterval(colMax, colMax);
+ }
+ else if (e.getActionCommand().equals("startEditing"))
+ {
+ if (table.isCellEditable(rowLead, colLead))
+ table.editCellAt(rowLead,colLead);
+ }
+ else if (e.getActionCommand().equals("selectFirstRowExtendSelection"))
+ {
+ rowModel.setLeadSelectionIndex(0);
+ colModel.setLeadSelectionIndex(colLead);
+ }
+ else if (e.getActionCommand().equals("selectFirstColumn"))
+ {
+ rowModel.setSelectionInterval(rowLead, rowLead);
+ colModel.setSelectionInterval(0, 0);
+ }
+ else if (e.getActionCommand().equals("selectFirstColumnExtendSelection"))
+ {
+ colModel.setLeadSelectionIndex(0);
+ rowModel.setLeadSelectionIndex(rowLead);
+ }
+ else if (e.getActionCommand().equals("selectLastRow"))
+ {
+ rowModel.setSelectionInterval(rowMax,rowMax);
+ colModel.setSelectionInterval(colLead, colLead);
+ }
+ else if (e.getActionCommand().equals("selectNextRowExtendSelection"))
+ {
+ rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax));
+ colModel.setLeadSelectionIndex(colLead);
+ }
+ else if (e.getActionCommand().equals("selectFirstRow"))
+ {
+ rowModel.setSelectionInterval(0,0);
+ colModel.setSelectionInterval(colLead, colLead);
+ }
+ else if (e.getActionCommand().equals("selectNextColumnExtendSelection"))
+ {
+ colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax));
+ rowModel.setLeadSelectionIndex(rowLead);
+ }
+ else if (e.getActionCommand().equals("selectLastColumnExtendSelection"))
+ {
+ colModel.setLeadSelectionIndex(colMax);
+ rowModel.setLeadSelectionIndex(rowLead);
+ }
+ else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection"))
+ {
+ colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0));
+ rowModel.setLeadSelectionIndex(rowLead);
+ }
+ else if (e.getActionCommand().equals("selectNextRow"))
+ {
+ rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax),
+ Math.min(rowLead + 1, rowMax));
+ colModel.setSelectionInterval(colLead,colLead);
+ }
+ else if (e.getActionCommand().equals("scrollUpExtendSelection"))
+ {
+ int target;
+ if (rowLead == getFirstVisibleRowIndex())
+ target = Math.max
+ (0, rowLead - (getLastVisibleRowIndex() -
+ getFirstVisibleRowIndex() + 1));
+ else
+ target = getFirstVisibleRowIndex();
+
+ rowModel.setLeadSelectionIndex(target);
+ colModel.setLeadSelectionIndex(colLead);
+ }
+ else if (e.getActionCommand().equals("selectPreviousRow"))
+ {
+ rowModel.setSelectionInterval(Math.max(rowLead - 1, 0),
+ Math.max(rowLead - 1, 0));
+ colModel.setSelectionInterval(colLead,colLead);
+ }
+ else if (e.getActionCommand().equals("scrollRightChangeSelection"))
+ {
+ int target;
+ if (colLead == getLastVisibleColumnIndex())
+ target = Math.min
+ (colMax, colLead + (getLastVisibleColumnIndex() -
+ getFirstVisibleColumnIndex() + 1));
+ else
+ target = getLastVisibleColumnIndex();
+
+ colModel.setSelectionInterval(target, target);
+ rowModel.setSelectionInterval(rowLead, rowLead);
+ }
+ else if (e.getActionCommand().equals("selectPreviousColumn"))
+ {
+ rowModel.setSelectionInterval(rowLead,rowLead);
+ colModel.setSelectionInterval(Math.max(colLead - 1, 0),
+ Math.max(colLead - 1, 0));
+ }
+ else if (e.getActionCommand().equals("scrollLeftChangeSelection"))
+ {
+ int target;
+ if (colLead == getFirstVisibleColumnIndex())
+ target = Math.max
+ (0, colLead - (getLastVisibleColumnIndex() -
+ getFirstVisibleColumnIndex() + 1));
+ else
+ target = getFirstVisibleColumnIndex();
+
+ colModel.setSelectionInterval(target, target);
+ rowModel.setSelectionInterval(rowLead, rowLead);
+ }
+ else if (e.getActionCommand().equals("clearSelection"))
+ {
+ table.clearSelection();
+ }
+ else if (e.getActionCommand().equals("cancel"))
+ {
+ // FIXME: implement other parts of "cancel" like undo-ing last
+ // selection. Right now it just calls editingCancelled if
+ // we're currently editing.
+ if (table.isEditing())
+ table.editingCanceled(new ChangeEvent("cancel"));
+ }
+ else if (e.getActionCommand().equals("selectNextRowCell")
+ || e.getActionCommand().equals("selectPreviousRowCell")
+ || e.getActionCommand().equals("selectNextColumnCell")
+ || e.getActionCommand().equals("selectPreviousColumnCell"))
+ {
+ // If nothing is selected, select the first cell in the table
+ if (table.getSelectedRowCount() == 0 &&
+ table.getSelectedColumnCount() == 0)
+ {
+ rowModel.setSelectionInterval(0, 0);
+ colModel.setSelectionInterval(0, 0);
+ return;
+ }
+
+ // If the lead selection index isn't selected (ie a remove operation
+ // happened, then set the lead to the first selected cell in the
+ // table
+ if (!table.isCellSelected(rowLead, colLead))
+ {
+ rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(),
+ rowModel.getMinSelectionIndex());
+ colModel.addSelectionInterval(colModel.getMinSelectionIndex(),
+ colModel.getMinSelectionIndex());
+ return;
+ }
+
+ // multRowsSelected and multColsSelected tell us if multiple rows or
+ // columns are selected, respectively
+ boolean multRowsSelected, multColsSelected;
+ multRowsSelected = table.getSelectedRowCount() > 1 &&
+ table.getRowSelectionAllowed();
+
+ multColsSelected = table.getSelectedColumnCount() > 1 &&
+ table.getColumnSelectionAllowed();
+
+ // If there is just one selection, select the next cell, and wrap
+ // when you get to the edges of the table.
+ if (!multColsSelected && !multRowsSelected)
+ {
+ if (e.getActionCommand().indexOf("Column") != -1)
+ advanceSingleSelection(colModel, colMax, rowModel, rowMax,
+ (e.getActionCommand().equals
+ ("selectPreviousColumnCell")));
+ else
+ advanceSingleSelection(rowModel, rowMax, colModel, colMax,
+ (e.getActionCommand().equals
+ ("selectPreviousRowCell")));
+ return;
+ }
+
+
+ // rowMinSelected and rowMaxSelected are the minimum and maximum
+ // values respectively of selected cells in the row selection model
+ // Similarly for colMinSelected and colMaxSelected.
+ int rowMaxSelected = table.getRowSelectionAllowed() ?
+ rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1;
+ int rowMinSelected = table.getRowSelectionAllowed() ?
+ rowModel.getMinSelectionIndex() : 0;
+ int colMaxSelected = table.getColumnSelectionAllowed() ?
+ colModel.getMaxSelectionIndex() :
+ table.getModel().getColumnCount() - 1;
+ int colMinSelected = table.getColumnSelectionAllowed() ?
+ colModel.getMinSelectionIndex() : 0;
+
+ // If there are multiple rows and columns selected, select the next
+ // cell and wrap at the edges of the selection.
+ if (e.getActionCommand().indexOf("Column") != -1)
+ advanceMultipleSelection(colModel, colMinSelected, colMaxSelected,
+ rowModel, rowMinSelected, rowMaxSelected,
+ (e.getActionCommand().equals
+ ("selectPreviousColumnCell")), true);
+
+ else
+ advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected,
+ colModel, colMinSelected, colMaxSelected,
+ (e.getActionCommand().equals
+ ("selectPreviousRowCell")), false);
+ }
+ else if (e.getActionCommand().equals("selectNextColumn"))
+ {
+ rowModel.setSelectionInterval(rowLead,rowLead);
+ colModel.setSelectionInterval(Math.min(colLead + 1, colMax),
+ Math.min(colLead + 1, colMax));
+ }
+ else if (e.getActionCommand().equals("scrollLeftExtendSelection"))
+ {
+ int target;
+ if (colLead == getFirstVisibleColumnIndex())
+ target = Math.max
+ (0, colLead - (getLastVisibleColumnIndex() -
+ getFirstVisibleColumnIndex() + 1));
+ else
+ target = getFirstVisibleColumnIndex();
+
+ colModel.setLeadSelectionIndex(target);
+ rowModel.setLeadSelectionIndex(rowLead);
+ }
+ else if (e.getActionCommand().equals("scrollDownChangeSelection"))
+ {
+ int target;
+ if (rowLead == getLastVisibleRowIndex())
+ target = Math.min
+ (rowMax, rowLead + (getLastVisibleRowIndex() -
+ getFirstVisibleRowIndex() + 1));
+ else
+ target = getLastVisibleRowIndex();
+
+ rowModel.setSelectionInterval(target, target);
+ colModel.setSelectionInterval(colLead, colLead);
+ }
+ else if (e.getActionCommand().equals("scrollRightExtendSelection"))
+ {
+ int target;
+ if (colLead == getLastVisibleColumnIndex())
+ target = Math.min
+ (colMax, colLead + (getLastVisibleColumnIndex() -
+ getFirstVisibleColumnIndex() + 1));
+ else
+ target = getLastVisibleColumnIndex();
+
+ colModel.setLeadSelectionIndex(target);
+ rowModel.setLeadSelectionIndex(rowLead);
+ }
+ else if (e.getActionCommand().equals("selectAll"))
+ {
+ table.selectAll();
+ }
+ else if (e.getActionCommand().equals("selectLastRowExtendSelection"))
+ {
+ rowModel.setLeadSelectionIndex(rowMax);
+ colModel.setLeadSelectionIndex(colLead);
+ }
+ else if (e.getActionCommand().equals("scrollDownExtendSelection"))
+ {
+ int target;
+ if (rowLead == getLastVisibleRowIndex())
+ target = Math.min
+ (rowMax, rowLead + (getLastVisibleRowIndex() -
+ getFirstVisibleRowIndex() + 1));
+ else
+ target = getLastVisibleRowIndex();
+
+ rowModel.setLeadSelectionIndex(target);
+ colModel.setLeadSelectionIndex(colLead);
+ }
+ else if (e.getActionCommand().equals("scrollUpChangeSelection"))
+ {
+ int target;
+ if (rowLead == getFirstVisibleRowIndex())
+ target = Math.max
+ (0, rowLead - (getLastVisibleRowIndex() -
+ getFirstVisibleRowIndex() + 1));
+ else
+ target = getFirstVisibleRowIndex();
+
+ rowModel.setSelectionInterval(target, target);
+ colModel.setSelectionInterval(colLead, colLead);
+ }
+ else
+ {
+ // If we're here that means we bound this TableAction class
+ // to a keyboard input but we either want to ignore that input
+ // or we just haven't implemented its action yet.
+ }
+
+ if (table.isEditing() && e.getActionCommand() != "startEditing")
+ table.editingCanceled(new ChangeEvent("update"));
+ table.repaint();
+
+ table.scrollRectToVisible
+ (table.getCellRect(rowModel.getLeadSelectionIndex(),
+ colModel.getLeadSelectionIndex(), false));
+ }
+
+ int getFirstVisibleColumnIndex()
+ {
+ ComponentOrientation or = table.getComponentOrientation();
+ Rectangle r = table.getVisibleRect();
+ if (!or.isLeftToRight())
+ r.translate((int) r.getWidth() - 1, 0);
+ return table.columnAtPoint(r.getLocation());
+ }
+
+ /**
+ * Returns the column index of the last visible column.
+ *
+ */
+ int getLastVisibleColumnIndex()
+ {
+ ComponentOrientation or = table.getComponentOrientation();
+ Rectangle r = table.getVisibleRect();
+ if (or.isLeftToRight())
+ r.translate((int) r.getWidth() - 1, 0);
+ return table.columnAtPoint(r.getLocation());
+ }
+
+ /**
+ * Returns the row index of the first visible row.
+ *
+ */
+ int getFirstVisibleRowIndex()
+ {
+ ComponentOrientation or = table.getComponentOrientation();
+ Rectangle r = table.getVisibleRect();
+ if (!or.isLeftToRight())
+ r.translate((int) r.getWidth() - 1, 0);
+ return table.rowAtPoint(r.getLocation());
+ }
+
+ /**
+ * Returns the row index of the last visible row.
+ *
+ */
+ int getLastVisibleRowIndex()
+ {
+ ComponentOrientation or = table.getComponentOrientation();
+ Rectangle r = table.getVisibleRect();
+ r.translate(0, (int) r.getHeight() - 1);
+ if (or.isLeftToRight())
+ r.translate((int) r.getWidth() - 1, 0);
+ // The next if makes sure that we don't return -1 simply because
+ // there is white space at the bottom of the table (ie, the display
+ // area is larger than the table)
+ if (table.rowAtPoint(r.getLocation()) == -1)
+ {
+ if (getFirstVisibleRowIndex() == -1)
+ return -1;
+ else
+ return table.getModel().getRowCount() - 1;
+ }
+ return table.rowAtPoint(r.getLocation());
+ }
+
+ /**
+ * A helper method for the key bindings. Used because the actions
+ * for TAB, SHIFT-TAB, ENTER, and SHIFT-ENTER are very similar.
+ *
+ * Selects the next (previous if SHIFT pressed) column for TAB, or row for
+ * ENTER from within the currently selected cells.
+ *
+ * @param firstModel the ListSelectionModel for columns (TAB) or
+ * rows (ENTER)
+ * @param firstMin the first selected index in firstModel
+ * @param firstMax the last selected index in firstModel
+ * @param secondModel the ListSelectionModel for rows (TAB) or
+ * columns (ENTER)
+ * @param secondMin the first selected index in secondModel
+ * @param secondMax the last selected index in secondModel
+ * @param reverse true if shift was held for the event
+ * @param eventIsTab true if TAB was pressed, false if ENTER pressed
+ */
+ void advanceMultipleSelection (ListSelectionModel firstModel, int firstMin,
+ int firstMax, ListSelectionModel secondModel,
+ int secondMin, int secondMax, boolean reverse,
+ boolean eventIsTab)
+ {
+ // If eventIsTab, all the "firsts" correspond to columns, otherwise, to rows
+ // "seconds" correspond to the opposite
+ int firstLead = firstModel.getLeadSelectionIndex();
+ int secondLead = secondModel.getLeadSelectionIndex();
+ int numFirsts = eventIsTab ?
+ table.getModel().getColumnCount() : table.getModel().getRowCount();
+ int numSeconds = eventIsTab ?
+ table.getModel().getRowCount() : table.getModel().getColumnCount();
+
+ // check if we have to wrap the "firsts" around, going to the other side
+ if ((firstLead == firstMax && !reverse) ||
+ (reverse && firstLead == firstMin))
+ {
+ firstModel.addSelectionInterval(reverse ? firstMax : firstMin,
+ reverse ? firstMax : firstMin);
+
+ // check if we have to wrap the "seconds"
+ if ((secondLead == secondMax && !reverse) ||
+ (reverse && secondLead == secondMin))
+ secondModel.addSelectionInterval(reverse ? secondMax : secondMin,
+ reverse ? secondMax : secondMin);
+
+ // if we're not wrapping the seconds, we have to find out where we
+ // are within the secondModel and advance to the next cell (or
+ // go back to the previous cell if reverse == true)
+ else
+ {
+ int[] secondsSelected;
+ if (eventIsTab && table.getRowSelectionAllowed() ||
+ !eventIsTab && table.getColumnSelectionAllowed())
+ secondsSelected = eventIsTab ?
+ table.getSelectedRows() : table.getSelectedColumns();
+ else
+ {
+ // if row selection is not allowed, then the entire column gets
+ // selected when you click on it, so consider ALL rows selected
+ secondsSelected = new int[numSeconds];
+ for (int i = 0; i < numSeconds; i++)
+ secondsSelected[i] = i;
+ }
+
+ // and now find the "next" index within the model
+ int secondIndex = reverse ? secondsSelected.length - 1 : 0;
+ if (!reverse)
+ while (secondsSelected[secondIndex] <= secondLead)
+ secondIndex++;
+ else
+ while (secondsSelected[secondIndex] >= secondLead)
+ secondIndex--;
+
+ // and select it - updating the lead selection index
+ secondModel.addSelectionInterval(secondsSelected[secondIndex],
+ secondsSelected[secondIndex]);
+ }
+ }
+ // We didn't have to wrap the firsts, so just find the "next" first
+ // and select it, we don't have to change "seconds"
+ else
+ {
+ int[] firstsSelected;
+ if (eventIsTab && table.getColumnSelectionAllowed() ||
+ !eventIsTab && table.getRowSelectionAllowed())
+ firstsSelected = eventIsTab ?
+ table.getSelectedColumns() : table.getSelectedRows();
+ else
+ {
+ // if selection not allowed, consider ALL firsts to be selected
+ firstsSelected = new int[numFirsts];
+ for (int i = 0; i < numFirsts; i++)
+ firstsSelected[i] = i;
+ }
+ int firstIndex = reverse ? firstsSelected.length - 1 : 0;
+ if (!reverse)
+ while (firstsSelected[firstIndex] <= firstLead)
+ firstIndex++;
+ else
+ while (firstsSelected[firstIndex] >= firstLead)
+ firstIndex--;
+ firstModel.addSelectionInterval(firstsSelected[firstIndex],
+ firstsSelected[firstIndex]);
+ secondModel.addSelectionInterval(secondLead, secondLead);
+ }
+ }
+
+ /**
+ * A helper method for the key bindings. Used because the actions
+ * for TAB, SHIFT-TAB, ENTER, and SHIFT-ENTER are very similar.
+ *
+ * Selects the next (previous if SHIFT pressed) column (TAB) or row (ENTER)
+ * in the table, changing the current selection. All cells in the table
+ * are eligible, not just the ones that are currently selected.
+ * @param firstModel the ListSelectionModel for columns (TAB) or rows
+ * (ENTER)
+ * @param firstMax the last index in firstModel
+ * @param secondModel the ListSelectionModel for rows (TAB) or columns
+ * (ENTER)
+ * @param secondMax the last index in secondModel
+ * @param reverse true if SHIFT was pressed for the event
+ */
+
+ void advanceSingleSelection (ListSelectionModel firstModel, int firstMax,
+ ListSelectionModel secondModel, int secondMax,
+ boolean reverse)
+ {
+ // for TABs, "first" corresponds to columns and "seconds" to rows.
+ // the opposite is true for ENTERs
+ int firstLead = firstModel.getLeadSelectionIndex();
+ int secondLead = secondModel.getLeadSelectionIndex();
+
+ // if we are going backwards subtract 2 because we later add 1
+ // for a net change of -1
+ if (reverse && (firstLead == 0))
+ {
+ // check if we have to wrap around
+ if (secondLead == 0)
+ secondLead += secondMax + 1;
+ secondLead -= 2;
+ }
+
+ // do we have to wrap the "seconds"?
+ if (reverse && (firstLead == 0) || !reverse && (firstLead == firstMax))
+ secondModel.setSelectionInterval((secondLead + 1)%(secondMax + 1),
+ (secondLead + 1)%(secondMax + 1));
+ // if not, just reselect the current lead
+ else
+ secondModel.setSelectionInterval(secondLead, secondLead);
+
+ // if we are going backwards, subtract 2 because we add 1 later
+ // for net change of -1
+ if (reverse)
+ {
+ // check for wraparound
+ if (firstLead == 0)
+ firstLead += firstMax + 1;
+ firstLead -= 2;
+ }
+ // select the next "first"
+ firstModel.setSelectionInterval ((firstLead + 1)%(firstMax + 1),
+ (firstLead + 1)%(firstMax + 1));
+ }
}
protected void installListeners()
@@ -281,7 +964,6 @@ public class BasicTableUI
{
table = (JTable)comp;
focusListener = createFocusListener();
- keyListener = createKeyListener();
mouseInputListener = createMouseInputListener();
installDefaults();
installKeyboardActions();
@@ -332,14 +1014,19 @@ public class BasicTableUI
gfx.translate(x, y);
comp.setBounds(new Rectangle(0, 0, width, height));
// Set correct border on cell renderer.
+ // Only the lead selection cell gets a border
if (comp instanceof JComponent)
{
- if (table.isCellSelected(r, c))
+ if (table.getSelectionModel().getLeadSelectionIndex() == r
+ && table.getColumnModel().getSelectionModel().
+ getLeadSelectionIndex() == c)
((JComponent) comp).setBorder(highlightCellBorder);
else
((JComponent) comp).setBorder(cellBorder);
}
comp.paint(gfx);
+ if (comp instanceof JTextField)
+ ((JTextField)comp).getCaret().paint(gfx);
gfx.translate(-x, -y);
}
y += height;
@@ -392,7 +1079,5 @@ public class BasicTableUI
}
gfx.setColor(save);
}
-
}
-
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java
index dd0828e..91ccb00 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java
@@ -78,10 +78,20 @@ import javax.swing.text.Position;
import javax.swing.text.View;
import javax.swing.text.ViewFactory;
-
+/**
+ * The abstract base class from which the UI classes for Swings text
+ * components are derived. This provides most of the functionality for
+ * the UI classes.
+ *
+ * @author original author unknown
+ * @author Roman Kennke (roman@kennke.org)
+ */
public abstract class BasicTextUI extends TextUI
implements ViewFactory
{
+ /**
+ * A {@link DefaultCaret} that implements {@link UIResource}.
+ */
public static class BasicCaret extends DefaultCaret
implements UIResource
{
@@ -90,6 +100,9 @@ public abstract class BasicTextUI extends TextUI
}
}
+ /**
+ * A {@link DefaultHighlighter} that implements {@link UIResource}.
+ */
public static class BasicHighlighter extends DefaultHighlighter
implements UIResource
{
@@ -97,40 +110,120 @@ public abstract class BasicTextUI extends TextUI
{
}
}
-
+
+ /**
+ * This view forms the root of the View hierarchy. However, it delegates
+ * most calls to another View which is the real root of the hierarchy.
+ * The purpose is to make sure that all Views in the hierarchy, including
+ * the (real) root have a well-defined parent to which they can delegate
+ * calls like {@link #preferenceChanged}, {@link #getViewFactory} and
+ * {@link #getContainer}.
+ */
private class RootView extends View
{
+ /** The real root view. */
private View view;
-
+
+ /**
+ * Creates a new RootView.
+ */
public RootView()
{
super(null);
}
- // View methods.
-
+ /**
+ * Returns the ViewFactory for this RootView. If the current EditorKit
+ * provides a ViewFactory, this is used. Otherwise the TextUI itself
+ * is returned as a ViewFactory.
+ *
+ * @return the ViewFactory for this RootView
+ */
public ViewFactory getViewFactory()
{
- // FIXME: Handle EditorKit somehow.
- return BasicTextUI.this;
+ ViewFactory factory = null;
+ EditorKit editorKit = BasicTextUI.this.getEditorKit(getComponent());
+ factory = editorKit.getViewFactory();
+ if (factory == null)
+ factory = BasicTextUI.this;
+ return factory;
+ }
+
+ /**
+ * Indicates that the preferences of one of the child view has changed.
+ * This calls revalidate on the text component.
+ *
+ * @param view the child view which's preference has changed
+ * @param width <code>true</code> if the width preference has changed
+ * @param height <code>true</code> if the height preference has changed
+ */
+ public void preferenceChanged(View view, boolean width, boolean height)
+ {
+ textComponent.revalidate();
}
+ /**
+ * Sets the real root view.
+ *
+ * @param v the root view to set
+ */
public void setView(View v)
{
if (view != null)
- view.setParent(null);
+ view.setParent(null);
if (v != null)
- v.setParent(null);
+ v.setParent(null);
view = v;
}
+ /**
+ * Returns the real root view, regardless of the index.
+ *
+ * @param index not used here
+ *
+ * @return the real root view, regardless of the index.
+ */
+ public View getView(int index)
+ {
+ return view;
+ }
+
+ /**
+ * Returns <code>1</code> since the RootView always contains one
+ * child, that is the real root of the View hierarchy.
+ *
+ * @return <code>1</code> since the RootView always contains one
+ * child, that is the real root of the View hierarchy
+ */
+ public int getViewCount()
+ {
+ if (view != null)
+ return 1;
+ else
+ return 0;
+ }
+
+ /**
+ * Returns the <code>Container</code> that contains this view. This
+ * normally will be the text component that is managed by this TextUI.
+ *
+ * @return the <code>Container</code> that contains this view
+ */
public Container getContainer()
{
return textComponent;
}
-
+
+ /**
+ * Returns the preferred span along the specified <code>axis</code>.
+ * This is delegated to the real root view.
+ *
+ * @param axis the axis for which the preferred span is queried
+ *
+ * @return the preferred span along the axis
+ */
public float getPreferredSpan(int axis)
{
if (view != null)
@@ -139,19 +232,61 @@ public abstract class BasicTextUI extends TextUI
return Integer.MAX_VALUE;
}
+ /**
+ * Paints the view. This is delegated to the real root view.
+ *
+ * @param g the <code>Graphics</code> context to paint to
+ * @param s the allocation for the View
+ */
public void paint(Graphics g, Shape s)
{
if (view != null)
view.paint(g, s);
}
+
+ /**
+ * Maps a position in the document into the coordinate space of the View.
+ * The output rectangle usually reflects the font height but has a width
+ * of zero.
+ *
+ * This is delegated to the real root view.
+ *
+ * @param pos the position of the character in the model
+ * @param a the area that is occupied by the view
+ * @param bias either {@link Position.Bias.Forward} or
+ * {@link Position.Bias.Backward} depending on the preferred
+ * direction bias. If <code>null</code> this defaults to
+ * <code>Position.Bias.Forward</code>
+ *
+ * @return a rectangle that gives the location of the document position
+ * inside the view coordinate space
+ *
+ * @throws BadLocationException if <code>pos</code> is invalid
+ * @throws IllegalArgumentException if b is not one of the above listed
+ * valid values
+ */
public Shape modelToView(int position, Shape a, Position.Bias bias)
throws BadLocationException
{
- if (view == null)
- return null;
-
- return ((PlainView) view).modelToView(position, a, bias).getBounds();
+ return ((View) view).modelToView(position, a, bias);
+ }
+
+ /**
+ * Maps coordinates from the <code>View</code>'s space into a position
+ * in the document model.
+ *
+ * @param x the x coordinate in the view space
+ * @param y the y coordinate in the view space
+ * @param a the allocation of this <code>View</code>
+ * @param b the bias to use
+ *
+ * @return the position in the document that corresponds to the screen
+ * coordinates <code>x, y</code>
+ */
+ public int viewToModel(float x, float y, Shape a, Position.Bias[] b)
+ {
+ return view.viewToModel(x, y, a, b);
}
/**
@@ -194,8 +329,16 @@ public abstract class BasicTextUI extends TextUI
}
}
+ /**
+ * Receives notifications when properties of the text component change.
+ */
class UpdateHandler implements PropertyChangeListener
{
+ /**
+ * Notifies when a property of the text component changes.
+ *
+ * @param event the PropertyChangeEvent describing the change
+ */
public void propertyChange(PropertyChangeEvent event)
{
if (event.getPropertyName().equals("document"))
@@ -223,7 +366,7 @@ public abstract class BasicTextUI extends TextUI
{
Dimension size = textComponent.getSize();
rootView.changedUpdate(ev, new Rectangle(0, 0, size.width, size.height),
- BasicTextUI.this);
+ rootView.getViewFactory());
}
/**
@@ -235,7 +378,7 @@ public abstract class BasicTextUI extends TextUI
{
Dimension size = textComponent.getSize();
rootView.insertUpdate(ev, new Rectangle(0, 0, size.width, size.height),
- BasicTextUI.this);
+ rootView.getViewFactory());
int caretPos = textComponent.getCaretPosition();
if (caretPos >= ev.getOffset())
textComponent.setCaretPosition(caretPos + ev.getLength());
@@ -250,41 +393,80 @@ public abstract class BasicTextUI extends TextUI
{
Dimension size = textComponent.getSize();
rootView.removeUpdate(ev, new Rectangle(0, 0, size.width, size.height),
- BasicTextUI.this);
+ rootView.getViewFactory());
int caretPos = textComponent.getCaretPosition();
if (caretPos >= ev.getOffset())
textComponent.setCaretPosition(ev.getOffset());
}
}
+ /**
+ * The EditorKit used by this TextUI.
+ */
+ // FIXME: should probably be non-static.
static EditorKit kit = new DefaultEditorKit();
+ /**
+ * The root view.
+ */
RootView rootView = new RootView();
+
+ /**
+ * The text component that we handle.
+ */
JTextComponent textComponent;
+
+ /**
+ * Receives notification when the model changes.
+ */
UpdateHandler updateHandler = new UpdateHandler();
/** The DocumentEvent handler. */
DocumentHandler documentHandler = new DocumentHandler();
+ /**
+ * Creates a new <code>BasicTextUI</code> instance.
+ */
public BasicTextUI()
{
}
+ /**
+ * Creates a {@link Caret} that should be installed into the text component.
+ *
+ * @return a caret that should be installed into the text component
+ */
protected Caret createCaret()
{
return new BasicCaret();
}
+ /**
+ * Creates a {@link Highlighter} that should be installed into the text
+ * component.
+ *
+ * @return a <code>Highlighter</code> for the text component
+ */
protected Highlighter createHighlighter()
{
return new BasicHighlighter();
}
-
+
+ /**
+ * The text component that is managed by this UI.
+ *
+ * @return the text component that is managed by this UI
+ */
protected final JTextComponent getComponent()
{
return textComponent;
}
-
+
+ /**
+ * Installs this UI on the text component.
+ *
+ * @param c the text component on which to install the UI
+ */
public void installUI(final JComponent c)
{
super.installUI(c);
@@ -307,6 +489,9 @@ public abstract class BasicTextUI extends TextUI
installKeyboardActions();
}
+ /**
+ * Installs UI defaults on the text components.
+ */
protected void installDefaults()
{
Caret caret = textComponent.getCaret();
@@ -331,6 +516,9 @@ public abstract class BasicTextUI extends TextUI
caret.setBlinkRate(defaults.getInt(prefix + ".caretBlinkRate"));
}
+ /**
+ * This FocusListener triggers repaints on focus shift.
+ */
private FocusListener focuslistener = new FocusListener() {
public void focusGained(FocusEvent e)
{
@@ -342,6 +530,9 @@ public abstract class BasicTextUI extends TextUI
}
};
+ /**
+ * Install all listeners on the text component.
+ */
protected void installListeners()
{
textComponent.addFocusListener(focuslistener);
@@ -375,6 +566,11 @@ public abstract class BasicTextUI extends TextUI
return className;
}
+ /**
+ * Creates the {@link Keymap} that is installed on the text component.
+ *
+ * @return the {@link Keymap} that is installed on the text component
+ */
protected Keymap createKeymap()
{
String prefix = getPropertyPrefix();
@@ -393,6 +589,9 @@ public abstract class BasicTextUI extends TextUI
return km;
}
+ /**
+ * Installs the keyboard actions on the text components.
+ */
protected void installKeyboardActions()
{
// load any bindings for the older Keymap interface
@@ -408,6 +607,13 @@ public abstract class BasicTextUI extends TextUI
SwingUtilities.replaceUIActionMap(textComponent, getActionMap());
}
+ /**
+ * Gets the input map for the specified <code>condition</code>.
+ *
+ * @param condition the condition for the InputMap
+ *
+ * @return the InputMap for the specified condition
+ */
InputMap getInputMap(int condition)
{
String prefix = getPropertyPrefix();
@@ -425,6 +631,13 @@ public abstract class BasicTextUI extends TextUI
}
}
+ /**
+ * Returns the ActionMap to be installed on the text component.
+ *
+ * @return the ActionMap to be installed on the text component
+ */
+ // FIXME: The UIDefaults have no entries for .actionMap, so this should
+ // be handled somehow different.
ActionMap getActionMap()
{
String prefix = getPropertyPrefix();
@@ -438,6 +651,11 @@ public abstract class BasicTextUI extends TextUI
return am;
}
+ /**
+ * Creates an ActionMap to be installed on the text component.
+ *
+ * @return an ActionMap to be installed on the text component
+ */
ActionMap createActionMap()
{
Action[] actions = textComponent.getActions();
@@ -450,7 +668,12 @@ public abstract class BasicTextUI extends TextUI
}
return am;
}
-
+
+ /**
+ * Uninstalls this TextUI from the text component.
+ *
+ * @param component the text component to uninstall the UI from
+ */
public void uninstallUI(final JComponent component)
{
super.uninstallUI(component);
@@ -465,23 +688,49 @@ public abstract class BasicTextUI extends TextUI
textComponent = null;
}
+ /**
+ * Uninstalls all default properties that have previously been installed by
+ * this UI.
+ */
protected void uninstallDefaults()
{
// Do nothing here.
}
+ /**
+ * Uninstalls all listeners that have previously been installed by
+ * this UI.
+ */
protected void uninstallListeners()
{
textComponent.removeFocusListener(focuslistener);
}
+ /**
+ * Uninstalls all keyboard actions that have previously been installed by
+ * this UI.
+ */
protected void uninstallKeyboardActions()
{
- // Do nothing here.
+ // FIXME: Uninstall keyboard actions here.
}
-
+
+ /**
+ * Returns the property prefix by which the text component's UIDefaults
+ * are looked up.
+ *
+ * @return the property prefix by which the text component's UIDefaults
+ * are looked up
+ */
protected abstract String getPropertyPrefix();
+ /**
+ * Returns the preferred size of the text component.
+ *
+ * @param c not used here
+ *
+ * @return the preferred size of the text component
+ */
public Dimension getPreferredSize(JComponent c)
{
View v = getRootView(textComponent);
@@ -497,6 +746,8 @@ public abstract class BasicTextUI extends TextUI
*
* This returns (Integer.MAX_VALUE, Integer.MAX_VALUE).
*
+ * @param c not used here
+ *
* @return the maximum size for text components that use this UI
*/
public Dimension getMaximumSize(JComponent c)
@@ -505,11 +756,22 @@ public abstract class BasicTextUI extends TextUI
return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
}
+ /**
+ * Paints the text component.
+ *
+ * @param g the <code>Graphics</code> context to paint to
+ * @param c not used here
+ */
public final void paint(Graphics g, JComponent c)
{
paintSafely(g);
}
+ /**
+ * Actually performs the painting.
+ *
+ * @param g the <code>Graphics</code> context to paint to
+ */
protected void paintSafely(Graphics g)
{
Caret caret = textComponent.getCaret();
@@ -528,74 +790,213 @@ public abstract class BasicTextUI extends TextUI
caret.paint(g);
}
+ /**
+ * Paints the background of the text component.
+ *
+ * @param g the <code>Graphics</code> context to paint to
+ */
protected void paintBackground(Graphics g)
{
g.setColor(textComponent.getBackground());
g.fillRect(0, 0, textComponent.getWidth(), textComponent.getHeight());
}
+ /**
+ * Marks the specified range inside the text component's model as
+ * damaged and queues a repaint request.
+ *
+ * @param t the text component
+ * @param p0 the start location inside the document model of the range that
+ * is damaged
+ * @param p1 the end location inside the document model of the range that
+ * is damaged
+ */
public void damageRange(JTextComponent t, int p0, int p1)
{
damageRange(t, p0, p1, null, null);
}
+ /**
+ * Marks the specified range inside the text component's model as
+ * damaged and queues a repaint request. This variant of this method
+ * allows a {@link Position.Bias} object to be specified for the start
+ * and end location of the range.
+ *
+ * @param t the text component
+ * @param p0 the start location inside the document model of the range that
+ * is damaged
+ * @param p1 the end location inside the document model of the range that
+ * is damaged
+ * @param firstBias the bias for the start location
+ * @param secondBias the bias for the end location
+ */
public void damageRange(JTextComponent t, int p0, int p1,
Position.Bias firstBias, Position.Bias secondBias)
{
+ // TODO: Implement me.
}
+ /**
+ * Returns the {@link EditorKit} used for the text component that is managed
+ * by this UI.
+ *
+ * @param t the text component
+ *
+ * @return the {@link EditorKit} used for the text component that is managed
+ * by this UI
+ */
public EditorKit getEditorKit(JTextComponent t)
{
return kit;
}
+ /**
+ * Gets the next position inside the document model that is visible on
+ * screen, starting from <code>pos</code>.
+ *
+ * @param t the text component
+ * @param pos the start positionn
+ * @param b the bias for pos
+ * @param direction the search direction
+ * @param biasRet filled by the method to indicate the bias of the return
+ * value
+ *
+ * @return the next position inside the document model that is visible on
+ * screen
+ */
public int getNextVisualPositionFrom(JTextComponent t, int pos,
Position.Bias b, int direction,
Position.Bias[] biasRet)
throws BadLocationException
{
- return 0;
+ return 0; // TODO: Implement me.
}
+ /**
+ * Returns the root {@link View} of a text component.
+ *
+ * @return the root {@link View} of a text component
+ */
public View getRootView(JTextComponent t)
{
return rootView;
}
+ /**
+ * Maps a position in the document into the coordinate space of the View.
+ * The output rectangle usually reflects the font height but has a width
+ * of zero. A bias of {@link Position.Bias.Forward} is used in this method.
+ *
+ * @param pos the position of the character in the model
+ * @param a the area that is occupied by the view
+ *
+ * @return a rectangle that gives the location of the document position
+ * inside the view coordinate space
+ *
+ * @throws BadLocationException if <code>pos</code> is invalid
+ * @throws IllegalArgumentException if b is not one of the above listed
+ * valid values
+ */
public Rectangle modelToView(JTextComponent t, int pos)
throws BadLocationException
{
return modelToView(t, pos, Position.Bias.Forward);
}
+ /**
+ * Maps a position in the document into the coordinate space of the View.
+ * The output rectangle usually reflects the font height but has a width
+ * of zero.
+ *
+ * @param pos the position of the character in the model
+ * @param a the area that is occupied by the view
+ * @param bias either {@link Position.Bias.Forward} or
+ * {@link Position.Bias.Backward} depending on the preferred
+ * direction bias. If <code>null</code> this defaults to
+ * <code>Position.Bias.Forward</code>
+ *
+ * @return a rectangle that gives the location of the document position
+ * inside the view coordinate space
+ *
+ * @throws BadLocationException if <code>pos</code> is invalid
+ * @throws IllegalArgumentException if b is not one of the above listed
+ * valid values
+ */
public Rectangle modelToView(JTextComponent t, int pos, Position.Bias bias)
throws BadLocationException
{
return rootView.modelToView(pos, getVisibleEditorRect(), bias).getBounds();
}
+ /**
+ * Maps a point in the <code>View</code> coordinate space to a position
+ * inside a document model.
+ *
+ * @param t the text component
+ * @param pt the point to be mapped
+ *
+ * @return the position inside the document model that corresponds to
+ * <code>pt</code>
+ */
public int viewToModel(JTextComponent t, Point pt)
{
return viewToModel(t, pt, null);
}
+ /**
+ * Maps a point in the <code>View</code> coordinate space to a position
+ * inside a document model.
+ *
+ * @param t the text component
+ * @param pt the point to be mapped
+ * @param biasReturn filled in by the method to indicate the bias of the
+ * return value
+ *
+ * @return the position inside the document model that corresponds to
+ * <code>pt</code>
+ */
public int viewToModel(JTextComponent t, Point pt, Position.Bias[] biasReturn)
{
- return 0;
+ return 0; // FIXME: Implement me.
}
+ /**
+ * Creates a {@link View} for the specified {@link Element}.
+ *
+ * @param elem the <code>Element</code> to create a <code>View</code> for
+ *
+ * @see ViewFactory
+ */
public View create(Element elem)
{
// Subclasses have to implement this to get this functionality.
return null;
}
+ /**
+ * Creates a {@link View} for the specified {@link Element}.
+ *
+ * @param elem the <code>Element</code> to create a <code>View</code> for
+ * @param p0 the start offset
+ * @param p1 the end offset
+ *
+ * @see ViewFactory
+ */
public View create(Element elem, int p0, int p1)
{
// Subclasses have to implement this to get this functionality.
return null;
}
-
+
+ /**
+ * Returns the allocation to give the root view.
+ *
+ * @return the allocation to give the root view
+ *
+ * @specnote The allocation has nothing to do with visibility. According
+ * to the specs the naming of this method is unfortunate and
+ * has historical reasons
+ */
protected Rectangle getVisibleEditorRect()
{
int width = textComponent.getWidth();
@@ -610,12 +1011,21 @@ public abstract class BasicTextUI extends TextUI
height - insets.top + insets.bottom);
}
+ /**
+ * Sets the root view for the text component.
+ *
+ * @param view the <code>View</code> to be set as root view
+ */
protected final void setView(View view)
{
rootView.setView(view);
view.setParent(rootView);
}
+ /**
+ * Indicates that the model of a text component has changed. This
+ * triggers a rebuild of the view hierarchy.
+ */
protected void modelChanged()
{
if (textComponent == null || rootView == null)
@@ -630,6 +1040,7 @@ public abstract class BasicTextUI extends TextUI
Element elem = doc.getDefaultRootElement();
if (elem == null)
return;
- setView(factory.create(elem));
+ View view = factory.create(elem);
+ setView(view);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java
index 84509ad..9106b0b 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java
@@ -56,7 +56,7 @@ public class BasicToggleButtonUI extends BasicButtonUI
*/
protected String getPropertyPrefix()
{
- return "ToggleButton";
+ return "ToggleButton.";
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java
index bc655a2..8be89ef 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java
@@ -542,19 +542,6 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
}
/**
- * This method returns the preferred size of the given JComponent for this
- * UI.
- *
- * @param c The JComponent to find a preferred size for.
- *
- * @return The preferred size for this UI.
- */
- public Dimension getPreferredSize(JComponent c)
- {
- return toolBar.getLayout().preferredLayoutSize(c);
- }
-
- /**
* This method installs the needed components for the JToolBar.
*/
protected void installComponents()
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java
index b9d3b62..6f714a3 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java
@@ -1,39 +1,39 @@
/* BasicTreeUI.java --
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
package javax.swing.plaf.basic;
@@ -60,18 +60,22 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
-
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.util.Hashtable;
import javax.swing.AbstractAction;
import javax.swing.Action;
+import javax.swing.ActionMap;
import javax.swing.CellRendererPane;
import javax.swing.Icon;
+import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
+import javax.swing.JTextField;
import javax.swing.JTree;
+import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
import javax.swing.UIDefaults;
@@ -86,21 +90,20 @@ import javax.swing.event.TreeModelListener;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.InputMapUIResource;
import javax.swing.plaf.TreeUI;
+import javax.swing.text.Caret;
import javax.swing.tree.AbstractLayoutCache;
-import javax.swing.tree.FixedHeightLayoutCache;
-import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellEditor;
import javax.swing.tree.DefaultTreeCellRenderer;
+import javax.swing.tree.ExpandVetoException;
+import javax.swing.tree.FixedHeightLayoutCache;
import javax.swing.tree.TreeCellEditor;
import javax.swing.tree.TreeCellRenderer;
-import javax.swing.tree.TreeSelectionModel;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
+import javax.swing.tree.TreeSelectionModel;
/**
* A delegate providing the user interface for <code>JTree</code> according to
@@ -111,2703 +114,3482 @@ import java.util.Hashtable;
* @author Lillian Angel (langel@redhat.com)
*/
public class BasicTreeUI
- extends TreeUI
+ extends TreeUI
{
+ /** Collapse Icon for the tree. */
+ protected transient Icon collapsedIcon;
- /** Collapse Icon for the tree. */
- protected transient Icon collapsedIcon;
-
- /** Expanded Icon for the tree. */
- protected transient Icon expandedIcon;
-
- /** Distance between left margin and where vertical dashes will be drawn. */
- protected int leftChildIndent;
-
- /**
- * Distance between leftChildIndent and where cell contents will be drawn.
- */
- protected int rightChildIndent;
-
- /**
- * Total fistance that will be indented. The sum of leftChildIndent and
- * rightChildIndent .
- */
- protected int totalChildIndent;
-
- /** Minimum preferred size. */
- protected Dimension preferredMinsize;
-
- /** Index of the row that was last selected. */
- protected int lastSelectedRow;
-
- /** Component that we're going to be drawing onto. */
- protected JTree tree;
-
- /** Renderer that is being used to do the actual cell drawing. */
- protected transient TreeCellRenderer currentCellRenderer;
-
- /**
- * Set to true if the renderer that is currently in the tree was created by
- * this instance.
- */
- protected boolean createdRenderer;
-
- /** Editor for the tree. */
- protected transient TreeCellEditor cellEditor;
-
- /**
- * Set to true if editor that is currently in the tree was created by this
- * instance.
- */
- protected boolean createdCellEditor;
+ /** Expanded Icon for the tree. */
+ protected transient Icon expandedIcon;
- /**
- * Set to false when editing and shouldSelectCall() returns true meaning the
- * node should be selected before editing, used in completeEditing.
- */
- protected boolean stopEditingInCompleteEditing;
+ /** Distance between left margin and where vertical dashes will be drawn. */
+ protected int leftChildIndent;
- /** Used to paint the TreeCellRenderer. */
- protected CellRendererPane rendererPane;
+ /**
+ * Distance between leftChildIndent and where cell contents will be drawn.
+ */
+ protected int rightChildIndent;
- /** Size needed to completely display all the nodes. */
- protected Dimension preferredSize;
+ /**
+ * Total fistance that will be indented. The sum of leftChildIndent and
+ * rightChildIndent .
+ */
+ protected int totalChildIndent;
- /** Is the preferredSize valid? */
- protected boolean validCachedPreferredSize;
+ /** Minimum preferred size. */
+ protected Dimension preferredMinsize;
- /** Object responsible for handling sizing and expanded issues. */
- protected AbstractLayoutCache treeState;
+ /** Index of the row that was last selected. */
+ protected int lastSelectedRow;
- /** Used for minimizing the drawing of vertical lines. */
- protected Hashtable drawingCache;
+ /** Component that we're going to be drawing onto. */
+ protected JTree tree;
- /**
- * True if doing optimizations for a largeModel. Subclasses that don't
- * support this may wish to override createLayoutCache to not return a
- * FixedHeightLayoutCache instance.
- */
- protected boolean largeModel;
+ /** Renderer that is being used to do the actual cell drawing. */
+ protected transient TreeCellRenderer currentCellRenderer;
- /** Responsible for telling the TreeState the size needed for a node. */
- protected AbstractLayoutCache.NodeDimensions nodeDimensions;
+ /**
+ * Set to true if the renderer that is currently in the tree was created by
+ * this instance.
+ */
+ protected boolean createdRenderer;
- /** Used to determine what to display. */
- protected TreeModel treeModel;
+ /** Editor for the tree. */
+ protected transient TreeCellEditor cellEditor;
- /** Model maintaining the selection. */
- protected TreeSelectionModel treeSelectionModel;
+ /**
+ * Set to true if editor that is currently in the tree was created by this
+ * instance.
+ */
+ protected boolean createdCellEditor;
- /**
- * How much the depth should be offset to properly calculate x locations.
- * This is based on whether or not the root is visible, and if the root
- * handles are visible.
- */
- protected int depthOffset;
+ /**
+ * Set to false when editing and shouldSelectCall() returns true meaning the
+ * node should be selected before editing, used in completeEditing.
+ */
+ protected boolean stopEditingInCompleteEditing;
- /**
- * When editing, this will be the Component that is doing the actual editing.
- */
- protected Component editingComponent;
+ /** Used to paint the TreeCellRenderer. */
+ protected CellRendererPane rendererPane;
- /** Path that is being edited. */
- protected TreePath editingPath;
+ /** Size needed to completely display all the nodes. */
+ protected Dimension preferredSize;
- /**
- * Row that is being edited. Should only be referenced if editingComponent is
- * null.
- */
- protected int editingRow;
+ /** Is the preferredSize valid? */
+ protected boolean validCachedPreferredSize;
- /** Set to true if the editor has a different size than the renderer. */
- protected boolean editorHasDifferentSize;
+ /** Object responsible for handling sizing and expanded issues. */
+ protected AbstractLayoutCache treeState;
- /** Listeners */
- private PropertyChangeListener propertyChangeListener;
+ /** Used for minimizing the drawing of vertical lines. */
+ protected Hashtable drawingCache;
- private FocusListener focusListener;
+ /**
+ * True if doing optimizations for a largeModel. Subclasses that don't support
+ * this may wish to override createLayoutCache to not return a
+ * FixedHeightLayoutCache instance.
+ */
+ protected boolean largeModel;
- private TreeSelectionListener treeSelectionListener;
+ /** Responsible for telling the TreeState the size needed for a node. */
+ protected AbstractLayoutCache.NodeDimensions nodeDimensions;
- private MouseInputListener mouseInputListener;
-
- private KeyListener keyListener;
-
- private PropertyChangeListener selectionModelPropertyChangeListener;
-
- private ComponentListener componentListener;
-
- private CellEditorListener cellEditorListener;
-
- private TreeExpansionListener treeExpansionListener;
-
- private TreeModelListener treeModelListener;
-
- /**
- * Creates a new BasicTreeUI object.
- */
- public BasicTreeUI()
- {
- drawingCache = new Hashtable();
- cellEditor = createDefaultCellEditor();
- currentCellRenderer = createDefaultCellRenderer();
- nodeDimensions = createNodeDimensions();
- rendererPane = createCellRendererPane();
- configureLayoutCache();
-
- propertyChangeListener = createPropertyChangeListener();
- focusListener = createFocusListener();
- treeSelectionListener = createTreeSelectionListener();
- mouseInputListener = new MouseInputHandler(null, null, null);
- keyListener = createKeyListener();
- selectionModelPropertyChangeListener = createSelectionModelPropertyChangeListener();
- componentListener = createComponentListener();
- cellEditorListener = createCellEditorListener();
- treeExpansionListener = createTreeExpansionListener();
- treeModelListener = createTreeModelListener();
+ /** Used to determine what to display. */
+ protected TreeModel treeModel;
+
+ /** Model maintaining the selection. */
+ protected TreeSelectionModel treeSelectionModel;
+
+ /**
+ * How much the depth should be offset to properly calculate x locations. This
+ * is based on whether or not the root is visible, and if the root handles are
+ * visible.
+ */
+ protected int depthOffset;
+
+ /**
+ * When editing, this will be the Component that is doing the actual editing.
+ */
+ protected Component editingComponent;
+
+ /** Path that is being edited. */
+ protected TreePath editingPath;
+
+ /**
+ * Row that is being edited. Should only be referenced if editingComponent is
+ * null.
+ */
+ protected int editingRow;
+
+ /** Set to true if the editor has a different size than the renderer. */
+ protected boolean editorHasDifferentSize;
+
+ /** The action listener for the editor's Timer. */
+ private Timer editorTimer = new EditorUpdateTimer();
+
+ /** The new value of the node after editing. */
+ private Object newVal;
+
+ /** The action bound to KeyStrokes. */
+ private TreeAction action;
+
+ /** Boolean to keep track of editing. */
+ private boolean isEditing;
+
+ /** Listeners */
+ private PropertyChangeListener propertyChangeListener;
+
+ private FocusListener focusListener;
+
+ private TreeSelectionListener treeSelectionListener;
+
+ private MouseInputListener mouseInputListener;
+
+ private KeyListener keyListener;
+
+ private PropertyChangeListener selectionModelPropertyChangeListener;
+
+ private ComponentListener componentListener;
+
+ private CellEditorListener cellEditorListener;
+
+ private TreeExpansionListener treeExpansionListener;
+
+ private TreeModelListener treeModelListener;
+
+ /**
+ * Creates a new BasicTreeUI object.
+ */
+ public BasicTreeUI()
+ {
+ drawingCache = new Hashtable();
+ nodeDimensions = createNodeDimensions();
+ configureLayoutCache();
+
+ propertyChangeListener = createPropertyChangeListener();
+ focusListener = createFocusListener();
+ treeSelectionListener = createTreeSelectionListener();
+ mouseInputListener = new MouseInputHandler(null, null, null);
+ keyListener = createKeyListener();
+ selectionModelPropertyChangeListener = createSelectionModelPropertyChangeListener();
+ componentListener = createComponentListener();
+ cellEditorListener = createCellEditorListener();
+ treeExpansionListener = createTreeExpansionListener();
+ treeModelListener = createTreeModelListener();
+
+ editingRow = -1;
+ lastSelectedRow = -1;
+ }
+
+ /**
+ * Returns an instance of the UI delegate for the specified component.
+ *
+ * @param c
+ * the <code>JComponent</code> for which we need a UI delegate for.
+ * @return the <code>ComponentUI</code> for c.
+ */
+ public static ComponentUI createUI(JComponent c)
+ {
+ return new BasicTreeUI();
+ }
+
+ /**
+ * Returns the Hash color.
+ *
+ * @return the <code>Color</code> of the Hash.
+ */
+ protected Color getHashColor()
+ {
+ return UIManager.getLookAndFeelDefaults().getColor("Tree.hash");
+ }
+
+ /**
+ * Sets the Hash color.
+ *
+ * @param color
+ * the <code>Color</code> to set the Hash to.
+ */
+ protected void setHashColor(Color color)
+ {
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ defaults.put("Tree.hash", color);
+ }
+
+ /**
+ * Sets the left child's indent value.
+ *
+ * @param newAmount
+ * is the new indent value for the left child.
+ */
+ public void setLeftChildIndent(int newAmount)
+ {
+ leftChildIndent = newAmount;
+ }
+
+ /**
+ * Returns the indent value for the left child.
+ *
+ * @return the indent value for the left child.
+ */
+ public int getLeftChildIndent(int newAmount)
+ {
+ return leftChildIndent;
+ }
+
+ /**
+ * Sets the right child's indent value.
+ *
+ * @param newAmount
+ * is the new indent value for the right child.
+ */
+ public void setRightChildIndent(int newAmount)
+ {
+ rightChildIndent = newAmount;
+ }
+
+ /**
+ * Returns the indent value for the right child.
+ *
+ * @return the indent value for the right child.
+ */
+ public int getRightChildIndent()
+ {
+ return rightChildIndent;
+ }
+
+ /**
+ * Sets the expanded icon.
+ *
+ * @param newG
+ * is the new expanded icon.
+ */
+ public void setExpandedIcon(Icon newG)
+ {
+ expandedIcon = newG;
+ }
+
+ /**
+ * Returns the current expanded icon.
+ *
+ * @return the current expanded icon.
+ */
+ public Icon getExpandedIcon()
+ {
+ return expandedIcon;
+ }
+
+ /**
+ * Sets the collapsed icon.
+ *
+ * @param newG
+ * is the new collapsed icon.
+ */
+ public void setCollapsedIcon(Icon newG)
+ {
+ collapsedIcon = newG;
+ }
+
+ /**
+ * Returns the current collapsed icon.
+ *
+ * @return the current collapsed icon.
+ */
+ public Icon getCollapsedIcon()
+ {
+ return collapsedIcon;
+ }
+
+ /**
+ * Updates the componentListener, if necessary.
+ *
+ * @param largeModel
+ * sets this.largeModel to it.
+ */
+ protected void setLargeModel(boolean largeModel)
+ {
+ if (largeModel != this.largeModel)
+ {
+ tree.removeComponentListener(componentListener);
+ this.largeModel = largeModel;
+ tree.addComponentListener(componentListener);
+ }
+ }
+
+ /**
+ * Returns true if largeModel is set
+ *
+ * @return true if largeModel is set, otherwise false.
+ */
+ protected boolean isLargeModel()
+ {
+ return largeModel;
+ }
+
+ /**
+ * Sets the row height.
+ *
+ * @param rowHeight
+ * is the height to set this.rowHeight to.
+ */
+ protected void setRowHeight(int rowHeight)
+ {
+ treeState.setRowHeight(rowHeight);
+ }
+
+ /**
+ * Returns the current row height.
+ *
+ * @return current row height.
+ */
+ protected int getRowHeight()
+ {
+ return treeState.getRowHeight();
+ }
+
+ /**
+ * Sets the TreeCellRenderer to <code>tcr</code>. This invokes
+ * <code>updateRenderer</code>.
+ *
+ * @param tcr
+ * is the new TreeCellRenderer.
+ */
+ protected void setCellRenderer(TreeCellRenderer tcr)
+ {
+ currentCellRenderer = tcr;
+ tree.setCellRenderer(tcr);
+ updateRenderer();
+ }
+
+ /**
+ * Return currentCellRenderer, which will either be the trees renderer, or
+ * defaultCellRenderer, which ever was not null.
+ *
+ * @return the current Cell Renderer
+ */
+ protected TreeCellRenderer getCellRenderer()
+ {
+ if (currentCellRenderer != null)
+ return currentCellRenderer;
+
+ return createDefaultCellRenderer();
+ }
+
+ /**
+ * Sets the tree's model.
+ *
+ * @param model
+ * to set the treeModel to.
+ */
+ protected void setModel(TreeModel model)
+ {
+ tree.setModel(model);
+ treeModel = tree.getModel();
+ }
+
+ /**
+ * Returns the tree's model
+ *
+ * @return treeModel
+ */
+ protected TreeModel getModel()
+ {
+ return treeModel;
+ }
+
+ /**
+ * Sets the root to being visible.
+ *
+ * @param newValue
+ * sets the visibility of the root
+ */
+ protected void setRootVisible(boolean newValue)
+ {
+ tree.setRootVisible(newValue);
+ }
+
+ /**
+ * Returns true if the root is visible.
+ *
+ * @return true if the root is visible.
+ */
+ protected boolean isRootVisible()
+ {
+ return tree.isRootVisible();
+ }
+
+ /**
+ * Determines whether the node handles are to be displayed.
+ *
+ * @param newValue
+ * sets whether or not node handles should be displayed.
+ */
+ protected void setShowsRootHandles(boolean newValue)
+ {
+ tree.setShowsRootHandles(newValue);
+ }
+
+ /**
+ * Returns true if the node handles are to be displayed.
+ *
+ * @return true if the node handles are to be displayed.
+ */
+ protected boolean getShowsRootHandles()
+ {
+ return tree.getShowsRootHandles();
+ }
+
+ /**
+ * Sets the cell editor.
+ *
+ * @param editor
+ * to set the cellEditor to.
+ */
+ protected void setCellEditor(TreeCellEditor editor)
+ {
+ cellEditor = editor;
+ createdCellEditor = true;
+ }
+
+ /**
+ * Returns the <code>TreeCellEditor</code> for this tree.
+ *
+ * @return the cellEditor for this tree.
+ */
+ protected TreeCellEditor getCellEditor()
+ {
+ return cellEditor;
+ }
+
+ /**
+ * Configures the receiver to allow, or not allow, editing.
+ *
+ * @param newValue
+ * sets the receiver to allow editing if true.
+ */
+ protected void setEditable(boolean newValue)
+ {
+ tree.setEditable(newValue);
+ }
+
+ /**
+ * Returns true if the receiver allows editing.
+ *
+ * @return true if the receiver allows editing.
+ */
+ protected boolean isEditable()
+ {
+ return tree.isEditable();
+ }
+
+ /**
+ * Resets the selection model. The appropriate listeners are installed on the
+ * model.
+ *
+ * @param newLSM
+ * resets the selection model.
+ */
+ protected void setSelectionModel(TreeSelectionModel newLSM)
+ {
+ if (newLSM != null)
+ {
+ treeSelectionModel = newLSM;
+ tree.setSelectionModel(treeSelectionModel);
+ }
+ }
+
+ /**
+ * Returns the current selection model.
+ *
+ * @return the current selection model.
+ */
+ protected TreeSelectionModel getSelectionModel()
+ {
+ return treeSelectionModel;
+ }
+
+ /**
+ * Returns the Rectangle enclosing the label portion that the last item in
+ * path will be drawn to. Will return null if any component in path is
+ * currently valid.
+ *
+ * @param tree
+ * is the current tree the path will be drawn to.
+ * @param path
+ * is the current path the tree to draw to.
+ * @return the Rectangle enclosing the label portion that the last item in the
+ * path will be drawn to.
+ */
+ public Rectangle getPathBounds(JTree tree, TreePath path)
+ {
+ if (path != null)
+ {
+ Object cell = path.getLastPathComponent();
+
+ TreeModel mod = tree.getModel();
+ if (mod != null)
+ {
+ Object root = mod.getRoot();
+ if (!tree.isRootVisible() && tree.isExpanded(new TreePath(root)))
+ root = getNextNode(root);
+
+ Point loc = getCellLocation(0, 0, tree, mod, cell, root);
+ return getCellBounds(loc.x, loc.y, cell);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the path for passed in row. If row is not visible null is returned.
+ *
+ * @param tree
+ * is the current tree to return path for.
+ * @param row
+ * is the row number of the row to return.
+ * @return the path for passed in row. If row is not visible null is returned.
+ */
+ public TreePath getPathForRow(JTree tree, int row)
+ {
+ TreeModel mod = tree.getModel();
+ if (mod != null)
+ {
+ Object node = mod.getRoot();
+ if (!tree.isRootVisible()
+ && tree.isExpanded(new TreePath(getPathToRoot(node, 0))))
+ node = getNextNode(node);
+
+ for (int i = 0; i < row; i++)
+ node = getNextVisibleNode(node);
+
+ if (node == null)
+ return null;
+
+ return new TreePath(getPathToRoot(node, 0));
+ }
+ return null;
+ }
+
+ /**
+ * Returns the row that the last item identified in path is visible at. Will
+ * return -1 if any of the elments in the path are not currently visible.
+ *
+ * @param tree
+ * is the current tree to return the row for.
+ * @param path
+ * is the path used to find the row.
+ * @return the row that the last item identified in path is visible at. Will
+ * return -1 if any of the elments in the path are not currently
+ * visible.
+ */
+ public int getRowForPath(JTree tree, TreePath path)
+ {
+ int row = path.getPathCount();
+ if (tree.isVisible(path))
+ return row;
+
+ path = path.getParentPath();
+ while (row > 0 && !tree.isVisible(path))
+ {
+ path = path.getParentPath();
+ row--;
+ }
+ return row;
+ }
+
+ /**
+ * Returns the number of rows that are being displayed.
+ *
+ * @param tree
+ * is the current tree to return the number of rows for.
+ * @return the number of rows being displayed.
+ */
+ public int getRowCount(JTree tree)
+ {
+ TreeModel mod = tree.getModel();
+ int count = 0;
+ if (mod != null)
+ {
+ Object node = mod.getRoot();
+ if (!tree.isRootVisible()
+ && tree.isExpanded(new TreePath((getPathToRoot(node, 0)))))
+ node = getNextNode(node);
+
+ while (node != null)
+ {
+ count++;
+ node = getNextVisibleNode(node);
+ }
+ }
+ return count;
+ }
+
+ /**
+ * Returns the path to the node that is closest to x,y. If there is nothing
+ * currently visible this will return null, otherwise it'll always return a
+ * valid path. If you need to test if the returned object is exactly at x,y
+ * you should get the bounds for the returned path and test x,y against that.
+ *
+ * @param tree
+ * the tree to search for the closest path
+ * @param x
+ * is the x coordinate of the location to search
+ * @param y
+ * is the y coordinate of the location to search
+ * @return the tree path closes to x,y.
+ */
+ public TreePath getClosestPathForLocation(JTree tree, int x, int y)
+ {
+ // FIXME: what if root is hidden? should not depend on (0,0)
+ // should start counting rows from where root is.
+
+ int row = Math.round(y / getRowHeight());
+ TreePath path = getPathForRow(tree, row);
+
+ // no row is visible at this node
+ while (row > 0 && path == null)
+ {
+ --row;
+ path = getPathForRow(tree, row);
+ }
+
+ return path;
+ }
+
+ /**
+ * Returns true if the tree is being edited. The item that is being edited can
+ * be returned by getEditingPath().
+ *
+ * @param tree
+ * is the tree to check for editing.
+ * @return true if the tree is being edited.
+ */
+ public boolean isEditing(JTree tree)
+ {
+ return isEditing;
+ }
+
+ /**
+ * Stops the current editing session. This has no effect if the tree is not
+ * being edited. Returns true if the editor allows the editing session to
+ * stop.
+ *
+ * @param tree
+ * is the tree to stop the editing on
+ * @return true if the editor allows the editing session to stop.
+ */
+ public boolean stopEditing(JTree tree)
+ {
+ if (isEditing(tree))
+ completeEditing(true, false, false);
+ return !isEditing(tree);
+ }
+
+ /**
+ * Cancels the current editing session.
+ *
+ * @param tree
+ * is the tree to cancel the editing session on.
+ */
+ public void cancelEditing(JTree tree)
+ {
+ if (isEditing(tree))
+ completeEditing(false, true, false);
+ }
+
+ /**
+ * Selects the last item in path and tries to edit it. Editing will fail if
+ * the CellEditor won't allow it for the selected item.
+ *
+ * @param tree
+ * is the tree to edit on.
+ * @param path
+ * is the path in tree to edit on.
+ */
+ public void startEditingAtPath(JTree tree, TreePath path)
+ {
+ startEditing(path, null);
+ }
+
+ /**
+ * Returns the path to the element that is being editted.
+ *
+ * @param tree
+ * is the tree to get the editing path from.
+ * @return the path that is being edited.
+ */
+ public TreePath getEditingPath(JTree tree)
+ {
+ return editingPath;
+ }
+
+ /**
+ * Invoked after the tree instance variable has been set, but before any
+ * default/listeners have been installed.
+ */
+ protected void prepareForUIInstall()
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * Invoked from installUI after all the defaults/listeners have been
+ * installed.
+ */
+ protected void completeUIInstall()
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * Invoked from uninstallUI after all the defaults/listeners have been
+ * uninstalled.
+ */
+ protected void completeUIUninstall()
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * Installs the subcomponents of the tree, which is the renderer pane.
+ */
+ protected void installComponents()
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * Creates an instance of NodeDimensions that is able to determine the size of
+ * a given node in the tree.
+ *
+ * @return the NodeDimensions of a given node in the tree
+ */
+ protected AbstractLayoutCache.NodeDimensions createNodeDimensions()
+ {
+ // FIXME: not implemented
+ return null;
+ }
+
+ /**
+ * Creates a listener that is reponsible for the updates the UI based on how
+ * the tree changes.
+ *
+ * @return the PropertyChangeListener that is reposnsible for the updates
+ */
+ protected PropertyChangeListener createPropertyChangeListener()
+ {
+ return new PropertyChangeHandler();
+ }
+
+ /**
+ * Creates the listener responsible for updating the selection based on mouse
+ * events.
+ *
+ * @return the MouseListener responsible for updating.
+ */
+ protected MouseListener createMouseListener()
+ {
+ return new MouseHandler();
+ }
+
+ /**
+ * Creates the listener that is responsible for updating the display when
+ * focus is lost/grained.
+ *
+ * @return the FocusListener responsible for updating.
+ */
+ protected FocusListener createFocusListener()
+ {
+ return new FocusHandler();
+ }
+
+ /**
+ * Creates the listener reponsible for getting key events from the tree.
+ *
+ * @return the KeyListener responsible for getting key events.
+ */
+ protected KeyListener createKeyListener()
+ {
+ return new KeyHandler();
+ }
+
+ /**
+ * Creates the listener responsible for getting property change events from
+ * the selection model.
+ *
+ * @returns the PropertyChangeListener reponsible for getting property change
+ * events from the selection model.
+ */
+ protected PropertyChangeListener createSelectionModelPropertyChangeListener()
+ {
+ return new SelectionModelPropertyChangeHandler();
+ }
+
+ /**
+ * Creates the listener that updates the display based on selection change
+ * methods.
+ *
+ * @return the TreeSelectionListener responsible for updating.
+ */
+ protected TreeSelectionListener createTreeSelectionListener()
+ {
+ return new TreeSelectionHandler();
+ }
+
+ /**
+ * Creates a listener to handle events from the current editor
+ *
+ * @return the CellEditorListener that handles events from the current editor
+ */
+ protected CellEditorListener createCellEditorListener()
+ {
+ return new CellEditorHandler();
+ }
+
+ /**
+ * Creates and returns a new ComponentHandler. This is used for the large
+ * model to mark the validCachedPreferredSize as invalid when the component
+ * moves.
+ *
+ * @return a new ComponentHandler.
+ */
+ protected ComponentListener createComponentListener()
+ {
+ return new ComponentHandler();
+ }
+
+ /**
+ * Creates and returns the object responsible for updating the treestate when
+ * a nodes expanded state changes.
+ *
+ * @return the TreeExpansionListener responsible for updating the treestate
+ */
+ protected TreeExpansionListener createTreeExpansionListener()
+ {
+ return new TreeExpansionHandler();
+ }
+
+ /**
+ * Creates the object responsible for managing what is expanded, as well as
+ * the size of nodes.
+ *
+ * @return the object responsible for managing what is expanded.
+ */
+ protected AbstractLayoutCache createLayoutCache()
+ {
+ return new FixedHeightLayoutCache();
+ }
+
+ /**
+ * Returns the renderer pane that renderer components are placed in.
+ *
+ * @return the rendererpane that render components are placed in.
+ */
+ protected CellRendererPane createCellRendererPane()
+ {
+ return new CellRendererPane();
+ }
+
+ /**
+ * Creates a default cell editor.
+ *
+ * @return the default cell editor.
+ */
+ protected TreeCellEditor createDefaultCellEditor()
+ {
+ if (currentCellRenderer != null)
+ return new DefaultTreeCellEditor(tree,
+ (DefaultTreeCellRenderer) currentCellRenderer,
+ cellEditor);
+ return new DefaultTreeCellEditor(tree,
+ (DefaultTreeCellRenderer) createDefaultCellRenderer(),
+ cellEditor);
+ }
+
+ /**
+ * Returns the default cell renderer that is used to do the stamping of each
+ * node.
+ *
+ * @return the default cell renderer that is used to do the stamping of each
+ * node.
+ */
+ protected TreeCellRenderer createDefaultCellRenderer()
+ {
+ return new DefaultTreeCellRenderer();
+ }
+
+ /**
+ * Returns a listener that can update the tree when the model changes.
+ *
+ * @return a listener that can update the tree when the model changes.
+ */
+ protected TreeModelListener createTreeModelListener()
+ {
+ return new TreeModelHandler();
+ }
+
+ /**
+ * Uninstall all registered listeners
+ */
+ protected void uninstallListeners()
+ {
+ tree.removePropertyChangeListener(propertyChangeListener);
+ tree.removeFocusListener(focusListener);
+ tree.removeTreeSelectionListener(treeSelectionListener);
+ tree.removeMouseListener(mouseInputListener);
+ tree.removeKeyListener(keyListener);
+ tree.removePropertyChangeListener(selectionModelPropertyChangeListener);
+ tree.removeComponentListener(componentListener);
+ tree.removeTreeExpansionListener(treeExpansionListener);
+
+ TreeCellEditor tce = tree.getCellEditor();
+ if (tce != null)
+ tce.removeCellEditorListener(cellEditorListener);
+ TreeModel tm = tree.getModel();
+ if (tm != null)
+ tm.removeTreeModelListener(treeModelListener);
+ }
+
+ /**
+ * Uninstall all keyboard actions.
+ */
+ protected void uninstallKeyboardActions()
+ {
+ }
+
+ /**
+ * Uninstall the rendererPane.
+ */
+ protected void uninstallComponents()
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * The vertical element of legs between nodes starts at the bottom of the
+ * parent node by default. This method makes the leg start below that.
+ *
+ * @return the vertical leg buffer
+ */
+ protected int getVerticalLegBuffer()
+ {
+ // FIXME: not implemented
+ return 0;
+ }
+
+ /**
+ * The horizontal element of legs between nodes starts at the right of the
+ * left-hand side of the child node by default. This method makes the leg end
+ * before that.
+ *
+ * @return the horizontal leg buffer
+ */
+ protected int getHorizontalLegBuffer()
+ {
+ // FIXME: not implemented
+ return 0;
+ }
+
+ /**
+ * Make all the nodes that are expanded in JTree expanded in LayoutCache. This
+ * invokes update ExpandedDescendants with the root path.
+ */
+ protected void updateLayoutCacheExpandedNodes()
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * Updates the expanded state of all the descendants of the <code>path</code>
+ * by getting the expanded descendants from the tree and forwarding to the
+ * tree state.
+ *
+ * @param path
+ * the path used to update the expanded states
+ */
+ protected void updateExpandedDescendants(TreePath path)
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * Returns a path to the last child of <code>parent</code>
+ *
+ * @param parent
+ * is the topmost path to specified
+ * @return a path to the last child of parent
+ */
+ protected TreePath getLastChildPath(TreePath parent)
+ {
+ return ((TreePath) parent.getLastPathComponent());
+ }
+
+ /**
+ * Updates how much each depth should be offset by.
+ */
+ protected void updateDepthOffset()
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * Updates the cellEditor based on editability of the JTree that we're
+ * contained in. If the tree is editable but doesn't have a cellEditor, a
+ * basic one will be used.
+ */
+ protected void updateCellEditor()
+ {
+ if (tree.isEditable() && cellEditor == null)
+ setCellEditor(createDefaultCellEditor());
+ createdCellEditor = true;
+ }
+
+ /**
+ * Messaged from the tree we're in when the renderer has changed.
+ */
+ protected void updateRenderer()
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * Resets the treeState instance based on the tree we're providing the look
+ * and feel for.
+ */
+ protected void configureLayoutCache()
+ {
+ treeState = createLayoutCache();
+ }
+
+ /**
+ * Marks the cached size as being invalid, and messages the tree with
+ * <code>treeDidChange</code>.
+ */
+ protected void updateSize()
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * Updates the <code>preferredSize</code> instance variable, which is
+ * returned from <code>getPreferredSize()</code>. For left to right
+ * orientations, the size is determined from the current AbstractLayoutCache.
+ * For RTL orientations, the preferred size becomes the width minus the
+ * minimum x position.
+ */
+ protected void updateCachedPreferredSize()
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * Messaged from the VisibleTreeNode after it has been expanded.
+ *
+ * @param path
+ * is the path that has been expanded.
+ */
+ protected void pathWasExpanded(TreePath path)
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * Messaged from the VisibleTreeNode after it has collapsed
+ */
+ protected void pathWasCollapsed(TreePath path)
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * Install all defaults for the tree.
+ *
+ * @param tree
+ * is the JTree to install defaults for
+ */
+ protected void installDefaults(JTree tree)
+ {
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+
+ tree.setFont(defaults.getFont("Tree.font"));
+ tree.setForeground(defaults.getColor("Tree.foreground"));
+ tree.setBackground(defaults.getColor("Tree.background"));
+ tree.setOpaque(true);
+
+ rightChildIndent = defaults.getInt("Tree.rightChildIndent");
+ leftChildIndent = defaults.getInt("Tree.leftChildIndent");
+ setRowHeight(defaults.getInt("Tree.rowHeight"));
+ tree.requestFocusInWindow(false);
+ }
+
+ /**
+ * Install all keyboard actions for this
+ */
+ protected void installKeyboardActions()
+ {
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ InputMap focusInputMap = (InputMap) defaults.get("Tree.focusInputMap");
+ InputMapUIResource parentInputMap = new InputMapUIResource();
+ ActionMap parentActionMap = new ActionMap();
+ action = new TreeAction();
+ Object keys[] = focusInputMap.allKeys();
+
+ for (int i = 0; i < keys.length; i++)
+ {
+ parentInputMap.put(
+ KeyStroke.getKeyStroke(
+ ((KeyStroke) keys[i]).getKeyCode(),
+ convertModifiers(((KeyStroke) keys[i]).getModifiers())),
+ (String) focusInputMap.get((KeyStroke) keys[i]));
+
+ parentInputMap.put(
+ KeyStroke.getKeyStroke(
+ ((KeyStroke) keys[i]).getKeyCode(),
+ ((KeyStroke) keys[i]).getModifiers()),
+ (String) focusInputMap.get((KeyStroke) keys[i]));
+
+ parentActionMap.put(
+ (String) focusInputMap.get((KeyStroke) keys[i]),
+ new ActionListenerProxy(
+ action,
+ (String) focusInputMap.get((KeyStroke) keys[i])));
+
+ }
+
+ parentInputMap.setParent(tree.getInputMap(
+ JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).getParent());
+ parentActionMap.setParent(tree.getActionMap().getParent());
+ tree.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).setParent(
+ parentInputMap);
+ tree.getActionMap().setParent(parentActionMap);
+ }
+
+ /**
+ * Converts the modifiers.
+ *
+ * @param mod -
+ * modifier to convert
+ * @returns the new modifier
+ */
+ private int convertModifiers(int mod)
+ {
+ if ((mod & KeyEvent.SHIFT_DOWN_MASK) != 0)
+ {
+ mod |= KeyEvent.SHIFT_MASK;
+ mod &= ~KeyEvent.SHIFT_DOWN_MASK;
+ }
+ if ((mod & KeyEvent.CTRL_DOWN_MASK) != 0)
+ {
+ mod |= KeyEvent.CTRL_MASK;
+ mod &= ~KeyEvent.CTRL_DOWN_MASK;
+ }
+ if ((mod & KeyEvent.META_DOWN_MASK) != 0)
+ {
+ mod |= KeyEvent.META_MASK;
+ mod &= ~KeyEvent.META_DOWN_MASK;
+ }
+ if ((mod & KeyEvent.ALT_DOWN_MASK) != 0)
+ {
+ mod |= KeyEvent.ALT_MASK;
+ mod &= ~KeyEvent.ALT_DOWN_MASK;
+ }
+ if ((mod & KeyEvent.ALT_GRAPH_DOWN_MASK) != 0)
+ {
+ mod |= KeyEvent.ALT_GRAPH_MASK;
+ mod &= ~KeyEvent.ALT_GRAPH_DOWN_MASK;
+ }
+ return mod;
+ }
+
+ /**
+ * Install all listeners for this
+ */
+ protected void installListeners()
+ {
+ tree.addPropertyChangeListener(propertyChangeListener);
+ tree.addFocusListener(focusListener);
+ tree.addTreeSelectionListener(treeSelectionListener);
+ tree.addMouseListener(mouseInputListener);
+ tree.addKeyListener(keyListener);
+ tree.addPropertyChangeListener(selectionModelPropertyChangeListener);
+ tree.addComponentListener(componentListener);
+ tree.addTreeExpansionListener(treeExpansionListener);
+ if (treeModel != null)
+ treeModel.addTreeModelListener(treeModelListener);
+ }
+
+ /**
+ * Install the UI for the component
+ *
+ * @param c
+ * the component to install UI for
+ */
+ public void installUI(JComponent c)
+ {
+ super.installUI(c);
+ installDefaults((JTree) c);
+ tree = (JTree) c;
+
+ currentCellRenderer = createDefaultCellRenderer();
+ rendererPane = createCellRendererPane();
+ createdRenderer = true;
+
+ setCellEditor(createDefaultCellEditor());
+ createdCellEditor = true;
+ isEditing = false;
+
+ TreeModel mod = tree.getModel();
+ setModel(mod);
+ tree.setRootVisible(true);
+ if (mod != null)
+ tree.expandPath(new TreePath(mod.getRoot()));
+ treeSelectionModel = tree.getSelectionModel();
+
+ installKeyboardActions();
+ installListeners();
+ completeUIInstall();
+ }
+
+ /**
+ * Uninstall the defaults for the tree
+ *
+ * @param tree
+ * to uninstall defaults for
+ */
+ protected void uninstallDefaults(JTree tree)
+ {
+ tree.setFont(null);
+ tree.setForeground(null);
+ tree.setBackground(null);
+ }
+
+ /**
+ * Uninstall the UI for the component
+ *
+ * @param c
+ * the component to uninstall UI for
+ */
+ public void uninstallUI(JComponent c)
+ {
+ uninstallDefaults((JTree) c);
+ uninstallKeyboardActions();
+ uninstallListeners();
+ tree = null;
+ completeUIUninstall();
+ }
+
+ /**
+ * Paints the specified component appropriate for the look and feel. This
+ * method is invoked from the ComponentUI.update method when the specified
+ * component is being painted. Subclasses should override this method and use
+ * the specified Graphics object to render the content of the component.
+ *
+ * @param g
+ * the Graphics context in which to paint
+ * @param c
+ * the component being painted; this argument is often ignored, but
+ * might be used if the UI object is stateless and shared by multiple
+ * components
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ JTree tree = (JTree) c;
+
+ TreeModel mod = tree.getModel();
+
+ if (mod != null)
+ {
+ Object root = mod.getRoot();
+
+ if (!tree.isRootVisible())
+ tree.expandPath(new TreePath(root));
+
+ paintRecursive(g, 0, 0, 0, 0, tree, mod, root);
+
+ if (hasControlIcons())
+ paintControlIcons(g, 0, 0, 0, 0, tree, mod, root);
+ }
+ }
+
+ /**
+ * Ensures that the rows identified by beginRow through endRow are visible.
+ *
+ * @param beginRow
+ * is the first row
+ * @param endRow
+ * is the last row
+ */
+ protected void ensureRowsAreVisible(int beginRow, int endRow)
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * Sets the preferred minimum size.
+ *
+ * @param newSize
+ * is the new preferred minimum size.
+ */
+ public void setPreferredMinSize(Dimension newSize)
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * Gets the preferred minimum size.
+ *
+ * @returns the preferred minimum size.
+ */
+ public Dimension getPreferredMinSize()
+ {
+ // FIXME: not implemented
+ return null;
+ }
+
+ /**
+ * Returns the preferred size to properly display the tree, this is a cover
+ * method for getPreferredSize(c, false).
+ *
+ * @param c
+ * the component whose preferred size is being queried; this argument
+ * is often ignored but might be used if the UI object is stateless
+ * and shared by multiple components
+ * @return the preferred size
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ return getPreferredSize(c, false);
+ }
+
+ /**
+ * Returns the preferred size to represent the tree in c. If checkConsistancy
+ * is true, checkConsistancy is messaged first.
+ *
+ * @param c
+ * the component whose preferred size is being queried.
+ * @param checkConsistancy
+ * if true must check consistancy
+ * @return the preferred size
+ */
+ public Dimension getPreferredSize(JComponent c, boolean checkConsistancy)
+ {
+ // FIXME: checkConsistancy not implemented, c not used
+ TreeModel model = tree.getModel();
+ int maxWidth = 0;
+ int count = 0;
+ if (model != null)
+ {
+ Object node = model.getRoot();
+ if (node != null)
+ {
+ maxWidth = (int) (getCellBounds(0, 0, node).getWidth());
+ while (node != null)
+ {
+ count++;
+ Object nextNode = getNextVisibleNode(node);
+ if (nextNode != null)
+ maxWidth = Math.max(maxWidth,
+ (int) (getCellBounds(0, 0, nextNode).getWidth()));
+ node = nextNode;
+ }
+ }
+ }
+ return new Dimension(maxWidth, (getRowHeight() * count));
+ }
+
+ /**
+ * Returns the minimum size for this component. Which will be the min
+ * preferred size or (0,0).
+ *
+ * @param c
+ * the component whose min size is being queried.
+ * @returns the preferred size or null
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ // FIXME: not implemented
+ return getPreferredSize(c);
+ }
+
+ /**
+ * Returns the maximum size for the component, which will be the preferred
+ * size if the instance is currently in JTree or (0,0).
+ *
+ * @param c
+ * the component whose preferred size is being queried
+ * @return the max size or null
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ // FIXME: not implemented
+ return getPreferredSize(c);
+ }
+
+ /**
+ * Messages to stop the editing session. If the UI the receiver is providing
+ * the look and feel for returns true from
+ * <code>getInvokesStopCellEditing</code>, stopCellEditing will be invoked
+ * on the current editor. Then completeEditing will be messaged with false,
+ * true, false to cancel any lingering editing.
+ */
+ protected void completeEditing()
+ {
+ completeEditing(false, true, false);
+ }
+
+ /**
+ * Stops the editing session. If messageStop is true, the editor is messaged
+ * with stopEditing, if messageCancel is true the editor is messaged with
+ * cancelEditing. If messageTree is true, the treeModel is messaged with
+ * valueForPathChanged.
+ *
+ * @param messageStop
+ * message to stop editing
+ * @param messageCancel
+ * message to cancel editing
+ * @param messageTree
+ * message to treeModel
+ */
+ protected void completeEditing(boolean messageStop, boolean messageCancel,
+ boolean messageTree)
+ {
+ if (messageStop)
+ {
+ getCellEditor().stopCellEditing();
+ stopEditingInCompleteEditing = true;
+ }
+
+ if (messageCancel)
+ {
+ getCellEditor().cancelCellEditing();
+ stopEditingInCompleteEditing = true;
+ }
+
+ if (messageTree)
+ tree.getModel().valueForPathChanged(tree.getLeadSelectionPath(), newVal);
+ }
+
+ /**
+ * Will start editing for node if there is a cellEditor and shouldSelectCall
+ * returns true. This assumes that path is valid and visible.
+ *
+ * @param path
+ * is the path to start editing
+ * @param event
+ * is the MouseEvent performed on the path
+ * @return true if successful
+ */
+ protected boolean startEditing(TreePath path, MouseEvent event)
+ {
+ int x;
+ int y;
+ if (event == null)
+ {
+ Rectangle bounds = getPathBounds(tree, path);
+ x = bounds.x;
+ y = bounds.y;
+ }
+ else
+ {
+ x = event.getX();
+ y = event.getY();
+ }
+
+ updateCellEditor();
+ TreeCellEditor ed = getCellEditor();
+ if (ed != null && ed.shouldSelectCell(event) && ed.isCellEditable(event))
+ {
+ editingPath = path;
+ editingRow = tree.getRowForPath(editingPath);
+ Object val = editingPath.getLastPathComponent();
+ cellEditor.addCellEditorListener(cellEditorListener);
+ stopEditingInCompleteEditing = false;
+ boolean expanded = tree.isExpanded(editingPath);
+ isEditing = true;
+ editingComponent = ed.getTreeCellEditorComponent(tree, val, true,
+ expanded,
+ isLeaf(editingRow),
+ editingRow);
+ editingComponent.getParent().setVisible(true);
+ editingComponent.getParent().validate();
+ tree.add(editingComponent.getParent());
+ editingComponent.getParent().validate();
+ ((JTextField) editingComponent).requestFocusInWindow(false);
+ editorTimer.start();
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * If the <code>mouseX</code> and <code>mouseY</code> are in the expand or
+ * collapse region of the row, this will toggle the row.
+ *
+ * @param path
+ * the path we are concerned with
+ * @param mouseX
+ * is the cursor's x position
+ * @param mouseY
+ * is the cursor's y position
+ */
+ protected void checkForClickInExpandControl(TreePath path, int mouseX,
+ int mouseY)
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * Returns true if the <code>mouseX</code> and <code>mouseY</code> fall in
+ * the area of row that is used to expand/collpse the node and the node at row
+ * does not represent a leaf.
+ *
+ * @param path
+ * the path we are concerned with
+ * @param mouseX
+ * is the cursor's x position
+ * @param mouseY
+ * is the cursor's y position
+ * @return true if the <code>mouseX</code> and <code>mouseY</code> fall in
+ * the area of row that is used to expand/collpse the node and the
+ * node at row does not represent a leaf.
+ */
+ protected boolean isLocationInExpandControl(TreePath path, int mouseX,
+ int mouseY)
+ {
+ // FIXME: not implemented
+ return false;
+ }
+
+ /**
+ * Messaged when the user clicks the particular row, this invokes
+ * toggleExpandState.
+ *
+ * @param path
+ * the path we are concerned with
+ * @param mouseX
+ * is the cursor's x position
+ * @param mouseY
+ * is the cursor's y position
+ */
+ protected void handleExpandControlClick(TreePath path, int mouseX, int mouseY)
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * Expands path if it is not expanded, or collapses row if it is expanded. If
+ * expanding a path and JTree scroll on expand, ensureRowsAreVisible is
+ * invoked to scroll as many of the children to visible as possible (tries to
+ * scroll to last visible descendant of path).
+ *
+ * @param path
+ * the path we are concerned with
+ */
+ protected void toggleExpandState(TreePath path)
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * Returning true signifies a mouse event on the node should toggle the
+ * selection of only the row under the mouse.
+ *
+ * @param event
+ * is the MouseEvent performed on the row.
+ * @return true signifies a mouse event on the node should toggle the
+ * selection of only the row under the mouse.
+ */
+ protected boolean isToggleSelectionEvent(MouseEvent event)
+ {
+ // FIXME: not implemented
+ return false;
+ }
+
+ /**
+ * Returning true signifies a mouse event on the node should select from the
+ * anchor point.
+ *
+ * @param event
+ * is the MouseEvent performed on the node.
+ * @return true signifies a mouse event on the node should select from the
+ * anchor point.
+ */
+ protected boolean isMultiSelectEvent(MouseEvent event)
+ {
+ // FIXME: not implemented
+ return false;
+ }
+
+ /**
+ * Returning true indicates the row under the mouse should be toggled based on
+ * the event. This is invoked after checkForClickInExpandControl, implying the
+ * location is not in the expand (toggle) control.
+ *
+ * @param event
+ * is the MouseEvent performed on the row.
+ * @return true indicates the row under the mouse should be toggled based on
+ * the event.
+ */
+ protected boolean isToggleEvent(MouseEvent event)
+ {
+ // FIXME: not implemented
+ return false;
+ }
+
+ /**
+ * Messaged to update the selection based on a MouseEvent over a particular
+ * row. If the even is a toggle selection event, the row is either selected,
+ * or deselected. If the event identifies a multi selection event, the
+ * selection is updated from the anchor point. Otherwise, the row is selected,
+ * and if the even specified a toggle event the row is expanded/collapsed.
+ *
+ * @param path
+ * is the path selected for an event
+ * @param event
+ * is the MouseEvent performed on the path.
+ */
+ protected void selectPathForEvent(TreePath path, MouseEvent event)
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * Returns true if the node at <code>row</code> is a leaf.
+ *
+ * @param row
+ * is the row we are concerned with.
+ * @return true if the node at <code>row</code> is a leaf.
+ */
+ protected boolean isLeaf(int row)
+ {
+ TreePath pathForRow = getPathForRow(tree, row);
+ if (pathForRow == null)
+ return true;
+
+ Object node = pathForRow.getLastPathComponent();
+ return tree.getModel().isLeaf(node);
+ }
+
+ /**
+ * This class implements the actions that we want to happen when specific keys
+ * are pressed for the JTree. The actionPerformed method is called when a key
+ * that has been registered for the JTree is received.
+ */
+ class TreeAction
+ extends AbstractAction
+ {
+
+ /**
+ * What to do when this action is called.
+ *
+ * @param e
+ * the ActionEvent that caused this action.
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ TreePath lead = tree.getLeadSelectionPath();
+
+ if (e.getActionCommand().equals("selectPreviousChangeLead")
+ || e.getActionCommand().equals("selectPreviousExtendSelection")
+ || e.getActionCommand().equals("selectPrevious")
+ || e.getActionCommand().equals("selectNext")
+ || e.getActionCommand().equals("selectNextExtendSelection")
+ || e.getActionCommand().equals("selectNextChangeLead"))
+ (new TreeIncrementAction(0, "")).actionPerformed(e);
+ else if (e.getActionCommand().equals("selectParent")
+ || e.getActionCommand().equals("selectChild"))
+ (new TreeTraverseAction(0, "")).actionPerformed(e);
+ else if (e.getActionCommand().equals("selectAll"))
+ {
+ TreePath[] paths = new TreePath[tree.getRowCount()];
+
+ Object curr = getNextVisibleNode(tree.getModel().getRoot());
+ int i = 0;
+ while (curr != null && i < paths.length)
+ {
+ paths[i] = new TreePath(getPathToRoot(curr, 0));
+ i++;
+ }
- createdRenderer = true;
- createdCellEditor = true;
+ tree.addSelectionPaths(paths);
+ }
+ else if (e.getActionCommand().equals("startEditing"))
+ tree.startEditingAtPath(lead);
+ else if (e.getActionCommand().equals("toggle"))
+ {
+ if (tree.isEditing())
+ tree.stopEditing();
+ else
+ {
+ Object last = lead.getLastPathComponent();
+ TreePath path = new TreePath(getPathToRoot(last, 0));
+ if (!tree.getModel().isLeaf(last))
+ {
+ if (tree.isExpanded(path))
+ tree.collapsePath(path);
+ else
+ tree.expandPath(path);
+ }
+ }
+ }
+ else if (e.getActionCommand().equals("clearSelection"))
+ tree.clearSelection();
+
+ if (tree.isEditing() && !e.getActionCommand().equals("startEditing"))
+ tree.cancelEditing();
+
+ tree.scrollPathToVisible(lead);
+ }
+ }
+
+ /**
+ * This class is used to mimic the behaviour of the JDK when registering
+ * keyboard actions. It is the same as the private class used in JComponent
+ * for the same reason. This class receives an action event and dispatches it
+ * to the true receiver after altering the actionCommand property of the
+ * event.
+ */
+ private static class ActionListenerProxy
+ extends AbstractAction
+ {
+ ActionListener target;
+
+ String bindingCommandName;
+
+ public ActionListenerProxy(ActionListener li, String cmd)
+ {
+ target = li;
+ bindingCommandName = cmd;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ ActionEvent derivedEvent = new ActionEvent(e.getSource(), e.getID(),
+ bindingCommandName,
+ e.getModifiers());
+
+ target.actionPerformed(derivedEvent);
+ }
+ }
+
+ /**
+ * The timer that updates the editor component.
+ */
+ private class EditorUpdateTimer
+ extends Timer
+ implements ActionListener
+ {
+ /**
+ * Creates a new EditorUpdateTimer object with a default delay of 0.3
+ * seconds.
+ */
+ public EditorUpdateTimer()
+ {
+ super(300, null);
+ addActionListener(this);
+ }
+
+ /**
+ * Lets the caret blink and repaints the table.
+ */
+ public void actionPerformed(ActionEvent ev)
+ {
+ Caret c = ((JTextField) editingComponent).getCaret();
+ if (c != null)
+ c.setVisible(!c.isVisible());
+ tree.repaint();
+ }
+
+ /**
+ * Updates the blink delay according to the current caret.
+ */
+ public void update()
+ {
+ stop();
+ Caret c = ((JTextField) editingComponent).getCaret();
+ if (c != null)
+ {
+ setDelay(c.getBlinkRate());
+ if (((JTextField) editingComponent).isEditable())
+ start();
+ else
+ c.setVisible(false);
+ }
+ }
+ }
+
+ /**
+ * Updates the preferred size when scrolling, if necessary.
+ */
+ public class ComponentHandler
+ extends ComponentAdapter
+ implements ActionListener
+ {
+ /**
+ * Timer used when inside a scrollpane and the scrollbar is adjusting
+ */
+ protected Timer timer;
+
+ /** ScrollBar that is being adjusted */
+ protected JScrollBar scrollBar;
+
+ /**
+ * Constructor
+ */
+ public ComponentHandler()
+ {
+ }
+
+ /**
+ * Invoked when the component's position changes.
+ *
+ * @param e
+ * the event that occurs when moving the component
+ */
+ public void componentMoved(ComponentEvent e)
+ {
+ }
+
+ /**
+ * Creats, if necessary, and starts a Timer to check if needed to resize the
+ * bounds
+ */
+ protected void startTimer()
+ {
+ }
+
+ /**
+ * Returns the JScrollPane housing the JTree, or null if one isn't found.
+ *
+ * @return JScrollPane housing the JTree, or null if one isn't found.
+ */
+ protected JScrollPane getScrollPane()
+ {
+ return null;
+ }
+
+ /**
+ * Public as a result of Timer. If the scrollBar is null, or not adjusting,
+ * this stops the timer and updates the sizing.
+ *
+ * @param ae
+ * is the action performed
+ */
+ public void actionPerformed(ActionEvent ae)
+ {
+ }
+ }// ComponentHandler
+
+ /**
+ * Listener responsible for getting cell editing events and updating the tree
+ * accordingly.
+ */
+ public class CellEditorHandler
+ implements CellEditorListener
+ {
+ /**
+ * Constructor
+ */
+ public CellEditorHandler()
+ {
+ }
+
+ /**
+ * Messaged when editing has stopped in the tree. Tells the listeners
+ * editing has stopped.
+ *
+ * @param e
+ * is the notification event
+ */
+ public void editingStopped(ChangeEvent e)
+ {
+ editingPath = null;
editingRow = -1;
- lastSelectedRow = -1;
- }
-
- /**
- * Returns an instance of the UI delegate for the specified component.
- *
- * @param c the <code>JComponent</code> for which we need a UI delegate
- * for.
- * @return the <code>ComponentUI</code> for c.
- */
- public static ComponentUI createUI(JComponent c)
- {
- return new BasicTreeUI();
- }
-
- /**
- * Returns the Hash color.
- *
- * @return the <code>Color</code> of the Hash.
- */
- protected Color getHashColor()
- {
- return UIManager.getLookAndFeelDefaults().getColor("Tree.hash");
- }
-
- /**
- * Sets the Hash color.
- *
- * @param the <code>Color</code> to set the Hash to.
- */
- protected void setHashColor(Color color)
- {
- // FIXME: not implemented
-
- }
-
- /**
- * Sets the left child's indent value.
- *
- * @param newAmount is the new indent value for the left child.
- */
- public void setLeftChildIndent(int newAmount)
- {
- leftChildIndent = newAmount;
- }
-
- /**
- * Returns the indent value for the left child.
- *
- * @return the indent value for the left child.
- */
- public int getLeftChildIndent(int newAmount)
- {
- return leftChildIndent;
- }
-
- /**
- * Sets the right child's indent value.
- *
- * @param newAmount is the new indent value for the right child.
- */
- public void setRightChildIndent(int newAmount)
- {
- rightChildIndent = newAmount;
- }
-
- /**
- * Returns the indent value for the right child.
- *
- * @return the indent value for the right child.
- */
- public int getRightChildIndent(int newAmount)
- {
- return rightChildIndent;
- }
-
- /**
- * Sets the expanded icon.
- *
- * @param newG is the new expanded icon.
- */
- public void setExpandedIcon(Icon newG)
- {
- expandedIcon = newG;
- }
-
- /**
- * Returns the current expanded icon.
- *
- * @return the current expanded icon.
- */
- public Icon getExpandedIcon()
- {
- return expandedIcon;
- }
-
- /**
- * Sets the collapsed icon.
- *
- * @param newG is the new collapsed icon.
- */
- public void setCollapsedIcon(Icon newG)
- {
- collapsedIcon = newG;
- }
-
- /**
- * Returns the current collapsed icon.
- *
- * @return the current collapsed icon.
- */
- public Icon getCollapsedIcon()
- {
- return collapsedIcon;
- }
-
- /**
- * Updates the componentListener, if necessary.
- *
- * @param largeModel sets this.largeModel to it.
- */
- protected void setLargeModel(boolean largeModel)
- {
- if (largeModel != this.largeModel)
- {
- tree.removeComponentListener(componentListener);
- this.largeModel = largeModel;
- tree.addComponentListener(componentListener);
- }
- }
-
- /**
- * Returns true if largeModel is set
- *
- * @return true if largeModel is set, otherwise false.
- */
- protected boolean isLargeModel()
- {
- return largeModel;
- }
-
- /**
- * Sets the row height.
- *
- * @param rowHeight is the height to set this.rowHeight to.
- */
- protected void setRowHeight(int rowHeight)
- {
- treeState.setRowHeight(rowHeight);
- }
-
- /**
- * Returns the current row height.
- *
- * @return current row height.
- */
- protected int getRowHeight()
- {
- return treeState.getRowHeight();
- }
-
- /**
- * Sets the TreeCellRenderer to <code>tcr</code>. This invokes
- * <code>updateRenderer</code>.
- *
- * @param tcr is the new TreeCellRenderer.
- */
- protected void setCellRenderer(TreeCellRenderer tcr)
- {
- currentCellRenderer = tcr;
- updateRenderer();
- }
-
- /**
- * Return currentCellRenderer, which will either be the trees renderer, or
- * defaultCellRenderer, which ever was not null.
- *
- * @return the current Cell Renderer
- */
- protected TreeCellRenderer getCellRenderer()
- {
- if (currentCellRenderer != null)
- return currentCellRenderer;
-
- return createDefaultCellRenderer();
- }
-
- /**
- * Sets the tree's model.
- *
- * @param model to set the treeModel to.
- */
- protected void setModel(TreeModel model)
- {
- treeState.setModel(model);
- treeModel = model;
- }
-
- /**
- * Returns the tree's model
- *
- * @return treeModel
- */
- protected TreeModel getModel()
- {
- return treeModel;
- }
-
- /**
- * Sets the root to being visible.
- *
- * @param newValue sets the visibility of the root
- */
- protected void setRootVisible(boolean newValue)
- {
- treeState.setRootVisible(newValue);
- }
-
- /**
- * Returns true if the root is visible.
- *
- * @return true if the root is visible.
- */
- protected boolean isRootVisible()
- {
- return treeState.isRootVisible();
- }
-
- /**
- * Determines whether the node handles are to be displayed.
- *
- * @param newValue sets whether or not node handles should be displayed.
- */
- protected void setShowsRootHandles(boolean newValue)
- {
- tree.setShowsRootHandles(newValue);
- }
-
- /**
- * Returns true if the node handles are to be displayed.
- *
- * @return true if the node handles are to be displayed.
- */
- protected boolean getShowsRootHandles()
- {
- return tree.getShowsRootHandles();
- }
-
- /**
- * Sets the cell editor.
- *
- * @param editor to set the cellEditor to.
- */
- protected void setCellEditor(TreeCellEditor editor)
- {
- cellEditor = editor;
- }
-
- /**
- * Returns the <code>TreeCellEditor</code> for this tree.
- *
- * @return the cellEditor for this tree.
- */
- protected TreeCellEditor getCellEditor()
- {
- return cellEditor;
- }
-
- /**
- * Configures the receiver to allow, or not allow, editing.
- *
- * @param newValue sets the receiver to allow editing if true.
- */
- protected void setEditable(boolean newValue)
- {
- tree.setEditable(newValue);
- }
-
- /**
- * Returns true if the receiver allows editing.
- *
- * @return true if the receiver allows editing.
- */
- protected boolean isEditable()
- {
- return tree.isEditable();
- }
-
- /**
- * Resets the selection model. The appropriate listeners are installed on the
- * model.
- *
- * @param newLSM resets the selection model.
- */
- protected void setSelectionModel(TreeSelectionModel newLSM)
- {
- if (newLSM != null)
- {
- treeSelectionModel = newLSM;
- tree.setSelectionModel(treeSelectionModel);
- }
- }
-
- /**
- * Returns the current selection model.
- *
- * @return the current selection model.
- */
- protected TreeSelectionModel getSelectionModel()
- {
- return treeSelectionModel;
- }
-
- /**
- * Returns the Rectangle enclosing the label portion that the last item in
- * path will be drawn to. Will return null if any component in path is
- * currently valid.
- *
- * @param tree is the current tree the path will be drawn to.
- * @param path is the current path the tree to draw to.
- * @return the Rectangle enclosing the label portion that the last item in
- * the path will be drawn to.
- */
- public Rectangle getPathBounds(JTree tree, TreePath path)
- {
- Object cell = path.getLastPathComponent();
- TreeModel mod = tree.getModel();
- Point loc = getCellLocation(0, 0, tree, mod, cell, mod.getRoot());
- int x = (int) loc.getX();
- int y = (int) loc.getY();
- return getCellBounds(x, y, cell);
- }
-
- /**
- * Returns the path for passed in row. If row is not visible null is
- * returned.
- *
- * @param tree is the current tree to return path for.
- * @param row is the row number of the row to return.
- * @return the path for passed in row. If row is not visible null is
- * returned.
- */
- public TreePath getPathForRow(JTree tree, int row)
- {
- DefaultMutableTreeNode node = ((DefaultMutableTreeNode) (tree.getModel())
- .getRoot());
-
- for (int i = 0; i < row; i++)
- node = getNextVisibleNode(node);
-
- // in case nothing was found
- if (node == null)
- return null;
-
- // something was found
- return new TreePath(node.getPath());
- }
-
- /**
- * Get next visible node in the tree.
- * Package private for use in inner classes.
- * @param the current node
- * @return the next visible node in the JTree. Return null if there are no
- * more.
- */
- DefaultMutableTreeNode getNextVisibleNode(DefaultMutableTreeNode node)
- {
- DefaultMutableTreeNode next = null;
- TreePath current = null;
-
- if (node != null)
- next = node.getNextNode();
-
- if (next != null)
- {
- current = new TreePath(next.getPath());
- if (tree.isVisible(current))
- return next;
-
- while (next != null && !tree.isVisible(current))
- {
- next = next.getNextNode();
+ stopEditingInCompleteEditing = false;
+ if (editingComponent != null)
+ {
+ tree.remove(editingComponent.getParent());
+ editingComponent = null;
+ }
+ if (cellEditor != null)
+ {
+ newVal = ((JTextField) getCellEditor().getCellEditorValue()).getText();
+ completeEditing(false, false, true);
+ if (cellEditor instanceof DefaultTreeCellEditor)
+ tree.removeTreeSelectionListener((DefaultTreeCellEditor) cellEditor);
+ cellEditor.removeCellEditorListener(cellEditorListener);
+ setCellEditor(null);
+ createdCellEditor = false;
+ }
+ isEditing = false;
+ tree.requestFocusInWindow(false);
+ editorTimer.stop();
+ }
+
+ /**
+ * Messaged when editing has been canceled in the tree. This tells the
+ * listeners the editor has canceled editing.
+ *
+ * @param e
+ * is the notification event
+ */
+ public void editingCanceled(ChangeEvent e)
+ {
+ editingPath = null;
+ editingRow = -1;
+ stopEditingInCompleteEditing = false;
+ if (editingComponent != null)
+ tree.remove(editingComponent.getParent());
+ editingComponent = null;
+ if (cellEditor != null)
+ {
+ if (cellEditor instanceof DefaultTreeCellEditor)
+ tree.removeTreeSelectionListener((DefaultTreeCellEditor) cellEditor);
+ cellEditor.removeCellEditorListener(cellEditorListener);
+ setCellEditor(null);
+ createdCellEditor = false;
+ }
+ tree.requestFocusInWindow(false);
+ editorTimer.stop();
+ isEditing = false;
+ tree.repaint();
+ }
+ }// CellEditorHandler
+
+ /**
+ * Repaints the lead selection row when focus is lost/grained.
+ */
+ public class FocusHandler
+ implements FocusListener
+ {
+ /**
+ * Constructor
+ */
+ public FocusHandler()
+ {
+ }
+
+ /**
+ * Invoked when focus is activated on the tree we're in, redraws the lead
+ * row. Invoked when a component gains the keyboard focus.
+ *
+ * @param e
+ * is the focus event that is activated
+ */
+ public void focusGained(FocusEvent e)
+ {
+ }
+
+ /**
+ * Invoked when focus is deactivated on the tree we're in, redraws the lead
+ * row. Invoked when a component loses the keyboard focus.
+ *
+ * @param e
+ * is the focus event that is deactivated
+ */
+ public void focusLost(FocusEvent e)
+ {
+ }
+ }// FocusHandler
+
+ /**
+ * This is used to get multiple key down events to appropriately genereate
+ * events.
+ */
+ public class KeyHandler
+ extends KeyAdapter
+ {
+ /** Key code that is being generated for. */
+ protected Action repeatKeyAction;
+
+ /** Set to true while keyPressed is active */
+ protected boolean isKeyDown;
+
+ /**
+ * Constructor
+ */
+ public KeyHandler()
+ {
+ }
+
+ /**
+ * Invoked when a key has been typed. Moves the keyboard focus to the first
+ * element whose first letter matches the alphanumeric key pressed by the
+ * user. Subsequent same key presses move the keyboard focus to the next
+ * object that starts with the same letter.
+ *
+ * @param e
+ * the key typed
+ */
+ public void keyTyped(KeyEvent e)
+ {
+ }
+
+ /**
+ * Invoked when a key has been pressed.
+ *
+ * @param e
+ * the key pressed
+ */
+ public void keyPressed(KeyEvent e)
+ {
+ }
+
+ /**
+ * Invoked when a key has been released
+ *
+ * @param e
+ * the key released
+ */
+ public void keyReleased(KeyEvent e)
+ {
+ }
+ }// KeyHandler
+
+ /**
+ * MouseListener is responsible for updating the selection based on mouse
+ * events.
+ */
+ public class MouseHandler
+ extends MouseAdapter
+ implements MouseMotionListener
+ {
+ /**
+ * Constructor
+ */
+ public MouseHandler()
+ {
+ }
+
+ /**
+ * Invoked when a mouse button has been pressed on a component.
+ *
+ * @param e
+ * is the mouse event that occured
+ */
+ public void mousePressed(MouseEvent e)
+ {
+ }
+
+ /**
+ * Invoked when a mouse button is pressed on a component and then dragged.
+ * MOUSE_DRAGGED events will continue to be delivered to the component where
+ * the drag originated until the mouse button is released (regardless of
+ * whether the mouse position is within the bounds of the component).
+ *
+ * @param e
+ * is the mouse event that occured
+ */
+ public void mouseDragged(MouseEvent e)
+ {
+ }
+
+ /**
+ * Invoked when the mouse button has been moved on a component (with no
+ * buttons no down).
+ *
+ * @param e
+ * the mouse event that occured
+ */
+ public void mouseMoved(MouseEvent e)
+ {
+ }
+
+ /**
+ * Invoked when a mouse button has been released on a component.
+ *
+ * @param e
+ * is the mouse event that occured
+ */
+ public void mouseReleased(MouseEvent e)
+ {
+ }
+ }// MouseHandler
+
+ /**
+ * MouseInputHandler handles passing all mouse events, including mouse motion
+ * events, until the mouse is released to the destination it is constructed
+ * with.
+ */
+ public class MouseInputHandler
+ implements MouseInputListener
+ {
+ /** Source that events are coming from */
+ protected Component source;
+
+ /** Destination that receives all events. */
+ protected Component destination;
+
+ /**
+ * Constructor
+ *
+ * @param source
+ * that events are coming from
+ * @param destination
+ * that receives all events
+ * @param e
+ * is the event received
+ */
+ public MouseInputHandler(Component source, Component destination,
+ MouseEvent e)
+ {
+ }
+
+ /**
+ * Invoked when the mouse button has been clicked (pressed and released) on
+ * a component.
+ *
+ * @param e
+ * mouse event that occured
+ */
+ public void mouseClicked(MouseEvent e)
+ {
+ }
+
+ /**
+ * Invoked when a mouse button has been pressed on a component.
+ *
+ * @param e
+ * mouse event that occured
+ */
+ public void mousePressed(MouseEvent e)
+ {
+ Point click = e.getPoint();
+ int row = Math.round(click.y / getRowHeight());
+ TreePath path = getClosestPathForLocation(tree, click.x, click.y);
- if (next != null)
- current = new TreePath(next.getPath());
- }
- }
- return next;
- }
-
- /**
- * Get previous visible node in the tree.
- * Package private for use in inner classes.
- *
- * @param the current node
- * @return the next visible node in the JTree. Return null if there are no
- * more.
- */
- DefaultMutableTreeNode getPreviousVisibleNode
- (DefaultMutableTreeNode node)
- {
- DefaultMutableTreeNode prev = null;
- TreePath current = null;
-
- if (node != null)
- prev = node.getPreviousNode();
-
- if (prev != null)
- {
- current = new TreePath(prev.getPath());
- if (tree.isVisible(current))
- return prev;
+ if (path != null)
+ {
+ boolean inBounds = false;
+ boolean cntlClick = false;
+ Rectangle bounds = getPathBounds(tree, path);
+
+ bounds.x -= rightChildIndent - 4;
+ bounds.width += rightChildIndent + 4;
+
+ if (bounds.contains(click.x, click.y))
+ inBounds = true;
+ else if (hasControlIcons()
+ && (click.x < (bounds.x - rightChildIndent + 5) &&
+ click.x > (bounds.x - rightChildIndent - 5)))
+ cntlClick = true;
+
+ if ((inBounds || cntlClick) && tree.isVisible(path))
+ {
+ selectPath(tree, path);
- while (prev != null && !tree.isVisible(current))
- {
- prev = prev.getPreviousNode();
+ if ((e.getClickCount() == 2 || cntlClick) && !isLeaf(row))
+ {
+ if (tree.isExpanded(path))
+ tree.collapsePath(path);
+ else
+ tree.expandPath(path);
+ }
- if (prev != null)
- current = new TreePath(prev.getPath());
- }
- }
- return prev;
- }
-
- /**
- * Returns the row that the last item identified in path is visible at. Will
- * return -1 if any of the elments in the path are not currently visible.
- *
- * @param tree is the current tree to return the row for.
- * @param path is the path used to find the row.
- * @return the row that the last item identified in path is visible at. Will
- * return -1 if any of the elments in the path are not currently
- * visible.
- */
- public int getRowForPath(JTree tree, TreePath path)
- {
- // FIXME: check visibility
- // right now, just returns last element because
- // expand/collapse is not implemented
- return path.getPathCount() - 1;
- }
-
- /**
- * Returns the number of rows that are being displayed.
- *
- * @param tree is the current tree to return the number of rows for.
- * @return the number of rows being displayed.
- */
- public int getRowCount(JTree tree)
- {
- DefaultMutableTreeNode node = ((DefaultMutableTreeNode) (tree.getModel())
- .getRoot());
- int count = 0;
-
- while (node != null)
- {
- count++;
- node = getNextVisibleNode(node);
- }
-
- return count;
- }
-
- /**
- * Returns the path to the node that is closest to x,y. If there is nothing
- * currently visible this will return null, otherwise it'll always return a
- * valid path. If you need to test if the returned object is exactly at x,y
- * you should get the bounds for the returned path and test x,y against that.
- *
- * @param tree the tree to search for the closest path
- * @param x is the x coordinate of the location to search
- * @param y is the y coordinate of the location to search
- * @return the tree path closes to x,y.
- */
- public TreePath getClosestPathForLocation(JTree tree, int x, int y)
- {
- return treeState.getPathClosestTo(x, y);
- }
-
- /**
- * Returns true if the tree is being edited. The item that is being edited
- * can be returned by getEditingPath().
- *
- * @param tree is the tree to check for editing.
- * @return true if the tree is being edited.
- */
- public boolean isEditing(JTree tree)
- {
- // FIXME: not implemented
- return false;
- }
-
- /**
- * Stops the current editing session. This has no effect if the tree is not
- * being edited. Returns true if the editor allows the editing session to
- * stop.
- *
- * @param tree is the tree to stop the editing on
- * @return true if the editor allows the editing session to stop.
- */
- public boolean stopEditing(JTree tree)
- {
- // FIXME: not implemented
- return false;
- }
-
- /**
- * Cancels the current editing session.
- *
- * @param tree is the tree to cancel the editing session on.
- */
- public void cancelEditing(JTree tree)
- {
- // FIXME: not implemented
- }
-
- /**
- * Selects the last item in path and tries to edit it. Editing will fail if
- * the CellEditor won't allow it for the selected item.
- *
- * @param tree is the tree to edit on.
- * @param path is the path in tree to edit on.
- */
- public void startEditingAtPath(JTree tree, TreePath path)
- {
- // FIXME: not implemented
- }
-
- /**
- * Returns the path to the element that is being editted.
- *
- * @param tree is the tree to get the editing path from.
- * @return the path that is being edited.
- */
- public TreePath getEditingPath(JTree tree)
- {
- // FIXME: not implemented
- return null;
- }
-
- /**
- * Invoked after the tree instance variable has been set, but before any
- * default/listeners have been installed.
- */
- protected void prepareForUIInstall()
- {
- // FIXME: not implemented
- }
-
- /**
- * Invoked from installUI after all the defaults/listeners have been
- * installed.
- */
- protected void completeUIInstall()
- {
- // FIXME: not implemented
- }
-
- /**
- * Invoked from uninstallUI after all the defaults/listeners have been
- * uninstalled.
- */
- protected void completeUIUninstall()
- {
- // FIXME: not implemented
- }
-
- /**
- * Installs the subcomponents of the tree, which is the renderer pane.
- */
- protected void installComponents()
- {
- // FIXME: not implemented
- }
-
- /**
- * Creates an instance of NodeDimensions that is able to determine the size
- * of a given node in the tree.
- *
- * @return the NodeDimensions of a given node in the tree
- */
- protected AbstractLayoutCache.NodeDimensions createNodeDimensions()
- {
- // FIXME: not implemented
+ if (!cntlClick && tree.isEditable())
+ startEditing(path, e);
+ }
+ }
+ }
+
+ /**
+ * Invoked when a mouse button has been released on a component.
+ *
+ * @param e
+ * mouse event that occured
+ */
+ public void mouseReleased(MouseEvent e)
+ {
+ }
+
+ /**
+ * Invoked when the mouse enters a component.
+ *
+ * @param e
+ * mouse event that occured
+ */
+ public void mouseEntered(MouseEvent e)
+ {
+ }
+
+ /**
+ * Invoked when the mouse exits a component.
+ *
+ * @param e
+ * mouse event that occured
+ */
+ public void mouseExited(MouseEvent e)
+ {
+ }
+
+ /**
+ * Invoked when a mouse button is pressed on a component and then dragged.
+ * MOUSE_DRAGGED events will continue to be delivered to the component where
+ * the drag originated until the mouse button is released (regardless of
+ * whether the mouse position is within the bounds of the component).
+ *
+ * @param e
+ * mouse event that occured
+ */
+ public void mouseDragged(MouseEvent e)
+ {
+ }
+
+ /**
+ * Invoked when the mouse cursor has been moved onto a component but no
+ * buttons have been pushed.
+ *
+ * @param e
+ * mouse event that occured
+ */
+ public void mouseMoved(MouseEvent e)
+ {
+ }
+
+ /**
+ * Removes event from the source
+ */
+ protected void removeFromSource()
+ {
+ }
+ }// MouseInputHandler
+
+ /**
+ * Class responsible for getting size of node, method is forwarded to
+ * BasicTreeUI method. X location does not include insets, that is handled in
+ * getPathBounds.
+ */
+ public class NodeDimensionsHandler
+ extends AbstractLayoutCache.NodeDimensions
+ {
+ /**
+ * Constructor
+ */
+ public NodeDimensionsHandler()
+ {
+ }
+
+ /**
+ * Responsible for getting the size of a particular node.
+ *
+ * @param value
+ * the value to be represented
+ * @param row
+ * row being queried
+ * @param depth
+ * the depth of the row
+ * @param expanded
+ * true if row is expanded
+ * @param size
+ * a Rectangle containing the size needed to represent value
+ * @return containing the node dimensions, or null if node has no dimension
+ */
+ public Rectangle getNodeDimensions(Object value, int row, int depth,
+ boolean expanded, Rectangle size)
+ {
return null;
- }
-
- /**
- * Creates a listener that is reponsible for the updates the UI based on how
- * the tree changes.
- *
- * @return the PropertyChangeListener that is reposnsible for the updates
- */
- protected PropertyChangeListener createPropertyChangeListener()
- {
- return new PropertyChangeHandler();
- }
-
- /**
- * Creates the listener responsible for updating the selection based on mouse
- * events.
- *
- * @return the MouseListener responsible for updating.
- */
- protected MouseListener createMouseListener()
- {
- return new MouseHandler();
- }
-
- /**
- * Creates the listener that is responsible for updating the display when
- * focus is lost/grained.
- *
- * @return the FocusListener responsible for updating.
- */
- protected FocusListener createFocusListener()
- {
- return new FocusHandler();
- }
-
- /**
- * Creates the listener reponsible for getting key events from the tree.
- *
- * @return the KeyListener responsible for getting key events.
- */
- protected KeyListener createKeyListener()
- {
- return new KeyHandler();
- }
-
- /**
- * Creates the listener responsible for getting property change events from
- * the selection model.
- *
- * @returns the PropertyChangeListener reponsible for getting property change
- * events from the selection model.
- */
- protected PropertyChangeListener createSelectionModelPropertyChangeListener()
- {
- return new SelectionModelPropertyChangeHandler();
- }
-
- /**
- * Creates the listener that updates the display based on selection change
- * methods.
- *
- * @return the TreeSelectionListener responsible for updating.
- */
- protected TreeSelectionListener createTreeSelectionListener()
- {
- return new TreeSelectionHandler();
- }
-
- /**
- * Creates a listener to handle events from the current editor
- *
- * @return the CellEditorListener that handles events from the current editor
- */
- protected CellEditorListener createCellEditorListener()
- {
- return new CellEditorHandler();
- }
-
- /**
- * Creates and returns a new ComponentHandler. This is used for the large
- * model to mark the validCachedPreferredSize as invalid when the component
- * moves.
- *
- * @return a new ComponentHandler.
- */
- protected ComponentListener createComponentListener()
- {
- return new ComponentHandler();
- }
-
- /**
- * Creates and returns the object responsible for updating the treestate when
- * a nodes expanded state changes.
- *
- * @return the TreeExpansionListener responsible for updating the treestate
- */
- protected TreeExpansionListener createTreeExpansionListener()
- {
- return new TreeExpansionHandler();
- }
-
- /**
- * Creates the object responsible for managing what is expanded, as well as
- * the size of nodes.
- *
- * @return the object responsible for managing what is expanded.
- */
- protected AbstractLayoutCache createLayoutCache()
- {
- return new FixedHeightLayoutCache();
- }
-
- /**
- * Returns the renderer pane that renderer components are placed in.
- *
- * @return the rendererpane that render components are placed in.
- */
- protected CellRendererPane createCellRendererPane()
- {
- return new CellRendererPane();
- }
-
- /**
- * Creates a default cell editor.
- *
- * @return the default cell editor.
- */
- protected TreeCellEditor createDefaultCellEditor()
- {
- return new DefaultTreeCellEditor(tree,
- (DefaultTreeCellRenderer) createDefaultCellRenderer(), cellEditor);
- }
-
- /**
- * Returns the default cell renderer that is used to do the stamping of each
- * node.
- *
- * @return the default cell renderer that is used to do the stamping of each
- * node.
- */
- protected TreeCellRenderer createDefaultCellRenderer()
- {
- return new DefaultTreeCellRenderer();
- }
-
- /**
- * Returns a listener that can update the tree when the model changes.
- *
- * @return a listener that can update the tree when the model changes.
- */
- protected TreeModelListener createTreeModelListener()
- {
- return new TreeModelHandler();
- }
-
- /**
- * Uninstall all registered listeners
- */
- protected void uninstallListeners()
- {
- tree.removePropertyChangeListener(propertyChangeListener);
- tree.removeFocusListener(focusListener);
- tree.removeTreeSelectionListener(treeSelectionListener);
- tree.removeMouseListener(mouseInputListener);
- tree.removeKeyListener(keyListener);
- tree.removePropertyChangeListener(selectionModelPropertyChangeListener);
- tree.removeComponentListener(componentListener);
- tree.getCellEditor().removeCellEditorListener(cellEditorListener);
- tree.removeTreeExpansionListener(treeExpansionListener);
- tree.getModel().removeTreeModelListener(treeModelListener);
- }
-
- /**
- * Uninstall all keyboard actions.
- */
- protected void uninstallKeyboardActions()
- {
- }
-
- /**
- * Uninstall the rendererPane.
- */
- protected void uninstallComponents()
- {
- // FIXME: not implemented
- }
-
- /**
- * The vertical element of legs between nodes starts at the bottom of the
- * parent node by default. This method makes the leg start below that.
- *
- * @return the vertical leg buffer
- */
- protected int getVerticalLegBuffer()
- {
- // FIXME: not implemented
- return 0;
- }
-
- /**
- * The horizontal element of legs between nodes starts at the right of the
- * left-hand side of the child node by default. This method makes the leg end
- * before that.
- *
- * @return the horizontal leg buffer
- */
- protected int getHorizontalLegBuffer()
- {
- // FIXME: not implemented
+ }
+
+ /**
+ * Returns the amount to indent the given row
+ *
+ * @return amount to indent the given row.
+ */
+ protected int getRowX(int row, int depth)
+ {
return 0;
- }
-
- /**
- * Make all the nodes that are expanded in JTree expanded in LayoutCache.
- * This invokes update ExpandedDescendants with the root path.
- */
- protected void updateLayoutCacheExpandedNodes()
- {
- // FIXME: not implemented
- }
-
- /**
- * Updates the expanded state of all the descendants of the <code>path</code>
- * by getting the expanded descendants from the tree and forwarding to the
- * tree state.
- *
- * @param path the path used to update the expanded states
- */
- protected void updateExpandedDescendants(TreePath path)
- {
- // FIXME: not implemented
- }
-
- /**
- * Returns a path to the last child of <code>parent</code>
- *
- * @param parent is the topmost path to specified
- * @return a path to the last child of parent
- */
- protected TreePath getLastChildPath(TreePath parent)
- {
- return ((TreePath) parent.getLastPathComponent());
- }
-
- /**
- * Updates how much each depth should be offset by.
- */
- protected void updateDepthOffset()
- {
- // FIXME: not implemented
- }
-
- /**
- * Updates the cellEditor based on editability of the JTree that we're
- * contained in. Ig the tree is editable but doesn't have a cellEditor, a
- * basic one will be used.
- */
- protected void updateCellEditor()
- {
- // FIXME: not implemented
- }
-
- /**
- * Messaged from the tree we're in when the renderer has changed.
- */
- protected void updateRenderer()
- {
- // FIXME: not implemented
- }
-
- /**
- * Resets the treeState instance based on the tree we're providing the look
- * and feel for.
- */
- protected void configureLayoutCache()
- {
- treeState = createLayoutCache();
- }
-
- /**
- * Marks the cached size as being invalid, and messages the tree with
- * <code>treeDidChange</code>.
- */
- protected void updateSize()
- {
- // FIXME: not implemented
- }
-
- /**
- * Updates the <code>preferredSize</code> instance variable, which is
- * returned from <code>getPreferredSize()</code>. For left to right
- * orientations, the size is determined from the current AbstractLayoutCache.
- * For RTL orientations, the preferred size becomes the width minus the
- * minimum x position.
- */
- protected void updateCachedPreferredSize()
- {
- // FIXME: not implemented
- }
-
- /**
- * Messaged from the VisibleTreeNode after it has been expanded.
- *
- * @param path is the path that has been expanded.
- */
- protected void pathWasExpanded(TreePath path)
- {
- // FIXME: not implemented
- }
-
- /**
- * Messaged from the VisibleTreeNode after it has collapsed
- */
- protected void pathWasCollapsed(TreePath path)
- {
- // FIXME: not implemented
- }
-
- /**
- * Install all defaults for the tree.
- *
- * @param tree is the JTree to install defaults for
- */
- protected void installDefaults(JTree tree)
- {
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- tree.setFont(defaults.getFont("Tree.font"));
- tree.setForeground(defaults.getColor("Tree.foreground"));
- tree.setBackground(defaults.getColor("Tree.background"));
- tree.setOpaque(true);
-
- rightChildIndent = defaults.getInt("Tree.rightChildIndent");
- leftChildIndent = defaults.getInt("Tree.leftChildIndent");
- setRowHeight(defaults.getInt("Tree.rowHeight"));
- }
-
- /**
- * Install all keyboard actions for this
- */
- protected void installKeyboardActions()
- {
- }
-
- /**
- * Install all listeners for this
- */
- protected void installListeners()
- {
- tree.addPropertyChangeListener(propertyChangeListener);
- tree.addFocusListener(focusListener);
- tree.addTreeSelectionListener(treeSelectionListener);
- tree.addMouseListener(mouseInputListener);
- tree.addKeyListener(keyListener);
- tree.addPropertyChangeListener(selectionModelPropertyChangeListener);
- tree.addComponentListener(componentListener);
- cellEditor.addCellEditorListener(cellEditorListener);
- tree.addTreeExpansionListener(treeExpansionListener);
- treeModel.addTreeModelListener(treeModelListener);
- }
-
- /**
- * Install the UI for the component
- *
- * @param c the component to install UI for
- */
- public void installUI(JComponent c)
- {
- super.installUI(c);
- installDefaults((JTree) c);
- tree = (JTree) c;
- setModel(tree.getModel());
- tree.setRootVisible(true);
- tree.expandPath(new TreePath(((DefaultMutableTreeNode)
- (tree.getModel()).getRoot()).getPath()));
- treeSelectionModel = tree.getSelectionModel();
- installListeners();
- installKeyboardActions();
- completeUIInstall();
- }
-
- /**
- * Uninstall the defaults for the tree
- *
- * @param tree to uninstall defaults for
- */
- protected void uninstallDefaults(JTree tree)
- {
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- tree.setFont(null);
- tree.setForeground(null);
- tree.setBackground(null);
- tree.setCellRenderer(null);
- }
-
- /**
- * Uninstall the UI for the component
- *
- * @param c the component to uninstall UI for
- */
- public void uninstallUI(JComponent c)
- {
- uninstallDefaults((JTree) c);
- uninstallKeyboardActions();
- uninstallListeners();
- tree = null;
- completeUIUninstall();
- }
-
- /**
- * Paints the specified component appropriate for the look and feel. This
- * method is invoked from the ComponentUI.update method when the specified
- * component is being painted. Subclasses should override this method and use
- * the specified Graphics object to render the content of the component.
- *
- * @param g the Graphics context in which to paint
- * @param c the component being painted; this argument is often ignored, but
- * might be used if the UI object is stateless and shared by multiple
- * components
- */
- public void paint(Graphics g, JComponent c)
- {
- JTree tree = (JTree) c;
- TreeModel mod = tree.getModel();
- g.translate(10, 10);
- paintRecursive(g, 0, 0, 0, 0, tree, mod, mod.getRoot());
- paintControlIcons(g, 0, 0, 0, 0, tree, mod, mod.getRoot());
- g.translate(-10, -10);
- }
-
- /**
- * Ensures that the rows identified by beginRow through endRow are visible.
- *
- * @param beginRow is the first row
- * @param endRow is the last row
- */
- protected void ensureRowsAreVisible(int beginRow, int endRow)
- {
- // FIXME: not implemented
- }
-
- /**
- * Sets the preferred minimum size.
- *
- * @param newSize is the new preferred minimum size.
- */
- public void setPreferredMinSize(Dimension newSize)
- {
- // FIXME: not implemented
- }
-
- /**
- * Gets the preferred minimum size.
- *
- * @returns the preferred minimum size.
- */
- public Dimension getPreferredMinSize()
- {
- // FIXME: not implemented
- return null;
- }
-
- /**
- * Returns the preferred size to properly display the tree, this is a cover
- * method for getPreferredSize(c, false).
- *
- * @param c the component whose preferred size is being queried; this
- * argument is often ignored but might be used if the UI object is
- * stateless and shared by multiple components
- * @return the preferred size
- */
- public Dimension getPreferredSize(JComponent c)
- {
- return getPreferredSize(c, false);
- }
-
- /**
- * Returns the preferred size to represent the tree in c. If checkConsistancy
- * is true, checkConsistancy is messaged first.
- *
- * @param c the component whose preferred size is being queried.
- * @param checkConsistancy if true must check consistancy
- * @return the preferred size
- */
- public Dimension getPreferredSize(JComponent c, boolean checkConsistancy)
- {
- // FIXME: checkConsistancy not implemented, c not used
- DefaultMutableTreeNode node = ((DefaultMutableTreeNode) (tree.getModel())
- .getRoot());
- int maxWidth = 0;
- int count = 0;
- if (node != null)
- {
- maxWidth = (int) (getCellBounds(0, 0, node).getWidth());
- while (node != null)
- {
- count++;
- DefaultMutableTreeNode nextNode = node.getNextNode();
- if (nextNode != null)
- maxWidth = Math.max(maxWidth, (int) (getCellBounds(0, 0, nextNode)
- .getWidth()));
- node = nextNode;
- }
- }
-
- return new Dimension(maxWidth, (getRowHeight() * count));
- }
-
- /**
- * Returns the minimum size for this component. Which will be the min
- * preferred size or (0,0).
- *
- * @param c the component whose min size is being queried.
- * @returns the preferred size or null
- */
- public Dimension getMinimumSize(JComponent c)
- {
- // FIXME: not implemented
- return getPreferredSize(c);
- }
-
- /**
- * Returns the maximum size for the component, which will be the preferred
- * size if the instance is currently in JTree or (0,0).
- *
- * @param c the component whose preferred size is being queried
- * @return the max size or null
- */
- public Dimension getMaximumSize(JComponent c)
- {
- // FIXME: not implemented
- return getPreferredSize(c);
- }
-
- /**
- * Messages to stop the editing session. If the UI the receiver is providing
- * the look and feel for returns true from
- * <code>getInvokesStopCellEditing</code>, stopCellEditing will be invoked
- * on the current editor. Then completeEditing will be messaged with false,
- * true, false to cancel any lingering editing.
- */
- protected void completeEditing()
- {
- // FIXME: not implemented
- }
-
- /**
- * Stops the editing session. If messageStop is true, the editor is messaged
- * with stopEditing, if messageCancel is true the editor is messaged with
- * cancelEditing. If messageTree is true, the treeModel is messaged with
- * valueForPathChanged.
- *
- * @param messageStop message to stop editing
- * @param messageCancel message to cancel editing
- * @param messageTree message to treeModel
- */
- protected void completeEditing(boolean messageStop, boolean messageCancel,
- boolean messageTree)
- {
- // FIXME: not implemented
- }
-
- /**
- * Will start editing for node if there is a cellEditor and shouldSelectCall
- * returns true. This assumes that path is valid and visible.
- *
- * @param path is the path to start editing
- * @param event is the MouseEvent performed on the path
- * @return true if successful
- */
- protected boolean startEditing(TreePath path, MouseEvent event)
- {
- // FIXME: not implemented
+ }
+ }// NodeDimensionsHandler
+
+ /**
+ * PropertyChangeListener for the tree. Updates the appropriate varaible, or
+ * TreeState, based on what changes.
+ */
+ public class PropertyChangeHandler
+ implements PropertyChangeListener
+ {
+
+ /**
+ * Constructor
+ */
+ public PropertyChangeHandler()
+ {
+ }
+
+ /**
+ * This method gets called when a bound property is changed.
+ *
+ * @param event
+ * A PropertyChangeEvent object describing the event source and the
+ * property that has changed.
+ */
+ public void propertyChange(PropertyChangeEvent event)
+ {
+ }
+ }// PropertyChangeHandler
+
+ /**
+ * Listener on the TreeSelectionModel, resets the row selection if any of the
+ * properties of the model change.
+ */
+ public class SelectionModelPropertyChangeHandler
+ implements PropertyChangeListener
+ {
+
+ /**
+ * Constructor
+ */
+ public SelectionModelPropertyChangeHandler()
+ {
+ }
+
+ /**
+ * This method gets called when a bound property is changed.
+ *
+ * @param event
+ * A PropertyChangeEvent object describing the event source and the
+ * property that has changed.
+ */
+ public void propertyChange(PropertyChangeEvent event)
+ {
+ }
+ }// SelectionModelPropertyChangeHandler
+
+ /**
+ * ActionListener that invokes cancelEditing when action performed.
+ */
+ public class TreeCancelEditingAction
+ extends AbstractAction
+ {
+
+ /**
+ * Constructor
+ */
+ public TreeCancelEditingAction()
+ {
+ }
+
+ /**
+ * Invoked when an action occurs.
+ *
+ * @param e
+ * event that occured
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * Returns true if the action is enabled.
+ *
+ * @return true if the action is enabled, false otherwise
+ */
+ public boolean isEnabled()
+ {
return false;
- }
-
- /**
- * If the <code>mouseX</code> and <code>mouseY</code> are in the expand
- * or collapse region of the row, this will toggle the row.
- *
- * @param path the path we are concerned with
- * @param mouseX is the cursor's x position
- * @param mouseY is the cursor's y position
- */
- protected void checkForClickInExpandControl(TreePath path, int mouseX,
- int mouseY)
- {
- // FIXME: not implemented
- }
-
- /**
- * Returns true if the <code>mouseX</code> and <code>mouseY</code> fall
- * in the area of row that is used to expand/collpse the node and the node at
- * row does not represent a leaf.
- *
- * @param path the path we are concerned with
- * @param mouseX is the cursor's x position
- * @param mouseY is the cursor's y position
- * @return true if the <code>mouseX</code> and <code>mouseY</code> fall
- * in the area of row that is used to expand/collpse the node and the
- * node at row does not represent a leaf.
- */
- protected boolean isLocationInExpandControl(TreePath path, int mouseX,
- int mouseY)
- {
- // FIXME: not implemented
+ }
+ }// TreeCancelEditingAction
+
+ /**
+ * Updates the TreeState in response to nodes expanding/collapsing.
+ */
+ public class TreeExpansionHandler
+ implements TreeExpansionListener
+ {
+
+ /**
+ * Constructor
+ */
+ public TreeExpansionHandler()
+ {
+ }
+
+ /**
+ * Called whenever an item in the tree has been expanded.
+ *
+ * @param event
+ * is the event that occured
+ */
+ public void treeExpanded(TreeExpansionEvent event)
+ {
+ tree.repaint();
+ }
+
+ /**
+ * Called whenever an item in the tree has been collapsed.
+ *
+ * @param event
+ * is the event that occured
+ */
+ public void treeCollapsed(TreeExpansionEvent event)
+ {
+ tree.repaint();
+ }
+ }// TreeExpansionHandler
+
+ /**
+ * TreeHomeAction is used to handle end/home actions. Scrolls either the first
+ * or last cell to be visible based on direction.
+ */
+ public class TreeHomeAction
+ extends AbstractAction
+ {
+
+ /** direction is either home or end */
+ protected int direction;
+
+ /**
+ * Constructor
+ *
+ * @param direction -
+ * it is home or end
+ * @param name
+ * is the name of the direction
+ */
+ public TreeHomeAction(int direction, String name)
+ {
+ }
+
+ /**
+ * Invoked when an action occurs.
+ *
+ * @param e
+ * is the event that occured
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * Returns true if the action is enabled.
+ *
+ * @return true if the action is enabled.
+ */
+ public boolean isEnabled()
+ {
return false;
- }
-
- /**
- * Messaged when the user clicks the particular row, this invokes
- * toggleExpandState.
- *
- * @param path the path we are concerned with
- * @param mouseX is the cursor's x position
- * @param mouseY is the cursor's y position
- */
- protected void handleExpandControlClick(TreePath path, int mouseX, int mouseY)
- {
- // FIXME: not implemented
- }
-
- /**
- * Expands path if it is not expanded, or collapses row if it is expanded. If
- * expanding a path and JTree scroll on expand, ensureRowsAreVisible is
- * invoked to scroll as many of the children to visible as possible (tries to
- * scroll to last visible descendant of path).
- *
- * @param path the path we are concerned with
- */
- protected void toggleExpandState(TreePath path)
- {
- // FIXME: not implemented
- }
-
- /**
- * Returning true signifies a mouse event on the node should toggle the
- * selection of only the row under the mouse.
- *
- * @param event is the MouseEvent performed on the row.
- * @return true signifies a mouse event on the node should toggle the
- * selection of only the row under the mouse.
- */
- protected boolean isToggleSelectionEvent(MouseEvent event)
- {
- // FIXME: not implemented
- return false;
- }
-
- /**
- * Returning true signifies a mouse event on the node should select from the
- * anchor point.
- *
- * @param event is the MouseEvent performed on the node.
- * @return true signifies a mouse event on the node should select from the
- * anchor point.
- */
- protected boolean isMultiSelectEvent(MouseEvent event)
- {
- // FIXME: not implemented
- return false;
- }
-
- /**
- * Returning true indicates the row under the mouse should be toggled based
- * on the event. This is invoked after checkForClickInExpandControl, implying
- * the location is not in the expand (toggle) control.
- *
- * @param event is the MouseEvent performed on the row.
- * @return true indicates the row under the mouse should be toggled based on
- * the event.
- */
- protected boolean isToggleEvent(MouseEvent event)
- {
- // FIXME: not implemented
- return false;
- }
-
- /**
- * Messaged to update the selection based on a MouseEvent over a particular
- * row. If the even is a toggle selection event, the row is either selected,
- * or deselected. If the event identifies a multi selection event, the
- * selection is updated from the anchor point. Otherwise, the row is
- * selected, and if the even specified a toggle event the row is
- * expanded/collapsed.
- *
- * @param path is the path selected for an event
- * @param event is the MouseEvent performed on the path.
- */
- protected void selectPathForEvent(TreePath path, MouseEvent event)
- {
- // FIXME: not implemented
- }
-
- /**
- * Returns true if the node at <code>row</code> is a leaf.
- *
- * @param row is the row we are concerned with.
- * @return true if the node at <code>row</code> is a leaf.
- */
- protected boolean isLeaf(int row)
- {
- TreePath pathForRow = getPathForRow(tree, row);
- if (pathForRow == null)
- return true;
-
- Object node = pathForRow.getLastPathComponent();
-
- if (node instanceof TreeNode)
- return ((TreeNode) node).isLeaf();
- else
- return true;
- }
-
- /**
- * Selects the specified path in the tree depending on modes.
- * Package private for use in inner classes.
- *
- * @param tree is the tree we are selecting the path in
- * @param path is the path we are selecting
- */
- void selectPath(JTree tree, TreePath path)
- {
- if (path != null)
- {
- if (tree.isPathSelected(path))
- tree.removeSelectionPath(path);
- else if (tree.getSelectionModel().getSelectionMode()
- == TreeSelectionModel.SINGLE_TREE_SELECTION)
- {
- tree.getSelectionModel().clearSelection();
- tree.addSelectionPath(path);
- tree.setLeadSelectionPath(path);
- }
- else if (tree.getSelectionModel().getSelectionMode()
- == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION)
- {
- // TODO
- }
- else
- {
- tree.getSelectionModel().setSelectionMode(
- TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
- tree.addSelectionPath(path);
- tree.setLeadSelectionPath(path);
- }
- }
- }
-
- /* * INTERNAL CLASSES * */
-
- /**
- * Updates the preferred size when scrolling, if necessary.
- */
- public class ComponentHandler
- extends ComponentAdapter
- implements ActionListener
- {
- /**
- * Timer used when inside a scrollpane and the scrollbar is adjusting
- */
- protected Timer timer;
-
- /** ScrollBar that is being adjusted */
- protected JScrollBar scrollBar;
-
- /**
- * Constructor
- */
- public ComponentHandler()
- {
- }
-
- /**
- * Invoked when the component's position changes.
- *
- * @param e the event that occurs when moving the component
- */
- public void componentMoved(ComponentEvent e)
- {
- }
-
- /**
- * Creats, if necessary, and starts a Timer to check if needed to resize
- * the bounds
- */
- protected void startTimer()
- {
- }
-
- /**
- * Returns the JScrollPane housing the JTree, or null if one isn't found.
- *
- * @return JScrollPane housing the JTree, or null if one isn't found.
- */
- protected JScrollPane getScrollPane()
- {
- return null;
- }
-
- /**
- * Public as a result of Timer. If the scrollBar is null, or not
- * adjusting, this stops the timer and updates the sizing.
- *
- * @param ae is the action performed
- */
- public void actionPerformed(ActionEvent ae)
- {
- }
- }// ComponentHandler
-
- /**
- * Listener responsible for getting cell editing events and updating the tree
- * accordingly.
- */
- public class CellEditorHandler
- implements CellEditorListener
- {
- /**
- * Constructor
- */
- public CellEditorHandler()
- {
- }
-
- /**
- * Messaged when editing has stopped in the tree. Tells the listeners
- * editing has stopped.
- *
- * @param e is the notification event
- */
- public void editingStopped(ChangeEvent e)
- {
- }
-
- /**
- * Messaged when editing has been canceled in the tree. This tells the
- * listeners the editor has canceled editing.
- *
- * @param e is the notification event
- */
- public void editingCanceled(ChangeEvent e)
- {
- }
- }// CellEditorHandler
-
- /**
- * Repaints the lead selection row when focus is lost/grained.
- */
- public class FocusHandler
- implements FocusListener
- {
- /**
- * Constructor
- */
- public FocusHandler()
- {
- }
-
- /**
- * Invoked when focus is activated on the tree we're in, redraws the lead
- * row. Invoked when a component gains the keyboard focus.
- *
- * @param e is the focus event that is activated
- */
- public void focusGained(FocusEvent e)
- {
- }
-
- /**
- * Invoked when focus is deactivated on the tree we're in, redraws the
- * lead row. Invoked when a component loses the keyboard focus.
- *
- * @param e is the focus event that is deactivated
- */
- public void focusLost(FocusEvent e)
- {
- }
- }// FocusHandler
-
- /**
- * This is used to get multiple key down events to appropriately genereate
- * events.
- */
- public class KeyHandler
- extends KeyAdapter
- {
- /** Key code that is being generated for. */
- protected Action repeatKeyAction;
-
- /** Set to true while keyPressed is active */
- protected boolean isKeyDown;
-
- /**
- * Constructor
- */
- public KeyHandler()
- {
- }
-
- /**
- * Invoked when a key has been typed. Moves the keyboard focus to the
- * first element whose first letter matches the alphanumeric key pressed
- * by the user. Subsequent same key presses move the keyboard focus to the
- * next object that starts with the same letter.
- *
- * @param e the key typed
- */
- public void keyTyped(KeyEvent e)
- {
- }
-
- /**
- * Invoked when a key has been pressed.
- *
- * @param e the key pressed
- */
- public void keyPressed(KeyEvent e)
- {
- TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath();
- DefaultMutableTreeNode last = null;
-
- if (start != null)
- last = (DefaultMutableTreeNode) start.getLastPathComponent();
- if (last != null)
- {
- if (e.getKeyCode() == KeyEvent.VK_DOWN)
+ }
+ }// TreeHomeAction
+
+ /**
+ * TreeIncrementAction is used to handle up/down actions. Selection is moved
+ * up or down based on direction.
+ */
+ public class TreeIncrementAction
+ extends AbstractAction
+ {
+
+ /** Specifies the direction to adjust the selection by. */
+ protected int direction;
+
+ /**
+ * Constructor
+ *
+ * @param direction
+ * up or down
+ * @param name
+ * is the name of the direction
+ */
+ public TreeIncrementAction(int direction, String name)
+ {
+ }
+
+ /**
+ * Invoked when an action occurs.
+ *
+ * @param e
+ * is the event that occured
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ Object last = tree.getLeadSelectionPath().getLastPathComponent();
+
+ if (e.getActionCommand().equals("selectPreviousChangeLead"))
+ {
+ Object prev = getPreviousVisibleNode(last);
+
+ if (prev != null)
{
- DefaultMutableTreeNode next = (DefaultMutableTreeNode)
- BasicTreeUI.this.getNextVisibleNode(last);
-
- if (next != null)
- BasicTreeUI.this.selectPath(BasicTreeUI.this.tree,
- new TreePath(next.getPath()));
+ TreePath newPath = new TreePath(getPathToRoot(prev, 0));
+ selectPath(tree, new TreePath(getPathToRoot(prev, 0)));
+ tree.setLeadSelectionPath(newPath);
}
- else if (e.getKeyCode() == KeyEvent.VK_UP)
+ }
+ else if (e.getActionCommand().equals("selectPreviousExtendSelection"))
+ {
+ Object prev = getPreviousVisibleNode(last);
+ if (prev != null)
{
- DefaultMutableTreeNode prev = (DefaultMutableTreeNode)
- BasicTreeUI.this.getPreviousVisibleNode(last);
-
- if (prev != null)
- BasicTreeUI.this.selectPath(BasicTreeUI.this.tree,
- new TreePath(prev.getPath()));
+ TreePath newPath = new TreePath(getPathToRoot(prev, 0));
+ tree.addSelectionPath(newPath);
+ tree.setLeadSelectionPath(newPath);
}
- else if (e.getKeyCode() == KeyEvent.VK_LEFT)
+ }
+ else if (e.getActionCommand().equals("selectPrevious"))
+ {
+ Object prev = getPreviousVisibleNode(last);
+ if (prev != null)
{
- TreePath path = new TreePath(last.getPath());
-
- if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path))
- {
- BasicTreeUI.this.tree.collapsePath(path);
- BasicTreeUI.this.tree.fireTreeCollapsed(path);
- }
+ TreePath newPath = new TreePath(getPathToRoot(prev, 0));
+ selectPath(tree, new TreePath(getPathToRoot(prev, 0)));
}
- else if (e.getKeyCode() == KeyEvent.VK_RIGHT)
+ }
+ else if (e.getActionCommand().equals("selectNext"))
+ {
+ Object next = getNextVisibleNode(last);
+ if (next != null)
{
- TreePath path = new TreePath(last.getPath());
-
- if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path))
- {
- BasicTreeUI.this.tree.expandPath(path);
- BasicTreeUI.this.tree.fireTreeExpanded(path);
- }
+ TreePath newPath = new TreePath(getPathToRoot(next, 0));
+ selectPath(tree, newPath);
}
- }
- }
-
- /**
- * Invoked when a key has been released
- *
- * @param e the key released
- */
- public void keyReleased(KeyEvent e)
- {
- }
- }// KeyHandler
-
- /**
- * MouseListener is responsible for updating the selevtion based on mouse
- * events.
- */
- public class MouseHandler
- extends MouseAdapter
- implements MouseMotionListener
- {
- /**
- * Constructor
- */
- public MouseHandler()
- {
- }
-
- /**
- * Invoked when a mouse button has been pressed on a component.
- *
- * @param e is the mouse event that occured
- */
- public void mousePressed(MouseEvent e)
- {
- }
-
- /**
- * Invoked when a mouse button is pressed on a component and then dragged.
- * MOUSE_DRAGGED events will continue to be delivered to the component
- * where the drag originated until the mouse button is released
- * (regardless of whether the mouse position is within the bounds of the
- * component).
- *
- * @param e is the mouse event that occured
- */
- public void mouseDragged(MouseEvent e)
- {
- }
-
- /**
- * Invoked when the mouse button has been moved on a component (with no
- * buttons no down).
- *
- * @param e the mouse event that occured
- */
- public void mouseMoved(MouseEvent e)
- {
- }
-
- /**
- * Invoked when a mouse button has been released on a component.
- *
- * @param e is the mouse event that occured
- */
- public void mouseReleased(MouseEvent e)
- {
- }
- }// MouseHandler
-
- /**
- * MouseInputHandler handles passing all mouse events, including mouse motion
- * events, until the mouse is released to the destination it is constructed
- * with.
- */
- public class MouseInputHandler
- implements MouseInputListener
- {
- /** Source that events are coming from */
- protected Component source;
-
- /** Destination that receives all events. */
- protected Component destination;
-
- /** Number of mouse clicks on a non-leaf */
- private int clickCount = 0;
-
- /**
- * Constructor
- *
- * @param source that events are coming from
- * @param destination that receives all events
- * @param event is the event received
- */
- public MouseInputHandler(Component source, Component destination,
- MouseEvent e)
- {
- }
-
- /**
- * Invoked when the mouse button has been clicked (pressed and released)
- * on a component.
- *
- * @param e mouse event that occured
- */
- public void mouseClicked(MouseEvent e)
- {
- Point click = e.getPoint();
- int clickX = (int) click.getX();
- int clickY = (int) click.getY();
- int row = (clickY / getRowHeight()) - 1;
- TreePath path = BasicTreeUI.this.tree.getPathForRow(row);
-
- boolean inBounds = false;
- boolean cntlClick = false;
- Rectangle bounds = BasicTreeUI.this.getPathBounds(
- BasicTreeUI.this.tree, path);
- int x = (int) bounds.getX();
- int y = (int) bounds.getY();
-
- if (clickY > y && clickY < (y + bounds.height + 10))
- {
- if (clickX > x && clickX < (x + bounds.width + 20))
- inBounds = true;
- else if (clickX < (x - rightChildIndent + 5) &&
- clickX > (x - rightChildIndent - 5))
- cntlClick = true;
- }
-
- if ((inBounds || cntlClick) && path != null &&
- BasicTreeUI.this.tree.isVisible(path))
- {
- if (!cntlClick && !BasicTreeUI.this.isLeaf(row))
- clickCount++;
-
- if (clickCount == 2 || cntlClick == true)
+ }
+ else if (e.getActionCommand().equals("selectNextExtendSelection"))
+ {
+ Object next = getNextVisibleNode(last);
+ if (next != null)
{
- clickCount = 0;
- BasicTreeUI.this.tree.getSelectionModel().clearSelection();
- if (BasicTreeUI.this.tree.isExpanded(path))
- {
- BasicTreeUI.this.tree.collapsePath(path);
- BasicTreeUI.this.tree.fireTreeCollapsed(path);
- }
- else
- {
- BasicTreeUI.this.tree.expandPath(path);
- BasicTreeUI.this.tree.fireTreeExpanded(path);
- }
+ TreePath newPath = new TreePath(getPathToRoot(next, 0));
+ tree.addSelectionPath(newPath);
+ tree.setLeadSelectionPath(newPath);
}
-
- BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, path);
- }
- }
-
- /**
- * Invoked when a mouse button has been pressed on a component.
- *
- * @param e mouse event that occured
- */
- public void mousePressed(MouseEvent e)
- {
- }
-
- /**
- * Invoked when a mouse button has been released on a component.
- *
- * @param e mouse event that occured
- */
- public void mouseReleased(MouseEvent e)
- {
- }
-
- /**
- * Invoked when the mouse enters a component.
- *
- * @param e mouse event that occured
- */
- public void mouseEntered(MouseEvent e)
- {
- }
-
- /**
- * Invoked when the mouse exits a component.
- *
- * @param e mouse event that occured
- */
- public void mouseExited(MouseEvent e)
- {
- }
-
- /**
- * Invoked when a mouse button is pressed on a component and then dragged.
- * MOUSE_DRAGGED events will continue to be delivered to the component
- * where the drag originated until the mouse button is released
- * (regardless of whether the mouse position is within the bounds of the
- * component).
- *
- * @param e mouse event that occured
- */
- public void mouseDragged(MouseEvent e)
- {
- }
-
- /**
- * Invoked when the mouse cursor has been moved onto a component but no
- * buttons have been pushed.
- *
- * @param e mouse event that occured
- */
- public void mouseMoved(MouseEvent e)
- {
- }
-
- /**
- * Removes event from the source
- */
- protected void removeFromSource()
- {
- }
- }// MouseInputHandler
-
- /**
- * Class responsible for getting size of node, method is forwarded to
- * BasicTreeUI method. X location does not include insets, that is handled in
- * getPathBounds.
- */
- public class NodeDimensionsHandler
- extends AbstractLayoutCache.NodeDimensions
- {
- /**
- * Constructor
- */
- public NodeDimensionsHandler()
- {
- }
-
- /**
- * Responsible for getting the size of a particular node.
- *
- * @param value the value to be represented
- * @param row row being queried
- * @param depth the depth of the row
- * @param expanded true if row is expanded
- * @param size a Rectangle containing the size needed to represent value
- * @return containing the node dimensions, or null if node has no
- * dimension
- */
- public Rectangle getNodeDimensions(Object value, int row, int depth,
- boolean expanded, Rectangle size)
- {
- return null;
- }
-
- /**
- * Returns the amount to indent the given row
- *
- * @return amount to indent the given row.
- */
- protected int getRowX(int row, int depth)
- {
- return 0;
- }
- }// NodeDimensionsHandler
-
- /**
- * PropertyChangeListener for the tree. Updates the appropriate varaible, or
- * TreeState, based on what changes.
- */
- public class PropertyChangeHandler
- implements PropertyChangeListener
- {
-
- /**
- * Constructor
- */
- public PropertyChangeHandler()
- {
- }
-
- /**
- * This method gets called when a bound property is changed.
- *
- * @param event A PropertyChangeEvent object describing the event source
- * and the property that has changed.
- */
- public void propertyChange(PropertyChangeEvent event)
- {
- }
- }// PropertyChangeHandler
-
- /**
- * Listener on the TreeSelectionModel, resets the row selection if any of the
- * properties of the model change.
- */
- public class SelectionModelPropertyChangeHandler
- implements PropertyChangeListener
- {
-
- /**
- * Constructor
- */
- public SelectionModelPropertyChangeHandler()
- {
- }
-
- /**
- * This method gets called when a bound property is changed.
- *
- * @param event A PropertyChangeEvent object describing the event source
- * and the property that has changed.
- */
- public void propertyChange(PropertyChangeEvent event)
- {
- }
- }// SelectionModelPropertyChangeHandler
-
- /**
- * ActionListener that invokes cancelEditing when action performed.
- */
- public class TreeCancelEditingAction
- extends AbstractAction
- {
-
- /**
- * Constructor
- */
- public TreeCancelEditingAction()
- {
- }
-
- /**
- * Invoked when an action occurs.
- *
- * @param e event that occured
- */
- public void actionPerformed(ActionEvent e)
- {
- }
-
- /**
- * Returns true if the action is enabled.
- *
- * @return true if the action is enabled, false otherwise
- */
- public boolean isEnabled()
- {
- return false;
- }
- }// TreeCancelEditingAction
-
- /**
- * Updates the TreeState in response to nodes expanding/collapsing.
- */
- public class TreeExpansionHandler
- implements TreeExpansionListener
- {
-
- /**
- * Constructor
- */
- public TreeExpansionHandler()
- {
- }
-
- /**
- * Called whenever an item in the tree has been expanded.
- *
- * @param event is the event that occured
- */
- public void treeExpanded(TreeExpansionEvent event)
- {
- BasicTreeUI.this.tree.repaint();
- }
-
- /**
- * Called whenever an item in the tree has been collapsed.
- *
- * @param event is the event that occured
- */
- public void treeCollapsed(TreeExpansionEvent event)
- {
- BasicTreeUI.this.tree.repaint();
- }
- }// TreeExpansionHandler
-
- /**
- * TreeHomeAction is used to handle end/home actions. Scrolls either the
- * first or last cell to be visible based on direction.
- */
- public class TreeHomeAction
- extends AbstractAction
- {
-
- /** direction is either home or end */
- protected int direction;
-
- /**
- * Constructor
- *
- * @param direction - it is home or end
- * @param name is the name of the direction
- */
- public TreeHomeAction(int direction, String name)
- {
- }
-
- /**
- * Invoked when an action occurs.
- *
- * @param e is the event that occured
- */
- public void actionPerformed(ActionEvent e)
- {
- }
+ }
+ else if (e.getActionCommand().equals("selectNextChangeLead"))
+ {
+ Object next = getNextVisibleNode(last);
+ if (next != null)
+ {
+ TreePath newPath = new TreePath(getPathToRoot(next, 0));
+ selectPath(tree, newPath);
+ tree.setLeadSelectionPath(newPath);
+ }
+ }
+ }
+
+ /**
+ * Returns true if the action is enabled.
+ *
+ * @return true if the action is enabled.
+ */
+ public boolean isEnabled()
+ {
+ return false;
+ }
+ }// TreeIncrementAction
+
+ /**
+ * Forwards all TreeModel events to the TreeState.
+ */
+ public class TreeModelHandler
+ implements TreeModelListener
+ {
+ /**
+ * Constructor
+ */
+ public TreeModelHandler()
+ {
+ }
+
+ /**
+ * Invoked after a node (or a set of siblings) has changed in some way. The
+ * node(s) have not changed locations in the tree or altered their children
+ * arrays, but other attributes have changed and may affect presentation.
+ * Example: the name of a file has changed, but it is in the same location
+ * in the file system. To indicate the root has changed, childIndices and
+ * children will be null. Use e.getPath() to get the parent of the changed
+ * node(s). e.getChildIndices() returns the index(es) of the changed
+ * node(s).
+ *
+ * @param e
+ * is the event that occured
+ */
+ public void treeNodesChanged(TreeModelEvent e)
+ {
+ tree.repaint();
+ }
+
+ /**
+ * Invoked after nodes have been inserted into the tree. Use e.getPath() to
+ * get the parent of the new node(s). e.getChildIndices() returns the
+ * index(es) of the new node(s) in ascending order.
+ *
+ * @param e
+ * is the event that occured
+ */
+ public void treeNodesInserted(TreeModelEvent e)
+ {
+ tree.repaint();
+ }
+
+ /**
+ * Invoked after nodes have been removed from the tree. Note that if a
+ * subtree is removed from the tree, this method may only be invoked once
+ * for the root of the removed subtree, not once for each individual set of
+ * siblings removed. Use e.getPath() to get the former parent of the deleted
+ * node(s). e.getChildIndices() returns, in ascending order, the index(es)
+ * the node(s) had before being deleted.
+ *
+ * @param e
+ * is the event that occured
+ */
+ public void treeNodesRemoved(TreeModelEvent e)
+ {
+ tree.repaint();
+ }
+
+ /**
+ * Invoked after the tree has drastically changed structure from a given
+ * node down. If the path returned by e.getPath() is of length one and the
+ * first element does not identify the current root node the first element
+ * should become the new root of the tree. Use e.getPath() to get the path
+ * to the node. e.getChildIndices() returns null.
+ *
+ * @param e
+ * is the event that occured
+ */
+ public void treeStructureChanged(TreeModelEvent e)
+ {
+ tree.repaint();
+ }
+ }// TreeModelHandler
+
+ /**
+ * TreePageAction handles page up and page down events.
+ */
+ public class TreePageAction
+ extends AbstractAction
+ {
+ /** Specifies the direction to adjust the selection by. */
+ protected int direction;
+
+ /**
+ * Constructor
+ *
+ * @param direction
+ * up or down
+ * @param name
+ * is the name of the direction
+ */
+ public TreePageAction(int direction, String name)
+ {
+ }
+
+ /**
+ * Invoked when an action occurs.
+ *
+ * @param e
+ * is the event that occured
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * Returns true if the action is enabled.
+ *
+ * @return true if the action is enabled.
+ */
+ public boolean isEnabled()
+ {
+ return false;
+ }
+ }// TreePageAction
+
+ /**
+ * Listens for changes in the selection model and updates the display
+ * accordingly.
+ */
+ public class TreeSelectionHandler
+ implements TreeSelectionListener
+ {
+ /**
+ * Constructor
+ */
+ public TreeSelectionHandler()
+ {
+ }
+
+ /**
+ * Messaged when the selection changes in the tree we're displaying for.
+ * Stops editing, messages super and displays the changed paths.
+ *
+ * @param event
+ * the event that characterizes the change.
+ */
+ public void valueChanged(TreeSelectionEvent event)
+ {
+ if (tree.isEditing())
+ tree.cancelEditing();
+ }
+ }// TreeSelectionHandler
+
+ /**
+ * For the first selected row expandedness will be toggled.
+ */
+ public class TreeToggleAction
+ extends AbstractAction
+ {
+ /**
+ * Constructor
+ *
+ * @param name
+ * is the name of <code>Action</code> field
+ */
+ public TreeToggleAction(String name)
+ {
+ }
+
+ /**
+ * Invoked when an action occurs.
+ *
+ * @param e
+ * the event that occured
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * Returns true if the action is enabled.
+ *
+ * @return true if the action is enabled, false otherwise
+ */
+ public boolean isEnabled()
+ {
+ return false;
+ }
+ } // TreeToggleAction
+
+ /**
+ * TreeTraverseAction is the action used for left/right keys. Will toggle the
+ * expandedness of a node, as well as potentially incrementing the selection.
+ */
+ public class TreeTraverseAction
+ extends AbstractAction
+ {
+ /**
+ * Determines direction to traverse, 1 means expand, -1 means collapse.
+ */
+ protected int direction;
+
+ /**
+ * Constructor
+ *
+ * @param direction
+ * to traverse
+ * @param name
+ * is the name of the direction
+ */
+ public TreeTraverseAction(int direction, String name)
+ {
+ }
+
+ /**
+ * Invoked when an action occurs.
+ *
+ * @param e
+ * the event that occured
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ TreeModel mod = tree.getModel();
+ Object last = tree.getLeadSelectionPath().getLastPathComponent();
+
+ if (e.getActionCommand().equals("selectParent"))
+ {
+ TreePath path = new TreePath(getPathToRoot(last, 0));
+ Object p = getParent(mod.getRoot(), last);
+
+ if (!mod.isLeaf(last) && tree.isExpanded(path))
+ tree.collapsePath(path);
+ else if (p != null)
+ selectPath(tree, new TreePath(getPathToRoot(p, 0)));
+ }
+ else if (e.getActionCommand().equals("selectChild"))
+ {
+ TreePath path = new TreePath(getPathToRoot(last, 0));
+
+ if (!mod.isLeaf(last) && tree.isCollapsed(path))
+ tree.expandPath(path);
+ else
+ {
+ Object next = getNextVisibleNode(last);
- /**
- * Returns true if the action is enabled.
- *
- * @return true if the action is enabled.
- */
- public boolean isEnabled()
- {
- return false;
- }
- }// TreeHomeAction
-
- /**
- * TreeIncrementAction is used to handle up/down actions. Selection is moved
- * up or down based on direction.
- */
- public class TreeIncrementAction
- extends AbstractAction
- {
-
- /** Specifies the direction to adjust the selection by. */
- protected int direction;
-
- /**
- * Constructor
- *
- * @param direction up or down
- * @param name is the name of the direction
- */
- public TreeIncrementAction(int direction, String name)
- {
- }
+ if (next != null)
+ selectPath(tree, new TreePath(getPathToRoot(next, 0)));
+ }
+ }
+ }
+
+ /**
+ * Returns true if the action is enabled.
+ *
+ * @return true if the action is enabled, false otherwise
+ */
+ public boolean isEnabled()
+ {
+ return false;
+ }
+ } // TreeTraverseAction
+
+ /**
+ * Returns the cell bounds for painting selected cells Package private for use
+ * in inner classes.
+ *
+ * @param x
+ * is the x location of the cell
+ * @param y
+ * is the y location of the cell
+ * @param cell
+ * is the Object to get the bounds for
+ * @returns Rectangle that represents the cell bounds
+ */
+ Rectangle getCellBounds(int x, int y, Object cell)
+ {
+ if (cell != null)
+ {
+ String s = cell.toString();
+ Font f = tree.getFont();
+ FontMetrics fm = tree.getToolkit().getFontMetrics(f);
+
+ if (s != null)
+ return new Rectangle(x, y,
+ SwingUtilities.computeStringWidth(fm, s) + 4,
+ fm.getHeight());
+ }
+ return new Rectangle(x, y, 0, 0);
+ }
+
+ /**
+ * Retrieves the location of some node, recursively starting at from some
+ * node. Package private for use in inner classes.
+ *
+ * @param x
+ * is the starting x position, offset
+ * @param y
+ * is the starting y position, offset
+ * @param tree
+ * is the tree to traverse
+ * @param mod
+ * is the TreeModel to use
+ * @param node
+ * is the node to get the location for
+ * @param startNode
+ * is the node to start searching from
+ * @return Point - the location of node
+ */
+ Point getCellLocation(int x, int y, JTree tree, TreeModel mod, Object node,
+ Object startNode)
+ {
+ int rowHeight = getRowHeight();
+ if (startNode == null || startNode.equals(node))
+ {
+ if (!tree.isRootVisible()
+ && tree.isExpanded(new TreePath(mod.getRoot())))
+ return new Point(x + ((getLevel(node)) * rightChildIndent), y);
+
+ return new Point(x + ((getLevel(node) + 1) * rightChildIndent), y);
+ }
+
+ if (!mod.isLeaf(startNode)
+ && tree.isExpanded(new TreePath(getPathToRoot(startNode, 0)))
+ && !mod.isLeaf(startNode) && mod.getChildCount(startNode) > 0)
+ {
+ Object child = mod.getChild(startNode, 0);
+ if (child != null)
+ return getCellLocation(x, y + rowHeight, tree, mod, node, child);
+ }
+
+ return getCellLocation(x, y + rowHeight, tree, mod, node,
+ getNextVisibleNode(startNode));
+ }
+
+ /**
+ * Paints a node in the tree Package private for use in inner classes.
+ *
+ * @param g
+ * the Graphics context in which to paint
+ * @param x
+ * the x location of the node
+ * @param y
+ * the y location of the node
+ * @param tree
+ * the tree to draw on
+ * @param node
+ * the object to draw
+ */
+ void paintNode(Graphics g, int x, int y, JTree tree, Object node,
+ boolean isLeaf)
+ {
+ TreePath curr = new TreePath(getPathToRoot(node, 0));
+ boolean selected = tree.isPathSelected(curr);
+ boolean expanded = false;
+ boolean hasIcons = false;
+
+ if (tree.isVisible(curr))
+ {
+ if (!isLeaf)
+ expanded = tree.isExpanded(curr);
+
+ if (editingComponent != null && editingPath != null && isEditing(tree)
+ && node.equals(editingPath.getLastPathComponent()))
+ {
+ Rectangle bounds = getPathBounds(tree, editingPath);
+ rendererPane.paintComponent(g, editingComponent.getParent(), null,
+ new Rectangle(0, 0, bounds.width,
+ bounds.height));
+ }
+ else
+ {
+ TreeCellRenderer dtcr = tree.getCellRenderer();
+ if (dtcr == null)
+ dtcr = createDefaultCellRenderer();
+
+ int row = getRowForPath(tree, curr);
+
+ Component c = dtcr.getTreeCellRendererComponent(tree, node,
+ selected, expanded,
+ isLeaf, row, false);
+
+ rendererPane.paintComponent(g, c, c.getParent(),
+ getCellBounds(x, y, node));
+ }
+ }
+ }
+
+ /**
+ * Recursively paints all elements of the tree Package private for use in
+ * inner classes.
+ *
+ * @param g
+ * the Graphics context in which to paint
+ * @param indentation
+ * of the current object
+ * @param descent
+ * is the number of elements drawn
+ * @param childNumber
+ * is the index of the current child in the tree
+ * @param depth
+ * is the depth of the current object in the tree
+ * @param tree
+ * is the tree to draw to
+ * @param mod
+ * is the TreeModel we are using to draw
+ * @param curr
+ * is the current object to draw
+ * @return int - current descent of the tree
+ */
+ int paintRecursive(Graphics g, int indentation, int descent, int childNumber,
+ int depth, JTree tree, TreeModel mod, Object curr)
+ {
+ Rectangle clip = g.getClipBounds();
+ if (indentation > clip.x + clip.width + rightChildIndent
+ || descent > clip.y + clip.height + getRowHeight())
+ return descent;
- /**
- * Invoked when an action occurs.
- *
- * @param e is the event that occured
- */
- public void actionPerformed(ActionEvent e)
- {
- }
+ int halfHeight = getRowHeight() / 2;
+ int halfWidth = rightChildIndent / 2;
+ int y0 = descent + halfHeight;
+ int heightOfLine = descent + halfHeight;
+ boolean isRootVisible = tree.isRootVisible();
- /**
- * Returns true if the action is enabled.
- *
- * @return true if the action is enabled.
- */
- public boolean isEnabled()
- {
- return false;
- }
- }// TreeIncrementAction
-
- /**
- * Forwards all TreeModel events to the TreeState.
- */
- public class TreeModelHandler
- implements TreeModelListener
- {
- /**
- * Constructor
- */
- public TreeModelHandler()
+ if (mod.isLeaf(curr))
{
+ paintNode(g, indentation + 4, descent, tree, curr, true);
+ descent += getRowHeight();
}
-
- /**
- * Invoked after a node (or a set of siblings) has changed in some way.
- * The node(s) have not changed locations in the tree or altered their
- * children arrays, but other attributes have changed and may affect
- * presentation. Example: the name of a file has changed, but it is in the
- * same location in the file system. To indicate the root has changed,
- * childIndices and children will be null. Use e.getPath() to get the
- * parent of the changed node(s). e.getChildIndices() returns the
- * index(es) of the changed node(s).
- *
- * @param e is the event that occured
- */
- public void treeNodesChanged(TreeModelEvent e)
+ else
{
- }
+ if (depth > 0 || isRootVisible)
+ {
+ paintNode(g, indentation + 4, descent, tree, curr, false);
+ descent += getRowHeight();
+ y0 += halfHeight;
+ }
+
+ int max = 0;
+ if (!mod.isLeaf(curr))
+ max = mod.getChildCount(curr);
+ if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0))))
+ {
+ for (int i = 0; i < max; i++)
+ {
+ int indent = indentation + rightChildIndent;
+ if (!isRootVisible && depth == 0)
+ indent = 0;
+ else if ((!isRootVisible && !curr.equals(mod.getRoot()))
+ || isRootVisible)
+ {
+ g.setColor(getHashColor());
+ heightOfLine = descent + halfHeight;
+ g.drawLine(indentation + halfWidth, heightOfLine,
+ indentation + rightChildIndent, heightOfLine);
+ }
- /**
- * Invoked after nodes have been inserted into the tree. Use e.getPath()
- * to get the parent of the new node(s). e.getChildIndices() returns the
- * index(es) of the new node(s) in ascending order.
- *
- * @param e is the event that occured
- */
- public void treeNodesInserted(TreeModelEvent e)
- {
- }
+ descent = paintRecursive(g, indent, descent, i, depth + 1,
+ tree, mod, mod.getChild(curr, i));
+ }
+ }
+ }
+
+ if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0))))
+ if (y0 != heightOfLine && !mod.isLeaf(curr)
+ && mod.getChildCount(curr) > 0)
+ {
+ g.setColor(getHashColor());
+ g.drawLine(indentation + halfWidth, y0, indentation + halfWidth,
+ heightOfLine);
+ }
+
+ return descent;
+ }
+
+ /**
+ * Recursively paints all the control icons on the tree. Package private for
+ * use in inner classes.
+ *
+ * @param g
+ * the Graphics context in which to paint
+ * @param indentation
+ * of the current object
+ * @param descent
+ * is the number of elements drawn
+ * @param childNumber
+ * is the index of the current child in the tree
+ * @param depth
+ * is the depth of the current object in the tree
+ * @param tree
+ * is the tree to draw to
+ * @param mod
+ * is the TreeModel we are using to draw
+ * @param curr
+ * is the current object to draw
+ * @return int - current descent of the tree
+ */
+ int paintControlIcons(Graphics g, int indentation, int descent,
+ int childNumber, int depth, JTree tree, TreeModel mod,
+ Object node)
+ {
+ int h = descent;
+ int rowHeight = getRowHeight();
+ Icon ei = UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon");
+ Icon ci = UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon");
+ Rectangle clip = g.getClipBounds();
+ if (indentation > clip.x + clip.width + rightChildIndent
+ || descent > clip.y + clip.height + getRowHeight())
+ return descent;
- /**
- * Invoked after nodes have been removed from the tree. Note that if a
- * subtree is removed from the tree, this method may only be invoked once
- * for the root of the removed subtree, not once for each individual set
- * of siblings removed. Use e.getPath() to get the former parent of the
- * deleted node(s). e.getChildIndices() returns, in ascending order, the
- * index(es) the node(s) had before being deleted.
- *
- * @param e is the event that occured
- */
- public void treeNodesRemoved(TreeModelEvent e)
+ if (mod.isLeaf(node))
+ descent += rowHeight;
+ else
{
- }
+ if (depth > 0 || tree.isRootVisible())
+ descent += rowHeight;
- /**
- * Invoked after the tree has drastically changed structure from a given
- * node down. If the path returned by e.getPath() is of length one and the
- * first element does not identify the current root node the first element
- * should become the new root of the tree. Use e.getPath() to get the path
- * to the node. e.getChildIndices() returns null.
- *
- * @param e is the event that occured
- */
- public void treeStructureChanged(TreeModelEvent e)
- {
- }
- }// TreeModelHandler
-
- /**
- * TreePageAction handles page up and page down events.
- */
- public class TreePageAction
- extends AbstractAction
- {
- /** Specifies the direction to adjust the selection by. */
- protected int direction;
-
- /**
- * Constructor
- *
- * @param direction up or down
- * @param name is the name of the direction
- */
- public TreePageAction(int direction, String name)
- {
- }
+ int max = 0;
+ if (!mod.isLeaf(node))
+ max = mod.getChildCount(node);
+ if (tree.isExpanded(new TreePath(getPathToRoot(node, 0))))
+ {
+ if (!node.equals(mod.getRoot()))
+ ei.paintIcon(tree, g, indentation - rightChildIndent - 3, h);
+
+ for (int i = 0; i < max; i++)
+ {
+ int indent = indentation + rightChildIndent;
+ if (depth == 0 && !tree.isRootVisible())
+ indent = -1;
+
+ descent = paintControlIcons(g, indent, descent, i, depth + 1,
+ tree, mod, mod.getChild(node, i));
+ }
+ }
+ else if (!node.equals(mod.getRoot()))
+ ci.paintIcon(tree, g, indentation - rightChildIndent - 3,
+ descent - getRowHeight());
+ }
+
+ return descent;
+ }
+
+ /**
+ * Returns true if the LookAndFeel implements the control icons Package
+ * private for use in inner classes.
+ *
+ * @return true if control icons are visible
+ */
+ boolean hasControlIcons()
+ {
+ if (UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon") == null
+ || UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon") == null)
+ return false;
+ return true;
+ }
+
+ /**
+ * Returns the parent of the current node
+ *
+ * @param root
+ * is the root of the tree
+ * @param node
+ * is the current node
+ * @return is the parent of the current node
+ */
+ Object getParent(Object root, Object node)
+ {
+ if (root == null || node == null)
+ return null;
+ if (node instanceof TreeNode)
+ return ((TreeNode) node).getParent();
+ return findNode(root, node);
+ }
+
+ /**
+ * Recursively checks the tree for the specified node, starting at the root.
+ *
+ * @param root
+ * is starting node to start searching at.
+ * @param node
+ * is the node to search for
+ * @return the parent node of node
+ */
+ private Object findNode(Object root, Object node)
+ {
+ TreeModel mod = tree.getModel();
+ int size = 0;
+ if (!mod.isLeaf(root))
+ size = mod.getChildCount(root);
+ for (int i = 0; i < size; i++)
+ {
+ if (mod.getIndexOfChild(root, node) != -1)
+ return root;
+
+ Object n = findNode(mod.getChild(root, i), node);
+ if (n != null)
+ return n;
+ }
+ return null;
+ }
+
+ /**
+ * Get next visible node in the tree. Package private for use in inner
+ * classes.
+ *
+ * @param the
+ * current node
+ * @return the next visible node in the JTree. Return null if there are no
+ * more.
+ */
+ Object getNextVisibleNode(Object node)
+ {
+ Object next = null;
+ TreePath current = null;
+
+ if (node != null)
+ next = getNextNode(node);
+
+ if (next != null)
+ {
+ current = new TreePath(getPathToRoot(next, 0));
+ if (tree.isVisible(current))
+ return next;
+
+ while (next != null && !tree.isVisible(current))
+ {
+ next = getNextNode(next);
- /**
- * Invoked when an action occurs.
- *
- * @param e is the event that occured
- */
- public void actionPerformed(ActionEvent e)
- {
- }
+ if (next != null)
+ current = new TreePath(getPathToRoot(next, 0));
+ }
+ }
+ return next;
+ }
+
+ /**
+ * Get previous visible node in the tree. Package private for use in inner
+ * classes.
+ *
+ * @param the
+ * current node
+ * @return the next visible node in the JTree. Return null if there are no
+ * more.
+ */
+ Object getPreviousVisibleNode(Object node)
+ {
+ Object prev = null;
+ TreePath current = null;
+
+ if (node != null)
+ prev = getPreviousNode(node);
+
+ if (prev != null)
+ {
+ current = new TreePath(getPathToRoot(prev, 0));
+ if (tree.isVisible(current))
+ return prev;
+
+ while (prev != null && !tree.isVisible(current))
+ {
+ prev = getPreviousNode(prev);
- /**
- * Returns true if the action is enabled.
- *
- * @return true if the action is enabled.
- */
- public boolean isEnabled()
- {
- return false;
- }
- }// TreePageAction
-
- /**
- * Listens for changes in the selection model and updates the display
- * accordingly.
- */
- public class TreeSelectionHandler
- implements TreeSelectionListener
- {
- /**
- * Constructor
- */
- public TreeSelectionHandler()
- {
- }
+ if (prev != null)
+ current = new TreePath(getPathToRoot(prev, 0));
+ }
+ }
+ return prev;
+ }
+
+ /**
+ * Returns the next node in the tree Package private for use in inner classes.
+ *
+ * @param the
+ * current node
+ * @return the next node in the tree
+ */
+ Object getNextNode(Object curr)
+ {
+ TreeModel mod = tree.getModel();
+ if (!mod.isLeaf(curr) && mod.getChildCount(curr) > 0)
+ return mod.getChild(curr, 0);
+
+ Object node = curr;
+ Object sibling = null;
+
+ do
+ {
+ sibling = getNextSibling(node);
+ node = getParent(mod.getRoot(), node);
+ }
+ while (sibling == null && node != null);
+
+ return sibling;
+ }
+
+ /**
+ * Returns the previous node in the tree Package private for use in inner
+ * classes.
+ *
+ * @param the
+ * current node
+ * @return the previous node in the tree
+ */
+ Object getPreviousNode(Object node)
+ {
+ TreeModel mod = tree.getModel();
+ Object parent = getParent(mod.getRoot(), node);
+ if (parent == null)
+ return null;
- /**
- * Messaged when the selection changes in the tree we're displaying for.
- * Stops editing, messages super and displays the changed paths.
- *
- * @param event the event that characterizes the change.
- */
- public void valueChanged(TreeSelectionEvent event)
- {
- }
- }// TreeSelectionHandler
-
- /**
- * For the first selected row expandedness will be toggled.
- */
- public class TreeToggleAction
- extends AbstractAction
- {
- /**
- * Constructor
- *
- * @param name is the name of <code>Action</code> field
- */
- public TreeToggleAction(String name)
- {
- }
+ Object sibling = getPreviousSibling(node);
+
+ if (sibling == null)
+ return parent;
+
+ int size = 0;
+ if (!mod.isLeaf(sibling))
+ size = mod.getChildCount(sibling);
+ while (size > 0)
+ {
+ sibling = mod.getChild(sibling, size - 1);
+ if (!mod.isLeaf(sibling))
+ size = mod.getChildCount(sibling);
+ else
+ size = 0;
+ }
+
+ return sibling;
+ }
+
+ /**
+ * Returns the next sibling in the tree Package private for use in inner
+ * classes.
+ *
+ * @param the
+ * current node
+ * @return the next sibling in the tree
+ */
+ Object getNextSibling(Object node)
+ {
+ TreeModel mod = tree.getModel();
+ Object parent = getParent(mod.getRoot(), node);
+ if (parent == null)
+ return null;
- /**
- * Invoked when an action occurs.
- *
- * @param e the event that occured
- */
- public void actionPerformed(ActionEvent e)
- {
- }
+ int index = mod.getIndexOfChild(parent, node) + 1;
- /**
- * Returns true if the action is enabled.
- *
- * @return true if the action is enabled, false otherwise
- */
- public boolean isEnabled()
- {
- return false;
- }
- } // TreeToggleAction
-
- /**
- * TreeTraverseAction is the action used for left/right keys. Will toggle
- * the expandedness of a node, as well as potentially incrementing the
- * selection.
- */
- public class TreeTraverseAction
- extends AbstractAction
- {
- /**
- * Determines direction to traverse, 1 means expand, -1 means collapse.
- */
- protected int direction;
-
- /**
- * Constructor
- *
- * @param direction to traverse
- * @param name is the name of the direction
- */
- public TreeTraverseAction(int direction, String name)
- {
- }
+ int size = 0;
+ if (!mod.isLeaf(parent))
+ size = mod.getChildCount(parent);
+ if (index == 0 || index >= size)
+ return null;
- /**
- * Invoked when an action occurs.
- *
- * @param e the event that occured
- */
- public void actionPerformed(ActionEvent e)
- {
- }
+ return mod.getChild(parent, index);
+ }
+
+ /**
+ * Returns the previous sibling in the tree Package private for use in inner
+ * classes.
+ *
+ * @param the
+ * current node
+ * @return the previous sibling in the tree
+ */
+ Object getPreviousSibling(Object node)
+ {
+ TreeModel mod = tree.getModel();
+ Object parent = getParent(mod.getRoot(), node);
+ if (parent == null)
+ return null;
- /**
- * Returns true if the action is enabled.
- *
- * @return true if the action is enabled, false otherwise
- */
- public boolean isEnabled()
- {
- return false;
- }
- } // TreeTraverseAction
-
- /**
- * Returns the cell bounds for painting selected cells
- *
- * @param x is the x location of the cell
- * @param y is the y location of the cell
- * @param cell is the Object to get the bounds for
- *
- * @returns Rectangle that represents the cell bounds
- */
- private Rectangle getCellBounds(int x, int y, Object cell)
- {
- if (cell != null)
- {
- String s = cell.toString();
- Font f = tree.getFont();
- FontMetrics fm = tree.getToolkit().getFontMetrics(tree.getFont());
+ int index = mod.getIndexOfChild(parent, node) - 1;
- return new Rectangle(x, y, SwingUtilities.computeStringWidth(fm, s),
- fm.getHeight());
- }
+ int size = 0;
+ if (!mod.isLeaf(parent))
+ size = mod.getChildCount(parent);
+ if (index < 0 || index >= size)
return null;
- }
-
- /**
- * Retrieves the location of some node, recursively starting at from
- * some node.
- *
- * @param x is the starting x position, offset
- * @param y is the starting y position, offset
- * @param tree is the tree to traverse
- * @param mod is the TreeModel to use
- * @param node is the node to get the location for
- * @param startNode is the node to start searching from
- *
- * @return Point - the location of node
- */
- private Point getCellLocation(int x, int y, JTree tree, TreeModel mod,
- Object node, Object startNode)
- {
- int rowHeight = getRowHeight();
- if (startNode == null || startNode.equals(node))
- return new Point(x + ((((DefaultMutableTreeNode) node).
- getLevel() + 1) * rightChildIndent), y);
-
- if (!mod.isLeaf(startNode)
- && tree.isExpanded(new TreePath(
- ((DefaultMutableTreeNode) startNode).getPath())))
- {
- Object child = mod.getChild(startNode, 0);
- if (child != null)
- return getCellLocation(x, y + rowHeight, tree, mod,
- node, child);
- }
-
- return getCellLocation(x, y + rowHeight, tree, mod, node,
- getNextVisibleNode((DefaultMutableTreeNode) startNode));
- }
-
- /**
- * Paints a leaf in the tree
- *
- * @param g the Graphics context in which to paint
- * @param x the x location of the leaf
- * @param y the y location of the leaf
- * @param tree the tree to draw on
- * @param leaf the object to draw
- */
- private void paintLeaf(Graphics g, int x, int y, JTree tree, Object leaf)
- {
- TreePath curr = new TreePath(((DefaultMutableTreeNode) leaf).getPath());
- boolean selected = tree.isPathSelected(curr);
-
- if (tree.isVisible(curr))
- {
- DefaultTreeCellRenderer dtcr = (DefaultTreeCellRenderer)
- tree.getCellRenderer();
- boolean hasIcons = false;
- Icon li = dtcr.getLeafIcon();
- if (li != null)
- hasIcons = true;
-
- if (selected)
- {
- Component c = dtcr.getTreeCellRendererComponent(tree, leaf,
- true, false, true, 0, false);
-
- if (hasIcons)
- {
- li.paintIcon(c, g, x, y + 2);
- x += li.getIconWidth() + 4;
- }
- rendererPane.paintComponent(g, c, tree,
- getCellBounds(x, y, leaf));
- }
- else
- {
- Component c = dtcr.getTreeCellRendererComponent(
- tree, leaf, false, false, true, 0, false);
-
- g.translate(x, y);
-
- if (hasIcons)
- {
- Component icon = dtcr.getTreeCellRendererComponent(tree,
- li, false, false, true, 0, false);
- icon.paint(g);
- }
-
- c.paint(g);
- g.translate(-x, -y);
- }
- }
- }
-
- /**
- * Paints a non-leaf in the tree
- *
- * @param g the Graphics context in which to paint
- * @param x the x location of the non-leaf
- * @param y the y location of the non-leaf
- * @param tree the tree to draw on
- * @param nonLeaf the object to draw
- */
- private void paintNonLeaf(Graphics g, int x, int y, JTree tree,
- Object nonLeaf)
- {
- TreePath curr = new TreePath(((DefaultMutableTreeNode) nonLeaf).getPath());
- boolean selected = tree.isPathSelected(curr);
- boolean expanded = tree.isExpanded(curr);
-
- if (tree.isVisible(curr))
- {
- DefaultTreeCellRenderer dtcr = (DefaultTreeCellRenderer)
- tree.getCellRenderer();
- boolean hasIcons = false;
- boolean hasOtherIcons = false;
- Icon oi = dtcr.getOpenIcon();
- Icon ci = dtcr.getClosedIcon();
-
- if (oi != null || ci != null)
- hasIcons = true;
-
- if (selected)
- {
- Component c = dtcr.getTreeCellRendererComponent(tree, nonLeaf,
- true, expanded, false, 0, false);
-
- if (hasIcons)
- {
- if (expanded)
- {
- oi.paintIcon(c, g, x, y + 2);
- x += (oi.getIconWidth() + 4);
- }
- else
- {
- ci.paintIcon(c, g, x, y + 2);
- x += (ci.getIconWidth() + 4);
- }
-
- }
- rendererPane.paintComponent(g, c, tree,
- getCellBounds(x, y, nonLeaf));
- }
- else
- {
- Component c = dtcr.getTreeCellRendererComponent(tree, nonLeaf,
- false, expanded, false, 0, false);
- g.translate(x, y);
-
- if (hasIcons)
- {
- Component icon;
- if (expanded)
- icon = dtcr.getTreeCellRendererComponent(tree,
- oi, false, false, false, 0, false);
- else
- icon = dtcr.getTreeCellRendererComponent(tree,
- ci, false, false, false, 0, false);
-
- icon.paint(g);
- }
- c.paint(g);
- g.translate(-x, -y);
- }
- }
- }
-
- /**
- * Recursively paints all elements of the tree
- *
- * @param g the Graphics context in which to paint
- * @param indentation of the current object
- * @param descent is the number of elements drawn
- * @param childNumber is the index of the current child in the tree
- * @param depth is the depth of the current object in the tree
- * @param tree is the tree to draw to
- * @param mod is the TreeModel we are using to draw
- * @param curr is the current object to draw
- *
- * @return int - current descent of the tree
- */
- private int paintRecursive(Graphics g, int indentation, int descent,
- int childNumber, int depth, JTree tree, TreeModel mod, Object curr)
- {
- Rectangle clip = g.getClipBounds();
- if (indentation > clip.x + clip.width + rightChildIndent
- || descent > clip.y + clip.height + getRowHeight())
- return descent;
-
- int halfHeight = getRowHeight() / 2;
- int halfWidth = rightChildIndent / 2;
- int y0 = descent + halfHeight;
- int heightOfLine = descent + halfHeight;
-
- if (mod.isLeaf(curr))
- {
- paintLeaf(g, indentation + 4, descent, tree, curr);
- descent += getRowHeight();
- }
- else
- {
- if (depth > 0 || tree.isRootVisible())
- {
- paintNonLeaf(g, indentation + 4, descent, tree, curr);
- descent += getRowHeight();
- y0 += halfHeight;
- }
-
- int max = mod.getChildCount(curr);
- if (tree.isExpanded(new TreePath(((DefaultMutableTreeNode) curr)
- .getPath())))
- {
- for (int i = 0; i < max; ++i)
- {
- g.setColor(getHashColor());
- heightOfLine = descent + halfHeight;
- g.drawLine(indentation + halfWidth, heightOfLine,
- indentation + rightChildIndent, heightOfLine);
-
- descent = paintRecursive(g, indentation + rightChildIndent,
- descent, i, depth + 1, tree, mod, mod.getChild(curr, i));
- }
- }
- }
- if (tree.isExpanded(new TreePath(((DefaultMutableTreeNode) curr)
- .getPath())))
- if (y0 != heightOfLine)
- {
- g.setColor(getHashColor());
- g.drawLine(indentation + halfWidth, y0, indentation + halfWidth,
- heightOfLine);
- }
-
- return descent;
- }
-
- /**
- * Recursively paints all the control icons on the tree.
- *
- * @param g the Graphics context in which to paint
- * @param indentation of the current object
- * @param descent is the number of elements drawn
- * @param childNumber is the index of the current child in the tree
- * @param depth is the depth of the current object in the tree
- * @param tree is the tree to draw to
- * @param mod is the TreeModel we are using to draw
- * @param curr is the current object to draw
- *
- * @return int - current descent of the tree
- */
- private int paintControlIcons(Graphics g, int indentation, int descent,
- int childNumber, int depth, JTree tree, TreeModel mod, Object node)
- {
- int h = descent;
- int rowHeight = getRowHeight();
- Icon ei = UIManager.getLookAndFeelDefaults().
- getIcon("Tree.expandedIcon");
- Icon ci = UIManager.getLookAndFeelDefaults().
- getIcon("Tree.collapsedIcon");
- Rectangle clip = g.getClipBounds();
- if (ci == null || ei == null || indentation > clip.x + clip.width +
- rightChildIndent || descent > clip.y + clip.height +
- getRowHeight())
- return descent;
-
- if (mod.isLeaf(node))
- descent += rowHeight;
- else
- {
- if (depth > 0 || tree.isRootVisible())
- descent += rowHeight;
-
- int max = mod.getChildCount(node);
- if (tree.isExpanded(new TreePath(((DefaultMutableTreeNode) node)
- .getPath())))
- {
- if (!node.equals(mod.getRoot()))
- ei.paintIcon(tree, g, indentation - rightChildIndent - 3, h);
-
- for (int i = 0; i < max; ++i)
- {
- descent = paintControlIcons(g, indentation + rightChildIndent,
- descent, i, depth + 1, tree, mod, mod.getChild(node, i));
- }
- }
- else if (!node.equals(mod.getRoot()))
- ci.paintIcon(tree, g, indentation - rightChildIndent - 3,
- descent - getRowHeight());
- }
-
- return descent;
- }
-} // BasicTreeUI \ No newline at end of file
+ return mod.getChild(parent, index);
+ }
+
+ /**
+ * Selects the specified path in the tree depending on modes. Package private
+ * for use in inner classes.
+ *
+ * @param tree
+ * is the tree we are selecting the path in
+ * @param path
+ * is the path we are selecting
+ */
+ void selectPath(JTree tree, TreePath path)
+ {
+ if (path != null)
+ {
+ if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION)
+ {
+ tree.addSelectionPath(path);
+ tree.setLeadSelectionPath(path);
+ }
+ else if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION)
+ {
+ // TODO
+ }
+ else
+ {
+ tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+
+ tree.getSelectionModel().clearSelection();
+ tree.addSelectionPath(path);
+ tree.setLeadSelectionPath(path);
+ }
+ }
+ }
+
+ /**
+ * Returns the path from node to the root. Package private for use in inner
+ * classes.
+ *
+ * @param node
+ * the node to get the path to
+ * @param depth
+ * the depth of the tree to return a path for
+ * @return an array of tree nodes that represent the path to node.
+ */
+ Object[] getPathToRoot(Object node, int depth)
+ {
+ TreeModel mod = tree.getModel();
+ if (node == null)
+ {
+ if (depth == 0)
+ return null;
+
+ return new Object[depth];
+ }
+
+ Object[] path = getPathToRoot(getParent(mod.getRoot(), node), depth + 1);
+ path[path.length - depth - 1] = node;
+ return path;
+ }
+
+ /**
+ * Returns the level of the node in the tree.
+ *
+ * @param the
+ * current node
+ * @return the number of the level
+ */
+ int getLevel(Object node)
+ {
+ int count = -1;
+ Object current = node;
+
+ do
+ {
+ current = getParent(tree.getModel().getRoot(), current);
+ count++;
+ }
+ while (current != null);
+
+ return count;
+ }
+
+ /**
+ * Draws a vertical line using the given graphic context
+ *
+ * @param g
+ * is the graphic context
+ * @param c
+ * is the component the new line will belong to
+ * @param x
+ * is the horizonal position
+ * @param top
+ * specifies the top of the line
+ * @param bottom
+ * specifies the bottom of the line
+ */
+ protected void paintVerticalLine(Graphics g, JComponent c, int x, int top,
+ int bottom)
+ {
+ g.drawLine(x, top, x, bottom);
+ }
+
+ /**
+ * Draws a horizontal line using the given graphic context
+ *
+ * @param g
+ * is the graphic context
+ * @param c
+ * is the component the new line will belong to
+ * @param y
+ * is the vertical position
+ * @param left
+ * specifies the left point of the line
+ * @param right
+ * specifies the right point of the line
+ */
+ protected void paintHorizontalLine(Graphics g, JComponent c, int y, int left,
+ int right)
+ {
+ g.drawLine(left, y, right, y);
+ }
+
+ /**
+ * Draws an icon at around a specific position
+ *
+ * @param c
+ * is the component the new line will belong to
+ * @param g
+ * is the graphic context
+ * @param icon
+ * is the icon which will be drawn
+ * @param x
+ * is the center position in x-direction
+ * @param y
+ * is the center position in y-direction FIXME what to do if x <
+ * (icon.width / 2). Same with y
+ */
+ protected void drawCentered(JComponent c, Graphics g, Icon icon, int x, int y)
+ {
+ int beginPositionX = x - icon.getIconWidth() / 2;
+ int beginPositionY = y - icon.getIconHeight() / 2;
+ icon.paintIcon(c, g, beginPositionX, beginPositionY);
+ }
+} // BasicTreeUI
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicViewportUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicViewportUI.java
index 8ce772b..0d46133 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicViewportUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicViewportUI.java
@@ -160,18 +160,18 @@ public class BasicViewportUI extends ViewportUI
Rectangle viewBounds,
Rectangle portBounds)
{
- Rectangle oldClip = g.getClipBounds ();
- g.setClip (oldClip.intersection (viewBounds));
+ Rectangle oldClip = g.getClipBounds();
+ g.setClip(new Rectangle(0, 0, portBounds.width, portBounds.height));
g.translate (-pos.x, -pos.y);
try
- {
+ {
view.paint(g);
}
finally
{
g.translate (pos.x, pos.y);
g.setClip (oldClip);
- }
+ }
}
private void paintBackingStore(Graphics g,
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalBorders.java b/libjava/classpath/javax/swing/plaf/metal/MetalBorders.java
index f260ef6..f555106 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalBorders.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalBorders.java
@@ -45,14 +45,18 @@ import java.awt.Insets;
import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
-import javax.swing.JButton;
+import javax.swing.JInternalFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JTextField;
import javax.swing.border.AbstractBorder;
import javax.swing.border.Border;
import javax.swing.plaf.BorderUIResource;
import javax.swing.plaf.UIResource;
-import javax.swing.plaf.basic.BasicGraphicsUtils;
import javax.swing.plaf.basic.BasicBorders;
+
/**
* This factory class creates borders for the different Swing components
* UI.
@@ -68,6 +72,9 @@ public class MetalBorders
/** The shared instance for getRolloverButtonBorder(). */
private static Border toolbarButtonBorder;
+ /** The shared instance for getTextFieldBorder(). */
+ private static Border textFieldBorder;
+
/**
* A MarginBorder that gets shared by multiple components.
* Created on demand by the private helper function {@link
@@ -184,6 +191,373 @@ public class MetalBorders
}
/**
+ * A simple 3D border.
+ */
+ public static class Flush3DBorder extends AbstractBorder
+ implements UIResource
+ {
+ /**
+ * Creates a new border instance.
+ */
+ public Flush3DBorder()
+ {
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ *
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return getBorderInsets(c, null);
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c, Insets newInsets)
+ {
+ if (newInsets == null)
+ newInsets = new Insets(2, 2, 2, 2);
+ else
+ {
+ newInsets.top = 2;
+ newInsets.left = 2;
+ newInsets.bottom = 2;
+ newInsets.right = 2;
+ }
+ return newInsets;
+ }
+
+ /**
+ * Paints the border for the specified component.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param w the width.
+ * @param h the height.
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+ Color savedColor = g.getColor();
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawRect(x, y, w - 2, h - 2);
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawRect(x + 1, y + 1, w - 2, h - 2);
+ g.setColor(MetalLookAndFeel.getControl());
+ g.drawLine(x + 1, y + h - 2, x + 1, y + h - 2);
+ g.drawLine(x + w - 2, y + 1, x + w - 2, y + 1);
+ g.setColor(savedColor);
+ }
+
+ }
+
+ /**
+ * A border used for the {@link JTextField} component.
+ */
+ public static class TextFieldBorder extends Flush3DBorder
+ implements UIResource
+ {
+ /**
+ * Creates a new border instance.
+ */
+ public TextFieldBorder()
+ {
+ }
+
+ /**
+ * Paints the border for the specified component.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param w the width.
+ * @param h the height.
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+ if (c.isEnabled())
+ super.paintBorder(c, g, x, y, w, h);
+ else
+ {
+ Color savedColor = g.getColor();
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ g.drawRect(x, y, w - 1, h - 1);
+ g.setColor(savedColor);
+ }
+ }
+
+ }
+
+ /**
+ * A border used when painting {@link JInternalFrame} instances.
+ */
+ public static class InternalFrameBorder extends AbstractBorder
+ implements UIResource
+ {
+ /**
+ * Creates a new border instance.
+ */
+ public InternalFrameBorder()
+ {
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ *
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return getBorderInsets(c, null);
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c, Insets newInsets)
+ {
+ if (newInsets == null)
+ newInsets = new Insets(5, 5, 5, 5);
+ else
+ {
+ newInsets.top = 5;
+ newInsets.left = 5;
+ newInsets.bottom = 5;
+ newInsets.right = 5;
+ }
+ return newInsets;
+ }
+
+ /**
+ * Paints the border for the specified component.
+ *
+ * @param c the component.
+ * @param g the graphics device.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param w the width.
+ * @param h the height.
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+
+ JInternalFrame f = (JInternalFrame) c;
+ if (f.isSelected())
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+
+ // fill the border background
+ g.fillRect(x, y, w, 5);
+ g.fillRect(x, y, 5, h);
+ g.fillRect(x + w - 5, y, 5, h);
+ g.fillRect(x, y + h - 5, w, 5);
+
+ // draw a dot in each corner
+ g.setColor(MetalLookAndFeel.getControl());
+ g.fillRect(x, y, 1, 1);
+ g.fillRect(x + w - 1, y, 1, 1);
+ g.fillRect(x + w - 1, y + h - 1, 1, 1);
+ g.fillRect(x, y + h - 1, 1, 1);
+
+ // draw the lines
+ g.setColor(MetalLookAndFeel.getBlack());
+ g.drawLine(x + 14, y + 2, x + w - 15, y + 2);
+ g.drawLine(x + 14, y + h - 3, x + w - 15, y + h - 3);
+ g.drawLine(x + 2, y + 14, x + 2, y + h - 15);
+ g.drawLine(x + w - 3, y + 14, x + w - 3, y + h - 15);
+
+ // draw the line highlights
+ g.setColor(MetalLookAndFeel.getControl());
+ g.drawLine(x + 15, y + 3, x + w - 14, y + 3);
+ g.drawLine(x + 15, y + h - 2, x + w - 14, y + h - 2);
+ g.drawLine(x + 3, y + 15, x + 3, y + h - 14);
+ g.drawLine(x + w - 2, y + 15, x + w - 2, y + h - 14);
+ }
+
+ }
+
+ /**
+ * A border used for {@link JMenu} and {@link JMenuItem} components.
+ */
+ public static class MenuItemBorder
+ extends AbstractBorder
+ implements UIResource
+ {
+ /** The border insets. */
+ protected static Insets borderInsets = new Insets(2, 2, 2, 2);
+
+ // TODO: find where the real colors come from
+ private static Color borderColorDark = new Color(102, 102, 153);
+ private static Color borderColorLight = new Color(255, 255, 255);
+
+ /**
+ * Creates a new border instance.
+ */
+ public MenuItemBorder()
+ {
+ }
+
+ /**
+ * Paints the border for the component. A border is painted only if the
+ * component is a selected {@link JMenu} or an armed {@link JMenuItem}.
+ *
+ * @param c the component.
+ * @param g the graphics device.
+ * @param x the x-coordinate of the border area.
+ * @param y the y-coordinate of the border area.
+ * @param w the width of the border area.
+ * @param h the height of the border area.
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+ if (c instanceof JMenu) {
+ JMenu menu = (JMenu) c;
+ if (menu.isSelected())
+ {
+ g.setColor(borderColorDark);
+ g.drawLine(x, y, x, y + h);
+ g.drawLine(x, y, x + w, y);
+ g.drawLine(x + w - 2, y + 1, x + w - 2, y + h);
+ g.setColor(borderColorLight);
+ g.drawLine(x + w - 1, y + 1, x + w - 1, y + h);
+ }
+ }
+ else if (c instanceof JMenuItem)
+ {
+ JMenuItem item = (JMenuItem) c;
+ if (item.isArmed())
+ {
+ g.setColor(borderColorDark);
+ g.drawLine(x, y, x + w, y);
+ g.setColor(borderColorLight);
+ g.drawLine(x, y + h - 1, x + w, y + h - 1);
+ }
+ }
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ *
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return borderInsets;
+ }
+
+ /**
+ * Populates <code>insets</code> with the border insets, then returns it.
+ *
+ * @param c the component (ignored).
+ * @param insets the object to populate with the border insets.
+ *
+ * @return The border insets.
+ *
+ * @throws NullPointerException if <code>insets</code> is <code>null</code>.
+ */
+ public Insets getBorderInsets(Component c, Insets insets)
+ {
+ insets.left = borderInsets.left;
+ insets.top = borderInsets.top;
+ insets.bottom = borderInsets.bottom;
+ insets.right = borderInsets.right;
+ return insets;
+ }
+ }
+
+ /**
+ * A border used for {@link JMenuBar} components.
+ */
+ public static class MenuBarBorder
+ extends AbstractBorder
+ implements UIResource
+ {
+ /** The border insets. */
+ protected static Insets borderInsets = new Insets(1, 0, 1, 0);
+
+ // TODO: find where this color really comes from
+ private static Color borderColor = new Color(153, 153, 153);
+
+ /**
+ * Creates a new border instance.
+ */
+ public MenuBarBorder()
+ {
+ }
+
+ /**
+ * Paints the border for the component. A border is painted only if the
+ * component is a selected {@link JMenu} or an armed {@link JMenuItem}.
+ *
+ * @param c the component.
+ * @param g the graphics device.
+ * @param x the x-coordinate of the border area.
+ * @param y the y-coordinate of the border area.
+ * @param w the width of the border area.
+ * @param h the height of the border area.
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+ g.setColor(borderColor);
+ g.drawLine(x, y + h - 1, x + w, y + h - 1);
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ *
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return borderInsets;
+ }
+
+ /**
+ * Populates <code>insets</code> with the border insets, then returns it.
+ *
+ * @param c the component (ignored).
+ * @param insets the object to populate with the border insets.
+ *
+ * @return The border insets.
+ *
+ * @throws NullPointerException if <code>insets</code> is <code>null</code>.
+ */
+ public Insets getBorderInsets(Component c, Insets insets)
+ {
+ insets.left = borderInsets.left;
+ insets.top = borderInsets.top;
+ insets.bottom = borderInsets.bottom;
+ insets.right = borderInsets.right;
+ return insets;
+ }
+ }
+
+ /**
* A border for JScrollPanes.
*/
public static class ScrollPaneBorder
@@ -413,6 +787,20 @@ public class MetalBorders
}
/**
+ * Returns a border for use by the {@link JTextField} component.
+ *
+ * @return A border.
+ *
+ * @since 1.3
+ */
+ public static Border getTextFieldBorder()
+ {
+ if (textFieldBorder == null)
+ textFieldBorder = new TextFieldBorder();
+ return textFieldBorder;
+ }
+
+ /**
* Returns a border for Toolbar buttons in the Metal Look &amp; Feel.
*
* @return a border for Toolbar buttons in the Metal Look &amp; Feel
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java
index a7b53c4..0dac5ec 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import java.awt.Color;
+
import javax.swing.AbstractButton;
import javax.swing.JComponent;
import javax.swing.JToolBar;
@@ -56,18 +58,60 @@ public class MetalButtonUI
extends BasicButtonUI
{
- // FIXME: probably substitute with a Map in the future in the case
- // that this UI becomes stateful
-
/** The cached MetalButtonUI instance. */
private static MetalButtonUI instance = null;
+ /** The color for the focus border. */
+ protected Color focusColor;
+
+ /** The color that indicates a selected button. */
+ protected Color selectColor;
+
+ /** The color for disabled button labels. */
+ protected Color disabledTextColor;
+
/**
* Creates a new instance of MetalButtonUI.
*/
public MetalButtonUI()
{
super();
+ focusColor = getFocusColor();
+ selectColor = getSelectColor();
+ disabledTextColor = getDisabledTextColor();
+ }
+
+ /**
+ * Returns the color for the focus border.
+ *
+ * @return the color for the focus border
+ */
+ protected Color getFocusColor()
+ {
+ UIDefaults def = UIManager.getLookAndFeelDefaults();
+ return def.getColor(getPropertyPrefix() + ".focus");
+ }
+
+ /**
+ * Returns the color that indicates a selected button.
+ *
+ * @return the color that indicates a selected button
+ */
+ protected Color getSelectColor()
+ {
+ UIDefaults def = UIManager.getLookAndFeelDefaults();
+ return def.getColor(getPropertyPrefix() + ".select");
+ }
+
+ /**
+ * Returns the color for the text label of disabled buttons.
+ *
+ * @return the color for the text label of disabled buttons
+ */
+ protected Color getDisabledTextColor()
+ {
+ UIDefaults def = UIManager.getLookAndFeelDefaults();
+ return def.getColor(getPropertyPrefix() + ".disabledText");
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxIcon.java b/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxIcon.java
index eba21a4..3f3c9ce 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxIcon.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxIcon.java
@@ -80,10 +80,10 @@ public class MetalCheckBoxIcon
protected void drawCheck(Component c, Graphics g, int x, int y)
{
g.setColor(Color.BLACK);
- g.drawLine(3, 5, 3, 9);
- g.drawLine(4, 5, 4, 9);
- g.drawLine(5, 7, 9, 3);
- g.drawLine(5, 8, 9, 4);
+ g.drawLine(3 + x, 5 + y, 3 + x, 9 + y);
+ g.drawLine(4 + x, 5 + y, 4 + x, 9 + y);
+ g.drawLine(5 + x, 7 + y, 9 + x, 3 + y);
+ g.drawLine(5 + x, 8 + y, 9 + x, 4 + y);
}
/**
@@ -124,7 +124,7 @@ public class MetalCheckBoxIcon
* @param c the Component to draw on (gets casted to JCheckBox)
* @param g the Graphics context to draw with
* @param x the X position
- * @param x the Y position
+ * @param y the Y position
*/
public void paintIcon(Component c, Graphics g, int x, int y)
{
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxUI.java
index d59e38c..c46cb5f 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxUI.java
@@ -38,12 +38,17 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import javax.swing.JCheckBox;
import javax.swing.JComponent;
+import javax.swing.UIDefaults;
import javax.swing.plaf.ComponentUI;
-import javax.swing.plaf.basic.BasicCheckBoxUI;
+/**
+ * A UI delegate for the {@link JCheckBox} component under the
+ * {@link MetalLookAndFeel}.
+ */
public class MetalCheckBoxUI
- extends BasicCheckBoxUI
+ extends MetalRadioButtonUI
{
// FIXME: maybe replace by a Map of instances when this becomes stateful
@@ -71,4 +76,15 @@ public class MetalCheckBoxUI
instance = new MetalCheckBoxUI();
return instance;
}
+
+ /**
+ * Returns the prefix for properties defined in the {@link UIDefaults} table.
+ *
+ * @return The property prefix (<code>"CheckBox."</code>).
+ */
+ public String getPropertyPrefix()
+ {
+ return "CheckBox.";
+ }
}
+
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalIconFactory.java b/libjava/classpath/javax/swing/plaf/metal/MetalIconFactory.java
index e770f47..d8c7743 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalIconFactory.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalIconFactory.java
@@ -44,7 +44,14 @@ import java.awt.Graphics;
import java.io.Serializable;
import javax.swing.Icon;
+import javax.swing.JCheckBox;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JInternalFrame;
+import javax.swing.JRadioButton;
+import javax.swing.JRadioButtonMenuItem;
import javax.swing.JSlider;
+import javax.swing.plaf.UIResource;
+
/**
* Creates icons for the {@link MetalLookAndFeel}.
@@ -59,6 +66,77 @@ public class MetalIconFactory implements Serializable
public static final boolean LIGHT = true;
/**
+ * An icon displayed for {@link JCheckBoxMenuItem} components.
+ */
+ private static class CheckBoxMenuItemIcon implements Icon, Serializable
+ {
+ /**
+ * Creates a new icon instance.
+ */
+ public CheckBoxMenuItemIcon()
+ {
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ *
+ * @return The width of the icon (10 pixels).
+ */
+ public int getIconWidth()
+ {
+ return 10;
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return The height of the icon (10 pixels).
+ */
+ public int getIconHeight()
+ {
+ return 10;
+ }
+
+ /**
+ * Paints the icon.
+ *
+ * @param c the component.
+ * @param g the graphics device.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ JCheckBoxMenuItem item = (JCheckBoxMenuItem) c;
+
+ if (item.isArmed())
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(x, y, x + 8, y);
+ g.drawLine(x, y + 1, x, y + 8);
+ g.drawLine(x + 2, y + 8, x + 8, y + 8);
+ g.drawLine(x + 8, y + 2, x + 8, y + 7);
+
+ g.setColor(MetalLookAndFeel.getWhite());
+ g.drawLine(x + 1, y + 1, x + 7, y + 1);
+ g.drawLine(x + 1, y + 2, x + 1, y + 7);
+ g.drawLine(x + 1, y + 9, x + 9, y + 9);
+ g.drawLine(x + 9, y + 1, x + 9, y + 8);
+
+ // if the item is selected, we should draw a tick
+ if (item.isSelected())
+ {
+ g.setColor(MetalLookAndFeel.getBlack());
+ g.fillRect(x + 2, y + 2, 2, 5);
+ for (int i = 0; i < 6; i++)
+ g.drawLine(x + 8 - i, y + i, x + 9 - i, y + i);
+ }
+
+ }
+ }
+
+ /**
* An icon representing a file (drawn as a piece of paper with the top-right
* corner turned down).
*/
@@ -208,7 +286,180 @@ public class MetalIconFactory implements Serializable
}
+ /**
+ * An {@link Icon} implementation for {@link JCheckBox}es in the
+ * Metal Look &amp; Feel.
+ *
+ * @author Roman Kennke (roman@kennke.org)
+ */
+ static class RadioButtonIcon
+ implements Icon, UIResource, Serializable
+ {
/**
+ * Draws the check in the RadioButton.
+ *
+ * @param c the component to draw on
+ * @param g the Graphics context to draw with
+ */
+ protected void drawCheck(Component c, Graphics g)
+ {
+ g.setColor(MetalLookAndFeel.getBlack());
+ g.fillRect(4, 3, 4, 6);
+ g.drawLine(3, 4, 3, 7);
+ g.drawLine(8, 4, 8, 7);
+ }
+
+ /**
+ * Returns the width of the icon in pixels.
+ *
+ * @return the width of the icon in pixels
+ */
+ public int getIconWidth()
+ {
+ return 13;
+ }
+
+ /**
+ * Returns the height of the icon in pixels.
+ *
+ * @return the height of the icon in pixels
+ */
+ public int getIconHeight()
+ {
+ return 13;
+ }
+
+ /**
+ * Paints the icon. This first paints the border of the RadioButton and
+ * if the CheckBox is selected it calls {@link #drawCheck} to draw
+ * the check.
+ *
+ * @param c the Component to draw on (gets casted to JCheckBox)
+ * @param g the Graphics context to draw with
+ * @param x the X position
+ * @param y the Y position
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color dark = MetalLookAndFeel.getControlDarkShadow();
+ Color light = MetalLookAndFeel.getWhite();
+ g.translate(x, y);
+
+ // The light 'circle'
+ g.setColor(light);
+ g.drawLine(4, 1, 10, 1);
+ g.drawLine(2, 2, 3, 2);
+ g.drawLine(8, 2, 11, 2);
+ g.drawLine(2, 3, 2, 3);
+ g.drawLine(11, 2, 11, 9);
+ g.drawLine(1, 4, 1, 7);
+ g.drawLine(12, 4, 12, 7);
+ g.drawLine(2, 8, 2, 11);
+ g.drawLine(11, 8, 11, 9);
+ g.drawLine(10, 10, 10, 10);
+ g.drawLine(2, 11, 9, 11);
+ g.drawLine(4, 12, 7, 12);
+
+ // The dark 'circle'
+ g.setColor(dark);
+ g.drawLine(4, 0, 7, 0);
+ g.drawLine(2, 1, 3, 1);
+ g.drawLine(8, 1, 9, 1);
+ g.drawLine(1, 2, 1, 3);
+ g.drawLine(10, 2, 10, 3);
+ g.drawLine(0, 4, 0, 7);
+ g.drawLine(11, 4, 11, 7);
+ g.drawLine(1, 8, 1, 9);
+ g.drawLine(10, 8, 10, 9);
+ g.drawLine(2, 10, 3, 10);
+ g.drawLine(8, 10, 9, 10);
+ g.drawLine(4, 11, 7, 11);
+
+ JRadioButton rb = (JRadioButton) c;
+ if (rb.isSelected())
+ drawCheck(c, g);
+
+ g.translate(-x, -y);
+ }
+ }
+
+ /**
+ * An icon displayed for {@link JRadioButtonMenuItem} components.
+ */
+ private static class RadioButtonMenuItemIcon
+ implements Icon, Serializable
+ {
+ /**
+ * Creates a new icon instance.
+ */
+ public RadioButtonMenuItemIcon()
+ {
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ *
+ * @return The width of the icon.
+ */
+ public int getIconWidth()
+ {
+ return 10;
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return The height of the icon.
+ */
+ public int getIconHeight()
+ {
+ return 10;
+ }
+
+ /**
+ * Paints the icon.
+ *
+ * @param c the component.
+ * @param g the graphics device.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color savedColor = g.getColor();
+ JRadioButtonMenuItem item = (JRadioButtonMenuItem) c;
+ g.setColor(MetalLookAndFeel.getBlack());
+ g.drawLine(x + 2, y, x + 6, y);
+ g.drawLine(x + 7, y + 1, x + 7, y + 1);
+ g.drawLine(x + 8, y + 2, x + 8, y + 6);
+ g.drawLine(x + 7, y + 7, x + 7, y + 7);
+ g.drawLine(x + 2, y + 8, x + 6, y + 8);
+ g.drawLine(x + 1, y + 7, x + 1, y + 7);
+ g.drawLine(x, y + 2, x, y + 6);
+ g.drawLine(x + 1, y + 1, x + 1, y + 1);
+
+ if (item.isSelected())
+ {
+ g.drawLine(x + 3, y + 2, x + 5, y + 2);
+ g.fillRect(x + 2, y + 3, 5, 3);
+ g.drawLine(x + 3, y + 6, x + 5, y + 6);
+ }
+
+ // highlight
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(x + 3, y + 1, x + 6, y + 1);
+ g.drawLine(x + 8, y + 1, x + 8, y + 1);
+ g.drawLine(x + 9, y + 2, x + 9, y + 7);
+ g.drawLine(x + 8, y + 8, x + 8, y + 8);
+ g.drawLine(x + 2, y + 9, x + 7, y + 9);
+ g.drawLine(x + 1, y + 8, x + 1, y + 8);
+ g.drawLine(x + 1, y + 3, x + 1, y + 6);
+ g.drawLine(x + 2, y + 2, x + 2, y + 2);
+ g.setColor(savedColor);
+ }
+ }
+
+ /**
* The icon used to display the thumb control on a horizontally oriented
* {@link JSlider} component.
*/
@@ -309,6 +560,447 @@ public class MetalIconFactory implements Serializable
}
/**
+ * An icon used for the 'close' button in the title frame of a
+ * {@link JInternalFrame}.
+ */
+ private static class InternalFrameCloseIcon implements Icon, Serializable
+ {
+ /** The icon size in pixels. */
+ private int size;
+
+ /**
+ * Creates a new icon.
+ *
+ * @param size the icon size (width and height) in pixels.
+ */
+ public InternalFrameCloseIcon(int size)
+ {
+ this.size = size;
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ *
+ * @return The width of the icon.
+ */
+ public int getIconWidth()
+ {
+ return size;
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return The height of the icon.
+ */
+ public int getIconHeight()
+ {
+ return size;
+ }
+
+ /**
+ * Paints the icon.
+ *
+ * @param c the component.
+ * @param g the graphics device.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ // draw the gray areas first
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ g.drawLine(x + 1, y + 1, x + 13, y + 1);
+ g.drawLine(x + 1, y + 2, x + 1, y + 12);
+ g.drawLine(x + 1, y + 13, x + 13, y + 13);
+ g.drawLine(x + 13, y + 2, x + 13, y + 12);
+
+ g.fillRect(x + 4, y + 4, 2, 2);
+ g.fillRect(x + 4, y + 9, 2, 2);
+ g.fillRect(x + 9, y + 4, 2, 2);
+ g.fillRect(x + 9, y + 9, 2, 2);
+ g.fillRect(x + 5, y + 5, 5, 5);
+
+ g.setColor(MetalLookAndFeel.getBlack());
+ g.drawLine(x, y, x + 13, y);
+ g.drawLine(x, y + 1, x, y + 13);
+ g.drawLine(x + 3, y + 4, x + 4, y + 3);
+ g.drawLine(x + 3, y + 9, x + 5, y + 7);
+ g.drawLine(x + 7, y + 5, x + 9, y + 3);
+
+ g.drawLine(x + 12, y + 3, x + 12, y + 11);
+ g.drawLine(x + 3, y + 12, x + 12, y + 12);
+
+ g.setColor(MetalLookAndFeel.getWhite());
+ g.drawLine(x + 1, y + 14, x + 14, y + 14);
+ g.drawLine(x + 14, y + 1, x + 14, y + 14);
+
+ g.drawLine(x + 5, y + 10, x + 5, y + 10);
+ g.drawLine(x + 6, y + 9, x + 7, y + 9);
+ g.drawLine(x + 10, y + 5, x + 10, y + 5);
+ g.drawLine(x + 9, y + 6, x + 9, y + 7);
+ g.drawLine(x + 10, y + 10, x + 11, y + 10);
+ g.drawLine(x + 10, y + 11, x + 10, y + 11);
+ }
+ }
+
+ /**
+ * The icon displayed at the top-left corner of a {@link JInternalFrame}.
+ */
+ private static class InternalFrameDefaultMenuIcon
+ implements Icon, Serializable
+ {
+
+ /**
+ * Creates a new instance.
+ */
+ public InternalFrameDefaultMenuIcon()
+ {
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ *
+ * @return The width of the icon.
+ */
+ public int getIconWidth()
+ {
+ return 16;
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return The height of the icon.
+ */
+ public int getIconHeight()
+ {
+ return 16;
+ }
+
+ /**
+ * Paints the icon at the specified location.
+ *
+ * @param c the component.
+ * @param g the graphics device.
+ * @param x the x coordinate.
+ * @param y the y coordinate.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ g.setColor(new Color(102, 102, 153));
+ g.fillRect(x + 1, y, 14, 2);
+ g.fillRect(x, y + 1, 2, 14);
+ g.fillRect(x + 1, y + 14, 14, 2);
+ g.fillRect(x + 14, y + 1, 2, 14);
+ g.drawLine(x + 2, y + 5, x + 14, y + 5);
+
+ g.setColor(new Color(204, 204, 255));
+ g.fillRect(x + 2, y + 2, 12, 3);
+
+ g.setColor(new Color(102, 102, 153));
+ g.drawLine(x + 3, y + 3, x + 3, y + 3);
+ g.drawLine(x + 6, y + 3, x + 6, y + 3);
+ g.drawLine(x + 9, y + 3, x + 9, y + 3);
+ g.drawLine(x + 12, y + 3, x + 12, y + 3);
+
+ g.setColor(Color.white);
+ g.fillRect(x + 2, y + 6, 12, 8);
+ g.drawLine(x + 2, y + 2, x + 2, y + 2);
+ g.drawLine(x + 5, y + 2, x + 5, y + 2);
+ g.drawLine(x + 8, y + 2, x + 8, y + 2);
+ g.drawLine(x + 11, y + 2, x + 11, y + 2);
+ }
+ }
+
+ /**
+ * An icon used in the title frame of a {@link JInternalFrame}. When you
+ * maximise an internal frame, this icon will replace the 'maximise' icon to
+ * provide a 'restore' option.
+ */
+ private static class InternalFrameAltMaximizeIcon
+ implements Icon, Serializable
+ {
+ /** The icon size in pixels. */
+ private int size;
+
+ /**
+ * Creates a new icon.
+ *
+ * @param size the icon size in pixels.
+ */
+ public InternalFrameAltMaximizeIcon(int size)
+ {
+ this.size = size;
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ *
+ * @return The width of the icon.
+ */
+ public int getIconWidth()
+ {
+ return size;
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return The height of the icon.
+ */
+ public int getIconHeight()
+ {
+ return size;
+ }
+
+ /**
+ * Paints the icon at the specified location.
+ *
+ * @param c the component.
+ * @param g the graphics device.
+ * @param x the x coordinate.
+ * @param y the y coordinate.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color color = MetalLookAndFeel.getControlDarkShadow();
+ if (c instanceof JInternalFrame)
+ {
+ JInternalFrame f = (JInternalFrame) c;
+ if (f.isSelected())
+ color = MetalLookAndFeel.getPrimaryControlShadow();
+ }
+ g.setColor(color);
+ g.drawLine(x + 12, y + 1, x + 13, y + 1);
+ g.drawLine(x + 11, y + 2, x + 12, y + 2);
+ g.drawLine(x + 10, y + 3, x + 11, y + 3);
+ g.drawLine(x + 8, y + 2, x + 8, y + 3);
+ g.fillRect(x + 8, y + 4, 3, 3);
+ g.drawLine(x + 11, y + 6, x + 12, y + 6);
+
+ g.drawLine(x + 1, y + 5, x + 5, y + 5);
+ g.drawLine(x + 1, y + 6, x + 1, y + 12);
+ g.drawLine(x + 9, y + 9, x + 9, y + 12);
+ g.drawLine(x + 1, y + 13, x + 9, y + 13);
+
+ g.drawLine(x + 2, y + 12, x + 2, y + 12);
+
+ g.setColor(MetalLookAndFeel.getBlack());
+ g.drawLine(x + 12, y, x + 9, y + 3);
+ g.drawLine(x + 7, y + 1, x + 8, y + 1);
+ g.drawLine(x + 7, y + 2, x + 7, y + 6);
+ g.drawLine(x + 11, y + 5, x + 12, y + 5);
+ g.drawLine(x, y + 4, x + 5, y + 4);
+ g.drawLine(x, y + 5, x, y + 13);
+ g.drawLine(x + 3, y + 12, x + 8, y + 12);
+ g.drawLine(x + 8, y + 8, x + 8, y + 11);
+ g.drawLine(x + 9, y + 8, x + 9, y + 8);
+
+ g.setColor(MetalLookAndFeel.getWhite());
+ g.drawLine(x + 9, y + 2, x + 9, y + 2);
+ g.drawLine(x + 11, y + 4, x + 13, y + 2);
+ g.drawLine(x + 13, y + 6, x + 13, y + 6);
+ g.drawLine(x + 8, y + 7, x + 13, y + 7);
+ g.drawLine(x + 6, y + 5, x + 6, y + 5);
+ g.drawLine(x + 2, y + 6, x + 6, y + 6);
+ g.drawLine(x + 2, y + 6, x + 2, y + 11);
+ g.drawLine(x + 10, y + 8, x + 10, y + 13);
+ g.drawLine(x + 1, y + 14, x + 10, y + 14);
+ }
+ }
+
+ /**
+ * An icon used for the 'maximize' button in the title frame of a
+ * {@link JInternalFrame}.
+ */
+ private static class InternalFrameMaximizeIcon
+ implements Icon, Serializable
+ {
+
+ /**
+ * Creates a new instance.
+ */
+ public InternalFrameMaximizeIcon()
+ {
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ *
+ * @return The width of the icon.
+ */
+ public int getIconWidth()
+ {
+ return 16;
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return The height of the icon.
+ */
+ public int getIconHeight()
+ {
+ return 16;
+ }
+
+ /**
+ * Paints the icon at the specified location.
+ *
+ * @param c the component.
+ * @param g the graphics device.
+ * @param x the x coordinate.
+ * @param y the y coordinate.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color color = MetalLookAndFeel.getControlDarkShadow();
+ if (c instanceof JInternalFrame)
+ {
+ JInternalFrame f = (JInternalFrame) c;
+ if (f.isSelected())
+ color = MetalLookAndFeel.getPrimaryControlShadow();
+ }
+ g.setColor(color);
+ g.drawLine(x + 9, y + 1, x + 10, y + 1);
+ g.fillRect(x + 11, y + 1, 3, 3);
+ g.fillRect(x + 12, y + 4, 2, 2);
+ g.drawLine(x + 10, y + 3, x + 10, y + 3);
+ g.drawLine(x + 9, y + 4, x + 10, y + 4);
+ g.drawLine(x + 1, y + 5, x + 9, y + 5);
+ g.drawLine(x + 1, y + 6, x + 1, y + 12);
+ g.drawLine(x + 9, y + 6, x + 9, y + 12);
+ g.drawLine(x + 1, y + 13, x + 9, y + 13);
+
+ // fill
+ g.drawLine(x + 7, y + 6, x + 8, y + 6);
+ g.drawLine(x + 6, y + 7, x + 8, y + 7);
+ g.drawLine(x + 5, y + 8, x + 6, y + 8);
+ g.drawLine(x + 4, y + 9, x + 5, y + 9);
+ g.drawLine(x + 3, y + 10, x + 4, y + 10);
+ g.drawLine(x + 2, y + 11, x + 3, y + 11);
+ g.drawLine(x + 2, y + 12, x + 4, y + 12);
+ g.drawLine(x + 8, y + 8, x + 8, y + 8);
+
+ // draw black
+ g.setColor(MetalLookAndFeel.getBlack());
+ g.drawLine(x + 8, y, x + 13, y);
+ g.drawLine(x + 8, y + 1, x + 8, y + 1);
+ g.drawLine(x + 10, y + 2, x + 9, y + 3);
+ g.drawLine(x, y + 4, x + 8, y + 4);
+ g.drawLine(x, y + 5, x, y + 13);
+
+ g.drawLine(x + 2, y + 10, x + 6, y + 6);
+ g.drawLine(x + 8, y + 9, x + 8, y + 11);
+ g.drawLine(x + 5, y + 12, x + 8, y + 12);
+
+ // draw white
+ g.setColor(MetalLookAndFeel.getWhite());
+ g.drawLine(x + 2, y + 6, x + 5, y + 6);
+ g.drawLine(x + 2, y + 7, x + 2, y + 9);
+ g.drawLine(x + 4, y + 11, x + 7, y + 8);
+
+ g.drawLine(x + 1, y + 14, x + 10, y + 14);
+ g.drawLine(x + 10, y + 5, x + 10, y + 13);
+
+ g.drawLine(x + 9, y + 2, x + 9, y + 2);
+ g.drawLine(x + 11, y + 4, x + 11, y + 5);
+ g.drawLine(x + 13, y + 6, x + 14, y + 6);
+ g.drawLine(x + 14, y + 1, x + 14, y + 5);
+ }
+ }
+
+ /**
+ * An icon used in the title frame of a {@link JInternalFrame}.
+ */
+ private static class InternalFrameMinimizeIcon
+ implements Icon, Serializable
+ {
+
+ /**
+ * Creates a new instance.
+ */
+ public InternalFrameMinimizeIcon()
+ {
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ *
+ * @return The width of the icon.
+ */
+ public int getIconWidth()
+ {
+ return 16;
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return The height of the icon.
+ */
+ public int getIconHeight()
+ {
+ return 16;
+ }
+
+ /**
+ * Paints the icon at the specified location.
+ *
+ * @param c the component.
+ * @param g the graphics device.
+ * @param x the x coordinate.
+ * @param y the y coordinate.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color color = MetalLookAndFeel.getControlDarkShadow();
+ if (c instanceof JInternalFrame)
+ {
+ JInternalFrame f = (JInternalFrame) c;
+ if (f.isSelected())
+ color = MetalLookAndFeel.getPrimaryControlShadow();
+ }
+ g.setColor(color);
+ g.drawLine(x + 12, y + 1, x + 13, y + 1);
+ g.drawLine(x + 11, y + 2, x + 12, y + 2);
+ g.drawLine(x + 10, y + 3, x + 11, y + 3);
+ g.drawLine(x + 8, y + 2, x + 8, y + 3);
+ g.fillRect(x + 8, y + 4, 3, 3);
+ g.drawLine(x + 11, y + 6, x + 12, y + 6);
+
+ g.drawLine(x + 1, y + 8, x + 6, y + 8);
+ g.drawLine(x + 1, y + 9, x + 1, y + 12);
+ g.drawLine(x + 6, y + 9, x + 6, y + 12);
+ g.drawLine(x + 1, y + 13, x + 6, y + 13);
+
+ g.drawLine(x + 5, y + 9, x + 5, y + 9);
+ g.drawLine(x + 2, y + 12, x + 2, y + 12);
+
+ g.setColor(MetalLookAndFeel.getBlack());
+ g.drawLine(x + 12, y, x + 9, y + 3);
+ g.drawLine(x + 7, y + 1, x + 8, y + 1);
+ g.drawLine(x + 7, y + 2, x + 7, y + 6);
+ g.drawLine(x, y + 7, x + 6, y + 7);
+ g.drawLine(x, y + 8, x, y + 13);
+ g.drawLine(x + 3, y + 12, x + 5, y + 12);
+ g.drawLine(x + 5, y + 10, x + 5, y + 11);
+ g.drawLine(x + 11, y + 5, x + 12, y + 5);
+
+ g.setColor(MetalLookAndFeel.getWhite());
+ g.drawLine(x + 9, y + 2, x + 9, y + 2);
+ g.drawLine(x + 11, y + 4, x + 13, y + 2);
+ g.drawLine(x + 13, y + 6, x + 13, y + 6);
+ g.drawLine(x + 8, y + 7, x + 13, y + 7);
+ g.drawLine(x + 2, y + 9, x + 4, y + 9);
+ g.drawLine(x + 2, y + 10, x + 2, y + 11);
+ g.drawLine(x + 7, y + 9, x + 7, y + 13);
+ g.drawLine(x + 1, y + 14, x + 7, y + 14);
+ }
+ }
+
+ /**
* The icon used to display the thumb control on a horizontally oriented
* {@link JSlider} component.
*/
@@ -606,6 +1298,9 @@ public class MetalIconFactory implements Serializable
}
}
+ /** The cached RadioButtonIcon instance. */
+ private static RadioButtonIcon radioButtonIcon;
+
/**
* Creates a new instance. All the methods are static, so creating an
* instance isn't necessary.
@@ -613,8 +1308,53 @@ public class MetalIconFactory implements Serializable
public MetalIconFactory()
{
}
+
+ /**
+ * Returns an icon for use when rendering the {@link JCheckBox} component.
+ *
+ * @return A check box icon.
+ *
+ * @since 1.3
+ */
+ public static Icon getCheckBoxIcon()
+ {
+ return new MetalCheckBoxIcon();
+ }
/**
+ * Returns an icon for use when rendering the {@link JCheckBoxMenuItem}
+ * component.
+ *
+ * @return An icon.
+ */
+ public static Icon getCheckBoxMenuItemIcon()
+ {
+ return new CheckBoxMenuItemIcon();
+ }
+
+ /**
+ * Returns an icon for RadioButtons in the Metal L&amp;F.
+ *
+ * @return an icon for RadioButtons in the Metal L&amp;F
+ */
+ public static Icon getRadioButtonIcon()
+ {
+ if (radioButtonIcon == null)
+ radioButtonIcon = new RadioButtonIcon();
+ return radioButtonIcon;
+ }
+
+ /**
+ * Creates a new instance of the icon used in a {@link JRadioButtonMenuItem}.
+ *
+ * @return A new icon instance.
+ */
+ public static Icon getRadioButtonMenuItemIcon()
+ {
+ return new RadioButtonMenuItemIcon();
+ }
+
+ /**
* Returns the icon used to display the thumb for a horizontally oriented
* {@link JSlider}.
*
@@ -626,6 +1366,72 @@ public class MetalIconFactory implements Serializable
}
/**
+ * Creates a new icon used to represent the 'close' button in the title
+ * pane of a {@link JInternalFrame}.
+ *
+ * @param size the icon size.
+ *
+ * @return A close icon.
+ */
+ public static Icon getInternalFrameCloseIcon(int size)
+ {
+ return new InternalFrameCloseIcon(size);
+ }
+
+ /**
+ * Creates a new icon for the menu in a {@link JInternalFrame}. This is the
+ * icon displayed at the top left of the frame.
+ *
+ * @return A menu icon.
+ */
+ public static Icon getInternalFrameDefaultMenuIcon()
+ {
+ return new InternalFrameDefaultMenuIcon();
+ }
+
+ /**
+ * Creates a new icon for the 'maximize' button in a {@link JInternalFrame}.
+ *
+ * @param size the icon size in pixels.
+ *
+ * @return The icon.
+ *
+ * @see #getInternalFrameAltMaximizeIcon(int)
+ */
+ public static Icon getInternalFrameMaximizeIcon(int size)
+ {
+ return new InternalFrameMaximizeIcon();
+ }
+
+ /**
+ * Returns the icon used for the minimize button in the frame title for a
+ * {@link JInternalFrame}.
+ *
+ * @param size the icon size in pixels (ignored by this implementation).
+ *
+ * @return The icon.
+ */
+ public static Icon getInternalFrameMinimizeIcon(int size)
+ {
+ return new InternalFrameMinimizeIcon();
+ }
+
+ /**
+ * Creates a new icon for the 'restore' button in a {@link JInternalFrame}
+ * that has been maximised.
+ *
+ * @param size the icon size in pixels.
+ *
+ * @return The icon.
+ *
+ * @see #getInternalFrameMaximizeIcon(int)
+ */
+ public static Icon getInternalFrameAltMaximizeIcon(int size)
+ {
+ return new InternalFrameAltMaximizeIcon(size);
+ }
+
+ /**
* Returns the icon used to display the thumb for a vertically oriented
* {@link JSlider}.
*
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameUI.java
index 1414351..7c7cb92 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameUI.java
@@ -42,9 +42,11 @@ import java.util.HashMap;
import javax.swing.JComponent;
import javax.swing.JInternalFrame;
+import javax.swing.border.EmptyBorder;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicInternalFrameUI;
+
public class MetalInternalFrameUI
extends BasicInternalFrameUI
{
@@ -85,4 +87,13 @@ public class MetalInternalFrameUI
return instance;
}
+
+ protected JComponent createNorthPane(JInternalFrame w)
+ {
+ titlePane = new MetalInternalFrameTitlePane(w);
+ titlePane.setBorder(new EmptyBorder(2, 2, 2, 2));
+ return titlePane;
+ }
+
+
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalLabelUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalLabelUI.java
index cdd8612..fe8a9e4 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalLabelUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalLabelUI.java
@@ -38,17 +38,26 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import java.awt.Color;
+import java.awt.Graphics;
+
import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.basic.BasicGraphicsUtils;
import javax.swing.plaf.basic.BasicLabelUI;
+/**
+ * A UI delegate used for {@link JLabel}s in the {@link MetalLookAndFeel}.
+ */
public class MetalLabelUI
extends BasicLabelUI
{
- // FIXME: maybe replace by a Map of instances when this becomes stateful
/** The shared UI instance for JLabels. */
- private static MetalLabelUI instance = null;
+ protected static MetalLabelUI metalLabelUI;
/**
* Constructs a new instance of MetalLabelUI.
@@ -67,8 +76,36 @@ public class MetalLabelUI
*/
public static ComponentUI createUI(JComponent component)
{
- if (instance == null)
- instance = new MetalLabelUI();
- return instance;
+ if (metalLabelUI == null)
+ metalLabelUI = new MetalLabelUI();
+ return metalLabelUI;
+ }
+
+ /**
+ * Draws the text for a disabled label, using the color defined in the
+ * {@link UIDefaults} with the key <code>Label.disabledForeground</code>.
+ *
+ * @param l the label.
+ * @param g the graphics device.
+ * @param s the label text.
+ * @param textX the x-coordinate for the label.
+ * @param textY the y-coordinate for the label.
+ *
+ * @see UIManager#getLookAndFeelDefaults()
+ */
+ protected void paintDisabledText(JLabel l, Graphics g, String s, int textX,
+ int textY)
+ {
+ Color savedColor = g.getColor();
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ g.setColor(defaults.getColor("Label.disabledForeground"));
+ int mnemIndex = l.getDisplayedMnemonicIndex();
+ if (mnemIndex != -1)
+ BasicGraphicsUtils.drawStringUnderlineCharAt(g, s, mnemIndex, textX,
+ textY);
+ else
+ g.drawString(s, textX, textY);
+
+ g.setColor(savedColor);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java b/libjava/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java
index 46519fc..d9cf7c6 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java
@@ -42,13 +42,14 @@ import java.awt.Color;
import java.awt.Font;
import java.awt.Insets;
-import javax.swing.ImageIcon;
import javax.swing.UIDefaults;
+import javax.swing.plaf.BorderUIResource;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.FontUIResource;
-import javax.swing.plaf.IconUIResource;
+import javax.swing.plaf.InsetsUIResource;
import javax.swing.plaf.basic.BasicLookAndFeel;
+
/**
* A custom look and feel that is designed to look similar across different
* operating systems.
@@ -771,7 +772,15 @@ public class MetalLookAndFeel extends BasicLookAndFeel
"Button.select", new ColorUIResource(getPrimaryControlShadow()),
"Button.shadow", new ColorUIResource(getPrimaryControlShadow()),
"CheckBox.background", new ColorUIResource(getControl()),
+ "CheckBox.border", MetalBorders.getButtonBorder(),
+ "CheckBox.icon",
+ new UIDefaults.ProxyLazyValue
+ ("javax.swing.plaf.metal.MetalCheckBoxIcon"),
+ "CheckBox.checkIcon",
+ new UIDefaults.ProxyLazyValue
+ ("javax.swing.plaf.metal.MetalCheckBoxIcon"),
"CheckBoxMenuItem.background", new ColorUIResource(getControl()),
+ "CheckBoxMenuItem.checkIcon", MetalIconFactory.getCheckBoxMenuItemIcon(),
"ToolBar.background", new ColorUIResource(getControl()),
"Panel.background", new ColorUIResource(getControl()),
"Slider.background", new ColorUIResource(getControl()),
@@ -779,16 +788,53 @@ public class MetalLookAndFeel extends BasicLookAndFeel
"ProgressBar.background", new ColorUIResource(getControl()),
"ScrollPane.border", new MetalBorders.ScrollPaneBorder(),
"TabbedPane.background", new ColorUIResource(getControl()),
+ "InternalFrame.border", new MetalBorders.InternalFrameBorder(),
+ "InternalFrame.icon", MetalIconFactory.getInternalFrameDefaultMenuIcon(),
+ "InternalFrame.closeIcon",
+ MetalIconFactory.getInternalFrameCloseIcon(16),
+ "InternalFrame.maximizeIcon",
+ MetalIconFactory.getInternalFrameMaximizeIcon(16),
+ "InternalFrame.iconifyIcon",
+ MetalIconFactory.getInternalFrameMinimizeIcon(16),
"Label.background", new ColorUIResource(getControl()),
"Label.font", getControlTextFont(),
- "Label.disabledForeground", new ColorUIResource(getControlDisabled()),
- "Label.foreground", new ColorUIResource(getSystemTextColor()),
+ "Label.disabledForeground", new ColorUIResource(getInactiveControlTextColor()),
+ "Label.foreground", new ColorUIResource(getControlTextColor()),
"Menu.background", new ColorUIResource(getControl()),
+ "Menu.border", new MetalBorders.MenuItemBorder(),
+ "Menu.borderPainted", Boolean.TRUE,
"Menu.font", getControlTextFont(),
+ "Menu.selectionBackground", getMenuSelectedBackground(),
+ "Menu.selectionForeground", getMenuSelectedForeground(),
"MenuBar.background", new ColorUIResource(getControl()),
+ "MenuBar.border", new MetalBorders.MenuBarBorder(),
"MenuBar.font", getControlTextFont(),
"MenuItem.background", new ColorUIResource(getControl()),
+ "MenuItem.border", new MetalBorders.MenuItemBorder(),
"MenuItem.font", getControlTextFont(),
+ "MenuItem.selectionBackground", getMenuSelectedBackground(),
+ "MenuItem.selectionForeground", getMenuSelectedForeground(),
+ "Panel.background", new ColorUIResource(getControl()),
+ "RadioButton.icon",
+ new UIDefaults.LazyValue()
+ {
+ public Object createValue(UIDefaults def)
+ {
+ return MetalIconFactory.getRadioButtonIcon();
+ }
+ },
+
+ "RadioButtonMenuItem.border", new MetalBorders.MenuItemBorder(),
+ "RadioButtonMenuItem.borderPainted", Boolean.TRUE,
+ "RadioButtonMenuItem.checkIcon",
+ MetalIconFactory.getRadioButtonMenuItemIcon(),
+ "RadioButtonMenuItem.font", MetalLookAndFeel.getControlTextFont(),
+ "RadioButtonMenuItem.margin", new InsetsUIResource(2, 2, 2, 2),
+ "RadioButtonMenuItem.selectionBackground",
+ MetalLookAndFeel.getMenuSelectedBackground(),
+ "RadioButtonMenuItem.selectionForeground",
+ MetalLookAndFeel.getMenuSelectedForeground(),
+
"ScrollBar.background", new ColorUIResource(getControl()),
"ScrollBar.shadow", new ColorUIResource(getControlShadow()),
"ScrollBar.thumb", new ColorUIResource(getPrimaryControlShadow()),
@@ -802,6 +848,32 @@ public class MetalLookAndFeel extends BasicLookAndFeel
"SplitPane.highlight",
new ColorUIResource(getControlHighlight()),
+ "Slider.focusInsets", new InsetsUIResource(0, 0, 0, 0),
+ "Slider.horizontalThumbIcon",
+ MetalIconFactory.getHorizontalSliderThumbIcon(),
+ "Slider.verticalThumbIcon",
+ MetalIconFactory.getVerticalSliderThumbIcon(),
+ "Slider.trackWidth", new Integer(7),
+ "Slider.majorTickLength", new Integer(6),
+
+ "TabbedPane.font", new FontUIResource("Dialog", Font.BOLD, 12),
+ "TabbedPane.tabInsets", new InsetsUIResource(0, 9, 1, 9),
+ "TabbedPane.selectedTabPadInsets", new InsetsUIResource(2, 2, 2, 1),
+ "TabbedPane.tabAreaInsets", new InsetsUIResource(4, 2, 0, 6),
+
+ "ToggleButton.background", new ColorUIResource(getControl()),
+ "ToggleButton.border", MetalBorders.getButtonBorder(),
+ "ToggleButton.darkShadow", new ColorUIResource(getControlDarkShadow()),
+ "ToggleButton.disabledText", new ColorUIResource(getControlDisabled()),
+ "ToggleButton.focus", new ColorUIResource(getFocusColor()),
+ "ToggleButton.font", getControlTextFont(),
+ "ToggleButton.foreground", new ColorUIResource(getSystemTextColor()),
+ "ToggleButton.highlight", new ColorUIResource(getControlHighlight()),
+ "ToggleButton.light", new ColorUIResource(getControlHighlight()),
+ "ToggleButton.margin", new Insets(2, 14, 2, 14),
+ "ToggleButton.select", new ColorUIResource(getPrimaryControlShadow()),
+ "ToggleButton.shadow", new ColorUIResource(getPrimaryControlShadow()),
+
"Tree.openIcon", MetalIconFactory.getTreeFolderIcon(),
"Tree.closedIcon", MetalIconFactory.getTreeFolderIcon(),
"Tree.leafIcon", MetalIconFactory.getTreeLeafIcon(),
@@ -818,6 +890,8 @@ public class MetalLookAndFeel extends BasicLookAndFeel
"Tree.selectionBackground", new ColorUIResource(new Color(204, 204, 255)),
"Tree.nonSelectionBackground", new ColorUIResource(Color.white),
"Tree.selectionBorderColor", new ColorUIResource(new Color(102, 102, 153)),
+ "Tree.selectionBorder", new BorderUIResource.LineBorderUIResource(new Color(102, 102, 153)),
+ "Tree.nonSelectionBorder", new BorderUIResource.LineBorderUIResource(Color.white),
"Tree.selectionForeground", new ColorUIResource(Color.black),
"Tree.textBackground", new ColorUIResource(new Color(204, 204, 255)),
"Tree.textForeground", new ColorUIResource(Color.black),
@@ -845,7 +919,8 @@ public class MetalLookAndFeel extends BasicLookAndFeel
super.initSystemColorDefaults(defaults);
Object[] uiDefaults;
uiDefaults = new Object[] {
- "control", new ColorUIResource(getControl())
+ "control", new ColorUIResource(getControl()),
+ "desktop", new ColorUIResource(getDesktopColor())
};
defaults.putDefaults(uiDefaults);
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalSliderUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalSliderUI.java
index a857d6a..4b52c4b 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalSliderUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalSliderUI.java
@@ -38,25 +38,72 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.beans.PropertyChangeListener;
import java.util.HashMap;
+import javax.swing.Icon;
import javax.swing.JComponent;
+import javax.swing.JSlider;
+import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.basic.BasicGraphicsUtils;
import javax.swing.plaf.basic.BasicSliderUI;
+/**
+ * A UI delegate for the {@link JSlider} component.
+ */
public class MetalSliderUI
extends BasicSliderUI
{
+ // TODO: find a use for this
+ protected static Color thumbColor;
+
+ // TODO: find a use for this
+ protected static Color highlightColor;
+
+ // TODO: find a use for this
+ protected static Color darkShadowColor;
+
+ /** The track width. */
+ protected static int trackWidth = UIManager.getInt("Slider.trackWidth");
+
+ /** The length of the major tick marks. */
+ protected static int tickLength = UIManager.getInt("Slider.majorTickLength");
+
+ /** The icon used for the thumb control of horizontally oriented sliders. */
+ protected static Icon horizThumbIcon = UIManager.getIcon(
+ "Slider.horizontalThumbIcon");
+
+ /** The icon used for the thumb control of vertically oriented sliders. */
+ protected static Icon vertThumbIcon = UIManager.getIcon(
+ "Slider.verticalThumbIcon");
+ /** The gap between the track and the tick marks. */
+ protected final int TICK_BUFFER = 4;
+
+ /**
+ * A flag that controls whether or not the track is filled up to the value
+ * of the slider.
+ */
+ protected boolean filledSlider;
+
+ /** A key to look up the filledSlider setting in the {@link UIManager}. */
+ protected final String SLIDER_FILL = "JSlider.isFilled";
+
/** The UI instances for MetalSliderUIs */
private static HashMap instances;
/**
- * Constructs a new instance of MetalSliderUI.
+ * Constructs a new instance.
*/
public MetalSliderUI()
{
super(null);
+ filledSlider = UIManager.getBoolean(SLIDER_FILL);
}
/**
@@ -71,17 +118,225 @@ public class MetalSliderUI
if (instances == null)
instances = new HashMap();
-
Object o = instances.get(component);
MetalSliderUI instance;
if (o == null)
{
- instance = new MetalSliderUI();
- instances.put(component, instance);
+ instance = new MetalSliderUI();
+ instances.put(component, instance);
}
else
instance = (MetalSliderUI) o;
return instance;
}
+
+ public void installUI(JComponent c)
+ {
+ super.installUI(c);
+ Boolean b = (Boolean) c.getClientProperty(SLIDER_FILL);
+ if (b != null)
+ filledSlider = b.booleanValue();
+ }
+
+ /**
+ * Paints the thumb icon for the slider.
+ *
+ * @param g the graphics device.
+ */
+ public void paintThumb(Graphics g)
+ {
+ if (slider.getOrientation() == JSlider.HORIZONTAL)
+ horizThumbIcon.paintIcon(slider, g, thumbRect.x, thumbRect.y);
+ else
+ vertThumbIcon.paintIcon(slider, g, thumbRect.x, thumbRect.y);
+ }
+
+ /**
+ * Creates a property change listener for the slider.
+ *
+ * @param slider the slider.
+ */
+ protected PropertyChangeListener createPropertyChangeListener(JSlider slider)
+ {
+ // TODO: try to figure out why it might be necessary to override this
+ // method as is done in Sun's implementation
+ return super.createPropertyChangeListener(slider);
+ }
+
+ /**
+ * Paints the track along which the thumb control moves.
+ *
+ * @param g the graphics device.
+ */
+ public void paintTrack(Graphics g)
+ {
+ if (slider.getOrientation() == JSlider.HORIZONTAL)
+ {
+ if (filledSlider)
+ {
+ // TODO: fill the track
+ }
+ BasicGraphicsUtils.drawEtchedRect(g, trackRect.x, trackRect.y
+ + (trackRect.height - getTrackWidth()) / 2, trackRect.width - 1,
+ getTrackWidth(), Color.darkGray, Color.gray, Color.darkGray,
+ Color.white);
+ }
+ else
+ {
+ if (filledSlider)
+ {
+ // TODO: fill the track
+ }
+ BasicGraphicsUtils.drawEtchedRect(g, trackRect.x + (trackRect.width
+ - getTrackWidth()) / 2, trackRect.y, getTrackWidth(),
+ trackRect.height - 1, Color.darkGray, Color.gray, Color.darkGray,
+ Color.white);
+ }
+ }
+
+ /**
+ * Draws the focus rectangle for the slider. The Metal look and feel
+ * indicates that the {@link JSlider} has the focus by changing the color of
+ * the thumb control - this is handled elsewhere and so this method is empty
+ * (it overrides the method in the {@link BasicSliderUI} class to prevent
+ * a default focus highlight from being drawn).
+ *
+ * @param g the graphics device.
+ */
+ public void paintFocus(Graphics g)
+ {
+ // do nothing as focus is shown by different color on thumb control
+ }
+
+ /**
+ * Returns the size of the thumb icon.
+ *
+ * @return The size of the thumb icon.
+ */
+ protected Dimension getThumbSize()
+ {
+ if (slider.getOrientation() == JSlider.HORIZONTAL)
+ return new Dimension(horizThumbIcon.getIconWidth(),
+ horizThumbIcon.getIconHeight());
+ else
+ return new Dimension(vertThumbIcon.getIconWidth(),
+ vertThumbIcon.getIconHeight());
+ }
+
+ /**
+ * Returns the length of the major tick marks.
+ *
+ * @return The length of the major tick marks.
+ */
+ public int getTickLength()
+ {
+ return tickLength + TICK_BUFFER;
+ }
+
+ /**
+ * Returns the track width.
+ *
+ * @return The track width.
+ */
+ protected int getTrackWidth()
+ {
+ return trackWidth;
+ }
+
+ /**
+ * Returns the track length.
+ *
+ * @return The track length.
+ */
+ protected int getTrackLength()
+ {
+ return (slider.getOrientation() == JSlider.HORIZONTAL
+ ? tickRect.width : tickRect.height);
+ }
+
+ /**
+ * Returns the thumb overhang.
+ *
+ * @return The thumb overhang.
+ */
+ protected int getThumbOverhang()
+ {
+ // TODO: figure out what this is used for
+ return 0;
+ }
+
+ protected void scrollDueToClickInTrack(int dir)
+ {
+ super.scrollDueToClickInTrack(dir);
+ }
+
+ /**
+ * Paints the minor ticks for a slider with a horizontal orientation.
+ *
+ * @param g the graphics device.
+ * @param tickBounds the tick bounds.
+ * @param x the x value for the tick.
+ */
+ protected void paintMinorTickForHorizSlider(Graphics g, Rectangle tickBounds,
+ int x)
+ {
+ // Note the incoming 'g' has a translation in place to get us to the
+ // start of the tick rect already...
+ // TODO: get color from UIManager...
+ g.setColor(new Color(153, 153, 204));
+ g.drawLine(x, TICK_BUFFER, x, TICK_BUFFER + tickLength / 2);
+ }
+
+ /**
+ * Paints the major ticks for a slider with a horizontal orientation.
+ *
+ * @param g the graphics device.
+ * @param tickBounds the tick bounds.
+ * @param x the x value for the tick.
+ */
+ protected void paintMajorTickForHorizSlider(Graphics g, Rectangle tickBounds,
+ int x)
+ {
+ // Note the incoming 'g' has a translation in place to get us to the
+ // start of the tick rect already...
+ // TODO: get color from UIManager...
+ g.setColor(new Color(153, 153, 204));
+ g.drawLine(x, TICK_BUFFER, x, TICK_BUFFER + tickLength);
+ }
+
+ /**
+ * Paints the minor ticks for a slider with a vertical orientation.
+ *
+ * @param g the graphics device.
+ * @param tickBounds the tick bounds.
+ * @param y the y value for the tick.
+ */
+ protected void paintMinorTickForVertSlider(Graphics g, Rectangle tickBounds,
+ int y)
+ {
+ // Note the incoming 'g' has a translation in place to get us to the
+ // start of the tick rect already...
+ // TODO: get color from UIManager...
+ g.setColor(new Color(153, 153, 204));
+ g.drawLine(TICK_BUFFER - 1, y, TICK_BUFFER - 1 + tickLength / 2, y);
+ }
+
+ /**
+ * Paints the major ticks for a slider with a vertical orientation.
+ *
+ * @param g the graphics device.
+ * @param tickBounds the tick bounds.
+ * @param y the y value for the tick.
+ */
+ protected void paintMajorTickForVertSlider(Graphics g, Rectangle tickBounds,
+ int y)
+ {
+ // Note the incoming 'g' has a translation in place to get us to the
+ // start of the tick rect already...
+ // TODO: get color from UIManager...
+ g.setColor(new Color(153, 153, 204));
+ g.drawLine(TICK_BUFFER - 1, y, TICK_BUFFER - 1 + tickLength, y);
+ }
+
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalTabbedPaneUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalTabbedPaneUI.java
index bf50f91..1b5fe14 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalTabbedPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalTabbedPaneUI.java
@@ -38,16 +38,70 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import java.awt.Graphics;
+import java.awt.LayoutManager;
import java.util.HashMap;
import javax.swing.JComponent;
+import javax.swing.JTabbedPane;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicTabbedPaneUI;
+/**
+ * A UI delegate used for the {@link JTabbedPane} component in the
+ * {@link MetalLookAndFeel}.
+ */
public class MetalTabbedPaneUI
extends BasicTabbedPaneUI
{
+ /**
+ * A {@link LayoutManager} responsible for placing all the tabs and the
+ * visible component inside the {@link JTabbedPane}. This class is only used
+ * for {@link JTabbedPane#WRAP_TAB_LAYOUT}.
+ *
+ * @specnote Apparently this class was intended to be protected,
+ * but was made public by a compiler bug and is now
+ * public for compatibility.
+ */
+ public class TabbedPaneLayout
+ extends BasicTabbedPaneUI.TabbedPaneLayout
+ {
+ /**
+ * Creates a new instance of the layout manager.
+ */
+ public TabbedPaneLayout()
+ {
+ }
+
+ /**
+ * Overridden to do nothing, because tab runs are not rotated in the
+ * {@link MetalLookAndFeel}.
+ *
+ * @param tabPlacement the tab placement (one of {@link #TOP},
+ * {@link #BOTTOM}, {@link #LEFT} or {@link #RIGHT}).
+ * @param selectedRun the index of the selected run.
+ */
+ protected void rotateTabRuns(int tabPlacement, int selectedRun)
+ {
+ // do nothing, because tab runs are not rotated in the MetalLookAndFeel
+ }
+
+ /**
+ * Overridden to do nothing, because the selected tab does not have extra
+ * padding in the {@link MetalLookAndFeel}.
+ *
+ * @param tabPlacement the tab placement (one of {@link #TOP},
+ * {@link #BOTTOM}, {@link #LEFT} or {@link #RIGHT}).
+ * @param selectedIndex the index of the selected tab.
+ */
+ protected void padSelectedTab(int tabPlacement, int selectedIndex)
+ {
+ // do nothing, because the selected tab does not have extra padding in
+ // the MetalLookAndFeel
+ }
+ }
+
/** The shared UI instance for JTabbedPanes. */
private static HashMap instances = null;
@@ -83,4 +137,228 @@ public class MetalTabbedPaneUI
return instance;
}
+
+ /**
+ * Creates and returns an instance of {@link TabbedPaneLayout}.
+ *
+ * @return A layout manager used by this UI delegate.
+ */
+ protected LayoutManager createLayoutManager()
+ {
+ return new TabbedPaneLayout();
+ }
+
+ /**
+ * Paints the border for a single tab.
+ *
+ * @param g the graphics device.
+ * @param tabPlacement the tab placement ({@link #TOP}, {@link #LEFT},
+ * {@link #BOTTOM} or {@link #RIGHT}).
+ * @param tabIndex the index of the tab to draw the border for.
+ * @param x the x-coordinate for the tab's bounding rectangle.
+ * @param y the y-coordinate for the tab's bounding rectangle.
+ * @param w the width for the tab's bounding rectangle.
+ * @param h the height for the tab's bounding rectangle.
+ * @param isSelected indicates whether or not the tab is selected.
+ */
+ protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex,
+ int x, int y, int w, int h, boolean isSelected)
+ {
+ if (tabPlacement == TOP)
+ paintTopTabBorder(tabIndex, g, x, y, w, h, 0, 0, isSelected);
+ else if (tabPlacement == LEFT)
+ paintLeftTabBorder(tabIndex, g, x, y, w, h, 0, 0, isSelected);
+ else if (tabPlacement == BOTTOM)
+ paintBottomTabBorder(tabIndex, g, x, y, w, h, 0, 0, isSelected);
+ else if (tabPlacement == RIGHT)
+ paintRightTabBorder(tabIndex, g, x, y, w, h, 0, 0, isSelected);
+ else
+ throw new AssertionError("Unrecognised 'tabPlacement' argument.");
+ }
+
+ /**
+ * Paints the border for a tab assuming that the tab position is at the top
+ * ({@link #TOP}).
+ *
+ * @param tabIndex the tab index.
+ * @param g the graphics device.
+ * @param x the x-coordinate for the tab's bounding rectangle.
+ * @param y the y-coordinate for the tab's bounding rectangle.
+ * @param w the width for the tab's bounding rectangle.
+ * @param h the height for the tab's bounding rectangle.
+ * @param btm ???
+ * @param rght ???
+ * @param isSelected indicates whether the tab is selected.
+ */
+ protected void paintTopTabBorder(int tabIndex, Graphics g, int x, int y,
+ int w, int h, int btm, int rght, boolean isSelected)
+ {
+ if (isSelected)
+ {
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(x + 1, y + h, x + 1, y + 6);
+ g.drawLine(x + 1, y + 6, x + 6, y + 1);
+ g.drawLine(x + 6, y + 1, x + w - 1, y + 1);
+ }
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(x, y + h - 1, x, y + 6);
+ g.drawLine(x, y + 6, x + 6, y);
+ g.drawLine(x + 6, y, x + w, y);
+ g.drawLine(x + w, y, x + w, y + h - 1);
+ }
+
+ /**
+ * Paints the border for a tab assuming that the tab position is at the left
+ * ({@link #LEFT}).
+ *
+ * @param tabIndex the tab index.
+ * @param g the graphics device.
+ * @param x the x-coordinate for the tab's bounding rectangle.
+ * @param y the y-coordinate for the tab's bounding rectangle.
+ * @param w the width for the tab's bounding rectangle.
+ * @param h the height for the tab's bounding rectangle.
+ * @param btm ???
+ * @param rght ???
+ * @param isSelected indicates whether the tab is selected.
+ */
+ protected void paintLeftTabBorder(int tabIndex, Graphics g, int x, int y,
+ int w, int h, int btm, int rght, boolean isSelected)
+ {
+ if (isSelected)
+ {
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(x + 1, y + h, x + 1, y + 6);
+ g.drawLine(x + 1, y + 6, x + 6, y + 1);
+ g.drawLine(x + 6, y + 1, x + w - 1, y + 1);
+ }
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(x, y + h, x, y + 6);
+ g.drawLine(x, y + 6, x + 6, y);
+ g.drawLine(x + 6, y, x + w - 1, y);
+ g.drawLine(x, y + h, x + w - 1, y + h);
+ }
+
+ /**
+ * Paints the border for a tab assuming that the tab position is at the right
+ * ({@link #RIGHT}).
+ *
+ * @param tabIndex the tab index.
+ * @param g the graphics device.
+ * @param x the x-coordinate for the tab's bounding rectangle.
+ * @param y the y-coordinate for the tab's bounding rectangle.
+ * @param w the width for the tab's bounding rectangle.
+ * @param h the height for the tab's bounding rectangle.
+ * @param btm ???
+ * @param rght ???
+ * @param isSelected indicates whether the tab is selected.
+ */
+ protected void paintRightTabBorder(int tabIndex, Graphics g, int x, int y,
+ int w, int h, int btm, int rght, boolean isSelected)
+ {
+ if (isSelected)
+ {
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(x, y + 1, x + w - 7, y + 1);
+ g.drawLine(x + w - 7, y + 1, x + w - 1, y + 7);
+ }
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(x, y, x + w - 7, y);
+ g.drawLine(x + w - 7, y, x + w - 1, y + 6);
+ g.drawLine(x + w - 1, y + 6, x + w - 1, y + h - 1);
+ g.drawLine(x + w - 1, y + h, x, y + h);
+ }
+
+ /**
+ * Paints the border for a tab assuming that the tab position is at the bottom
+ * ({@link #BOTTOM}).
+ *
+ * @param tabIndex the tab index.
+ * @param g the graphics device.
+ * @param x the x-coordinate for the tab's bounding rectangle.
+ * @param y the y-coordinate for the tab's bounding rectangle.
+ * @param w the width for the tab's bounding rectangle.
+ * @param h the height for the tab's bounding rectangle.
+ * @param btm ???
+ * @param rght ???
+ * @param isSelected indicates whether the tab is selected.
+ */
+ protected void paintBottomTabBorder(int tabIndex, Graphics g, int x, int y,
+ int w, int h, int btm, int rght, boolean isSelected)
+ {
+ if (isSelected)
+ {
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(x + 1, y, x + 1, y + h - 7);
+ g.drawLine(x + 1, y + h - 7, x + 7, y + h - 1);
+ }
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(x, y, x, y + h - 7);
+ g.drawLine(x, y + h - 7, x + 6, y + h - 1);
+ g.drawLine(x + 6, y + h - 1, x + w, y + h - 1);
+ g.drawLine(x + w, y + h - 1, x + w, y);
+ }
+
+ /**
+ * Paints the background for a tab.
+ *
+ * @param g the graphics device.
+ * @param tabPlacement the tab placement ({@link #TOP}, {@link #LEFT},
+ * {@link #BOTTOM} or {@link #RIGHT}).
+ * @param tabIndex the index of the tab to draw the border for.
+ * @param x the x-coordinate for the tab's bounding rectangle.
+ * @param y the y-coordinate for the tab's bounding rectangle.
+ * @param w the width for the tab's bounding rectangle.
+ * @param h the height for the tab's bounding rectangle.
+ * @param isSelected indicates whether or not the tab is selected.
+ */
+ protected void paintTabBackground(Graphics g, int tabPlacement,
+ int tabIndex, int x, int y, int w, int h, boolean isSelected)
+ {
+ if (isSelected)
+ g.setColor(MetalLookAndFeel.getControl());
+ else
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ int[] px, py;
+ if (tabPlacement == TOP)
+ {
+ px = new int[] {x + 6, x + w - 1, x + w -1, x + 2, x + 2};
+ py = new int[] {y + 2, y + 2, y + h - 1, y + h -1, y + 6};
+ }
+ else if (tabPlacement == LEFT)
+ {
+ px = new int[] {x + 6, x + w - 1, x + w -1, x + 2, x + 2};
+ py = new int[] {y + 2, y + 2, y + h - 1, y + h -1, y + 6};
+ }
+ else if (tabPlacement == BOTTOM)
+ {
+ px = new int[] {x + 2, x + w - 1, x + w -1, x + 8, x + 2};
+ py = new int[] {y, y, y + h - 1, y + h -1, y + h - 7};
+ }
+ else if (tabPlacement == RIGHT)
+ {
+ px = new int[] {x + 2, x + w - 7, x + w - 1, x + w - 1, x + 2};
+ py = new int[] {y + 2, y + 2, y + 7, y + h -1, y + h - 1};
+ }
+ else
+ throw new AssertionError("Unrecognised 'tabPlacement' argument.");
+ g.fillPolygon(px, py, 5);
+ }
+
+ /**
+ * Returns <code>true</code> if the tabs in the specified run should be
+ * padded to make the run fill the width/height of the {@link JTabbedPane}.
+ *
+ * @param tabPlacement the tab placement for the {@link JTabbedPane} (one of
+ * {@link #TOP}, {@link #BOTTOM}, {@link #LEFT} and {@link #RIGHT}).
+ * @param run the run index.
+ *
+ * @return A boolean.
+ */
+ protected boolean shouldPadTabRun(int tabPlacement, int run)
+ {
+ // as far as I can tell, all runs should be padded except the last run
+ // (which is drawn at the very top for tabPlacement == TOP)
+ return run < this.runCount - 1;
+ }
+
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java
index 7913cdb..be6d0c3 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java
@@ -38,7 +38,11 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import java.awt.Color;
+
import javax.swing.JComponent;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicToggleButtonUI;
@@ -46,7 +50,15 @@ public class MetalToggleButtonUI
extends BasicToggleButtonUI
{
- // FIXME: maybe replace by a Map of instances when this becomes stateful
+ /** The color for the focus border. */
+ protected Color focusColor;
+
+ /** The color that indicates a selected button. */
+ protected Color selectColor;
+
+ /** The color for disabled button labels. */
+ protected Color disabledTextColor;
+
/** The shared UI instance for MetalToggleButtonUIs */
private static MetalToggleButtonUI instance = null;
@@ -56,6 +68,43 @@ public class MetalToggleButtonUI
public MetalToggleButtonUI()
{
super();
+ focusColor = getFocusColor();
+ selectColor = getSelectColor();
+ disabledTextColor = getDisabledTextColor();
+ }
+
+
+ /**
+ * Returns the color for the focus border.
+ *
+ * @return the color for the focus border
+ */
+ protected Color getFocusColor()
+ {
+ UIDefaults def = UIManager.getLookAndFeelDefaults();
+ return def.getColor(getPropertyPrefix() + ".focus");
+ }
+
+ /**
+ * Returns the color that indicates a selected button.
+ *
+ * @return the color that indicates a selected button
+ */
+ protected Color getSelectColor()
+ {
+ UIDefaults def = UIManager.getLookAndFeelDefaults();
+ return def.getColor(getPropertyPrefix() + ".select");
+ }
+
+ /**
+ * Returns the color for the text label of disabled buttons.
+ *
+ * @return the color for the text label of disabled buttons
+ */
+ protected Color getDisabledTextColor()
+ {
+ UIDefaults def = UIManager.getLookAndFeelDefaults();
+ return def.getColor(getPropertyPrefix() + ".disabledText");
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalTreeUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalTreeUI.java
index d85d61c..8d16f74 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalTreeUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalTreeUI.java
@@ -75,8 +75,8 @@ public class MetalTreeUI
MetalTreeUI instance;
if (o == null)
{
- instance = new MetalTreeUI();
- instances.put(component, instance);
+ instance = new MetalTreeUI();
+ instances.put(component, instance);
}
else
instance = (MetalTreeUI) o;
diff --git a/libjava/classpath/javax/swing/table/DefaultTableCellRenderer.java b/libjava/classpath/javax/swing/table/DefaultTableCellRenderer.java
index 02e9fd7..349f4ba 100644
--- a/libjava/classpath/javax/swing/table/DefaultTableCellRenderer.java
+++ b/libjava/classpath/javax/swing/table/DefaultTableCellRenderer.java
@@ -47,6 +47,7 @@ import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
+import javax.swing.JTextField;
/**
* Class to display every cells.
@@ -123,7 +124,11 @@ public class DefaultTableCellRenderer extends JLabel
int row, int column)
{
if (value != null)
- super.setText(value.toString());
+ {
+ if (value instanceof JTextField)
+ return new JTextField(((JTextField)value).getText());
+ super.setText(value.toString());
+ }
setOpaque(true);
diff --git a/libjava/classpath/javax/swing/text/AbstractDocument.java b/libjava/classpath/javax/swing/text/AbstractDocument.java
index c3a3d70..3c9a4d4 100644
--- a/libjava/classpath/javax/swing/text/AbstractDocument.java
+++ b/libjava/classpath/javax/swing/text/AbstractDocument.java
@@ -56,70 +56,193 @@ import javax.swing.undo.AbstractUndoableEdit;
import javax.swing.undo.CompoundEdit;
import javax.swing.undo.UndoableEdit;
+/**
+ * An abstract base implementation for the {@link Document} interface.
+ * This class provides some common functionality for all <code>Element</code>s,
+ * most notably it implements a locking mechanism to make document modification
+ * thread-safe.
+ *
+ * @author original author unknown
+ * @author Roman Kennke (roman@kennke.org)
+ */
public abstract class AbstractDocument
implements Document, Serializable
{
+ /** The serial version UID for this class as of JDK1.4. */
private static final long serialVersionUID = -116069779446114664L;
-
+
+ /**
+ * Standard error message to indicate a bad location.
+ */
protected static final String BAD_LOCATION = "document location failure";
-
+
+ /**
+ * Standard name for unidirectional <code>Element</code>s.
+ */
public static final String BidiElementName = "bidi level";
+
+ /**
+ * Standard name for content <code>Element</code>s. These are usually
+ * {@link LeafElement}s.
+ */
public static final String ContentElementName = "content";
+
+ /**
+ * Standard name for paragraph <code>Element</code>s. These are usually
+ * {@link BranchElement}s.
+ */
public static final String ParagraphElementName = "paragraph";
+
+ /**
+ * Standard name for section <code>Element</code>s. These are usually
+ * {@link DefaultStyledDocument.SectionElement}s.
+ */
public static final String SectionElementName = "section";
+
+ /**
+ * Attribute key for storing the element name.
+ */
public static final String ElementNameAttribute = "$ename";
+ /**
+ * The actual content model of this <code>Document</code>.
+ */
Content content;
+
+ /**
+ * The AttributeContext for this <code>Document</code>.
+ */
AttributeContext context;
+
+ /**
+ * The currently installed <code>DocumentFilter</code>.
+ */
DocumentFilter documentFilter;
- /** The documents properties. */
+ /**
+ * The documents properties.
+ */
Dictionary properties;
+ /**
+ * Manages event listeners for this <code>Document</code>.
+ */
protected EventListenerList listenerList = new EventListenerList();
+ /**
+ * Creates a new <code>AbstractDocument</code> with the specified
+ * {@link Content} model.
+ *
+ * @param doc the <code>Content</code> model to be used in this
+ * <code>Document<code>
+ *
+ * @see GapContent
+ * @see StringContent
+ */
protected AbstractDocument(Content doc)
{
this(doc, StyleContext.getDefaultStyleContext());
}
+ /**
+ * Creates a new <code>AbstractDocument</code> with the specified
+ * {@link Content} model and {@link AttributeContext}.
+ *
+ * @param doc the <code>Content</code> model to be used in this
+ * <code>Document<code>
+ * @param ctx the <code>AttributeContext</code> to use
+ *
+ * @see GapContent
+ * @see StringContent
+ */
protected AbstractDocument(Content doc, AttributeContext ctx)
{
content = doc;
context = ctx;
}
- // These still need to be implemented by a derived class:
+ /**
+ * Returns the paragraph {@link Element} that holds the specified position.
+ *
+ * @param pos the position for which to get the paragraph element
+ *
+ * @return the paragraph {@link Element} that holds the specified position
+ */
public abstract Element getParagraphElement(int pos);
+ /**
+ * Returns the default root {@link Element} of this <code>Document</code>.
+ * Usual <code>Document</code>s only have one root element and return this.
+ * However, there may be <code>Document</code> implementations that
+ * support multiple root elements, they have to return a default root element
+ * here.
+ *
+ * @return the default root {@link Element} of this <code>Document</code>
+ */
public abstract Element getDefaultRootElement();
+ /**
+ * Creates and returns a branch element with the specified
+ * <code>parent</code> and <code>attributes</code>. Note that the new
+ * <code>Element</code> is linked to the parent <code>Element</code>
+ * through {@link Element#getParentElement}, but it is not yet added
+ * to the parent <code>Element</code> as child.
+ *
+ * @param parent the parent <code>Element</code> for the new branch element
+ * @param attributes the text attributes to be installed in the new element
+ *
+ * @return the new branch <code>Element</code>
+ *
+ * @see BranchElement
+ */
protected Element createBranchElement(Element parent,
AttributeSet attributes)
{
return new BranchElement(parent, attributes);
}
+ /**
+ * Creates and returns a leaf element with the specified
+ * <code>parent</code> and <code>attributes</code>. Note that the new
+ * <code>Element</code> is linked to the parent <code>Element</code>
+ * through {@link Element#getParentElement}, but it is not yet added
+ * to the parent <code>Element</code> as child.
+ *
+ * @param parent the parent <code>Element</code> for the new branch element
+ * @param attributes the text attributes to be installed in the new element
+ *
+ * @return the new branch <code>Element</code>
+ *
+ * @see LeafElement
+ */
protected Element createLeafElement(Element parent, AttributeSet attributes,
int start, int end)
{
return new LeafElement(parent, attributes, start, end);
}
+ /**
+ * Creates a {@link Position} that keeps track of the location at the
+ * specified <code>offset</code>.
+ *
+ * @param offset the location in the document to keep track by the new
+ * <code>Position</code>
+ *
+ * @return the newly created <code>Position</code>
+ *
+ * @throws BadLocationException if <code>offset</code> is not a valid
+ * location in the documents content model
+ */
public Position createPosition(final int offset) throws BadLocationException
{
- if (offset < 0 || offset > getLength())
- throw new BadLocationException(getText(0, getLength()), offset);
-
- return new Position()
- {
- public int getOffset()
- {
- return offset;
- }
- };
+ return content.createPosition(offset);
}
+ /**
+ * Notifies all registered listeners when the document model changes.
+ *
+ * @param event the <code>DocumentEvent</code> to be fired
+ */
protected void fireChangedUpdate(DocumentEvent event)
{
DocumentListener[] listeners = getDocumentListeners();
@@ -128,6 +251,12 @@ public abstract class AbstractDocument
listeners[index].changedUpdate(event);
}
+ /**
+ * Notifies all registered listeners when content is inserted in the document
+ * model.
+ *
+ * @param event the <code>DocumentEvent</code> to be fired
+ */
protected void fireInsertUpdate(DocumentEvent event)
{
DocumentListener[] listeners = getDocumentListeners();
@@ -136,6 +265,12 @@ public abstract class AbstractDocument
listeners[index].insertUpdate(event);
}
+ /**
+ * Notifies all registered listeners when content is removed from the
+ * document model.
+ *
+ * @param event the <code>DocumentEvent</code> to be fired
+ */
protected void fireRemoveUpdate(DocumentEvent event)
{
DocumentListener[] listeners = getDocumentListeners();
@@ -144,6 +279,12 @@ public abstract class AbstractDocument
listeners[index].removeUpdate(event);
}
+ /**
+ * Notifies all registered listeners when an <code>UndoableEdit</code> has
+ * been performed on this <code>Document</code>.
+ *
+ * @param event the <code>UndoableEditEvent</code> to be fired
+ */
protected void fireUndoableEditUpdate(UndoableEditEvent event)
{
UndoableEditListener[] listeners = getUndoableEditListeners();
@@ -152,31 +293,70 @@ public abstract class AbstractDocument
listeners[index].undoableEditHappened(event);
}
+ /**
+ * Returns the asynchronous loading priority. Returns <code>-1</code> if this
+ * document should not be loaded asynchronously.
+ *
+ * @return the asynchronous loading priority
+ */
public int getAsynchronousLoadPriority()
{
return 0;
}
+ /**
+ * Returns the {@link AttributeContext} used in this <code>Document</code>.
+ *
+ * @return the {@link AttributeContext} used in this <code>Document</code>
+ */
protected AttributeContext getAttributeContext()
{
return context;
}
+ /**
+ * Returns the root element for bidirectional content.
+ *
+ * @return the root element for bidirectional content
+ */
public Element getBidiRootElement()
{
return null;
}
+ /**
+ * Returns the {@link Content} model for this <code>Document</code>
+ *
+ * @return the {@link Content} model for this <code>Document</code>
+ *
+ * @see GapContent
+ * @see StringContent
+ */
protected Content getContent()
{
return content;
}
+ /**
+ * Returns the thread that currently modifies this <code>Document</code>
+ * if there is one, otherwise <code>null</code>. This can be used to
+ * distinguish between a method call that is part of an ongoing modification
+ * or if it is a separate modification for which a new lock must be aquired.
+ *
+ * @return the thread that currently modifies this <code>Document</code>
+ * if there is one, otherwise <code>null</code>
+ */
protected Thread getCurrentWriter()
{
+ // FIXME: Implement locking!
return null;
}
+ /**
+ * Returns the properties of this <code>Document</code>.
+ *
+ * @return the properties of this <code>Document</code>
+ */
public Dictionary getDocumentProperties()
{
// FIXME: make me thread-safe
@@ -186,8 +366,16 @@ public abstract class AbstractDocument
return properties;
}
+ /**
+ * Returns a {@link Position} which will always mark the end of the
+ * <code>Document</code>.
+ *
+ * @return a {@link Position} which will always mark the end of the
+ * <code>Document</code>
+ */
public Position getEndPosition()
{
+ // FIXME: Properly implement this by calling Content.createPosition().
return new Position()
{
public int getOffset()
@@ -197,16 +385,39 @@ public abstract class AbstractDocument
};
}
+ /**
+ * Returns the length of this <code>Document</code>'s content.
+ *
+ * @return the length of this <code>Document</code>'s content
+ */
public int getLength()
{
+ // We return Content.getLength() -1 here because there is always an
+ // implicit \n at the end of the Content which does count in Content
+ // but not in Document.
return content.length() - 1;
}
+ /**
+ * Returns all registered listeners of a given listener type.
+ *
+ * @param listenerType the type of the listeners to be queried
+ *
+ * @return all registered listeners of the specified type
+ */
public EventListener[] getListeners(Class listenerType)
{
return listenerList.getListeners(listenerType);
}
+ /**
+ * Returns a property from this <code>Document</code>'s property list.
+ *
+ * @param key the key of the property to be fetched
+ *
+ * @return the property for <code>key</code> or <code>null</code> if there
+ * is no such property stored
+ */
public Object getProperty(Object key)
{
// FIXME: make me thread-safe
@@ -217,6 +428,15 @@ public abstract class AbstractDocument
return value;
}
+ /**
+ * Returns all root elements of this <code>Document</code>. By default
+ * this just returns the single root element returned by
+ * {@link #getDefaultRootElement()}. <code>Document</code> implementations
+ * that support multiple roots must override this method and return all roots
+ * here.
+ *
+ * @return all root elements of this <code>Document</code>
+ */
public Element[] getRootElements()
{
Element[] elements = new Element[1];
@@ -224,8 +444,16 @@ public abstract class AbstractDocument
return elements;
}
+ /**
+ * Returns a {@link Position} which will always mark the beginning of the
+ * <code>Document</code>.
+ *
+ * @return a {@link Position} which will always mark the beginning of the
+ * <code>Document</code>
+ */
public Position getStartPosition()
{
+ // FIXME: Properly implement this using Content.createPosition().
return new Position()
{
public int getOffset()
@@ -235,17 +463,53 @@ public abstract class AbstractDocument
};
}
+ /**
+ * Returns a piece of this <code>Document</code>'s content.
+ *
+ * @param offset the start offset of the content
+ * @param length the length of the content
+ *
+ * @return the piece of content specified by <code>offset</code> and
+ * <code>length</code>
+ *
+ * @throws BadLocationException if <code>offset</code> or <code>offset +
+ * length</code> are invalid locations with this
+ * <code>Document</code>
+ */
public String getText(int offset, int length) throws BadLocationException
{
return content.getString(offset, length);
}
+ /**
+ * Fetches a piece of this <code>Document</code>'s content and stores
+ * it in the given {@link Segment}.
+ *
+ * @param offset the start offset of the content
+ * @param length the length of the content
+ * @param segment the <code>Segment</code> to store the content in
+ *
+ * @throws BadLocationException if <code>offset</code> or <code>offset +
+ * length</code> are invalid locations with this
+ * <code>Document</code>
+ */
public void getText(int offset, int length, Segment segment)
throws BadLocationException
{
content.getChars(offset, length, segment);
}
+ /**
+ * Inserts a String into this <code>Document</code> at the specified
+ * position and assigning the specified attributes to it.
+ *
+ * @param offset the location at which the string should be inserted
+ * @param text the content to be inserted
+ * @param attributes the text attributes to be assigned to that string
+ *
+ * @throws BadLocationException if <code>offset</code> is not a valid
+ * location in this <code>Document</code>
+ */
public void insertString(int offset, String text, AttributeSet attributes)
throws BadLocationException
{
@@ -261,14 +525,37 @@ public abstract class AbstractDocument
fireInsertUpdate(event);
}
+ /**
+ * Called to indicate that text has been inserted into this
+ * <code>Document</code>. The default implementation does nothing.
+ * This method is executed within a write lock.
+ *
+ * @param chng the <code>DefaultDocumentEvent</code> describing the change
+ * @param attr the attributes of the changed content
+ */
protected void insertUpdate(DefaultDocumentEvent chng, AttributeSet attr)
{
+ // Do nothing here. Subclasses may want to override this.
}
+ /**
+ * Called after some content has been removed from this
+ * <code>Document</code>. The default implementation does nothing.
+ * This method is executed within a write lock.
+ *
+ * @param chng the <code>DefaultDocumentEvent</code> describing the change
+ */
protected void postRemoveUpdate(DefaultDocumentEvent chng)
{
+ // Do nothing here. Subclasses may want to override this.
}
+ /**
+ * Stores a property in this <code>Document</code>'s property list.
+ *
+ * @param key the key of the property to be stored
+ * @param value the value of the property to be stored
+ */
public void putProperty(Object key, Object value)
{
// FIXME: make me thread-safe
@@ -278,14 +565,31 @@ public abstract class AbstractDocument
properties.put(key, value);
}
+ /**
+ * Blocks until a read lock can be obtained.
+ */
public void readLock()
{
}
+ /**
+ * Releases the read lock. If this was the only reader on this
+ * <code>Document</code>, writing may begin now.
+ */
public void readUnlock()
{
}
+ /**
+ * Removes a piece of content from this <code>Document</code>.
+ *
+ * @param offset the start offset of the fragment to be removed
+ * @param length the length of the fragment to be removed
+ *
+ * @throws BadLocationException if <code>offset</code> or
+ * <code>offset + length</code> or invalid locations within this
+ * document
+ */
public void remove(int offset, int length) throws BadLocationException
{
DefaultDocumentEvent event =
@@ -298,7 +602,17 @@ public abstract class AbstractDocument
}
/**
- * Replaces some text in the document.
+ * Replaces a piece of content in this <code>Document</code> with
+ * another piece of content.
+ *
+ * @param offset the start offset of the fragment to be removed
+ * @param length the length of the fragment to be removed
+ * @param text the text to replace the content with
+ * @param attributes the text attributes to assign to the new content
+ *
+ * @throws BadLocationException if <code>offset</code> or
+ * <code>offset + length</code> or invalid locations within this
+ * document
*
* @since 1.4
*/
@@ -331,9 +645,9 @@ public abstract class AbstractDocument
}
/**
- * Returns add added <code>DocumentListener</code> objects.
+ * Returns all registered <code>DocumentListener</code>s.
*
- * @return an array of listeners
+ * @return all registered <code>DocumentListener</code>s
*/
public DocumentListener[] getDocumentListeners()
{
@@ -341,7 +655,7 @@ public abstract class AbstractDocument
}
/**
- * Adds a <code>UndoableEditListener</code> object to this document.
+ * Adds an {@link UndoableEditListener} to this <code>Document</code>.
*
* @param listener the listener to add
*/
@@ -351,7 +665,7 @@ public abstract class AbstractDocument
}
/**
- * Removes a <code>UndoableEditListener</code> object from this document.
+ * Removes an {@link UndoableEditListener} from this <code>Document</code>.
*
* @param listener the listener to remove
*/
@@ -361,42 +675,93 @@ public abstract class AbstractDocument
}
/**
- * Returns add added <code>UndoableEditListener</code> objects.
+ * Returns all registered {@link UndoableEditListener}s.
*
- * @return an array of listeners
+ * @return all registered {@link UndoableEditListener}s
*/
public UndoableEditListener[] getUndoableEditListeners()
{
return (UndoableEditListener[]) getListeners(UndoableEditListener.class);
}
+ /**
+ * Called before some content gets removed from this <code>Document</code>.
+ * The default implementation does nothing but may be overridden by
+ * subclasses to modify the <code>Document</code> structure in response
+ * to a remove request. The method is executed within a write lock.
+ *
+ * @param chng the <code>DefaultDocumentEvent</code> describing the change
+ */
protected void removeUpdate(DefaultDocumentEvent chng)
{
+ // Do nothing here. Subclasses may wish to override this.
}
- public void render(Runnable r)
+ /**
+ * Called to render this <code>Document</code> visually. It obtains a read
+ * lock, ensuring that no changes will be made to the <code>document</code>
+ * during the rendering process. It then calls the {@link Runnable#run()}
+ * method on <code>runnable</code>. This method <em>must not</em> attempt
+ * to modifiy the <code>Document</code>, since a deadlock will occur if it
+ * tries to obtain a write lock. When the {@link Runnable#run()} method
+ * completes (either naturally or by throwing an exception), the read lock
+ * is released. Note that there is nothing in this method related to
+ * the actual rendering. It could be used to execute arbitrary code within
+ * a read lock.
+ *
+ * @param runnable the {@link Runnable} to execute
+ */
+ public void render(Runnable runnable)
{
+ // FIXME: Implement me!
}
+ /**
+ * Sets the asynchronous loading priority for this <code>Document</code>.
+ * A value of <code>-1</code> indicates that this <code>Document</code>
+ * should be loaded synchronously.
+ *
+ * @param p the asynchronous loading priority to set
+ */
public void setAsynchronousLoadPriority(int p)
{
}
- public void setDocumentProperties(Dictionary x)
+ /**
+ * Sets the properties of this <code>Document</code>.
+ *
+ * @param p the document properties to set
+ */
+ public void setDocumentProperties(Dictionary p)
{
// FIXME: make me thread-safe
- properties = x;
+ properties = p;
}
+ /**
+ * Blocks until a write lock can be obtained.
+ */
protected void writeLock()
{
+ // FIXME: Implement me.
}
+ /**
+ * Releases the write lock. This allows waiting readers or writers to
+ * obtain the lock.
+ */
protected void writeUnlock()
{
+ // FIXME: Implement me.
}
/**
+ * Returns the currently installed {@link DocumentFilter} for this
+ * <code>Document</code>.
+ *
+ * @return the currently installed {@link DocumentFilter} for this
+ * <code>Document</code>
+ *
* @since 1.4
*/
public DocumentFilter getDocumentFilter()
@@ -405,6 +770,10 @@ public abstract class AbstractDocument
}
/**
+ * Sets the {@link DocumentFilter} for this <code>Document</code>.
+ *
+ * @param filter the <code>DocumentFilter</code> to set
+ *
* @since 1.4
*/
public void setDocumentFilter(DocumentFilter filter)
@@ -412,209 +781,592 @@ public abstract class AbstractDocument
this.documentFilter = filter;
}
+ /**
+ * Dumps diagnostic information to the specified <code>PrintStream</code>.
+ *
+ * @param out the stream to write the diagnostic information to
+ */
public void dump(PrintStream out)
{
((AbstractElement) getDefaultRootElement()).dump(out, 0);
}
+ /**
+ * Defines a set of methods for managing text attributes for one or more
+ * <code>Document</code>s.
+ *
+ * Replicating {@link AttributeSet}s throughout a <code>Document</code> can
+ * be very expensive. Implementations of this interface are intended to
+ * provide intelligent management of <code>AttributeSet</code>s, eliminating
+ * costly duplication.
+ *
+ * @see StyleContext
+ */
public interface AttributeContext
{
+ /**
+ * Returns an {@link AttributeSet} that contains the attributes
+ * of <code>old</code> plus the new attribute specified by
+ * <code>name</code> and <code>value</code>.
+ *
+ * @param old the attribute set to be merged with the new attribute
+ * @param name the name of the attribute to be added
+ * @param value the value of the attribute to be added
+ *
+ * @return the old attributes plus the new attribute
+ */
AttributeSet addAttribute(AttributeSet old, Object name, Object value);
+ /**
+ * Returns an {@link AttributeSet} that contains the attributes
+ * of <code>old</code> plus the new attributes in <code>attributes</code>.
+ *
+ * @param old the set of attributes where to add the new attributes
+ * @param attributes the attributes to be added
+ *
+ * @return an {@link AttributeSet} that contains the attributes
+ * of <code>old</code> plus the new attributes in
+ * <code>attributes</code>
+ */
AttributeSet addAttributes(AttributeSet old, AttributeSet attributes);
+ /**
+ * Returns an empty {@link AttributeSet}.
+ *
+ * @return an empty {@link AttributeSet}
+ */
AttributeSet getEmptySet();
+ /**
+ * Called to indicate that the attributes in <code>attributes</code> are
+ * no longer used.
+ *
+ * @param attributes the attributes are no longer used
+ */
void reclaim(AttributeSet attributes);
+ /**
+ * Returns a {@link AttributeSet} that has the attribute with the specified
+ * <code>name</code> removed from <code>old</code>.
+ *
+ * @param old the attribute set from which an attribute is removed
+ * @param name the name of the attribute to be removed
+ *
+ * @return the attributes of <code>old</code> minus the attribute
+ * specified by <code>name</code>
+ */
AttributeSet removeAttribute(AttributeSet old, Object name);
+ /**
+ * Removes all attributes in <code>attributes</code> from <code>old</code>
+ * and returns the resulting <code>AttributeSet</code>.
+ *
+ * @param old the set of attributes from which to remove attributes
+ * @param attributes the attributes to be removed from <code>old</code>
+ *
+ * @return the attributes of <code>old</code> minus the attributes in
+ * <code>attributes</code>
+ */
AttributeSet removeAttributes(AttributeSet old, AttributeSet attributes);
+ /**
+ * Removes all attributes specified by <code>names</code> from
+ * <code>old</code> and returns the resulting <code>AttributeSet</code>.
+ *
+ * @param old the set of attributes from which to remove attributes
+ * @param names the names of the attributes to be removed from
+ * <code>old</code>
+ *
+ * @return the attributes of <code>old</code> minus the attributes in
+ * <code>attributes</code>
+ */
AttributeSet removeAttributes(AttributeSet old, Enumeration names);
}
+ /**
+ * A sequence of data that can be edited. This is were the actual content
+ * in <code>AbstractDocument</code>'s is stored.
+ */
public interface Content
{
+ /**
+ * Creates a {@link Position} that keeps track of the location at
+ * <code>offset</code>.
+ *
+ * @return a {@link Position} that keeps track of the location at
+ * <code>offset</code>.
+ *
+ * @throw BadLocationException if <code>offset</code> is not a valid
+ * location in this <code>Content</code> model
+ */
Position createPosition(int offset) throws BadLocationException;
+ /**
+ * Returns the length of the content.
+ *
+ * @return the length of the content
+ */
int length();
+ /**
+ * Inserts a string into the content model.
+ *
+ * @param where the offset at which to insert the string
+ * @param str the string to be inserted
+ *
+ * @return an <code>UndoableEdit</code> or <code>null</code> if undo is
+ * not supported by this <code>Content</code> model
+ *
+ * @throws BadLocationException if <code>where</code> is not a valid
+ * location in this <code>Content</code> model
+ */
UndoableEdit insertString(int where, String str)
throws BadLocationException;
+ /**
+ * Removes a piece of content from the content model.
+ *
+ * @param where the offset at which to remove content
+ * @param nitems the number of characters to be removed
+ *
+ * @return an <code>UndoableEdit</code> or <code>null</code> if undo is
+ * not supported by this <code>Content</code> model
+ *
+ * @throws BadLocationException if <code>where</code> is not a valid
+ * location in this <code>Content</code> model
+ */
UndoableEdit remove(int where, int nitems) throws BadLocationException;
+ /**
+ * Returns a piece of content.
+ *
+ * @param where the start offset of the requested fragment
+ * @param len the length of the requested fragment
+ *
+ * @return the requested fragment
+ * @throws BadLocationException if <code>offset</code> or
+ * <code>offset + len</code>is not a valid
+ * location in this <code>Content</code> model
+ */
String getString(int where, int len) throws BadLocationException;
+ /**
+ * Fetches a piece of content and stores it in <code>txt</code>.
+ *
+ * @param where the start offset of the requested fragment
+ * @param len the length of the requested fragment
+ * @param txt the <code>Segment</code> where to fragment is stored into
+ *
+ * @throws BadLocationException if <code>offset</code> or
+ * <code>offset + len</code>is not a valid
+ * location in this <code>Content</code> model
+ */
void getChars(int where, int len, Segment txt) throws BadLocationException;
}
+ /**
+ * An abstract base implementation of the {@link Element} interface.
+ */
public abstract class AbstractElement
implements Element, MutableAttributeSet, TreeNode, Serializable
{
+ /** The serial version UID for AbstractElement. */
private static final long serialVersionUID = 1265312733007397733L;
+
+ /** The number of characters that this Element spans. */
int count;
+
+ /** The starting offset of this Element. */
int offset;
+ /** The attributes of this Element. */
AttributeSet attributes;
+ /** The parent element. */
Element element_parent;
+ /** The parent in the TreeNode interface. */
TreeNode tree_parent;
+
+ /** The children of this element. */
Vector tree_children;
+ /**
+ * Creates a new instance of <code>AbstractElement</code> with a
+ * specified parent <code>Element</code> and <code>AttributeSet</code>.
+ *
+ * @param p the parent of this <code>AbstractElement</code>
+ * @param s the attributes to be assigned to this
+ * <code>AbstractElement</code>
+ */
public AbstractElement(Element p, AttributeSet s)
{
element_parent = p;
- attributes = s;
+ AttributeContext ctx = getAttributeContext();
+ attributes = ctx.getEmptySet();
+ if (s != null)
+ attributes = ctx.addAttributes(attributes, s);
}
- // TreeNode implementation
-
+ /**
+ * Returns the child nodes of this <code>Element</code> as an
+ * <code>Enumeration</code> of {@link TreeNode}s.
+ *
+ * @return the child nodes of this <code>Element</code> as an
+ * <code>Enumeration</code> of {@link TreeNode}s
+ */
public abstract Enumeration children();
-
+
+ /**
+ * Returns <code>true</code> if this <code>AbstractElement</code>
+ * allows children.
+ *
+ * @return <code>true</code> if this <code>AbstractElement</code>
+ * allows children
+ */
public abstract boolean getAllowsChildren();
-
+
+ /**
+ * Returns the child of this <code>AbstractElement</code> at
+ * <code>index</code>.
+ *
+ * @param index the position in the child list of the child element to
+ * be returned
+ *
+ * @return the child of this <code>AbstractElement</code> at
+ * <code>index</code>
+ */
public TreeNode getChildAt(int index)
{
return (TreeNode) tree_children.get(index);
}
-
+
+ /**
+ * Returns the number of children of this <code>AbstractElement</code>.
+ *
+ * @return the number of children of this <code>AbstractElement</code>
+ */
public int getChildCount()
{
return tree_children.size();
}
-
+
+ /**
+ * Returns the index of a given child <code>TreeNode</code> or
+ * <code>-1</code> if <code>node</code> is not a child of this
+ * <code>AbstractElement</code>.
+ *
+ * @param node the node for which the index is requested
+ *
+ * @return the index of a given child <code>TreeNode</code> or
+ * <code>-1</code> if <code>node</code> is not a child of this
+ * <code>AbstractElement</code>
+ */
public int getIndex(TreeNode node)
{
return tree_children.indexOf(node);
}
+ /**
+ * Returns the parent <code>TreeNode</code> of this
+ * <code>AbstractElement</code> or <code>null</code> if this element
+ * has no parent.
+ *
+ * @return the parent <code>TreeNode</code> of this
+ * <code>AbstractElement</code> or <code>null</code> if this
+ * element has no parent
+ */
public TreeNode getParent()
{
return tree_parent;
}
+ /**
+ * Returns <code>true</code> if this <code>AbstractElement</code> is a
+ * leaf element, <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if this <code>AbstractElement</code> is a
+ * leaf element, <code>false</code> otherwise
+ */
public abstract boolean isLeaf();
-
- // MutableAttributeSet support
-
+ /**
+ * Adds an attribute to this element.
+ *
+ * @param name the name of the attribute to be added
+ * @param value the value of the attribute to be added
+ */
public void addAttribute(Object name, Object value)
{
attributes = getAttributeContext().addAttribute(attributes, name, value);
}
+ /**
+ * Adds a set of attributes to this element.
+ *
+ * @param attrs the attributes to be added to this element
+ */
public void addAttributes(AttributeSet attrs)
{
attributes = getAttributeContext().addAttributes(attributes, attrs);
}
+ /**
+ * Removes an attribute from this element.
+ *
+ * @param name the name of the attribute to be removed
+ */
public void removeAttribute(Object name)
{
attributes = getAttributeContext().removeAttribute(attributes, name);
}
+ /**
+ * Removes a set of attributes from this element.
+ *
+ * @param attrs the attributes to be removed
+ */
public void removeAttributes(AttributeSet attrs)
{
attributes = getAttributeContext().removeAttributes(attributes, attrs);
}
+ /**
+ * Removes a set of attribute from this element.
+ *
+ * @param names the names of the attributes to be removed
+ */
public void removeAttributes(Enumeration names)
{
attributes = getAttributeContext().removeAttributes(attributes, names);
}
+ /**
+ * Sets the parent attribute set against which the element can resolve
+ * attributes that are not defined in itself.
+ *
+ * @param parent the resolve parent to set
+ */
public void setResolveParent(AttributeSet parent)
{
- attributes = getAttributeContext().addAttribute(attributes, ResolveAttribute, parent);
+ attributes = getAttributeContext().addAttribute(attributes,
+ ResolveAttribute,
+ parent);
}
-
- // AttributeSet interface support
-
+ /**
+ * Returns <code>true</code> if this element contains the specified
+ * attribute.
+ *
+ * @param name the name of the attribute to check
+ * @param value the value of the attribute to check
+ *
+ * @return <code>true</code> if this element contains the specified
+ * attribute
+ */
public boolean containsAttribute(Object name, Object value)
{
return attributes.containsAttribute(name, value);
}
+ /**
+ * Returns <code>true</code> if this element contains all of the
+ * specified attributes.
+ *
+ * @param attrs the attributes to check
+ *
+ * @return <code>true</code> if this element contains all of the
+ * specified attributes
+ */
public boolean containsAttributes(AttributeSet attrs)
{
return attributes.containsAttributes(attrs);
}
+ /**
+ * Returns a copy of the attributes of this element.
+ *
+ * @return a copy of the attributes of this element
+ */
public AttributeSet copyAttributes()
{
return attributes.copyAttributes();
}
+ /**
+ * Returns the attribute value with the specified key. If this attribute
+ * is not defined in this element and this element has a resolving
+ * parent, the search goes upward to the resolve parent chain.
+ *
+ * @param key the key of the requested attribute
+ *
+ * @return the attribute value for <code>key</code> of <code>null</code>
+ * if <code>key</code> is not found locally and cannot be resolved
+ * in this element's resolve parents
+ */
public Object getAttribute(Object key)
{
return attributes.getAttribute(key);
}
+ /**
+ * Returns the number of defined attributes in this element.
+ *
+ * @return the number of defined attributes in this element
+ */
public int getAttributeCount()
{
return attributes.getAttributeCount();
}
-
+
+ /**
+ * Returns the names of the attributes of this element.
+ *
+ * @return the names of the attributes of this element
+ */
public Enumeration getAttributeNames()
{
return attributes.getAttributeNames();
}
-
+
+ /**
+ * Returns the resolve parent of this element.
+ *
+ * @return the resolve parent of this element
+ *
+ * @see #setResolveParent(AttributeSet)
+ */
public AttributeSet getResolveParent()
{
return attributes.getResolveParent();
}
+ /**
+ * Returns <code>true</code> if an attribute with the specified name
+ * is defined in this element, <code>false</code> otherwise.
+ *
+ * @param attrName the name of the requested attributes
+ *
+ * @return <code>true</code> if an attribute with the specified name
+ * is defined in this element, <code>false</code> otherwise
+ */
public boolean isDefined(Object attrName)
{
return attributes.isDefined(attrName);
}
-
+
+ /**
+ * Returns <code>true</code> if the specified <code>AttributeSet</code>
+ * is equal to this element's <code>AttributeSet</code>, <code>false</code>
+ * otherwise.
+ *
+ * @param attrs the attributes to compare this element to
+ *
+ * @return <code>true</code> if the specified <code>AttributeSet</code>
+ * is equal to this element's <code>AttributeSet</code>,
+ * <code>false</code> otherwise
+ */
public boolean isEqual(AttributeSet attrs)
{
return attributes.isEqual(attrs);
}
- // Element interface support
-
+ /**
+ * Returns the attributes of this element.
+ *
+ * @return the attributes of this element
+ */
public AttributeSet getAttributes()
{
- return attributes;
+ return this;
}
+ /**
+ * Returns the {@link Document} to which this element belongs.
+ *
+ * @return the {@link Document} to which this element belongs
+ */
public Document getDocument()
{
return AbstractDocument.this;
}
-
+
+ /**
+ * Returns the child element at the specified <code>index</code>.
+ *
+ * @param index the index of the requested child element
+ *
+ * @return the requested element
+ */
public abstract Element getElement(int index);
-
+
+ /**
+ * Returns the name of this element.
+ *
+ * @return the name of this element
+ */
public String getName()
{
return (String) getAttribute(NameAttribute);
}
-
+
+ /**
+ * Returns the parent element of this element.
+ *
+ * @return the parent element of this element
+ */
public Element getParentElement()
{
return element_parent;
}
-
+
+ /**
+ * Returns the offset inside the document model that is after the last
+ * character of this element.
+ *
+ * @return the offset inside the document model that is after the last
+ * character of this element
+ */
public abstract int getEndOffset();
-
+
+ /**
+ * Returns the number of child elements of this element.
+ *
+ * @return the number of child elements of this element
+ */
public abstract int getElementCount();
-
+
+ /**
+ * Returns the index of the child element that spans the specified
+ * offset in the document model.
+ *
+ * @param offset the offset for which the responsible element is searched
+ *
+ * @return the index of the child element that spans the specified
+ * offset in the document model
+ */
public abstract int getElementIndex(int offset);
-
+
+ /**
+ * Returns the start offset if this element inside the document model.
+ *
+ * @return the start offset if this element inside the document model
+ */
public abstract int getStartOffset();
- private void dumpElement(PrintStream stream, String indent, Element element)
+ /**
+ * Prints diagnostic information to the specified stream.
+ *
+ * @param stream the stream to dump to
+ * @param indent the indentation level
+ * @param element the element to be dumped
+ */
+ private void dumpElement(PrintStream stream, String indent,
+ Element element)
{
+ // FIXME: Should the method be removed?
System.out.println(indent + "<" + element.getName() +">");
-
+
if (element.isLeaf())
{
int start = element.getStartOffset();
@@ -626,6 +1378,12 @@ public abstract class AbstractDocument
}
catch (BadLocationException e)
{
+ AssertionError error =
+ new AssertionError("BadLocationException should not be "
+ + "thrown here. start = " + start
+ + ", end = " + end);
+ error.initCause(e);
+ throw error;
}
System.out.println(indent + " ["
+ start + ","
@@ -638,7 +1396,13 @@ public abstract class AbstractDocument
dumpElement(stream, indent + " ", element.getElement(i));
}
}
-
+
+ /**
+ * Prints diagnostic output to the specified stream.
+ *
+ * @param stream the stream to write to
+ * @param indent the indentation level
+ */
public void dump(PrintStream stream, int indent)
{
String indentStr = "";
@@ -648,17 +1412,36 @@ public abstract class AbstractDocument
}
}
+ /**
+ * An implementation of {@link Element} to represent composite
+ * <code>Element</code>s that contain other <code>Element</code>s.
+ */
public class BranchElement extends AbstractElement
{
+ /** The serial version UID for BranchElement. */
private static final long serialVersionUID = -8595176318868717313L;
-
+
+ /** The child elements of this BranchElement. */
private Element[] children = new Element[0];
+ /**
+ * Creates a new <code>BranchElement</code> with the specified
+ * parent and attributes.
+ *
+ * @param parent the parent element of this <code>BranchElement</code>
+ * @param attributes the attributes to set on this
+ * <code>BranchElement</code>
+ */
public BranchElement(Element parent, AttributeSet attributes)
{
super(parent, attributes);
}
+ /**
+ * Returns the children of this <code>BranchElement</code>.
+ *
+ * @return the children of this <code>BranchElement</code>
+ */
public Enumeration children()
{
if (children.length == 0)
@@ -672,11 +1455,25 @@ public abstract class AbstractDocument
return tmp.elements();
}
+ /**
+ * Returns <code>true</code> since <code>BranchElements</code> allow
+ * child elements.
+ *
+ * @return <code>true</code> since <code>BranchElements</code> allow
+ * child elements
+ */
public boolean getAllowsChildren()
{
return true;
}
+ /**
+ * Returns the child element at the specified <code>index</code>.
+ *
+ * @param index the index of the requested child element
+ *
+ * @return the requested element
+ */
public Element getElement(int index)
{
if (index < 0 || index >= children.length)
@@ -685,47 +1482,113 @@ public abstract class AbstractDocument
return children[index];
}
+ /**
+ * Returns the number of child elements of this element.
+ *
+ * @return the number of child elements of this element
+ */
public int getElementCount()
{
return children.length;
}
+ /**
+ * Returns the index of the child element that spans the specified
+ * offset in the document model.
+ *
+ * @param offset the offset for which the responsible element is searched
+ *
+ * @return the index of the child element that spans the specified
+ * offset in the document model
+ */
public int getElementIndex(int offset)
{
+ // If we have no children, return -1.
+ if (getElementCount() == 0)
+ return - 1;
+
// XXX: There is surely a better algorithm
// as beginning from first element each time.
for (int index = 0; index < children.length; ++index)
{
- Element elem = children[index];
+ Element elem = children[index];
- if ((elem.getStartOffset() <= offset)
- && (offset < elem.getEndOffset()))
- return index;
+ if ((elem.getStartOffset() <= offset)
+ && (offset < elem.getEndOffset()))
+ return index;
}
- return 0;
+ // If offset is greater than the index of the last element, return
+ // the index of the last element.
+ return getElementCount() - 1;
}
+ /**
+ * Returns the offset inside the document model that is after the last
+ * character of this element.
+ * This is the end offset of the last child element. If this element
+ * has no children, this method throws a <code>NullPointerException</code>.
+ *
+ * @return the offset inside the document model that is after the last
+ * character of this element
+ *
+ * @throws NullPointerException if this branch element has no children
+ */
public int getEndOffset()
{
+ if (getElementCount() == 0)
+ throw new NullPointerException("This BranchElement has no children.");
return children[children.length - 1].getEndOffset();
}
+ /**
+ * Returns the name of this element. This is {@link #ParagraphElementName}
+ * in this case.
+ *
+ * @return the name of this element
+ */
public String getName()
{
return ParagraphElementName;
}
+ /**
+ * Returns the start offset of this element inside the document model.
+ * This is the start offset of the first child element. If this element
+ * has no children, this method throws a <code>NullPointerException</code>.
+ *
+ * @return the start offset of this element inside the document model
+ *
+ * @throws NullPointerException if this branch element has no children
+ */
public int getStartOffset()
{
+ if (getElementCount() == 0)
+ throw new NullPointerException("This BranchElement has no children.");
return children[0].getStartOffset();
}
+ /**
+ * Returns <code>false</code> since <code>BranchElement</code> are no
+ * leafes.
+ *
+ * @return <code>false</code> since <code>BranchElement</code> are no
+ * leafes
+ */
public boolean isLeaf()
{
return false;
}
+ /**
+ * Returns the <code>Element</code> at the specified <code>Document</code>
+ * offset.
+ *
+ * @return the <code>Element</code> at the specified <code>Document</code>
+ * offset
+ *
+ * @see #getElementIndex(int)
+ */
public Element positionToElement(int position)
{
// XXX: There is surely a better algorithm
@@ -742,6 +1605,13 @@ public abstract class AbstractDocument
return null;
}
+ /**
+ * Replaces a set of child elements with a new set of child elemens.
+ *
+ * @param offset the start index of the elements to be removed
+ * @param length the number of elements to be removed
+ * @param elements the new elements to be inserted
+ */
public void replace(int offset, int length, Element[] elements)
{
Element[] target = new Element[children.length - length
@@ -754,6 +1624,11 @@ public abstract class AbstractDocument
children = target;
}
+ /**
+ * Returns a string representation of this element.
+ *
+ * @return a string representation of this element
+ */
public String toString()
{
return ("BranchElement(" + getName() + ") "
@@ -761,59 +1636,157 @@ public abstract class AbstractDocument
}
}
+ /**
+ * Stores the changes when a <code>Document</code> is beeing modified.
+ */
public class DefaultDocumentEvent extends CompoundEdit
implements DocumentEvent
{
+ /** The serial version UID of DefaultDocumentEvent. */
private static final long serialVersionUID = -7406103236022413522L;
-
+
+ /** The starting offset of the change. */
private int offset;
+
+ /** The length of the change. */
private int length;
+
+ /** The type of change. */
private DocumentEvent.EventType type;
+ /**
+ * Maps <code>Element</code> to their change records.
+ */
+ Hashtable changes;
+
+ /**
+ * Creates a new <code>DefaultDocumentEvent</code>.
+ *
+ * @param offset the starting offset of the change
+ * @param length the length of the change
+ * @param type the type of change
+ */
public DefaultDocumentEvent(int offset, int length,
DocumentEvent.EventType type)
{
this.offset = offset;
this.length = length;
this.type = type;
+ changes = new Hashtable();
}
+ /**
+ * Adds an UndoableEdit to this <code>DocumentEvent</code>. If this
+ * edit is an instance of {@link ElementEdit}, then this record can
+ * later be fetched by calling {@link #getChange}.
+ *
+ * @param edit the undoable edit to add
+ */
+ public boolean addEdit(UndoableEdit edit)
+ {
+ // XXX - Fully qualify ElementChange to work around gcj bug #2499.
+ if (edit instanceof DocumentEvent.ElementChange)
+ {
+ DocumentEvent.ElementChange elEdit =
+ (DocumentEvent.ElementChange) edit;
+ changes.put(elEdit.getElement(), elEdit);
+ }
+ return super.addEdit(edit);
+ }
+
+ /**
+ * Returns the document that has been modified.
+ *
+ * @return the document that has been modified
+ */
public Document getDocument()
{
return AbstractDocument.this;
}
+ /**
+ * Returns the length of the modification.
+ *
+ * @return the length of the modification
+ */
public int getLength()
{
return length;
}
+ /**
+ * Returns the start offset of the modification.
+ *
+ * @return the start offset of the modification
+ */
public int getOffset()
{
return offset;
}
+ /**
+ * Returns the type of the modification.
+ *
+ * @return the type of the modification
+ */
public DocumentEvent.EventType getType()
{
return type;
}
+ /**
+ * Returns the changes for an element.
+ *
+ * @param elem the element for which the changes are requested
+ *
+ * @return the changes for <code>elem</code> or <code>null</code> if
+ * <code>elem</code> has not been changed
+ */
public DocumentEvent.ElementChange getChange(Element elem)
{
- return null;
+ // XXX - Fully qualify ElementChange to work around gcj bug #2499.
+ return (DocumentEvent.ElementChange) changes.get(elem);
}
}
+ /**
+ * An implementation of {@link DocumentEvent.ElementChange} to be added
+ * to {@link DefaultDocumentEvent}s.
+ */
public static class ElementEdit extends AbstractUndoableEdit
implements DocumentEvent.ElementChange
{
+ /** The serial version UID of ElementEdit. */
private static final long serialVersionUID = -1216620962142928304L;
+ /**
+ * The changed element.
+ */
private Element elem;
+
+ /**
+ * The index of the change.
+ */
private int index;
+
+ /**
+ * The removed elements.
+ */
private Element[] removed;
+
+ /**
+ * The added elements.
+ */
private Element[] added;
+ /**
+ * Creates a new <code>ElementEdit</code>.
+ *
+ * @param elem the changed element
+ * @param index the index of the change
+ * @param removed the removed elements
+ * @param added the added elements
+ */
public ElementEdit(Element elem, int index,
Element[] removed, Element[] added)
{
@@ -823,86 +1796,211 @@ public abstract class AbstractDocument
this.added = added;
}
+ /**
+ * Returns the added elements.
+ *
+ * @return the added elements
+ */
public Element[] getChildrenAdded()
{
return added;
}
-
+
+ /**
+ * Returns the removed elements.
+ *
+ * @return the removed elements
+ */
public Element[] getChildrenRemoved()
{
return removed;
}
+ /**
+ * Returns the changed element.
+ *
+ * @return the changed element
+ */
public Element getElement()
{
return elem;
}
+ /**
+ * Returns the index of the change.
+ *
+ * @return the index of the change
+ */
public int getIndex()
{
return index;
}
}
+ /**
+ * An implementation of {@link Element} that represents a leaf in the
+ * document structure. This is used to actually store content.
+ */
public class LeafElement extends AbstractElement
{
+ /** The serial version UID of LeafElement. */
private static final long serialVersionUID = 5115368706941283802L;
- int start;
- int end;
+ /** Manages the start offset of this element. */
+ Position startPos;
+
+ /** Manages the end offset of this element. */
+ Position endPos;
+
+ /**
+ * Creates a new <code>LeafElement</code>.
+ *
+ * @param parent the parent of this <code>LeafElement</code>
+ * @param attributes the attributes to be set
+ * @param start the start index of this element inside the document model
+ * @param end the end index of this element inside the document model
+ */
public LeafElement(Element parent, AttributeSet attributes, int start,
int end)
{
super(parent, attributes);
- this.start = start;
- this.end = end;
+ {
+ try
+ {
+ if (parent != null)
+ {
+ startPos = parent.getDocument().createPosition(start);
+ endPos = parent.getDocument().createPosition(end);
+ }
+ else
+ {
+ startPos = createPosition(start);
+ endPos = createPosition(end);
+ }
+ }
+ catch (BadLocationException ex)
+ {
+ AssertionError as;
+ as = new AssertionError("BadLocationException thrown "
+ + "here. start=" + start
+ + ", end=" + end
+ + ", length=" + getLength());
+ as.initCause(ex);
+ throw as;
+ }
+ }
}
+ /**
+ * Returns <code>null</code> since <code>LeafElement</code>s cannot have
+ * children.
+ *
+ * @return <code>null</code> since <code>LeafElement</code>s cannot have
+ * children
+ */
public Enumeration children()
{
return null;
}
+ /**
+ * Returns <code>false</code> since <code>LeafElement</code>s cannot have
+ * children.
+ *
+ * @return <code>false</code> since <code>LeafElement</code>s cannot have
+ * children
+ */
public boolean getAllowsChildren()
{
return false;
}
+ /**
+ * Returns <code>null</code> since <code>LeafElement</code>s cannot have
+ * children.
+ *
+ * @return <code>null</code> since <code>LeafElement</code>s cannot have
+ * children
+ */
public Element getElement(int index)
{
return null;
}
+ /**
+ * Returns <code>0</code> since <code>LeafElement</code>s cannot have
+ * children.
+ *
+ * @return <code>0</code> since <code>LeafElement</code>s cannot have
+ * children
+ */
public int getElementCount()
{
return 0;
}
+ /**
+ * Returns <code>-1</code> since <code>LeafElement</code>s cannot have
+ * children.
+ *
+ * @return <code>-1</code> since <code>LeafElement</code>s cannot have
+ * children
+ */
public int getElementIndex(int offset)
{
return -1;
}
+ /**
+ * Returns the end offset of this <code>Element</code> inside the
+ * document.
+ *
+ * @return the end offset of this <code>Element</code> inside the
+ * document
+ */
public int getEndOffset()
{
- return end;
+ return endPos.getOffset();
}
+ /**
+ * Returns the name of this <code>Element</code>. This is
+ * {@link #ContentElementName} in this case.
+ *
+ * @return the name of this <code>Element</code>
+ */
public String getName()
{
return ContentElementName;
}
+ /**
+ * Returns the start offset of this <code>Element</code> inside the
+ * document.
+ *
+ * @return the start offset of this <code>Element</code> inside the
+ * document
+ */
public int getStartOffset()
{
- return start;
+ return startPos.getOffset();
}
+ /**
+ * Returns <code>true</code>.
+ *
+ * @return <code>true</code>
+ */
public boolean isLeaf()
{
return true;
}
+ /**
+ * Returns a string representation of this <code>Element</code>.
+ *
+ * @return a string representation of this <code>Element</code>
+ */
public String toString()
{
return ("LeafElement(" + getName() + ") "
diff --git a/libjava/classpath/javax/swing/text/AttributeSet.java b/libjava/classpath/javax/swing/text/AttributeSet.java
index 87e7b98..2f1f189 100644
--- a/libjava/classpath/javax/swing/text/AttributeSet.java
+++ b/libjava/classpath/javax/swing/text/AttributeSet.java
@@ -1,5 +1,5 @@
/* AttributeSet.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,34 +39,153 @@ package javax.swing.text;
import java.util.Enumeration;
+/**
+ * A set of attributes. An attribute has a key and a value. They typically
+ * describe features of a piece of text that make up its graphical
+ * representation.
+ *
+ * An <code>AttributeSet</code> may have a resolving parent,
+ * that is another <code>AttributeSet</code> that is searched for attribute
+ * keys that are not stored locally in this <code>AttributeSet</code>.
+ *
+ * @author original author unknown
+ * @author Roman Kennke (roman@kennke.org)
+ */
public interface AttributeSet
{
+ /**
+ * Used as keys to identify character-run attributes.
+ */
static interface CharacterAttribute
{
}
+ /**
+ * Used as keys to identify color attributes.
+ */
static interface ColorAttribute
{
}
+ /**
+ * Used as keys to identify font attributes.
+ */
static interface FontAttribute
{
}
+ /**
+ * Used as keys to identify paragraph level attributes.
+ */
static interface ParagraphAttribute
{
}
+ /**
+ * Key of the attribute that is used to describe the name of an
+ * <code>AttributeSet</code>.
+ */
Object NameAttribute = StyleConstants.NameAttribute;
+
+ /**
+ * Key of the attribute that is used to identify the resolving parent of
+ * an <code>AttributeSet</code>.
+ */
Object ResolveAttribute = StyleConstants.ResolveAttribute;
+ /**
+ * Returns <code>true</code> if this <code>AttributeSet</code> contains
+ * an attribute with the specified <code>name</code> and <code>value</code>,
+ * <code>false</code> otherwise.
+ *
+ * @param name the name of the requested attribute
+ * @param the value of the requested attribute
+ *
+ * @return <code>true</code> if this <code>AttributeSet</code> contains
+ * an attribute with the specified <code>name</code> and
+ * <code>value</code>, <code>false</code> otherwise
+ */
boolean containsAttribute(Object name, Object value);
+
+ /**
+ * Returns <code>true</code> of this <code>AttributeSet</code> contains all
+ * of the specified <code>attributes</code>.
+ *
+ * @param attributes the requested attributes
+ *
+ * @return <code>true</code> of this <code>AttributeSet</code> contains all
+ * of the specified <code>attributes</code>
+ */
boolean containsAttributes(AttributeSet attributes);
+
+ /**
+ * Creates and returns a copy of this <code>AttributeSet</code>.
+ *
+ * @return a copy of this <code>AttributeSet</code>
+ */
AttributeSet copyAttributes();
+
+ /**
+ * Returns the attribute with the specified <code>key</code> or
+ * <code>null</code> if no such attribute is defined in this
+ * <code>AttributeSet</code> and its resolving parents.
+ *
+ * @param key the key of the attribute that is looked up
+ *
+ * @return the attribute with the specified <code>key</code> or
+ * <code>null</code> if no such attribute is defined in this
+ * <code>AttributeSet</code> and its resolving parents
+ */
Object getAttribute(Object key);
+
+ /**
+ * Returns the number of attributes that are stored locally in this
+ * <code>AttributeSet</code>.
+ *
+ * @return the number of attributes that are stored locally in this
+ * <code>AttributeSet</code>
+ */
int getAttributeCount();
+
+ /**
+ * Returns the names of the attributes that are stored in this
+ * <code>AttributeSet</code>.
+ *
+ * @return the names of the attributes that are stored in this
+ * <code>AttributeSet</code>
+ */
Enumeration getAttributeNames();
+
+ /**
+ * Returns the resolving parent of this <code>AttributeSet</code>.
+ * If a key is not stored locally, then a {@link #getAttribute(Object)}
+ * request is resolved up in the resolving parent of this
+ * <code>AttributeSet</code>.
+ *
+ * @return the resolving parent of this <code>AttributeSet</code>
+ */
AttributeSet getResolveParent();
+
+ /**
+ * Returns <code>true</code> if an attribute with the specified name is
+ * defined locally in this <code>AttributeSet</code>, without resolving
+ * through the resolving parents.
+ *
+ * @return <code>true</code> if an attribute with the specified name is
+ * defined locally in this <code>AttributeSet</code>
+ */
boolean isDefined(Object attrName);
+
+ /**
+ * Returns <code>true</code> if all of the attributes in <code>attr</code>
+ * are equal to the attributes in this <code>AttributeSet</code>,
+ * <code>false</code> otherwise.
+ *
+ * @param attr the attributes to be compared to <code>this</code>
+ *
+ * @return <code>true</code> if all of the attributes in <code>attr</code>
+ * are equal to the attributes in this <code>AttributeSet</code>,
+ * <code>false</code> otherwise
+ */
boolean isEqual(AttributeSet attr);
}
diff --git a/libjava/classpath/javax/swing/text/BadLocationException.java b/libjava/classpath/javax/swing/text/BadLocationException.java
index e1a2ebc..7059140 100644
--- a/libjava/classpath/javax/swing/text/BadLocationException.java
+++ b/libjava/classpath/javax/swing/text/BadLocationException.java
@@ -1,5 +1,5 @@
/* BadLocationException.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,17 +37,28 @@ exception statement from your version. */
package javax.swing.text;
+/**
+ * Indicates that an invalid location within a <code>Document</code> has been
+ * accessed.
+ *
+ * @author original author unknown
+ * @author Roman Kennke (roman@kennke.org)
+ */
public class BadLocationException extends Exception
{
+ /** The serial version UID for BadLocationException. */
private static final long serialVersionUID = -7712259886815656766L;
-
+
+ /**
+ * The invalid location.
+ */
int offset;
/**
* Constructs a <code>BadLocationException</code>
*
- * @param str A string indicating what was wrong with the arguments
- * @param offset Offset within the document that was requested &gt;= 0
+ * @param str a string indicating what was wrong with the arguments
+ * @param offset offset within the document that was requested &gt;= 0
*/
public BadLocationException(String str, int offset)
{
@@ -56,7 +67,9 @@ public class BadLocationException extends Exception
}
/**
- * Returns the offset into the document that was not legal
+ * Returns the offset into the document that was not legal.
+ *
+ * @return the offset into the document that was not legal
*/
public int offsetRequested()
{
diff --git a/libjava/classpath/javax/swing/text/Caret.java b/libjava/classpath/javax/swing/text/Caret.java
index 46072ef..d641190 100644
--- a/libjava/classpath/javax/swing/text/Caret.java
+++ b/libjava/classpath/javax/swing/text/Caret.java
@@ -1,5 +1,5 @@
/* Caret.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,39 +43,165 @@ import java.awt.Point;
import javax.swing.event.ChangeListener;
+/**
+ * Defines the method to be implemented by a caret that can be used in Swing
+ * text components.
+ *
+ * @author original author unknown
+ * @author Roman Kennke (roman@kennke.org)
+ */
public interface Caret
{
+ /**
+ * Registers a {@link ChangeListener} that is notified whenever that state
+ * of this <code>Caret</code> changes.
+ *
+ * @param l the listener to register to this caret
+ */
void addChangeListener(ChangeListener l);
+
+ /**
+ * Removes a {@link ChangeListener} from the list of registered listeners.
+ *
+ * @param l the listener to remove
+ */
+ void removeChangeListener(ChangeListener l);
+
+ /**
+ * Installs this <code>Caret</code> on the specified text component. This
+ * usually involves setting up listeners.
+ *
+ * This method is called by {@link JTextComponent#setCaret(Caret)} after
+ * this caret has been set on the text component.
+ *
+ * @param c the text component to install this caret to
+ */
+ void install(JTextComponent c);
+ /**
+ * Deinstalls this <code>Caret</code> from the specified text component.
+ * This usually involves removing listeners from the text component.
+ *
+ * This method is called by {@link JTextComponent#setCaret(Caret)} before
+ * this caret is removed from the text component.
+ *
+ * @param c the text component to deinstall this caret from
+ */
void deinstall(JTextComponent c);
-
+
+ /**
+ * Returns the blink rate of this <code>Caret</code> in milliseconds.
+ * A value of <code>0</code> means that the caret does not blink.
+ *
+ * @return the blink rate of this <code>Caret</code> or <code>0</code> if
+ * this caret does not blink
+ */
int getBlinkRate();
+
+ /**
+ * Sets the blink rate of this <code>Caret</code> in milliseconds.
+ * A value of <code>0</code> means that the caret does not blink.
+ *
+ * @param rate the new blink rate to set
+ */
+ void setBlinkRate(int rate);
+ /**
+ * Returns the current position of this <code>Caret</code> within the
+ * <code>Document</code>.
+ *
+ * @return the current position of this <code>Caret</code> within the
+ * <code>Document</code>
+ */
int getDot();
+
+ /**
+ * Sets the current position of this <code>Caret</code> within the
+ * <code>Document</code>. This also sets the <code>mark</code> to the
+ * new location.
+ *
+ * @param dot the new position to be set
+ *
+ * @see #moveDot(int)
+ */
+ void setDot(int dot);
- Point getMagicCaretPosition();
-
- int getMark();
-
- void install(JTextComponent c);
-
- boolean isSelectionVisible();
-
- boolean isVisible();
-
+ /**
+ * Moves the <code>dot</code> location without touching the
+ * <code>mark</code>. This is used when making a selection.
+ *
+ * @param dot the location where to move the dot
+ *
+ * @see #setDot(int)
+ */
void moveDot(int dot);
- void paint(Graphics g);
-
- void removeChangeListener(ChangeListener l);
-
- void setBlinkRate(int rate);
-
- void setDot(int dot);
+ /**
+ * Returns the current position of the <code>mark</code>. The
+ * <code>mark</code> marks the location in the <code>Document</code> that
+ * is the end of a selection. If there is no selection, the <code>mark</code>
+ * is the same as the <code>dot</code>.
+ *
+ * @return the current position of the mark
+ */
+ int getMark();
+ /**
+ * Returns the current visual position of this <code>Caret</code>.
+ *
+ * @return the current visual position of this <code>Caret</code>
+ *
+ * @see #setMagicCaretPosition
+ */
+ Point getMagicCaretPosition();
+
+ /**
+ * Sets the current visual position of this <code>Caret</code>.
+ *
+ * @param p the Point to use for the saved location. May be <code>null</code>
+ * to indicate that there is no visual location
+ */
void setMagicCaretPosition(Point p);
-
+
+ /**
+ * Returns <code>true</code> if the selection is currently visible,
+ * <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if the selection is currently visible,
+ * <code>false</code> otherwise
+ */
+ boolean isSelectionVisible();
+
+ /**
+ * Sets the visiblity state of the selection.
+ *
+ * @param v <code>true</code> if the selection should be visible,
+ * <code>false</code> otherwise
+ */
void setSelectionVisible(boolean v);
-
+
+ /**
+ * Returns <code>true</code> if this <code>Caret</code> is currently visible,
+ * and <code>false</code> if it is not.
+ *
+ * @return <code>true</code> if this <code>Caret</code> is currently visible,
+ * and <code>false</code> if it is not
+ */
+ boolean isVisible();
+
+ /**
+ * Sets the visibility state of the caret. <code>true</code> shows the
+ * <code>Caret</code>, <code>false</code> hides it.
+ *
+ * @param v the visibility to set
+ */
void setVisible(boolean v);
+
+ /**
+ * Paints this <code>Caret</code> to the specified <code>Graphics</code>
+ * context.
+ *
+ * @param g the graphics context to render to
+ */
+ void paint(Graphics g);
}
diff --git a/libjava/classpath/javax/swing/text/ComponentView.java b/libjava/classpath/javax/swing/text/ComponentView.java
index 744d537..f6feda2 100644
--- a/libjava/classpath/javax/swing/text/ComponentView.java
+++ b/libjava/classpath/javax/swing/text/ComponentView.java
@@ -100,4 +100,22 @@ public class ComponentView extends View
{
return 0;
}
+
+ /**
+ * Maps coordinates from the <code>View</code>'s space into a position
+ * in the document model.
+ *
+ * @param x the x coordinate in the view space
+ * @param y the y coordinate in the view space
+ * @param a the allocation of this <code>View</code>
+ * @param b the bias to use
+ *
+ * @return the position in the document that corresponds to the screen
+ * coordinates <code>x, y</code>
+ */
+ public int viewToModel(float x, float y, Shape a, Position.Bias b)
+ {
+ // FIXME: Implement this properly.
+ return 0;
+ }
}
diff --git a/libjava/classpath/javax/swing/text/DateFormatter.java b/libjava/classpath/javax/swing/text/DateFormatter.java
index 0e20b77..869f9a0 100644
--- a/libjava/classpath/javax/swing/text/DateFormatter.java
+++ b/libjava/classpath/javax/swing/text/DateFormatter.java
@@ -54,7 +54,7 @@ public class DateFormatter extends InternationalFormatter
/**
* Creates a new instance using the default {@link DateFormat} object
- * returned by {@link DateFormat#getDateInstance}.
+ * returned by {@link DateFormat#getDateInstance()}.
*/
public DateFormatter()
{
diff --git a/libjava/classpath/javax/swing/text/DefaultCaret.java b/libjava/classpath/javax/swing/text/DefaultCaret.java
index b57b365..33c3ae3 100644
--- a/libjava/classpath/javax/swing/text/DefaultCaret.java
+++ b/libjava/classpath/javax/swing/text/DefaultCaret.java
@@ -1,5 +1,5 @@
/* DefaultCaret.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,69 +51,203 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
-
+/**
+ * The default implementation of the {@link Caret} interface.
+ *
+ * @author orgininal author unknown
+ * @author Roman Kennke (roman@kennke.org)
+ */
public class DefaultCaret extends Rectangle
implements Caret, FocusListener, MouseListener, MouseMotionListener
{
+ /**
+ * The serial version UID for DefaultCaret.
+ */
private static final long serialVersionUID = 228155774675466193L;
-
+
+ /**
+ * The <code>ChangeEvent</code> that is fired by {@link #fireStateChanged()}.
+ */
protected ChangeEvent changeEvent = new ChangeEvent(this);
+
+ /**
+ * Stores all registered event listeners.
+ */
protected EventListenerList listenerList = new EventListenerList();
-
+
+ /**
+ * The text component in which this caret is installed.
+ */
private JTextComponent textComponent;
-
+
+ /**
+ * Indicates if the selection should be visible or not.
+ */
private boolean selectionVisible = true;
+
+ /**
+ * The blink rate of this <code>Caret</code>.
+ */
private int blinkRate = 500;
+
+ /**
+ * The current dot position.
+ */
private int dot = 0;
+
+ /**
+ * The current mark position.
+ */
private int mark = 0;
+
+ /**
+ * The current visual caret position.
+ */
private Point magicCaretPosition = null;
+
+ /**
+ * Indicates if this <code>Caret</code> is currently visible or not.
+ */
private boolean visible = true;
+
+ /**
+ * The current highlight entry.
+ */
private Object highlightEntry;
+ /**
+ * Moves the caret position when the mouse is dragged over the text
+ * component, modifying the selection accordingly.
+ *
+ * @param event the <code>MouseEvent</code> describing the drag operation
+ */
public void mouseDragged(MouseEvent event)
{
+ // FIXME: Implement this properly.
}
+ /**
+ * Indicates a mouse movement over the text component. Does nothing here.
+ *
+ * @param event the <code>MouseEvent</code> describing the mouse operation
+ */
public void mouseMoved(MouseEvent event)
{
- }
-
+ // Nothing to do here.
+ }
+
+ /**
+ * When the click is received from Button 1 then the following actions
+ * are performed here:
+ *
+ * <ul>
+ * <li>If we receive a double click, the caret position (dot) is set
+ * to the position associated to the mouse click and the word at
+ * this location is selected.</li>
+ * <li>If we receive a triple click, the caret position (dot) is set
+ * to the position associated to the mouse click and the line at
+ * this location is selected.</li>
+ * </ul>
+ *
+ * @param event the <code>MouseEvent</code> describing the click operation
+ */
public void mouseClicked(MouseEvent event)
{
+ // FIXME: Implement this properly.
}
+ /**
+ * Indicates that the mouse has entered the text component. Nothing is done
+ * here.
+ *
+ * @param event the <code>MouseEvent</code> describing the mouse operation
+ */
public void mouseEntered(MouseEvent event)
{
+ // Nothing to do here.
}
+ /**
+ * Indicates that the mouse has exited the text component. Nothing is done
+ * here.
+ *
+ * @param event the <code>MouseEvent</code> describing the mouse operation
+ */
public void mouseExited(MouseEvent event)
{
}
+ /**
+ * If the button 1 is pressed, the caret position is updated to the
+ * position of the mouse click and the text component requests the input
+ * focus if it is enabled. If the SHIFT key is held down, the caret will
+ * be moved, which might select the text between the old and new location.
+ *
+ * @param event the <code>MouseEvent</code> describing the press operation
+ */
public void mousePressed(MouseEvent event)
{
+ // FIXME: Implement this properly.
}
+ /**
+ * Indicates that a mouse button has been released on the text component.
+ * Nothing is done here.
+ *
+ * @param event the <code>MouseEvent</code> describing the mouse operation
+ */
public void mouseReleased(MouseEvent event)
{
+ // Nothing to do here.
}
+ /**
+ * Sets the caret to <code>visible</code> if the text component is editable.
+ *
+ * @param event the <code>FocusEvent</code>
+ */
public void focusGained(FocusEvent event)
{
}
+ /**
+ * Sets the caret to <code>invisible</code>.
+ *
+ * @param event the <code>FocusEvent</code>
+ */
public void focusLost(FocusEvent event)
{
}
+ /**
+ * Moves the caret to the position specified in the <code>MouseEvent</code>.
+ * This will cause a selection if the dot and mark are different.
+ *
+ * @param event the <code>MouseEvent</code> from which to fetch the position
+ */
protected void moveCaret(MouseEvent event)
{
+ // FIXME: Implement this properly.
}
+ /**
+ * Repositions the caret to the position specified in the
+ * <code>MouseEvent</code>.
+ *
+ * @param event the <code>MouseEvent</code> from which to fetch the position
+ */
protected void positionCaret(MouseEvent event)
{
+ // FIXME: Implement this properly.
}
+ /**
+ * Deinstalls this <code>Caret</code> from the specified
+ * <code>JTextComponent</code>. This removes any listeners that have been
+ * registered by this <code>Caret</code>.
+ *
+ * @param c the text component from which to install this caret
+ */
public void deinstall(JTextComponent c)
{
textComponent.removeFocusListener(this);
@@ -122,6 +256,13 @@ public class DefaultCaret extends Rectangle
textComponent = null;
}
+ /**
+ * Installs this <code>Caret</code> on the specified
+ * <code>JTextComponent</code>. This registers a couple of listeners
+ * on the text component.
+ *
+ * @param c the text component on which to install this caret
+ */
public void install(JTextComponent c)
{
textComponent = c;
@@ -131,16 +272,37 @@ public class DefaultCaret extends Rectangle
repaint();
}
+ /**
+ * Sets the current visual position of this <code>Caret</code>.
+ *
+ * @param p the Point to use for the saved location. May be <code>null</code>
+ * to indicate that there is no visual location
+ */
public void setMagicCaretPosition(Point p)
{
magicCaretPosition = p;
}
+ /**
+ * Returns the current visual position of this <code>Caret</code>.
+ *
+ * @return the current visual position of this <code>Caret</code>
+ *
+ * @see #setMagicCaretPosition
+ */
public Point getMagicCaretPosition()
{
return magicCaretPosition;
}
+ /**
+ * Returns the current position of the <code>mark</code>. The
+ * <code>mark</code> marks the location in the <code>Document</code> that
+ * is the end of a selection. If there is no selection, the <code>mark</code>
+ * is the same as the <code>dot</code>.
+ *
+ * @return the current position of the mark
+ */
public int getMark()
{
return mark;
@@ -181,6 +343,12 @@ public class DefaultCaret extends Rectangle
}
}
+ /**
+ * Sets the visiblity state of the selection.
+ *
+ * @param v <code>true</code> if the selection should be visible,
+ * <code>false</code> otherwise
+ */
public void setSelectionVisible(boolean v)
{
if (selectionVisible == v)
@@ -191,17 +359,35 @@ public class DefaultCaret extends Rectangle
repaint();
}
+ /**
+ * Returns <code>true</code> if the selection is currently visible,
+ * <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if the selection is currently visible,
+ * <code>false</code> otherwise
+ */
public boolean isSelectionVisible()
{
return selectionVisible;
}
+ /**
+ * Causes the <code>Caret</code> to repaint itself.
+ */
protected final void repaint()
{
+ // FIXME: Is this good? This possibly causes alot of the component
+ // hierarchy to be repainted on every caret blink.
if (textComponent != null)
textComponent.repaint();
}
+ /**
+ * Paints this <code>Caret</code> using the specified <code>Graphics</code>
+ * context.
+ *
+ * @param g the graphics context to use
+ */
public void paint(Graphics g)
{
if (textComponent == null)
@@ -234,26 +420,53 @@ public class DefaultCaret extends Rectangle
}
}
+ /**
+ * Returns all registered event listeners of the specified type.
+ *
+ * @param listenerType the type of listener to return
+ *
+ * @return all registered event listeners of the specified type
+ */
public EventListener[] getListeners(Class listenerType)
{
return listenerList.getListeners(listenerType);
}
+ /**
+ * Registers a {@link ChangeListener} that is notified whenever that state
+ * of this <code>Caret</code> changes.
+ *
+ * @param listener the listener to register to this caret
+ */
public void addChangeListener(ChangeListener listener)
{
listenerList.add(ChangeListener.class, listener);
}
+ /**
+ * Removes a {@link ChangeListener} from the list of registered listeners.
+ *
+ * @param listener the listener to remove
+ */
public void removeChangeListener(ChangeListener listener)
{
listenerList.remove(ChangeListener.class, listener);
}
+ /**
+ * Returns all registered {@link ChangeListener}s of this <code>Caret</code>.
+ *
+ * @return all registered {@link ChangeListener}s of this <code>Caret</code>
+ */
public ChangeListener[] getChangeListeners()
{
return (ChangeListener[]) getListeners(ChangeListener.class);
}
+ /**
+ * Notifies all registered {@link ChangeListener}s that the state
+ * of this <code>Caret</code> has changed.
+ */
protected void fireStateChanged()
{
ChangeListener[] listeners = getChangeListeners();
@@ -262,26 +475,61 @@ public class DefaultCaret extends Rectangle
listeners[index].stateChanged(changeEvent);
}
+ /**
+ * Returns the <code>JTextComponent</code> on which this <code>Caret</code>
+ * is installed.
+ *
+ * @return the <code>JTextComponent</code> on which this <code>Caret</code>
+ * is installed
+ */
protected final JTextComponent getComponent()
{
return textComponent;
}
-
+
+ /**
+ * Returns the blink rate of this <code>Caret</code> in milliseconds.
+ * A value of <code>0</code> means that the caret does not blink.
+ *
+ * @return the blink rate of this <code>Caret</code> or <code>0</code> if
+ * this caret does not blink
+ */
public int getBlinkRate()
{
return blinkRate;
}
+ /**
+ * Sets the blink rate of this <code>Caret</code> in milliseconds.
+ * A value of <code>0</code> means that the caret does not blink.
+ *
+ * @param rate the new blink rate to set
+ */
public void setBlinkRate(int rate)
{
blinkRate = rate;
}
+ /**
+ * Returns the current position of this <code>Caret</code> within the
+ * <code>Document</code>.
+ *
+ * @return the current position of this <code>Caret</code> within the
+ * <code>Document</code>
+ */
public int getDot()
{
return dot;
}
+ /**
+ * Moves the <code>dot</code> location without touching the
+ * <code>mark</code>. This is used when making a selection.
+ *
+ * @param dot the location where to move the dot
+ *
+ * @see #setDot(int)
+ */
public void moveDot(int dot)
{
this.dot = dot;
@@ -289,6 +537,15 @@ public class DefaultCaret extends Rectangle
repaint();
}
+ /**
+ * Sets the current position of this <code>Caret</code> within the
+ * <code>Document</code>. This also sets the <code>mark</code> to the
+ * new location.
+ *
+ * @param dot the new position to be set
+ *
+ * @see #moveDot(int)
+ */
public void setDot(int dot)
{
this.dot = dot;
@@ -297,17 +554,37 @@ public class DefaultCaret extends Rectangle
repaint();
}
+ /**
+ * Returns <code>true</code> if this <code>Caret</code> is currently visible,
+ * and <code>false</code> if it is not.
+ *
+ * @return <code>true</code> if this <code>Caret</code> is currently visible,
+ * and <code>false</code> if it is not
+ */
public boolean isVisible()
{
return visible;
}
+ /**
+ * Sets the visibility state of the caret. <code>true</code> shows the
+ * <code>Caret</code>, <code>false</code> hides it.
+ *
+ * @param v the visibility to set
+ */
public void setVisible(boolean v)
{
visible = v;
repaint();
}
+ /**
+ * Returns the {@link Highlighter.HighlightPainter} that should be used
+ * to paint the selection.
+ *
+ * @return the {@link Highlighter.HighlightPainter} that should be used
+ * to paint the selection
+ */
protected Highlighter.HighlightPainter getSelectionPainter()
{
return DefaultHighlighter.DefaultPainter;
diff --git a/libjava/classpath/javax/swing/text/DefaultEditorKit.java b/libjava/classpath/javax/swing/text/DefaultEditorKit.java
index aa2fbe85..a14f3ff 100644
--- a/libjava/classpath/javax/swing/text/DefaultEditorKit.java
+++ b/libjava/classpath/javax/swing/text/DefaultEditorKit.java
@@ -51,44 +51,135 @@ import java.io.Writer;
import javax.swing.Action;
+/**
+ * The default implementation of {@link EditorKit}. This <code>EditorKit</code>
+ * a plain text <code>Document</code> and several commands that together
+ * make up a basic editor, like cut / copy + paste.
+ *
+ * @author original author unknown
+ * @author Roman Kennke (roman@kennke.org)
+ */
public class DefaultEditorKit extends EditorKit
{
+ /**
+ * Creates a beep on the PC speaker.
+ *
+ * @see Toolkit#beep()
+ */
public static class BeepAction
extends TextAction
{
+ /**
+ * Creates a new <code>BeepAction</code>.
+ */
public BeepAction()
{
super(beepAction);
}
+ /**
+ * Performs the <code>Action</code>.
+ *
+ * @param event the action event describing the user action
+ */
public void actionPerformed(ActionEvent event)
{
Toolkit.getDefaultToolkit().beep();
}
}
+ /**
+ * Copies the selected content into the system clipboard.
+ *
+ * @see Toolkit#getSystemClipboard()
+ * @see CutAction
+ * @see PasteAction
+ */
public static class CopyAction
extends TextAction
{
+
+ /**
+ * Create a new <code>CopyAction</code>.
+ */
public CopyAction()
{
super(copyAction);
}
+
+ /**
+ * Performs the <code>Action</code>.
+ *
+ * @param event the action event describing the user action
+ */
public void actionPerformed(ActionEvent event)
{
+ // FIXME: Implement me. Tookit.getSystemClipboard should be used
+ // for that.
}
}
+
+ /**
+ * Copies the selected content into the system clipboard and deletes the
+ * selection.
+ *
+ * @see Toolkit#getSystemClipboard()
+ * @see CopyAction
+ * @see PasteAction
+ */
public static class CutAction
extends TextAction
{
+
+ /**
+ * Create a new <code>CutAction</code>.
+ */
public CutAction()
{
super(cutAction);
}
+ /**
+ * Performs the <code>Action</code>.
+ *
+ * @param event the action event describing the user action
+ */
public void actionPerformed(ActionEvent event)
{
+ // FIXME: Implement me. Tookit.getSystemClipboard should be used
+ // for that.
+ }
+ }
+
+ /**
+ * Copies content from the system clipboard into the editor.
+ *
+ * @see Toolkit#getSystemClipboard()
+ * @see CopyAction
+ * @see CutAction
+ */
+ public static class PasteAction
+ extends TextAction
+ {
+
+ /**
+ * Create a new <code>PasteAction</code>.
+ */
+ public PasteAction()
+ {
+ super(pasteAction);
+ }
+
+ /**
+ * Performs the <code>Action</code>.
+ *
+ * @param event the action event describing the user action
+ */
+ public void actionPerformed(ActionEvent event)
+ {
+ // FIXME: Implement me. Tookit.getSystemClipboard should be used
+ // for that.
}
}
@@ -99,17 +190,26 @@ public class DefaultEditorKit extends EditorKit
* the control characters and characters with the ALT-modifier.
*
* If an event does not get filtered, it is inserted into the document
- * of the text component. If there is some text selected in the text component,
- * this text will be replaced.
+ * of the text component. If there is some text selected in the text
+ * component, this text will be replaced.
*/
public static class DefaultKeyTypedAction
extends TextAction
{
+
+ /**
+ * Creates a new <code>DefaultKeyTypedAction</code>.
+ */
public DefaultKeyTypedAction()
{
super(defaultKeyTypedAction);
}
+ /**
+ * Performs the <code>Action</code>.
+ *
+ * @param event the action event describing the user action
+ */
public void actionPerformed(ActionEvent event)
{
// first we filter the following events:
@@ -124,9 +224,11 @@ public class DefaultEditorKit extends EditorKit
{
try
{
- t.getDocument().insertString(t.getCaret().getDot(), event.getActionCommand(), null);
+ t.getDocument().insertString(t.getCaret().getDot(),
+ event.getActionCommand(), null);
t.getCaret().setDot(Math.min(t.getCaret().getDot() + 1,
- t.getDocument().getEndPosition().getOffset()));
+ t.getDocument().getEndPosition()
+ .getOffset()));
}
catch (BadLocationException be)
{
@@ -144,11 +246,20 @@ public class DefaultEditorKit extends EditorKit
public static class InsertBreakAction
extends TextAction
{
+
+ /**
+ * Creates a new <code>InsertBreakAction</code>.
+ */
public InsertBreakAction()
{
super(insertBreakAction);
}
+ /**
+ * Performs the <code>Action</code>.
+ *
+ * @param event the action event describing the user action
+ */
public void actionPerformed(ActionEvent event)
{
JTextComponent t = getTextComponent(event);
@@ -156,101 +267,446 @@ public class DefaultEditorKit extends EditorKit
}
}
+ /**
+ * Places content into the associated editor. If there currently is a
+ * selection, this selection is replaced.
+ */
+ // FIXME: Figure out what this Action is supposed to do. Obviously text
+ // that is entered by the user is inserted through DefaultKeyTypedAction.
public static class InsertContentAction
extends TextAction
{
+
+ /**
+ * Creates a new <code>InsertContentAction</code>.
+ */
public InsertContentAction()
{
super(insertContentAction);
}
+
+ /**
+ * Performs the <code>Action</code>.
+ *
+ * @param event the action event describing the user action
+ */
public void actionPerformed(ActionEvent event)
{
}
}
+ /**
+ * Inserts a TAB character into the text editor.
+ */
public static class InsertTabAction
extends TextAction
{
+
+ /**
+ * Creates a new <code>TabAction</code>.
+ */
public InsertTabAction()
{
super(insertTabAction);
}
+ /**
+ * Performs the <code>Action</code>.
+ *
+ * @param event the action event describing the user action
+ */
public void actionPerformed(ActionEvent event)
{
+ // FIXME: Implement this.
}
}
- public static class PasteAction
- extends TextAction
- {
- public PasteAction()
- {
- super(pasteAction);
- }
-
- public void actionPerformed(ActionEvent event)
- {
- }
- }
-
+ /**
+ * The serial version of DefaultEditorKit.
+ */
private static final long serialVersionUID = 9017245433028523428L;
-
+
+ /**
+ * The name of the <code>Action</code> that moves the caret one character
+ * backwards.
+ *
+ * @see #getActions()
+ */
public static final String backwardAction = "caret-backward";
+
+ /**
+ * The name of the <code>Action</code> that creates a beep in the speaker.
+ *
+ * @see #getActions()
+ */
public static final String beepAction = "beep";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret to the beginning
+ * of the <code>Document</code>.
+ *
+ * @see #getActions()
+ */
public static final String beginAction = "caret-begin";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret to the beginning
+ * of the current line.
+ *
+ * @see #getActions()
+ */
public static final String beginLineAction = "caret-begin-line";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret to the beginning
+ * of the current paragraph.
+ *
+ * @see #getActions()
+ */
public static final String beginParagraphAction = "caret-begin-paragraph";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret to the beginning
+ * of the current word.
+ *
+ * @see #getActions()
+ */
public static final String beginWordAction = "caret-begin-word";
+
+ /**
+ * The name of the <code>Action</code> that copies the selected content
+ * into the system clipboard.
+ *
+ * @see #getActions()
+ */
public static final String copyAction = "copy-to-clipboard";
+
+ /**
+ * The name of the <code>Action</code> that copies the selected content
+ * into the system clipboard and removes the selection.
+ *
+ * @see #getActions()
+ */
public static final String cutAction = "cut-to-clipboard";
+
+ /**
+ * The name of the <code>Action</code> that is performed by default if
+ * a key is typed and there is no keymap entry.
+ *
+ * @see #getActions()
+ */
public static final String defaultKeyTypedAction = "default-typed";
+
+ /**
+ * The name of the <code>Action</code> that deletes the character that
+ * follows the current caret position.
+ *
+ * @see #getActions()
+ */
public static final String deleteNextCharAction = "delete-next";
+
+ /**
+ * The name of the <code>Action</code> that deletes the character that
+ * precedes the current caret position.
+ *
+ * @see #getActions()
+ */
public static final String deletePrevCharAction = "delete-previous";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret one line down.
+ *
+ * @see #getActions()
+ */
public static final String downAction = "caret-down";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret to the end
+ * of the <code>Document</code>.
+ *
+ * @see #getActions()
+ */
public static final String endAction = "caret-end";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret to the end
+ * of the current line.
+ *
+ * @see #getActions()
+ */
public static final String endLineAction = "caret-end-line";
+
+ /**
+ * When a document is read and an CRLF is encountered, then we add a property
+ * with this name and a value of &quot;\r\n&quot;.
+ */
public static final String EndOfLineStringProperty = "__EndOfLine__";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret to the end
+ * of the current paragraph.
+ *
+ * @see #getActions()
+ */
public static final String endParagraphAction = "caret-end-paragraph";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret to the end
+ * of the current word.
+ *
+ * @see #getActions()
+ */
public static final String endWordAction = "caret-end-word";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret one character
+ * forward.
+ *
+ * @see #getActions()
+ */
public static final String forwardAction = "caret-forward";
+
+ /**
+ * The name of the <code>Action</code> that inserts a line break.
+ *
+ * @see #getActions()
+ */
public static final String insertBreakAction = "insert-break";
+
+ /**
+ * The name of the <code>Action</code> that inserts some content.
+ *
+ * @see #getActions()
+ */
public static final String insertContentAction = "insert-content";
+
+ /**
+ * The name of the <code>Action</code> that inserts a TAB.
+ *
+ * @see #getActions()
+ */
public static final String insertTabAction = "insert-tab";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret to the beginning
+ * of the next word.
+ *
+ * @see #getActions()
+ */
public static final String nextWordAction = "caret-next-word";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret one page down.
+ *
+ * @see #getActions()
+ */
public static final String pageDownAction = "page-down";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret one page up.
+ *
+ * @see #getActions()
+ */
public static final String pageUpAction = "page-up";
+
+ /**
+ * The name of the <code>Action</code> that copies content from the system
+ * clipboard into the document.
+ *
+ * @see #getActions()
+ */
public static final String pasteAction = "paste-from-clipboard";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret to the beginning
+ * of the previous word.
+ *
+ * @see #getActions()
+ */
public static final String previousWordAction = "caret-previous-word";
+
+ /**
+ * The name of the <code>Action</code> that sets the editor in read only
+ * mode.
+ *
+ * @see #getActions()
+ */
public static final String readOnlyAction = "set-read-only";
+
+ /**
+ * The name of the <code>Action</code> that selects the whole document.
+ *
+ * @see #getActions()
+ */
public static final String selectAllAction = "select-all";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret one character
+ * backwards, possibly extending the current selection.
+ *
+ * @see #getActions()
+ */
public static final String selectionBackwardAction = "selection-backward";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret to the beginning
+ * of the document, possibly extending the current selection.
+ *
+ * @see #getActions()
+ */
public static final String selectionBeginAction = "selection-begin";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret to the beginning
+ * of the current line, possibly extending the current selection.
+ *
+ * @see #getActions()
+ */
public static final String selectionBeginLineAction = "selection-begin-line";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret to the beginning
+ * of the current paragraph, possibly extending the current selection.
+ *
+ * @see #getActions()
+ */
public static final String selectionBeginParagraphAction =
"selection-begin-paragraph";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret to the beginning
+ * of the current word, possibly extending the current selection.
+ *
+ * @see #getActions()
+ */
public static final String selectionBeginWordAction = "selection-begin-word";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret one line down,
+ * possibly extending the current selection.
+ *
+ * @see #getActions()
+ */
public static final String selectionDownAction = "selection-down";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret to the end
+ * of the document, possibly extending the current selection.
+ *
+ * @see #getActions()
+ */
public static final String selectionEndAction = "selection-end";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret to the end
+ * of the current line, possibly extending the current selection.
+ *
+ * @see #getActions()
+ */
public static final String selectionEndLineAction = "selection-end-line";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret to the end
+ * of the current paragraph, possibly extending the current selection.
+ *
+ * @see #getActions()
+ */
public static final String selectionEndParagraphAction =
"selection-end-paragraph";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret to the end
+ * of the current word, possibly extending the current selection.
+ *
+ * @see #getActions()
+ */
public static final String selectionEndWordAction = "selection-end-word";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret one character
+ * forwards, possibly extending the current selection.
+ *
+ * @see #getActions()
+ */
public static final String selectionForwardAction = "selection-forward";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret to the beginning
+ * of the next word, possibly extending the current selection.
+ *
+ * @see #getActions()
+ */
public static final String selectionNextWordAction = "selection-next-word";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret to the beginning
+ * of the previous word, possibly extending the current selection.
+ *
+ * @see #getActions()
+ */
public static final String selectionPreviousWordAction =
"selection-previous-word";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret one line up,
+ * possibly extending the current selection.
+ *
+ * @see #getActions()
+ */
public static final String selectionUpAction = "selection-up";
+
+ /**
+ * The name of the <code>Action</code> that selects the line around the
+ * caret.
+ *
+ * @see #getActions()
+ */
public static final String selectLineAction = "select-line";
+
+ /**
+ * The name of the <code>Action</code> that selects the paragraph around the
+ * caret.
+ *
+ * @see #getActions()
+ */
public static final String selectParagraphAction = "select-paragraph";
+
+ /**
+ * The name of the <code>Action</code> that selects the word around the
+ * caret.
+ *
+ * @see #getActions()
+ */
public static final String selectWordAction = "select-word";
+
+ /**
+ * The name of the <code>Action</code> that moves the caret one line up.
+ *
+ * @see #getActions()
+ */
public static final String upAction = "caret-up";
+
+ /**
+ * The name of the <code>Action</code> that sets the editor in read-write
+ * mode.
+ *
+ * @see #getActions()
+ */
public static final String writableAction = "set-writable";
+ /**
+ * Creates a new <code>DefaultEditorKit</code>.
+ */
public DefaultEditorKit()
{
}
+ /**
+ * The <code>Action</code>s that are supported by the
+ * <code>DefaultEditorKit</code>.
+ */
+ // TODO: All these inner classes look ugly. Maybe work out a better way
+ // to handle this.
private static Action[] defaultActions =
new Action[] {
new BeepAction(),
@@ -356,37 +812,98 @@ public class DefaultEditorKit extends EditorKit
},
};
+ /**
+ * Creates the <code>Caret</code> for this <code>EditorKit</code>. This
+ * returns a {@link DefaultCaret} in this case.
+ *
+ * @return the <code>Caret</code> for this <code>EditorKit</code>
+ */
public Caret createCaret()
{
return new DefaultCaret();
}
+ /**
+ * Creates the default {@link Document} that this <code>EditorKit</code>
+ * supports. This is a {@link PlainDocument} in this case.
+ *
+ * @return the default {@link Document} that this <code>EditorKit</code>
+ * supports
+ */
public Document createDefaultDocument()
{
return new PlainDocument();
}
-
+
+ /**
+ * Returns the <code>Action</code>s supported by this <code>EditorKit</code>.
+ *
+ * @return the <code>Action</code>s supported by this <code>EditorKit</code>
+ */
public Action[] getActions()
{
return defaultActions;
}
+ /**
+ * Returns the content type that this <code>EditorKit</code> supports.
+ * The <code>DefaultEditorKit</code> supports the content type
+ * <code>text/plain</code>.
+ *
+ * @return the content type that this <code>EditorKit</code> supports
+ */
public String getContentType()
{
return "text/plain";
}
-
+
+ /**
+ * Returns a {@link ViewFactory} that is able to create {@link View}s for
+ * the <code>Element</code>s that are used in this <code>EditorKit</code>'s
+ * model. This returns null which lets the UI of the text component supply
+ * <code>View</code>s.
+ *
+ * @return a {@link ViewFactory} that is able to create {@link View}s for
+ * the <code>Element</code>s that are used in this
+ * <code>EditorKit</code>'s model
+ */
public ViewFactory getViewFactory()
{
return null;
}
+ /**
+ * Reads a document of the supported content type from an {@link InputStream}
+ * into the actual {@link Document} object.
+ *
+ * @param in the stream from which to read the document
+ * @param document the document model into which the content is read
+ * @param offset the offset inside to document where the content is inserted
+ *
+ * @throws BadLocationException if <code>offset</code> is an invalid location
+ * inside <code>document</code>
+ * @throws IOException if something goes wrong while reading from
+ * <code>in</code>
+ */
public void read(InputStream in, Document document, int offset)
throws BadLocationException, IOException
{
read(new InputStreamReader(in), document, offset);
}
+ /**
+ * Reads a document of the supported content type from a {@link Reader}
+ * into the actual {@link Document} object.
+ *
+ * @param in the reader from which to read the document
+ * @param document the document model into which the content is read
+ * @param offset the offset inside to document where the content is inserted
+ *
+ * @throws BadLocationException if <code>offset</code> is an invalid location
+ * inside <code>document</code>
+ * @throws IOException if something goes wrong while reading from
+ * <code>in</code>
+ */
public void read(Reader in, Document document, int offset)
throws BadLocationException, IOException
{
@@ -405,14 +922,47 @@ public class DefaultEditorKit extends EditorKit
SimpleAttributeSet.EMPTY);
}
+ /**
+ * Writes the <code>Document</code> (or a fragment of the
+ * <code>Document</code>) to an {@link OutputStream} in the
+ * supported content type format.
+ *
+ * @param out the stream to write to
+ * @param document the document that should be written out
+ * @param offset the beginning offset from where to write
+ * @param len the length of the fragment to write
+ *
+ * @throws BadLocationException if <code>offset</code> or
+ * <code>offset + len</code>is an invalid location inside
+ * <code>document</code>
+ * @throws IOException if something goes wrong while writing to
+ * <code>out</code>
+ */
public void write(OutputStream out, Document document, int offset, int len)
throws BadLocationException, IOException
{
write(new OutputStreamWriter(out), document, offset, len);
}
+ /**
+ * Writes the <code>Document</code> (or a fragment of the
+ * <code>Document</code>) to a {@link Writer} in the
+ * supported content type format.
+ *
+ * @param out the writer to write to
+ * @param document the document that should be written out
+ * @param offset the beginning offset from where to write
+ * @param len the length of the fragment to write
+ *
+ * @throws BadLocationException if <code>offset</code> or
+ * <code>offset + len</code>is an invalid location inside
+ * <code>document</code>
+ * @throws IOException if something goes wrong while writing to
+ * <code>out</code>
+ */
public void write(Writer out, Document document, int offset, int len)
throws BadLocationException, IOException
{
+ // TODO: Implement this properly.
}
}
diff --git a/libjava/classpath/javax/swing/text/DefaultStyledDocument.java b/libjava/classpath/javax/swing/text/DefaultStyledDocument.java
index 6fe206a..3545e52 100644
--- a/libjava/classpath/javax/swing/text/DefaultStyledDocument.java
+++ b/libjava/classpath/javax/swing/text/DefaultStyledDocument.java
@@ -42,42 +42,174 @@ import java.awt.Color;
import java.awt.Font;
import java.io.Serializable;
+import javax.swing.event.DocumentEvent;
+
/**
+ * The default implementation of {@link StyledDocument}.
+ *
+ * The document is modeled as an {@link Element} tree, which has
+ * a {@link SectionElement} as single root, which has one or more
+ * {@link AbstractDocument.BranchElement}s as paragraph nodes
+ * and each paragraph node having one or more
+ * {@link AbstractDocument.LeafElement}s as content nodes.
+ *
* @author Michael Koch (konqueror@gmx.de)
+ * @author Roman Kennke (roman@kennke.org)
*/
public class DefaultStyledDocument extends AbstractDocument
implements StyledDocument
{
+ /**
+ * Performs all <em>structural</code> changes to the <code>Element</code>
+ * hierarchy.
+ */
public class ElementBuffer
implements Serializable
{
+ /** The root element of the hierarchy. */
private Element root;
-
+
+ /** Holds the offset for structural changes. */
+ private int offset;
+
+ /** Holds the length of structural changes. */
+ private int length;
+
+ /**
+ * Creates a new <code>ElementBuffer</code> for the specified
+ * <code>root</code> element.
+ *
+ * @param root the root element for this <code>ElementBuffer</code>
+ */
public ElementBuffer(Element root)
{
this.root = root;
}
+ /**
+ * Returns the root element of this <code>ElementBuffer</code>.
+ *
+ * @return the root element of this <code>ElementBuffer</code>
+ */
public Element getRootElement()
{
return root;
}
+
+ /**
+ * Modifies the element structure so that the specified interval starts
+ * and ends at an element boundary. Content and paragraph elements
+ * are split and created as necessary.
+ *
+ * This also updates the <code>DefaultDocumentEvent</code> to reflect the
+ * structural changes.
+ *
+ * The bulk work is delegated to {@link #changeUpdate()}.
+ *
+ * @param offset the start index of the interval to be changed
+ * @param length the length of the interval to be changed
+ * @param ev the <code>DefaultDocumentEvent</code> describing the change
+ */
+ public void change(int offset, int length, DefaultDocumentEvent ev)
+ {
+ this.offset = offset;
+ this.length = length;
+ changeUpdate();
+ }
+
+ /**
+ * Performs the actual work for {@link #change}.
+ * The elements at the interval boundaries are split up (if necessary)
+ * so that the interval boundaries are located at element boundaries.
+ */
+ protected void changeUpdate()
+ {
+ // Split up the element at the start offset if necessary.
+ Element el = getCharacterElement(offset);
+ split(el, offset);
+
+ int endOffset = offset + length;
+ el = getCharacterElement(endOffset);
+ split(el, endOffset);
+ }
+
+ /**
+ * Splits an element if <code>offset</code> is not alread at its boundary.
+ *
+ * @param el the Element to possibly split
+ * @param offset the offset at which to possibly split
+ */
+ void split(Element el, int offset)
+ {
+ if (el instanceof AbstractElement)
+ {
+ AbstractElement ael = (AbstractElement) el;
+ int startOffset = ael.getStartOffset();
+ int endOffset = ael.getEndOffset();
+ int len = endOffset - startOffset;
+ if (startOffset != offset && endOffset != offset)
+ {
+ Element paragraph = ael.getParentElement();
+ if (paragraph instanceof BranchElement)
+ {
+ BranchElement par = (BranchElement) paragraph;
+ Element child1 = createLeafElement(par, ael, startOffset,
+ offset);
+ Element child2 = createLeafElement(par, ael, offset,
+ endOffset);
+ int index = par.getElementIndex(startOffset);
+ par.replace(index, 1, new Element[]{ child1, child2 });
+ }
+ else
+ throw new AssertionError("paragraph elements are expected to "
+ + "be instances of "
+ + "javax.swing.text.AbstractDocument.BranchElement");
+ }
+ }
+ else
+ throw new AssertionError("content elements are expected to be "
+ + "instances of "
+ + "javax.swing.text.AbstractDocument.AbstractElement");
+ }
}
-
+
+ /**
+ * The default size to use for new content buffers.
+ */
public static final int BUFFER_SIZE_DEFAULT = 4096;
+ /**
+ * The <code>EditorBuffer</code> that is used to manage to
+ * <code>Element</code> hierarchy.
+ */
protected DefaultStyledDocument.ElementBuffer buffer;
-
+
+ /**
+ * Creates a new <code>DefaultStyledDocument</code>.
+ */
public DefaultStyledDocument()
{
this(new GapContent(BUFFER_SIZE_DEFAULT), new StyleContext());
}
+ /**
+ * Creates a new <code>DefaultStyledDocument</code> that uses the
+ * specified {@link StyleContext}.
+ *
+ * @param context the <code>StyleContext</code> to use
+ */
public DefaultStyledDocument(StyleContext context)
{
this(new GapContent(BUFFER_SIZE_DEFAULT), context);
}
+ /**
+ * Creates a new <code>DefaultStyledDocument</code> that uses the
+ * specified {@link StyleContext} and {@link Content} buffer.
+ *
+ * @param content the <code>Content</code> buffer to use
+ * @param context the <code>StyleContext</code> to use
+ */
public DefaultStyledDocument(AbstractDocument.Content content,
StyleContext context)
{
@@ -86,15 +218,38 @@ public class DefaultStyledDocument extends AbstractDocument
setLogicalStyle(0, context.getStyle(StyleContext.DEFAULT_STYLE));
}
+ /**
+ * Adds a style into the style hierarchy. Unspecified style attributes
+ * can be resolved in the <code>parent</code> style, if one is specified.
+ *
+ * While it is legal to add nameless styles (<code>nm == null</code),
+ * you must be aware that the client application is then responsible
+ * for managing the style hierarchy, since unnamed styles cannot be
+ * looked up by their name.
+ *
+ * @param nm the name of the style or <code>null</code> if the style should
+ * be unnamed
+ * @param parent the parent in which unspecified style attributes are
+ * resolved, or <code>null</code> if that is not necessary
+ *
+ * @return the newly created <code>Style</code>
+ */
public Style addStyle(String nm, Style parent)
{
StyleContext context = (StyleContext) getAttributeContext();
return context.addStyle(nm, parent);
}
-
+
+ /**
+ * Create the default root element for this kind of <code>Document</code>.
+ *
+ * @return the default root element for this kind of <code>Document</code>
+ */
protected AbstractDocument.AbstractElement createDefaultRoot()
{
Element[] tmp;
+ // FIXME: Create a SecionElement here instead of a BranchElement.
+ // Use createBranchElement() and createLeafElement instead.
BranchElement section = new BranchElement(null, null);
BranchElement paragraph = new BranchElement(section, null);
@@ -109,7 +264,17 @@ public class DefaultStyledDocument extends AbstractDocument
return section;
}
-
+
+ /**
+ * Returns the <code>Element</code> that corresponds to the character
+ * at the specified position.
+ *
+ * @param position the position of which we query the corresponding
+ * <code>Element</code>
+ *
+ * @return the <code>Element</code> that corresponds to the character
+ * at the specified position
+ */
public Element getCharacterElement(int position)
{
Element element = getDefaultRootElement();
@@ -122,63 +287,172 @@ public class DefaultStyledDocument extends AbstractDocument
return element;
}
-
+
+ /**
+ * Extracts a background color from a set of attributes.
+ *
+ * @param attributes the attributes from which to get a background color
+ *
+ * @return the background color that correspond to the attributes
+ */
public Color getBackground(AttributeSet attributes)
{
StyleContext context = (StyleContext) getAttributeContext();
return context.getBackground(attributes);
}
-
+
+ /**
+ * Returns the default root element.
+ *
+ * @return the default root element
+ */
public Element getDefaultRootElement()
{
return buffer.getRootElement();
}
-
+
+ /**
+ * Extracts a font from a set of attributes.
+ *
+ * @param attributes the attributes from which to get a font
+ *
+ * @return the font that correspond to the attributes
+ */
public Font getFont(AttributeSet attributes)
{
StyleContext context = (StyleContext) getAttributeContext();
return context.getFont(attributes);
}
+ /**
+ * Extracts a foreground color from a set of attributes.
+ *
+ * @param attributes the attributes from which to get a foreground color
+ *
+ * @return the foreground color that correspond to the attributes
+ */
public Color getForeground(AttributeSet attributes)
{
StyleContext context = (StyleContext) getAttributeContext();
return context.getForeground(attributes);
}
-
+
+ /**
+ * Returns the logical <code>Style</code> for the specified position.
+ *
+ * @param position the position from which to query to logical style
+ *
+ * @return the logical <code>Style</code> for the specified position
+ */
public Style getLogicalStyle(int position)
{
Element paragraph = getParagraphElement(position);
AttributeSet attributes = paragraph.getAttributes();
return (Style) attributes.getResolveParent();
}
-
+
+ /**
+ * Returns the paragraph element for the specified position.
+ *
+ * @param position the position for which to query the paragraph element
+ *
+ * @return the paragraph element for the specified position
+ */
public Element getParagraphElement(int position)
{
Element element = getCharacterElement(position);
return element.getParentElement();
}
+ /**
+ * Looks up and returns a named <code>Style</code>.
+ *
+ * @param nm the name of the <code>Style</code>
+ *
+ * @return the found <code>Style</code> of <code>null</code> if no such
+ * <code>Style</code> exists
+ */
public Style getStyle(String nm)
{
StyleContext context = (StyleContext) getAttributeContext();
return context.getStyle(nm);
}
+ /**
+ * Removes a named <code>Style</code> from the style hierarchy.
+ *
+ * @param nm the name of the <code>Style</code> to be removed
+ */
public void removeStyle(String nm)
{
StyleContext context = (StyleContext) getAttributeContext();
context.removeStyle(nm);
}
+ /**
+ * Sets text attributes for the fragment specified by <code>offset</code>
+ * and <code>length</code>.
+ *
+ * @param offset the start offset of the fragment
+ * @param length the length of the fragment
+ * @param attributes the text attributes to set
+ * @param replace if <code>true</code>, the attributes of the current
+ * selection are overridden, otherwise they are merged
+ */
public void setCharacterAttributes(int offset, int length,
AttributeSet attributes,
boolean replace)
{
- // FIXME: Implement me.
- throw new Error("not implemented");
+ DefaultDocumentEvent ev =
+ new DefaultDocumentEvent(offset, length,
+ DocumentEvent.EventType.CHANGE);
+
+ // Modify the element structure so that the interval begins at an element
+ // start and ends at an element end.
+ buffer.change(offset, length, ev);
+
+ Element root = getDefaultRootElement();
+ // Visit all paragraph elements within the specified interval
+ int paragraphCount = root.getElementCount();
+ for (int pindex = 0; pindex < paragraphCount; pindex++)
+ {
+ Element paragraph = root.getElement(pindex);
+ // Skip paragraphs that lie outside the interval.
+ if ((paragraph.getStartOffset() > offset + length)
+ || (paragraph.getEndOffset() < offset))
+ continue;
+
+ // Visit content elements within this paragraph
+ int contentCount = paragraph.getElementCount();
+ for (int cindex = 0; cindex < contentCount; cindex++)
+ {
+ Element content = paragraph.getElement(cindex);
+ // Skip content that lies outside the interval.
+ if ((content.getStartOffset() > offset + length)
+ || (content.getEndOffset() < offset))
+ continue;
+
+ if (content instanceof AbstractElement)
+ {
+ AbstractElement el = (AbstractElement) content;
+ if (replace)
+ el.removeAttributes(el);
+ el.addAttributes(attributes);
+ }
+ else
+ throw new AssertionError("content elements are expected to be"
+ + "instances of "
+ + "javax.swing.text.AbstractDocument.AbstractElement");
+ }
+ }
}
+ /**
+ * Sets the logical style for the paragraph at the specified position.
+ *
+ * @param position the position at which the logical style is added
+ * @param style the style to set for the current paragraph
+ */
public void setLogicalStyle(int position, Style style)
{
Element el = getParagraphElement(position);
@@ -192,6 +466,15 @@ public class DefaultStyledDocument extends AbstractDocument
+ "instances of javax.swing.text.AbstractDocument.AbstractElement");
}
+ /**
+ * Sets text attributes for the paragraph at the specified fragment.
+ *
+ * @param offset the beginning of the fragment
+ * @param length the length of the fragment
+ * @param attributes the text attributes to set
+ * @param replace if <code>true</code>, the attributes of the current
+ * selection are overridden, otherwise they are merged
+ */
public void setParagraphAttributes(int offset, int length,
AttributeSet attributes,
boolean replace)
diff --git a/libjava/classpath/javax/swing/text/FieldView.java b/libjava/classpath/javax/swing/text/FieldView.java
index 4d5c51c..e2e04d7 100644
--- a/libjava/classpath/javax/swing/text/FieldView.java
+++ b/libjava/classpath/javax/swing/text/FieldView.java
@@ -173,4 +173,9 @@ public class FieldView extends PlainView
super.removeUpdate(ev, newAlloc, vf);
}
+ public int viewToModel(float fx, float fy, Shape a, Position.Bias[] bias)
+ {
+ return super.viewToModel(fx, fy, a, bias);
+ }
+
}
diff --git a/libjava/classpath/javax/swing/text/GapContent.java b/libjava/classpath/javax/swing/text/GapContent.java
index 1bbef8f..1dd46c4 100644
--- a/libjava/classpath/javax/swing/text/GapContent.java
+++ b/libjava/classpath/javax/swing/text/GapContent.java
@@ -39,29 +39,93 @@ exception statement from your version. */
package javax.swing.text;
import java.io.Serializable;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.ListIterator;
import javax.swing.undo.UndoableEdit;
/**
- * This implementation of {@link AbstractDocument.Content} uses a gapped
- * buffer. This takes advantage of the fact that text area content is
- * mostly inserted sequentially. The buffer is a char array that maintains
- * a gap at the current insertion point. If characters a inserted at
- * gap boundaries, the cost is minimal (simple array access). The array only
- * has to be shifted around when the insertion point moves (then the gap also
- * moves and one array copy is necessary) or when the gap is filled up and
- * the buffer has to be enlarged.
- *
+ * This implementation of {@link AbstractDocument.Content} uses a gapped buffer.
+ * This takes advantage of the fact that text area content is mostly inserted
+ * sequentially. The buffer is a char array that maintains a gap at the current
+ * insertion point. If characters a inserted at gap boundaries, the cost is
+ * minimal (simple array access). The array only has to be shifted around when
+ * the insertion point moves (then the gap also moves and one array copy is
+ * necessary) or when the gap is filled up and the buffer has to be enlarged.
+ *
* TODO: Implement UndoableEdit support stuff
*/
public class GapContent
- implements AbstractDocument.Content, Serializable
+ implements AbstractDocument.Content, Serializable
{
+
+ /**
+ * A {@link Position} implementation for <code>GapContent</code>.
+ */
+ class GapContentPosition
+ implements Position, Comparable
+ {
+
+ /** The index within the buffer array. */
+ int mark;
+
+ /**
+ * Creates a new GapContentPosition object.
+ *
+ * @param mark the mark of this Position
+ */
+ GapContentPosition(int mark)
+ {
+ this.mark = mark;
+ }
+
+ /**
+ * Comparable interface implementation. This is used to store all
+ * positions in an ordered fashion.
+ *
+ * @param o the object to be compared to this
+ *
+ * @return a negative integer if this is less than <code>o</code>, zero
+ * if both are equal or a positive integer if this is greater than
+ * <code>o</code>
+ *
+ * @throws ClassCastException if <code>o</code> is not a
+ * GapContentPosition or Integer object
+ */
+ public int compareTo(Object o)
+ {
+ if (o instanceof Integer)
+ {
+ int otherMark = ((Integer) o).intValue();
+ return mark - otherMark;
+ }
+ else
+ {
+ GapContentPosition other = (GapContentPosition) o;
+ return mark - other.mark;
+ }
+ }
+
+ /**
+ * Returns the current offset of this Position within the content.
+ *
+ * @return the current offset of this Position within the content.
+ */
+ public int getOffset()
+ {
+ if (mark <= gapStart)
+ return mark;
+ else
+ return mark - (gapEnd - gapStart);
+ }
+ }
+
private static final long serialVersionUID = 8374645204155842629L;
/**
- * This is the default buffer size and the amount of bytes that
- * a buffer is extended if it is full.
+ * This is the default buffer size and the amount of bytes that a buffer is
+ * extended if it is full.
*/
static final int DEFAULT_BUFSIZE = 64;
@@ -81,6 +145,12 @@ public class GapContent
int gapEnd;
/**
+ * The positions generated by this GapContent. They are kept in an ordered
+ * fashion, so they can be looked up easily.
+ */
+ LinkedList positions;
+
+ /**
* Creates a new GapContent object.
*/
public GapContent()
@@ -90,7 +160,7 @@ public class GapContent
/**
* Creates a new GapContent object with a specified initial size.
- *
+ *
* @param size the initial size of the buffer
*/
public GapContent(int size)
@@ -99,14 +169,15 @@ public class GapContent
gapStart = 0;
gapEnd = size - 1;
buffer[size - 1] = '\n';
+ positions = new LinkedList();
}
/**
* Allocates an array of the specified length that can then be used as
* buffer.
- *
+ *
* @param size the size of the array to be allocated
- *
+ *
* @return the allocated array
*/
protected Object allocateArray(int size)
@@ -116,7 +187,7 @@ public class GapContent
/**
* Returns the length of the allocated buffer array.
- *
+ *
* @return the length of the allocated buffer array
*/
protected int getArrayLength()
@@ -126,7 +197,7 @@ public class GapContent
/**
* Returns the length of the content.
- *
+ *
* @return the length of the content
*/
public int length()
@@ -136,18 +207,18 @@ public class GapContent
/**
* Inserts a string at the specified position.
- *
+ *
* @param where the position where the string is inserted
* @param str the string that is to be inserted
- *
+ *
* @return an UndoableEdit object (currently not supported, so
* <code>null</code> is returned)
- *
- * @throws BadLocationException if <code>where</code> is not a valid location
- * in the buffer
+ *
+ * @throws BadLocationException if <code>where</code> is not a valid
+ * location in the buffer
*/
public UndoableEdit insertString(int where, String str)
- throws BadLocationException
+ throws BadLocationException
{
// check arguments
int length = length();
@@ -155,190 +226,230 @@ public class GapContent
if (where >= length)
throw new BadLocationException("the where argument cannot be greater"
- + " than the content length", where);
-
- // check if the gap is big enough to hold the string
- if ((gapEnd - gapStart) < strLen)
- // make room for this string and some more
- shiftEnd(strLen + DEFAULT_BUFSIZE);
+ + " than the content length", where);
- // are we at the gap boundary?
- if (where != gapStart)
- shiftGap(where);
+ replace(where, 0, str.toCharArray(), str.length());
- // now we can simple copy the string into the gap and adjust the
- // gap boundaries
- System.arraycopy(str.toCharArray(), 0, buffer, gapStart, strLen);
- gapStart += strLen;
return null;
}
/**
* Removes a piece of content at th specified position.
- *
+ *
* @param where the position where the content is to be removed
* @param nitems number of characters to be removed
- *
+ *
* @return an UndoableEdit object (currently not supported, so
* <code>null</code> is returned)
- *
- * @throws BadLocationException if <code>where</code> is not a valid location
- * in the buffer
+ *
+ * @throws BadLocationException if <code>where</code> is not a valid
+ * location in the buffer
*/
- public UndoableEdit remove(int where, int nitems)
- throws BadLocationException
+ public UndoableEdit remove(int where, int nitems) throws BadLocationException
{
// check arguments
int length = length();
if (where >= length)
throw new BadLocationException("the where argument cannot be greater"
- + " than the content length", where);
+ + " than the content length", where);
if ((where + nitems) > length)
throw new BadLocationException("where + nitems cannot be greater"
- + " than the content length",
- where + nitems);
+ + " than the content length", where + nitems);
- // check if we are at the gap boundary
- if (where != gapStart)
- shiftGap(where);
+ replace(where, nitems, null, 0);
- // now we simply have to enlarge the gap
- gapEnd += nitems;
return null;
}
/**
* Returns a piece of content as String.
- *
+ *
* @param where the start location of the fragment
* @param len the length of the fragment
- *
+ *
* @throws BadLocationException if <code>where</code> or
* <code>where + len</code> are no valid locations in the buffer
*/
public String getString(int where, int len) throws BadLocationException
{
Segment seg = new Segment();
- getChars(where, len, seg);
- return new String(seg.array, seg.offset, seg.count);
+ try
+ {
+ getChars(where, len, seg);
+ return new String(seg.array, seg.offset, seg.count);
+ }
+ catch (StringIndexOutOfBoundsException ex)
+ {
+ int invalid = 0;
+ if (seg.offset < 0 || seg.offset >= seg.array.length)
+ invalid = seg.offset;
+ else
+ invalid = seg.offset + seg.count;
+ throw new BadLocationException("Illegal location: array.length = "
+ + seg.array.length + ", offset = "
+ + seg.offset + ", count = "
+ + seg.count, invalid);
+ }
}
/**
* Fetches a piece of content and stores it in a {@link Segment} object.
- *
- * If the requested piece of text spans the gap, the content is copied
- * into a new array. If it doesn't then it is contiguous and the
- * actual content store is returned.
- *
+ *
+ * If the requested piece of text spans the gap, the content is copied into a
+ * new array. If it doesn't then it is contiguous and the actual content
+ * store is returned.
+ *
* @param where the start location of the fragment
* @param len the length of the fragment
* @param txt the Segment object to store the fragment in
- *
+ *
* @throws BadLocationException if <code>where</code> or
* <code>where + len</code> are no valid locations in the buffer
*/
public void getChars(int where, int len, Segment txt)
- throws BadLocationException
+ throws BadLocationException
{
// check arguments
int length = length();
if (where >= length)
throw new BadLocationException("the where argument cannot be greater"
- + " than the content length", where);
+ + " than the content length", where);
if ((where + len) > length)
throw new BadLocationException("len plus where cannot be greater"
- + " than the content length",
- len + where);
+ + " than the content length", len + where);
// check if requested segment is contiguous
if ((where < gapStart) && ((gapStart - where) < len))
- {
- // requested segment is not contiguous -> copy the pieces together
- char[] copy = new char[len];
- int lenFirst = gapStart - where; // the length of the first segment
- System.arraycopy(buffer, where, copy, 0, lenFirst);
- System.arraycopy(buffer, gapEnd, copy, lenFirst, len - lenFirst);
- txt.array = copy;
- txt.offset = 0;
- txt.count = len;
- }
+ {
+ // requested segment is not contiguous -> copy the pieces together
+ char[] copy = new char[len];
+ int lenFirst = gapStart - where; // the length of the first segment
+ System.arraycopy(buffer, where, copy, 0, lenFirst);
+ System.arraycopy(buffer, gapEnd, copy, lenFirst, len - lenFirst);
+ txt.array = copy;
+ txt.offset = 0;
+ txt.count = len;
+ }
else
- {
- // requested segment is contiguous -> we can simply return the
- // actual content
- txt.array = buffer;
- if (where < gapStart)
- txt.offset = where;
- else
- txt.offset = where + (gapEnd - gapStart);
- txt.count = len;
- }
+ {
+ // requested segment is contiguous -> we can simply return the
+ // actual content
+ txt.array = buffer;
+ if (where < gapStart)
+ txt.offset = where;
+ else
+ txt.offset = where + (gapEnd - gapStart);
+ txt.count = len;
+ }
}
/**
* Creates and returns a mark at the specified position.
- *
+ *
* @param offset the position at which to create the mark
- *
+ *
* @return the create Position object for the mark
- *
- * @throws BadLocationException if the offset is not a valid position in
- * the buffer
+ *
+ * @throws BadLocationException if the offset is not a valid position in the
+ * buffer
*/
public Position createPosition(final int offset) throws BadLocationException
{
- return new Position()
- {
- int off = offset;
-
- public int getOffset()
- {
- return off;
- }
- };
+ if (offset < 0 || offset > length())
+ throw new BadLocationException("The offset was out of the bounds of this"
+ + " buffer", offset);
+
+ // We store the actual array index in the GapContentPosition. The real
+ // offset is then calculated in the GapContentPosition.
+ int mark = offset;
+ if (offset > gapStart)
+ mark += gapEnd - gapStart;
+ GapContentPosition pos = new GapContentPosition(mark);
+
+ // Add this into our list in a sorted fashion.
+ int index = Collections.binarySearch(positions, pos);
+ if (index < 0)
+ index = -(index + 1);
+ positions.add(index, pos);
+
+ return pos;
}
/**
* Enlarges the gap. This allocates a new bigger buffer array, copy the
- * segment before the gap as it is and the segment after the gap at
- * the end of the new buffer array. This does change the gapEnd mark
- * but not the gapStart mark.
- *
+ * segment before the gap as it is and the segment after the gap at the end
+ * of the new buffer array. This does change the gapEnd mark but not the
+ * gapStart mark.
+ *
* @param newSize the new size of the gap
*/
protected void shiftEnd(int newSize)
{
+ int delta = (gapEnd - gapStart) - newSize;
char[] newBuf = (char[]) allocateArray(length() + newSize);
System.arraycopy(buffer, 0, newBuf, 0, gapStart);
- System.arraycopy(buffer, gapEnd, newBuf, gapStart + newSize,
- buffer.length - gapEnd);
+ System.arraycopy(buffer, gapEnd, newBuf, gapStart + newSize, buffer.length
+ - gapEnd);
gapEnd = gapStart + newSize;
buffer = newBuf;
+
+ // Update the marks after the gapEnd.
+ int index = Collections.binarySearch(positions, new GapContentPosition(
+ gapEnd));
+ if (index < 0)
+ {
+ index = -(index + 1);
+ }
+ for (ListIterator i = positions.listIterator(index); i.hasNext();)
+ {
+ GapContentPosition p = (GapContentPosition) i.next();
+ p.mark += delta;
+ }
}
/**
* Shifts the gap to the specified position.
- *
+ *
* @param newGapStart the new start position of the gap
*/
protected void shiftGap(int newGapStart)
{
int newGapEnd = newGapStart + (gapEnd - gapStart);
+ // Update the positions between newGapEnd and (old) gapEnd. The marks
+ // must be shifted by (gapEnd - newGapEnd).
+ int index1 = Collections.binarySearch(positions,
+ new GapContentPosition(gapEnd));
+ int index2 = Collections.binarySearch(positions,
+ new GapContentPosition(newGapEnd));
+ if (index1 > 0 && index2 > 0)
+ {
+ int i1 = Math.min(index1, index2);
+ int i2 = Math.max(index1, index2);
+ for (ListIterator i = positions.listIterator(i1); i.hasNext();)
+ {
+ if (i.nextIndex() > i2)
+ break;
+
+ GapContentPosition p = (GapContentPosition) i.next();
+ p.mark += gapEnd - newGapEnd;
+ }
+ }
+
if (newGapStart == gapStart)
return;
else if (newGapStart < gapStart)
{
- System.arraycopy(buffer, newGapStart, buffer, newGapEnd,
- gapStart - newGapStart);
+ System.arraycopy(buffer, newGapStart, buffer, newGapEnd, gapStart
+ - newGapStart);
gapStart = newGapStart;
gapEnd = newGapEnd;
}
else
{
- System.arraycopy(buffer, gapEnd, buffer, gapStart,
- newGapStart - gapStart);
+ System.arraycopy(buffer, gapEnd, buffer, gapStart, newGapStart
+ - gapStart);
gapStart = newGapStart;
gapEnd = newGapEnd;
}
@@ -346,11 +457,38 @@ public class GapContent
/**
* Returns the allocated buffer array.
- *
+ *
* @return the allocated buffer array
*/
protected Object getArray()
{
return buffer;
}
+
+ /**
+ * Replaces a portion of the storage with the specified items.
+ *
+ * @param position the position at which to remove items
+ * @param rmSize the number of items to remove
+ * @param addItems the items to add at location
+ * @param addSize the number of items to add
+ */
+ protected void replace(int position, int rmSize, Object addItems,
+ int addSize)
+ {
+ // Remove content
+ shiftGap(position);
+ gapEnd += rmSize;
+
+ // If gap is too small, enlarge the gap.
+ if ((gapEnd - gapStart) < addSize)
+ shiftEnd(addSize);
+
+ // Add new items to the buffer.
+ if (addItems != null)
+ {
+ System.arraycopy(addItems, 0, buffer, gapStart, addSize);
+ gapStart += addSize;
+ }
+ }
}
diff --git a/libjava/classpath/javax/swing/text/InternationalFormatter.java b/libjava/classpath/javax/swing/text/InternationalFormatter.java
index 531a4c1..cedaf59 100644
--- a/libjava/classpath/javax/swing/text/InternationalFormatter.java
+++ b/libjava/classpath/javax/swing/text/InternationalFormatter.java
@@ -214,7 +214,7 @@ public class InternationalFormatter
/**
* Converts a value object into a String. This is done by invoking
- * {@link Format#format} on the specified <code>Format</code> object.
+ * {@link Format#format(Object)} on the specified <code>Format</code> object.
* If no format is set, then {@link DefaultFormatter#valueToString(Object)}
* is called as a fallback.
*
diff --git a/libjava/classpath/javax/swing/text/JTextComponent.java b/libjava/classpath/javax/swing/text/JTextComponent.java
index f2ef4d7..b3fad79 100644
--- a/libjava/classpath/javax/swing/text/JTextComponent.java
+++ b/libjava/classpath/javax/swing/text/JTextComponent.java
@@ -96,7 +96,6 @@ public abstract class JTextComponent extends JComponent
/**
* Constructor AccessibleJTextComponent
- * @param component TODO
*/
public AccessibleJTextComponent()
{
@@ -712,8 +711,8 @@ public abstract class JTextComponent extends JComponent
* @return A Keymap associated with the provided name, or
* <code>null</code> if no such Keymap exists
*
- * @see #addKeymap()
- * @see #removeKeymap()
+ * @see #addKeymap
+ * @see #removeKeymap
* @see #keymaps
*/
public static Keymap getKeymap(String n)
@@ -728,7 +727,7 @@ public abstract class JTextComponent extends JComponent
*
* @return The keymap removed from the global table
*
- * @see #addKeymap()
+ * @see #addKeymap
* @see #getKeymap()
* @see #keymaps
*/
@@ -751,7 +750,7 @@ public abstract class JTextComponent extends JComponent
*
* @return The newly created Keymap
*
- * @see #removeKeymap()
+ * @see #removeKeymap
* @see #getKeymap()
* @see #keymaps
*/
@@ -769,7 +768,7 @@ public abstract class JTextComponent extends JComponent
*
* @return The component's current Keymap
*
- * @see #setKeymap()
+ * @see #setKeymap
* @see #keymap
*/
public Keymap getKeymap()
@@ -901,8 +900,8 @@ public abstract class JTextComponent extends JComponent
* @param actions The set of actions to resolve binding names against
*
* @see Action#NAME
- * @see Action#getValue()
- * @see KeyBinding#ActionName
+ * @see Action#getValue
+ * @see KeyBinding#actionName
*/
public static void loadKeymap(Keymap map,
JTextComponent.KeyBinding[] bindings,
@@ -921,12 +920,12 @@ public abstract class JTextComponent extends JComponent
* editor can run. Equivalent to calling
* <code>getUI().getEditorKit().getActions()</code>. This set of Actions
* is a reasonable value to provide as a parameter to {@link
- * #loadKeymap()}, when resolving a set of {@link #KeyBinding} objects
+ * #loadKeymap}, when resolving a set of {@link KeyBinding} objects
* against this component.
*
* @return The set of available Actions on this component's {@link EditorKit}
*
- * @see TextUI#getEditorKit()
+ * @see TextUI#getEditorKit
* @see EditorKit#getActions()
*/
public Action[] getActions()
@@ -1122,7 +1121,7 @@ public abstract class JTextComponent extends JComponent
/**
* This method sets the label's UI delegate.
*
- * @param ui The label's UI delegate.
+ * @param newUI The label's UI delegate.
*/
public void setUI(TextUI newUI)
{
@@ -1360,7 +1359,7 @@ public abstract class JTextComponent extends JComponent
/**
* Selects the text from the given postion to the selection end position.
*
- * @param end the start positon of the selected text.
+ * @param start the start positon of the selected text.
*/
public void setSelectionStart(int start)
{
@@ -1391,7 +1390,7 @@ public abstract class JTextComponent extends JComponent
* Selects a part of the content of the text component.
*
* @param start the start position of the selected text
- * @param ent the end position of the selected text
+ * @param end the end position of the selected text
*/
public void select(int start, int end)
{
@@ -1635,7 +1634,7 @@ public abstract class JTextComponent extends JComponent
*
* @throws IOException if the reader throws it.
*
- * @see getDocument()
+ * @see #getDocument()
* @see Document#getProperty(Object)
*/
public void read(Reader input, Object streamDescription)
diff --git a/libjava/classpath/javax/swing/text/PasswordView.java b/libjava/classpath/javax/swing/text/PasswordView.java
index 229fd2b..c3aa66c 100644
--- a/libjava/classpath/javax/swing/text/PasswordView.java
+++ b/libjava/classpath/javax/swing/text/PasswordView.java
@@ -1,56 +1,59 @@
/* PasswordView.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., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+ 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., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
package javax.swing.text;
import java.awt.Color;
+import java.awt.FontMetrics;
import java.awt.Graphics;
+import java.awt.Shape;
import javax.swing.JPasswordField;
-public class PasswordView extends FieldView
+public class PasswordView
+ extends FieldView
{
/**
* Buffer for putting the echo char into it and
* then using it to draw it into the view.
*/
private char[] oneCharBuffer = new char[1];
-
+
public PasswordView(Element elem)
{
super(elem);
@@ -70,7 +73,7 @@ public class PasswordView extends FieldView
{
// Update font metrics.
updateMetrics();
-
+
// Draw character.
oneCharBuffer[0] = ch;
g.drawChars(oneCharBuffer, 0, 1, x, y);
@@ -82,7 +85,7 @@ public class PasswordView extends FieldView
private char getEchoChar()
{
char ch = ((JPasswordField) getContainer()).getEchoChar();
-
+
if (ch == 0)
ch = '*';
@@ -107,10 +110,10 @@ public class PasswordView extends FieldView
// Update font metrics.
updateMetrics();
-
+
// Get echo character.
char ch = getEchoChar();
-
+
// Set color for selected text.
g.setColor(selectedColor);
g.setColor(Color.BLACK);
@@ -120,7 +123,7 @@ public class PasswordView extends FieldView
char[] buffer = new char[len];
for (int index = 0; index < len; ++index)
buffer[index] = ch;
-
+
// Draw echo charaters.
g.drawChars(buffer, 0, len, x, y);
@@ -146,25 +149,96 @@ public class PasswordView extends FieldView
// Update font metrics.
updateMetrics();
-
+
// Get echo character.
char ch = getEchoChar();
-
+ Segment segment = new Segment();
+
// Set color for unselected text.
g.setColor(unselectedColor);
g.setColor(Color.BLACK);
// Initialize buffer for faster drawing of all characters.
- int len = p1 - p0;
+ p1--;
+ getDocument().getText(p0, p1 - p0, segment);
+ int len = segment.toString().length();
+
char[] buffer = new char[len];
for (int index = 0; index < len; ++index)
buffer[index] = ch;
+ y += getPreferredSpan(Y_AXIS)/2;
+
// Draw echo charaters.
g.drawChars(buffer, 0, len, x, y);
-
+
// Return new x position right of all drawn characters.
- return x + len * metrics.charWidth(ch);
+ return x + (len * metrics.charWidth(ch));
+ }
+
+ /**
+ * Determines the preferred span for this view along an axis.
+ *
+ * @param axis to get the preferred span of
+ * @return the preferred span of the axis
+ */
+ public float getPreferredSpan(int axis)
+ {
+ if (axis != X_AXIS && axis != Y_AXIS)
+ throw new IllegalArgumentException();
+
+ FontMetrics fm = getFontMetrics();
+
+ if (axis == Y_AXIS)
+ return fm.getHeight();
+
+ String text;
+ Element elem = getElement();
+
+ try
+ {
+ text = elem.getDocument().getText(elem.getStartOffset(),
+ elem.getEndOffset());
+ }
+ catch (BadLocationException e)
+ {
+ // This should never happen.
+ text = "";
+ }
+ return fm.stringWidth(text);
}
-}
+ /**
+ * Provides a mapping from the document model coordinate space to the
+ * coordinate space of the view mapped to it.
+ *
+ * @param pos - the position to convert >= 0
+ * @param a - the allocated region to render into
+ * @param b - typesafe enumeration to indicate bias to a position in the model.
+ * @return the bounding box of the given position
+ * @throws BadLocationException if the given position does not
+ * represent a valid location in the associated document
+ */
+ public Shape modelToView(int pos, Shape a, Position.Bias b)
+ throws BadLocationException
+ {
+ return super.modelToView(pos, a, b);
+ }
+
+ /**
+ * Provides a mapping from the view coordinate space to the logical
+ * coordinate space of the model.
+ *
+ * @param fx - the X coordinate >= 0.0f
+ * @param fy - the Y coordinate >= 0.0f
+ * @param a - the allocated region to render into
+ * @param bias - typesafe enumeration to indicate bias to a position in the model.
+ * @return the location within the model that best represents
+ * the given point in the view
+ *
+ */
+ public int viewToModel(float fx, float fy, Shape a, Position.Bias[] bias)
+ {
+ return super.viewToModel(fx, fy, a, bias);
+ }
+}
diff --git a/libjava/classpath/javax/swing/text/PlainDocument.java b/libjava/classpath/javax/swing/text/PlainDocument.java
index c3f59e4..71070e9 100644
--- a/libjava/classpath/javax/swing/text/PlainDocument.java
+++ b/libjava/classpath/javax/swing/text/PlainDocument.java
@@ -135,22 +135,6 @@ public class PlainDocument extends AbstractDocument
start, end - len);
rootElement.replace(i1, i2 - i1, new Element[]{ newEl });
}
- else
- {
- // otherwise only adjust indices of the element
- LeafElement el1 = (LeafElement) rootElement.getElement(i1);
- el1.end -= len;
- }
-
- // reindex remaining elements
- for (int i = rootElement.getElementIndex(p0) + 1;
- i < rootElement.getElementCount(); i++)
- {
- LeafElement el = (LeafElement) rootElement.getElement(i);
- el.start -= len;
- el.end -= len;
- }
-
}
public Element getDefaultRootElement()
diff --git a/libjava/classpath/javax/swing/text/PlainView.java b/libjava/classpath/javax/swing/text/PlainView.java
index 5d1fab0..91d7547 100644
--- a/libjava/classpath/javax/swing/text/PlainView.java
+++ b/libjava/classpath/javax/swing/text/PlainView.java
@@ -237,5 +237,23 @@ public class PlainView extends View
return span;
}
+
+ /**
+ * Maps coordinates from the <code>View</code>'s space into a position
+ * in the document model.
+ *
+ * @param x the x coordinate in the view space
+ * @param y the y coordinate in the view space
+ * @param a the allocation of this <code>View</code>
+ * @param b the bias to use
+ *
+ * @return the position in the document that corresponds to the screen
+ * coordinates <code>x, y</code>
+ */
+ public int viewToModel(float x, float y, Shape a, Position.Bias[] b)
+ {
+ // FIXME: not implemented
+ return 0;
+ }
}
diff --git a/libjava/classpath/javax/swing/text/StyledEditorKit.java b/libjava/classpath/javax/swing/text/StyledEditorKit.java
index 459f243..89c4cf1 100644
--- a/libjava/classpath/javax/swing/text/StyledEditorKit.java
+++ b/libjava/classpath/javax/swing/text/StyledEditorKit.java
@@ -46,458 +46,663 @@ import java.io.Serializable;
import javax.swing.Action;
import javax.swing.JEditorPane;
+import javax.swing.JTextPane;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
/**
- * StyledEditorKit
+ * An {@link EditorKit} that supports editing styled text.
*
* @author Andrew Selkirk
+ * @author Roman Kennke (roman@kennke.org)
*/
public class StyledEditorKit extends DefaultEditorKit
{
+ /** The serialVersionUID. */
private static final long serialVersionUID = 7002391892985555948L;
/**
- * UnderlineAction
+ * Toggles the underline attribute for the selected text.
*/
public static class UnderlineAction extends StyledEditorKit.StyledTextAction
{
/**
- * Constructor UnderlineAction
+ * Creates an instance of <code>UnderlineAction</code>.
*/
public UnderlineAction()
{
- super("TODO");
- // TODO
+ super("TODO"); // TODO: Figure out name for this action.
}
/**
- * actionPerformed
- * @param event TODO
+ * Performs the action.
+ *
+ * @param event the <code>ActionEvent</code> that describes the action
*/
public void actionPerformed(ActionEvent event)
{
- // TODO
+ JEditorPane editor = getEditor(event);
+ StyledDocument doc = getStyledDocument(editor);
+ Element el = doc.getCharacterElement(editor.getSelectionStart());
+ boolean isUnderline = StyleConstants.isUnderline(el.getAttributes());
+ SimpleAttributeSet atts = new SimpleAttributeSet();
+ StyleConstants.setUnderline(atts, ! isUnderline);
+ setCharacterAttributes(editor, atts, false);
}
}
/**
- * ItalicAction
+ * Toggles the italic attribute for the selected text.
*/
public static class ItalicAction extends StyledEditorKit.StyledTextAction
{
/**
- * Constructor ItalicAction
+ * Creates an instance of <code>ItalicAction</code>.
*/
public ItalicAction()
{
- super("TODO");
- // TODO
+ super("TODO"); // TODO: Figure out correct name of this Action.
}
/**
- * actionPerformed
- * @param event TODO
+ * Performs the action.
+ *
+ * @param event the <code>ActionEvent</code> that describes the action
*/
public void actionPerformed(ActionEvent event)
{
- // TODO
+ JEditorPane editor = getEditor(event);
+ StyledDocument doc = getStyledDocument(editor);
+ Element el = doc.getCharacterElement(editor.getSelectionStart());
+ boolean isItalic = StyleConstants.isItalic(el.getAttributes());
+ SimpleAttributeSet atts = new SimpleAttributeSet();
+ StyleConstants.setItalic(atts, ! isItalic);
+ setCharacterAttributes(editor, atts, false);
}
}
/**
- * BoldAction
+ * Toggles the bold attribute for the selected text.
*/
public static class BoldAction extends StyledEditorKit.StyledTextAction
{
/**
- * Constructor BoldAction
+ * Creates an instance of <code>BoldAction</code>.
*/
public BoldAction()
{
- super("TODO");
- // TODO
+ super("TODO"); // TODO: Figure out correct name of this Action.
}
/**
- * actionPerformed
- * @param event TODO
+ * Performs the action.
+ *
+ * @param event the <code>ActionEvent</code> that describes the action
*/
public void actionPerformed(ActionEvent event)
{
- // TODO
+ JEditorPane editor = getEditor(event);
+ StyledDocument doc = getStyledDocument(editor);
+ Element el = doc.getCharacterElement(editor.getSelectionStart());
+ boolean isBold = StyleConstants.isBold(el.getAttributes());
+ SimpleAttributeSet atts = new SimpleAttributeSet();
+ StyleConstants.setItalic(atts, ! isBold);
+ setCharacterAttributes(editor, atts, false);
}
}
/**
- * AlignmentAction
+ * Sets the alignment attribute on the selected text.
*/
public static class AlignmentAction extends StyledEditorKit.StyledTextAction
{
/**
- * a
+ * The aligment to set.
*/
private int a;
/**
- * Constructor AlignmentAction
- * @param nm TODO
- * @param a TODO
+ * Creates a new instance of <code>AlignmentAction</code> to set the
+ * alignment to <code>a</code>.
+ *
+ * @param nm the name of the Action
+ * @param a the alignment to set
*/
public AlignmentAction(String nm, int a)
{
- super("TODO");
- // TODO
+ super(nm);
+ this.a = a;
}
/**
- * actionPerformed
- * @param event TODO
+ * Performs the action.
+ *
+ * @param event the <code>ActionEvent</code> that describes the action
*/
public void actionPerformed(ActionEvent event)
{
- // TODO
+ SimpleAttributeSet atts = new SimpleAttributeSet();
+ StyleConstants.setAlignment(atts, a);
+ setParagraphAttributes(getEditor(event), atts, false);
}
}
/**
- * ForegroundAction
+ * Sets the foreground color attribute on the selected text.
*/
public static class ForegroundAction extends StyledEditorKit.StyledTextAction
{
/**
- * fg
+ * The foreground color to set.
*/
private Color fg;
/**
- * Constructor ForegroundAction
- * @param nm TODO
- * @param fg TODO
+ * Creates a new instance of <code>ForegroundAction</code> to set the
+ * foreground color to <code>fg</code>.
+ *
+ * @param nm the name of the Action
+ * @param fg the foreground color to set
*/
public ForegroundAction(String nm, Color fg)
{
- super("TODO");
- // TODO
+ super(nm);
+ this.fg = fg;
}
/**
- * actionPerformed
- * @param event TODO
+ * Performs the action.
+ *
+ * @param event the <code>ActionEvent</code> that describes the action
*/
public void actionPerformed(ActionEvent event)
{
- // TODO
+ SimpleAttributeSet atts = new SimpleAttributeSet();
+ StyleConstants.setForeground(atts, fg);
+ setCharacterAttributes(getEditor(event), atts, false);
}
}
/**
- * FontSizeAction
+ * Sets the font size attribute on the selected text.
*/
public static class FontSizeAction extends StyledEditorKit.StyledTextAction
{
/**
- * size
+ * The font size to set.
*/
private int size;
/**
- * Constructor FontSizeAction
- * @param nm TODO
- * @param size TODO
+ * Creates a new instance of <code>FontSizeAction</code> to set the
+ * font size to <code>size</code>.
+ *
+ * @param nm the name of the Action
+ * @param size the font size to set
*/
public FontSizeAction(String nm, int size)
{
- super("TODO");
- // TODO
+ super(nm);
+ this.size = size;
}
/**
- * actionPerformed
- * @param event TODO
+ * Performs the action.
+ *
+ * @param event the <code>ActionEvent</code> that describes the action
*/
public void actionPerformed(ActionEvent event)
{
- // TODO
+ SimpleAttributeSet atts = new SimpleAttributeSet();
+ StyleConstants.setFontSize(atts, size);
+ setCharacterAttributes(getEditor(event), atts, false);
}
}
/**
- * FontFamilyAction
+ * Sets the font family attribute on the selected text.
*/
public static class FontFamilyAction extends StyledEditorKit.StyledTextAction
{
/**
- * family
+ * The font family to set.
*/
private String family;
/**
- * Constructor FontFamilyAction
- * @param nm TODO
- * @param family TODO
+ * Creates a new instance of <code>FontFamilyAction</code> to set the
+ * font family to <code>family</code>.
+ *
+ * @param nm the name of the Action
+ * @param family the font family to set
*/
public FontFamilyAction(String nm, String family)
{
- super("TODO");
- // TODO
+ super(nm);
+ this.family = family;
}
/**
- * actionPerformed
- * @param event TODO
+ * Performs the action.
+ *
+ * @param event the <code>ActionEvent</code> that describes the action
*/
public void actionPerformed(ActionEvent event)
{
- // TODO
+ SimpleAttributeSet atts = new SimpleAttributeSet();
+ StyleConstants.setFontFamily(atts, family);
+ setCharacterAttributes(getEditor(event), atts, false);
}
}
/**
- * StyledTextAction
+ * The abstract superclass of all styled TextActions. This class
+ * provides some useful methods to manipulate the text attributes.
*/
public abstract static class StyledTextAction extends TextAction
{
/**
- * Constructor StyledTextAction
- * @param nm TODO
+ * Creates a new instance of <code>StyledTextAction</code>.
+ *
+ * @param nm the name of the <code>StyledTextAction</code>
*/
public StyledTextAction(String nm)
{
super(nm);
- // TODO
}
/**
- * getEditor
- * @param event TODO
- * @returns JEditorPane
+ * Returns the <code>JEditorPane</code> component from which the
+ * <code>ActionEvent</code> originated.
+ *
+ * @param event the <code>ActionEvent</code>
+ * @return the <code>JEditorPane</code> component from which the
+ * <code>ActionEvent</code> originated
*/
protected final JEditorPane getEditor(ActionEvent event)
{
- return null; // TODO
+ return (JEditorPane) getTextComponent(event);
}
/**
- * setCharacterAttributes
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
+ * Sets the specified character attributes on the currently selected
+ * text of <code>editor</code>. If <code>editor</code> does not have
+ * a selection, then the attributes are used as input attributes
+ * for newly inserted content.
+ *
+ * @param editor the <code>JEditorPane</code> component
+ * @param atts the text attributes to set
+ * @param replace if <code>true</code> the current attributes of the
+ * selection are replaces, otherwise they are merged
*/
- protected final void setCharacterAttributes(JEditorPane value0,
- AttributeSet value1,
- boolean value2)
+ protected final void setCharacterAttributes(JEditorPane editor,
+ AttributeSet atts,
+ boolean replace)
{
- // TODO
+ Document doc = editor.getDocument();
+ if (doc instanceof StyledDocument)
+ {
+ StyledDocument styleDoc = (StyledDocument) editor.getDocument();
+ EditorKit kit = editor.getEditorKit();
+ if (!(kit instanceof StyledEditorKit))
+ {
+ StyledEditorKit styleKit = (StyledEditorKit) kit;
+ int start = editor.getSelectionStart();
+ int end = editor.getSelectionEnd();
+ int dot = editor.getCaret().getDot();
+ if (start == dot && end == dot)
+ {
+ // If there is no selection, then we only update the
+ // input attributes.
+ MutableAttributeSet inputAttributes =
+ styleKit.getInputAttributes();
+ inputAttributes.addAttributes(atts);
+ }
+ else
+ styleDoc.setCharacterAttributes(start, end, atts, replace);
+ }
+ else
+ throw new AssertionError("The EditorKit for StyledTextActions "
+ + "is expected to be a StyledEditorKit");
+ }
+ else
+ throw new AssertionError("The Document for StyledTextActions is "
+ + "expected to be a StyledDocument.");
}
/**
- * getStyledDocument
- * @param value0 TODO
- * @returns StyledDocument
+ * Returns the {@link StyledDocument} that is used by <code>editor</code>.
+ *
+ * @param editor the <code>JEditorPane</code> from which to get the
+ * <code>StyledDocument</code>
+ *
+ * @return the {@link StyledDocument} that is used by <code>editor</code>
*/
- protected final StyledDocument getStyledDocument(JEditorPane value0)
+ protected final StyledDocument getStyledDocument(JEditorPane editor)
{
- return null; // TODO
+ Document doc = editor.getDocument();
+ if (!(doc instanceof StyledDocument))
+ throw new AssertionError("The Document for StyledEditorKits is "
+ + "expected to be a StyledDocument.");
+
+ return (StyledDocument) doc;
}
/**
- * getStyledEditorKit
- * @param value0 TODO
- * @returns StyledEditorKit
+ * Returns the {@link StyledEditorKit} that is used by <code>editor</code>.
+ *
+ * @param editor the <code>JEditorPane</code> from which to get the
+ * <code>StyledEditorKit</code>
+ *
+ * @return the {@link StyledEditorKit} that is used by <code>editor</code>
*/
- protected final StyledEditorKit getStyledEditorKit(JEditorPane value0)
+ protected final StyledEditorKit getStyledEditorKit(JEditorPane editor)
{
- return null; // TODO
+ EditorKit kit = editor.getEditorKit();
+ if (!(kit instanceof StyledEditorKit))
+ throw new AssertionError("The EditorKit for StyledDocuments is "
+ + "expected to be a StyledEditorKit.");
+
+ return (StyledEditorKit) kit;
}
/**
- * setParagraphAttributes
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
+ * Sets the specified character attributes on the paragraph that
+ * contains the currently selected
+ * text of <code>editor</code>. If <code>editor</code> does not have
+ * a selection, then the attributes are set on the paragraph that
+ * contains the current caret position.
+ *
+ * @param editor the <code>JEditorPane</code> component
+ * @param atts the text attributes to set
+ * @param replace if <code>true</code> the current attributes of the
+ * selection are replaces, otherwise they are merged
*/
- protected final void setParagraphAttributes(JEditorPane value0,
- AttributeSet value1,
- boolean value2)
+ protected final void setParagraphAttributes(JEditorPane editor,
+ AttributeSet atts,
+ boolean replace)
{
- // TODO
+ Document doc = editor.getDocument();
+ if (doc instanceof StyledDocument)
+ {
+ StyledDocument styleDoc = (StyledDocument) editor.getDocument();
+ EditorKit kit = editor.getEditorKit();
+ if (!(kit instanceof StyledEditorKit))
+ {
+ StyledEditorKit styleKit = (StyledEditorKit) kit;
+ int start = editor.getSelectionStart();
+ int end = editor.getSelectionEnd();
+ int dot = editor.getCaret().getDot();
+ if (start == dot && end == dot)
+ {
+ // If there is no selection, then we only update the
+ // input attributes.
+ MutableAttributeSet inputAttributes =
+ styleKit.getInputAttributes();
+ inputAttributes.addAttributes(atts);
+ }
+ else
+ styleDoc.setParagraphAttributes(start, end, atts, replace);
+ }
+ else
+ throw new AssertionError("The EditorKit for StyledTextActions "
+ + "is expected to be a StyledEditorKit");
+ }
+ else
+ throw new AssertionError("The Document for StyledTextActions is "
+ + "expected to be a StyledDocument.");
}
}
/**
- * StyledViewFactory
+ * A {@link ViewFactory} that is able to create {@link View}s for
+ * the <code>Element</code>s that are supported by
+ * <code>StyledEditorKit</code>, namely the following types of Elements:
+ *
+ * <ul>
+ * <li>{@link AbstractDocument.ContentElementName}</li>
+ * <li>{@link AbstractDocument.ParagraphElementName}</li>
+ * <li>{@link AbstractDocument.SectionElementName}</li>
+ * <li>{@link StyleContext.ComponentElementName}</li>
+ * <li>{@link StyleContext.IconElementName}</li>
+ * </ul>
*/
static class StyledViewFactory
implements ViewFactory
{
/**
- * Constructor StyledViewFactory
- */
- StyledViewFactory()
- {
- // TODO
- }
-
- /**
- * create
- * @param value0 TODO
- * @returns View
+ * Creates a {@link View} for the specified <code>Element</code>.
+ *
+ * @param element the <code>Element</code> to create a <code>View</code>
+ * for
+ * @return the <code>View</code> for the specified <code>Element</code>
+ * or <code>null</code> if the type of <code>element</code> is
+ * not supported
*/
- public View create(Element value0)
+ public View create(Element element)
{
- return null; // TODO
+ String name = element.getName();
+ View view = null;
+ if (name.equals(AbstractDocument.ContentElementName))
+ view = new LabelView(element);
+ else if (name.equals(AbstractDocument.ParagraphElementName))
+ view = new ParagraphView(element);
+ else if (name.equals(AbstractDocument.SectionElementName))
+ view = new BoxView(element, View.Y_AXIS);
+ else if (name.equals(StyleConstants.ComponentElementName))
+ view = new ComponentView(element);
+ else if (name.equals(StyleConstants.IconElementName))
+ view = new IconView(element);
+ else
+ throw new AssertionError("Unknown Element type: "
+ + element.getClass().getName() + " : "
+ + name);
+ return view;
}
}
/**
- * AttributeTracker
+ * Keeps track of the caret position and updates the currentRun
+ * <code>Element</code> and the <code>inputAttributes</code>.
*/
- class AttributeTracker
- implements CaretListener, PropertyChangeListener, Serializable
+ class CaretTracker
+ implements CaretListener
{
/**
- * Constructor AttributeTracker
- * @param value0 TODO
- */
- AttributeTracker(StyledEditorKit value0)
- {
- // TODO
- }
-
- /**
- * updateInputAttributes
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
+ * Notifies an update of the caret position.
+ *
+ * @param ev the event for the caret update
*/
- void updateInputAttributes(int value0, int value1, JTextComponent value2)
+ public void caretUpdate(CaretEvent ev)
{
- // TODO
- }
-
- /**
- * propertyChange
- * @param value0 TODO
- */
- public void propertyChange(PropertyChangeEvent value0)
- {
- // TODO
- }
-
- /**
- * caretUpdate
- * @param value0 TODO
- */
- public void caretUpdate(CaretEvent value0)
- {
- // TODO
+ Object source = ev.getSource();
+ if (!(source instanceof JTextComponent))
+ throw new AssertionError("CaretEvents are expected to come from a"
+ + "JTextComponent.");
+
+ JTextComponent text = (JTextComponent) source;
+ Document doc = text.getDocument();
+ if (!(doc instanceof StyledDocument))
+ throw new AssertionError("The Document used by StyledEditorKits is"
+ + "expected to be a StyledDocument");
+
+ StyledDocument styleDoc = (StyledDocument) doc;
+ currentRun = styleDoc.getCharacterElement(ev.getDot());
+ createInputAttributes(currentRun, inputAttributes);
}
}
/**
- * currentRun
+ * Stores the <code>Element</code> at the current caret position. This
+ * is updated by {@link CaretTracker}.
*/
Element currentRun;
/**
- * currentParagraph
+ * The current input attributes. This is updated by {@link CaretTracker}.
*/
- Element currentParagraph;
+ MutableAttributeSet inputAttributes;
/**
- * inputAttributes
+ * The CaretTracker that keeps track of the current input attributes, and
+ * the current character run Element.
*/
- MutableAttributeSet inputAttributes;
+ CaretTracker caretTracker;
+
+ /**
+ * The ViewFactory for StyledEditorKits.
+ */
+ StyledViewFactory viewFactory;
/**
- * Constructor StyledEditorKit
+ * Creates a new instance of <code>StyledEditorKit</code>.
*/
public StyledEditorKit()
{
- // TODO
+ inputAttributes = new SimpleAttributeSet();
}
/**
- * clone
- * @returns Object
+ * Creates an exact copy of this <code>StyledEditorKit</code>.
+ *
+ * @return an exact copy of this <code>StyledEditorKit</code>
*/
public Object clone()
{
- return null; // TODO
+ StyledEditorKit clone = (StyledEditorKit) super.clone();
+ // FIXME: Investigate which fields must be copied.
+ return clone;
}
/**
- * getActions
- * @returns Action[]
+ * Returns the <code>Action</code>s supported by this {@link EditorKit}.
+ * This includes the {@link BoldAction}, {@link ItalicAction} and
+ * {@link UnderlineAction} as well as the <code>Action</code>s supported
+ * by {@link DefaultEditorKit}.
+ *
+ * The other <code>Action</code>s of <code>StyledEditorKit</code> are not
+ * returned here, since they require a parameter and thus custom
+ * instantiation.
+ *
+ * @return the <code>Action</code>s supported by this {@link EditorKit}
*/
public Action[] getActions()
{
- return null; // TODO
+ Action[] actions1 = super.getActions();
+ Action[] myActions = new Action[] { new BoldAction(), new ItalicAction(),
+ new UnderlineAction() };
+ return TextAction.augmentList(actions1, myActions);
}
/**
- * getInputAttributes
- * @returns MutableAttributeSet
+ * Returns the current input attributes. These are automatically set on
+ * any newly inserted content, if not specified otherwise.
+ *
+ * @return the current input attributes
*/
public MutableAttributeSet getInputAttributes()
{
- return null; // TODO
+ return inputAttributes;
}
/**
- * getCharacterAttributeRun
- * @returns Element
+ * Returns the {@link Element} that represents the character run at the
+ * current caret position.
+ *
+ * @return the {@link Element} that represents the character run at the
+ * current caret position
*/
public Element getCharacterAttributeRun()
{
- return null; // TODO
+ return currentRun;
}
/**
- * createDefaultDocument
- * @returns Document
+ * Creates the default {@link Document} supported by this
+ * <code>EditorKit</code>. This is an instance of
+ * {@link DefaultStyledDocument} in this case but may be overridden by
+ * subclasses.
+ *
+ * @return an instance of <code>DefaultStyledDocument</code>
*/
public Document createDefaultDocument()
{
- return null; // TODO
+ return new DefaultStyledDocument();
}
/**
- * install
- * @param component TODO
+ * Installs this <code>EditorKit</code> on the specified {@link JEditorPane}.
+ * This basically involves setting up required listeners on the
+ * <code>JEditorPane</code>.
+ *
+ * @param component the <code>JEditorPane</code> to install this
+ * <code>EditorKit</code> on
*/
public void install(JEditorPane component)
{
- // TODO
+ CaretTracker tracker = new CaretTracker();
+ component.addCaretListener(tracker);
}
/**
- * deinstall
- * @param component TODO
+ * Deinstalls this <code>EditorKit</code> from the specified
+ * {@link JEditorPane}. This basically involves removing all listeners from
+ * <code>JEditorPane</code> that have been set up by this
+ * <code>EditorKit</code>.
+ *
+ * @param component the <code>JEditorPane</code> from which to deinstall this
+ * <code>EditorKit</code>
*/
public void deinstall(JEditorPane component)
{
- // TODO
+ CaretTracker t = caretTracker;
+ if (t != null)
+ component.removeCaretListener(t);
+ caretTracker = null;
}
/**
- * getViewFactory
- * @returns ViewFactory
+ * Returns a {@link ViewFactory} that is able to create {@link View}s
+ * for {@link Element}s that are supported by this <code>EditorKit</code>,
+ * namely the following types of <code>Element</code>s:
+ *
+ * <ul>
+ * <li>{@link AbstractDocument.ContentElementName}</li>
+ * <li>{@link AbstractDocument.ParagraphElementName}</li>
+ * <li>{@link AbstractDocument.SectionElementName}</li>
+ * <li>{@link StyleContext.ComponentElementName}</li>
+ * <li>{@link StyleContext.IconElementName}</li>
+ * </ul>
+ *
+ * @return a {@link ViewFactory} that is able to create {@link View}s
+ * for {@link Element}s that are supported by this <code>EditorKit</code>
*/
public ViewFactory getViewFactory()
{
- return null; // TODO
+ if (viewFactory == null)
+ viewFactory = new StyledViewFactory();
+ return viewFactory;
}
/**
- * createInputAttributes
- * @param element TODO
- * @param set TODO
+ * Copies the text attributes from <code>element</code> to <code>set</code>.
+ * This is called everytime when the caret position changes to keep
+ * track of the current input attributes. The attributes in <code>set</code>
+ * are cleaned before adding the attributes of <code>element</code>.
+ *
+ * This method filters out attributes for element names, <code>Icon</code>s
+ * and <code>Component</code>s.
+ *
+ * @param element the <code>Element</code> from which to copy the text
+ * attributes
+ * @param set the inputAttributes to copy the attributes to
*/
- protected void createInputAttributes(Element element, MutableAttributeSet set)
+ protected void createInputAttributes(Element element,
+ MutableAttributeSet set)
{
- // TODO
+ AttributeSet atts = element.getAttributes();
+ set.removeAttributes(set);
+ // FIXME: Filter out component, icon and element name attributes.
+ set.addAttributes(atts);
}
}
diff --git a/libjava/classpath/javax/swing/text/View.java b/libjava/classpath/javax/swing/text/View.java
index 4d9ed7b..24efba9 100644
--- a/libjava/classpath/javax/swing/text/View.java
+++ b/libjava/classpath/javax/swing/text/View.java
@@ -62,11 +62,6 @@ public abstract class View implements SwingConstants
private View parent;
/**
- * The child views.
- */
- View[] children;
-
- /**
* Creates a new <code>View</code> instance.
*
* @param elem an <code>Element</code> value
@@ -74,7 +69,6 @@ public abstract class View implements SwingConstants
public View(Element elem)
{
elt = elem;
- children = new View[0];
}
public abstract void paint(Graphics g, Shape s);
@@ -92,7 +86,10 @@ public abstract class View implements SwingConstants
public Container getContainer()
{
View parent = getParent();
- return parent != null ? parent.getContainer() : null;
+ if (parent == null)
+ throw new AssertionError("The parent of a View must not be null.");
+
+ return parent.getContainer();
}
public Document getDocument()
@@ -178,12 +175,13 @@ public abstract class View implements SwingConstants
public void append(View view)
{
View[] array = { view };
- replace(getViewCount(), 1, array);
+ int offset = getViewCount();
+ replace(offset, 0, array);
}
public void removeAll()
{
- replace(0, getViewCount(), null);
+ replace(0, getViewCount(), new View[0]);
}
public void remove(int index)
@@ -250,8 +248,6 @@ public abstract class View implements SwingConstants
{
if (parent != null)
parent.preferenceChanged(this, width, height);
- else
- ((JComponent) getContainer()).revalidate();
}
public int getBreakWeight(int axis, float pos, float len)
@@ -351,7 +347,7 @@ public abstract class View implements SwingConstants
Element el = getElement();
DocumentEvent.ElementChange ec = ev.getChange(el);
if (ec != null)
- updateChildren(ec, ev, vf);
+ updateChildren(ec, ev, vf);
forwardUpdate(ec, ev, shape, vf);
updateLayout(ec, ev, shape);
}
@@ -382,16 +378,12 @@ public abstract class View implements SwingConstants
{
Element[] added = ec.getChildrenAdded();
Element[] removed = ec.getChildrenRemoved();
- View[] newChildren = new View[children.length + added.length
- - removed.length];
int index = ec.getIndex();
- System.arraycopy(children, 0, newChildren, 0, index);
- System.arraycopy(children, index, added, 0, added.length);
- int index2 = index + removed.length;
- int len2 = children.length - index2;
- System.arraycopy(children, index2, newChildren, index + added.length,
- len2);
- children = newChildren;
+
+ View[] newChildren = new View[added.length];
+ for (int i = 0; i < added.length; ++i)
+ newChildren[i] = vf.create(added[i]);
+ replace(index, removed.length, newChildren);
return true;
}
@@ -412,9 +404,10 @@ public abstract class View implements SwingConstants
protected void forwardUpdate(DocumentEvent.ElementChange ec,
DocumentEvent ev, Shape shape, ViewFactory vf)
{
- for (int i = 0; i < children.length; i++)
+ int count = getViewCount();
+ for (int i = 0; i < count; i++)
{
- View child = children[i];
+ View child = getView(i);
forwardUpdateToView(child, ev, shape, vf);
}
}
@@ -459,5 +452,104 @@ public abstract class View implements SwingConstants
if (ec != null)
preferenceChanged(this, true, true);
}
-}
+ /**
+ * Maps a position in the document into the coordinate space of the View.
+ * The output rectangle usually reflects the font height but has a width
+ * of zero.
+ *
+ * @param pos the position of the character in the model
+ * @param a the area that is occupied by the view
+ * @param b either {@link Position.Bias#Forward} or
+ * {@link Position.Bias#Backward} depending on the preferred
+ * direction bias. If <code>null</code> this defaults to
+ * <code>Position.Bias.Forward</code>
+ *
+ * @return a rectangle that gives the location of the document position
+ * inside the view coordinate space
+ *
+ * @throws BadLocationException if <code>pos</code> is invalid
+ * @throws IllegalArgumentException if b is not one of the above listed
+ * valid values
+ */
+ public abstract Shape modelToView(int pos, Shape a, Position.Bias b)
+ throws BadLocationException;
+
+ /**
+ * Maps a region in the document into the coordinate space of the View.
+ *
+ * @param p1 the beginning position inside the document
+ * @param b1 the direction bias for the beginning position
+ * @param p2 the end position inside the document
+ * @param b2 the direction bias for the end position
+ * @param a the area that is occupied by the view
+ *
+ * @return a rectangle that gives the span of the document region
+ * inside the view coordinate space
+ *
+ * @throws BadLocationException if <code>p1</code> or <code>p2</code> are
+ * invalid
+ * @throws IllegalArgumentException if b1 or b2 is not one of the above
+ * listed valid values
+ */
+ public Shape modelToView(int p1, Position.Bias b1,
+ int p2, Position.Bias b2, Shape a)
+ throws BadLocationException
+ {
+ if (b1 != Position.Bias.Forward && b1 != Position.Bias.Backward)
+ throw new IllegalArgumentException
+ ("b1 must be either Position.Bias.Forward or Position.Bias.Backward");
+ if (b2 != Position.Bias.Forward && b2 != Position.Bias.Backward)
+ throw new IllegalArgumentException
+ ("b2 must be either Position.Bias.Forward or Position.Bias.Backward");
+ Shape s1 = modelToView(p1, a, b1);
+ Shape s2 = modelToView(p2, a, b2);
+ return s1.getBounds().union(s2.getBounds());
+ }
+
+ /**
+ * Maps coordinates from the <code>View</code>'s space into a position
+ * in the document model.
+ *
+ * @param x the x coordinate in the view space
+ * @param y the y coordinate in the view space
+ * @param a the allocation of this <code>View</code>
+ * @param b the bias to use
+ *
+ * @return the position in the document that corresponds to the screen
+ * coordinates <code>x, y</code>
+ */
+ public abstract int viewToModel(float x, float y, Shape a, Position.Bias[] b);
+
+
+ /**
+ * Dumps the complete View hierarchy. This method can be used for debugging
+ * purposes.
+ */
+ void dump()
+ {
+ // Climb up the hierarchy to the parent.
+ View parent = getParent();
+ if (parent != null)
+ parent.dump();
+ else
+ dump(0);
+ }
+
+ /**
+ * Dumps the view hierarchy below this View with the specified indentation
+ * level.
+ *
+ * @param indent the indentation level to be used for this view
+ */
+ void dump(int indent)
+ {
+ for (int i = 0; i < indent; ++i)
+ System.out.print('.');
+ System.out.println(this);
+
+ int count = getViewCount();
+ for (int i = 0; i < count; ++i)
+ getView(i).dump(indent + 1);
+ }
+}
diff --git a/libjava/classpath/javax/swing/text/html/HTMLEditorKit.java b/libjava/classpath/javax/swing/text/html/HTMLEditorKit.java
index 7ae78ec..c0182fe 100644
--- a/libjava/classpath/javax/swing/text/html/HTMLEditorKit.java
+++ b/libjava/classpath/javax/swing/text/html/HTMLEditorKit.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package javax.swing.text.html;
+import java.io.IOException;
import java.io.Reader;
import java.io.Serializable;
@@ -75,7 +76,7 @@ public class HTMLEditorKit
public abstract void parse(Reader reader, ParserCallback callback,
boolean ignoreCharSet
)
- throws java.io.IOException;
+ throws IOException;
}
/**
@@ -123,8 +124,8 @@ public class HTMLEditorKit
* The method is called when the HTML closing tag ((like &lt;/table&gt;)
* is found or if the parser concludes that the one should be present
* in the current position.
- * @param The tag being handled
- * @position the tag position in the text being parsed.
+ * @param tag The tag being handled
+ * @param position the tag position in the text being parsed.
*/
public void handleEndTag(HTML.Tag tag, int position)
{
diff --git a/libjava/classpath/javax/swing/text/html/parser/DTD.java b/libjava/classpath/javax/swing/text/html/parser/DTD.java
index 63d03ea..f17ca01 100644
--- a/libjava/classpath/javax/swing/text/html/parser/DTD.java
+++ b/libjava/classpath/javax/swing/text/html/parser/DTD.java
@@ -62,7 +62,8 @@ import java.util.Vector;
* <p>
* If you need more information about SGML DTD documents,
* the author suggests to read SGML tutorial on
- * {@link http://www.w3.org/TR/WD-html40-970708/intro/sgmltut.html}.
+ * <a href="http://www.w3.org/TR/WD-html40-970708/intro/sgmltut.html"
+ * >http://www.w3.org/TR/WD-html40-970708/intro/sgmltut.html</a>.
* We also recommend Goldfarb C.F (1991) <i>The SGML Handbook</i>,
* Oxford University Press, 688 p, ISBN: 0198537379.
* </p>
@@ -402,7 +403,7 @@ public class DTD
* placed to the field
* {@link javax.swing.text.html.parser.AttributeList#next },
* creating a linked list.
- * @return
+ * @return The attributes.
*/
protected AttributeList defAttributeList(String name, int type, int modifier,
String default_value,
@@ -541,7 +542,7 @@ public class DTD
* The unknown elements are automatically defined and added
* to the element table.
* @param elements
- * @return
+ * @return The bit set.
*/
private BitSet bitSet(String[] elements)
{
diff --git a/libjava/classpath/javax/swing/text/html/parser/DTDConstants.java b/libjava/classpath/javax/swing/text/html/parser/DTDConstants.java
index a771264..75e7afb 100644
--- a/libjava/classpath/javax/swing/text/html/parser/DTDConstants.java
+++ b/libjava/classpath/javax/swing/text/html/parser/DTDConstants.java
@@ -40,14 +40,16 @@ package javax.swing.text.html.parser;
/**
* <p>This class defines the SGML basic types, used for describing HTML 4.01
- * at {@link http://www.w3.org/TR/html4/types.html }. Not all constants,
+ * at <a href="http://www.w3.org/TR/html4/types.html"
+ * >http://www.w3.org/TR/html4/types.html</a>. Not all constants,
* defined here, are actually used in HTML 4.01 SGML specification. Some others
* are defined just as part of the required implementation.
* </p>
* <p>
* If you need more information about SGML DTD documents,
* the author suggests to read SGML tutorial on
- * {@link http://www.w3.org/TR/WD-html40-970708/intro/sgmltut.html}.
+ * <a href="http://www.w3.org/TR/WD-html40-970708/intro/sgmltut.html"
+ * >http://www.w3.org/TR/WD-html40-970708/intro/sgmltut.html</a>.
* We also recommend Goldfarb C.F (1991) <i>The SGML Handbook</i>,
* Oxford University Press, 688 p, ISBN: 0198537379.
* </p>
diff --git a/libjava/classpath/javax/swing/text/html/parser/DocumentParser.java b/libjava/classpath/javax/swing/text/html/parser/DocumentParser.java
index c706f4d..164297f 100644
--- a/libjava/classpath/javax/swing/text/html/parser/DocumentParser.java
+++ b/libjava/classpath/javax/swing/text/html/parser/DocumentParser.java
@@ -167,7 +167,7 @@ public class DocumentParser
* to get a default DTD; you must either refer to the implementation -
* specific packages, write your own DTD or obtain the working instance
* of parser in other way, for example, by calling
- * {@link javax.swing.text.html.HTMLEditorKit#getParser() }.
+ * {@link javax.swing.text.html.HTMLEditorKit#getParser()}.
* @param a_dtd a DTD to use.
*/
public DocumentParser(DTD a_dtd)
@@ -180,18 +180,18 @@ public class DocumentParser
* Parses the HTML document, calling methods of the provided
* callback. This method must be multithread - safe.
* @param reader The reader to read the HTML document from
- * @param callback The callback that is notifyed about the presence
+ * @param aCallback The callback that is notifyed about the presence
* of HTML elements in the document.
* @param ignoreCharSet If thrue, any charset changes during parsing
* are ignored.
* @throws java.io.IOException
*/
- public void parse(Reader reader, HTMLEditorKit.ParserCallback a_callback,
+ public void parse(Reader reader, HTMLEditorKit.ParserCallback aCallback,
boolean ignoreCharSet
)
throws IOException
{
- callBack = a_callback;
+ callBack = aCallback;
gnu.parse(reader);
callBack.handleEndOfLineString(gnu.getEndOfLineSequence());
@@ -230,7 +230,7 @@ public class DocumentParser
* The method is called when the HTML closing tag ((like &lt;/table&gt;)
* is found or if the parser concludes that the one should be present
* in the current position.
- * @param The tag being handled
+ * @param tag The tag being handled
*/
protected void handleEndTag(TagElement tag)
{
@@ -245,7 +245,7 @@ public class DocumentParser
* The method is called when the HTML opening tag ((like &lt;table&gt;)
* is found or if the parser concludes that the one should be present
* in the current position.
- * @param The tag being handled
+ * @param tag The tag being handled
*/
protected void handleStartTag(TagElement tag)
{
diff --git a/libjava/classpath/javax/swing/text/html/parser/Element.java b/libjava/classpath/javax/swing/text/html/parser/Element.java
index f0a0f33..098983c 100644
--- a/libjava/classpath/javax/swing/text/html/parser/Element.java
+++ b/libjava/classpath/javax/swing/text/html/parser/Element.java
@@ -225,7 +225,7 @@ public final class Element
/**
* Get all attributes of this document as an attribute list.
- * @return
+ * @return The attribute list.
*/
public AttributeList getAttributes()
{
diff --git a/libjava/classpath/javax/swing/text/html/parser/Parser.java b/libjava/classpath/javax/swing/text/html/parser/Parser.java
index 5867107..7ff6853 100644
--- a/libjava/classpath/javax/swing/text/html/parser/Parser.java
+++ b/libjava/classpath/javax/swing/text/html/parser/Parser.java
@@ -327,7 +327,7 @@ public class Parser
* Handle the tag with no content, like &lt;br&gt;. The method is
* called for the elements that, in accordance with the current DTD,
* has an empty content.
- * @param The tag being handled.
+ * @param tag The tag being handled.
* @throws javax.swing.text.ChangedCharSetException
*/
protected void handleEmptyTag(TagElement tag)
@@ -339,7 +339,7 @@ public class Parser
* The method is called when the HTML closing tag ((like &lt;/table&gt;)
* is found or if the parser concludes that the one should be present
* in the current position.
- * @param The tag being handled
+ * @param tag The tag being handled
*/
protected void handleEndTag(TagElement tag)
{
@@ -354,7 +354,7 @@ public class Parser
* The method is called when the HTML opening tag ((like &lt;table&gt;)
* is found or if the parser concludes that the one should be present
* in the current position.
- * @param The tag being handled
+ * @param tag The tag being handled
*/
protected void handleStartTag(TagElement tag)
{
@@ -383,7 +383,7 @@ public class Parser
* both title starting and closing tags are already behind.
* The passed argument contains the concatenation of all
* title text sections.
- * @param The title text.
+ * @param title The title text.
*/
protected void handleTitle(char[] title)
{
@@ -402,7 +402,7 @@ public class Parser
/**
* Constructs the tag from the given element.
- * @param the tag base {@link javax.swing.text.html.parser.Element}
+ * @param element the tag base {@link javax.swing.text.html.parser.Element}
* @param isSupposed true if the tag is not actually present in the
* html input, but the parser supposes that it should to occur in
* the current location.
@@ -427,7 +427,7 @@ public class Parser
* is found or if the parser concludes that the one should be present
* in the current position. The method is called immediately before
* calling the handleStartTag.
- * @param The tag
+ * @param tag The tag
*/
protected void startTag(TagElement tag)
throws ChangedCharSetException
diff --git a/libjava/classpath/javax/swing/text/html/parser/ParserDelegator.java b/libjava/classpath/javax/swing/text/html/parser/ParserDelegator.java
index 4b54e8a..e5d2db4 100644
--- a/libjava/classpath/javax/swing/text/html/parser/ParserDelegator.java
+++ b/libjava/classpath/javax/swing/text/html/parser/ParserDelegator.java
@@ -143,7 +143,7 @@ public class ParserDelegator
* Parses the HTML document, calling methods of the provided
* callback. This method must be multithread - safe.
* @param reader The reader to read the HTML document from
- * @param callback The callback that is notifyed about the presence
+ * @param a_callback The callback that is notifyed about the presence
* of HTML elements in the document.
* @param ignoreCharSet If thrue, any charset changes during parsing
* are ignored.
@@ -191,7 +191,7 @@ public class ParserDelegator
* all subsequent calls to the parse(...) . If you need to specify
* your DTD locally, simply {@link javax.swing.text.html.parser.Parser}
* instead.
- * @param dtd The DTD that will be used to parse documents by this class.
+ * @param a_dtd The DTD that will be used to parse documents by this class.
* @param name The name of this DTD.
* @return No standard is specified on which instance of DTD must be
* returned by this method, and it is recommended to leave the returned
diff --git a/libjava/classpath/javax/swing/tree/AbstractLayoutCache.java b/libjava/classpath/javax/swing/tree/AbstractLayoutCache.java
index 9f8e9da..adece10 100644
--- a/libjava/classpath/javax/swing/tree/AbstractLayoutCache.java
+++ b/libjava/classpath/javax/swing/tree/AbstractLayoutCache.java
@@ -134,11 +134,11 @@ public abstract class AbstractLayoutCache
/**
* getNodeDimensions
*
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- * @param value3 TODO
- * @param value4 TODO
+ * @param value TODO
+ * @param row TODO
+ * @param depth TODO
+ * @param expanded TODO
+ * @param bounds TODO
*
* @return Rectangle
*/
@@ -154,7 +154,7 @@ public abstract class AbstractLayoutCache
/**
* Sets the model that provides the tree data.
*
- * @param the model
+ * @param model the model
*/
public void setModel(TreeModel model)
{
@@ -318,7 +318,7 @@ public abstract class AbstractLayoutCache
*
* @return int
*/
- public abstract int getVisibleChildCount(TreePath value0);
+ public abstract int getVisibleChildCount(TreePath path);
/**
* setExpandedState
diff --git a/libjava/classpath/javax/swing/tree/DefaultTreeCellEditor.java b/libjava/classpath/javax/swing/tree/DefaultTreeCellEditor.java
index e509d2c..7a44e73 100644
--- a/libjava/classpath/javax/swing/tree/DefaultTreeCellEditor.java
+++ b/libjava/classpath/javax/swing/tree/DefaultTreeCellEditor.java
@@ -1,5 +1,5 @@
/* DefaultTreeCellEditor.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,17 +43,30 @@ import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
+import java.awt.FontMetrics;
import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.Rectangle;
+import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.MouseEvent;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.EventObject;
+import javax.swing.CellRendererPane;
+import javax.swing.DefaultCellEditor;
import javax.swing.Icon;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
import javax.swing.JTextField;
import javax.swing.JTree;
+import javax.swing.SwingUtilities;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.event.CellEditorListener;
import javax.swing.event.EventListenerList;
@@ -90,29 +103,62 @@ public class DefaultTreeCellEditor
}
/**
- * getPreferredSize
- * @return Dimension
+ * Returns the preferred size for the Container.
+ *
+ * @return Dimension of EditorContainer
*/
public Dimension getPreferredSize()
{
- return null; // TODO
+ Dimension containerSize = super.getPreferredSize();
+ containerSize.width += DefaultTreeCellEditor.this.offset;
+ return containerSize;
}
/**
- * paint
- * @param value0 TODO
+ * Overrides Container.paint to paint the node's icon and use the selection
+ * color for the background.
+ *
+ * @param g -
+ * the specified Graphics window
*/
- public void paint(Graphics value0)
+ public void paint(Graphics g)
{
- // TODO
+ Rectangle tr = tree.getPathBounds(lastPath);
+ if (tr != null)
+ {
+ Insets i = ((DefaultTextField) editingComponent).getBorder()
+ .getBorderInsets(this);
+ int textIconGap = 3;
+ tr.x -= i.left;
+
+ // paints icon
+ if (editingIcon != null)
+ {
+ editingIcon.paintIcon(this, g, tr.x - editingIcon.
+ getIconWidth()/2, tr.y + i.top + i.bottom);
+ tr.x += editingIcon.getIconWidth()/2 + textIconGap;
+ }
+
+ tr.width += offset;
+
+ // paint background
+ g.translate(tr.x, tr.y);
+ editingComponent.setSize(new Dimension(tr.width, tr.height));
+ editingComponent.paint(g);
+ g.translate(-tr.x, -tr.y);
+ }
+ super.paint(g);
}
/**
- * doLayout
+ * Lays out this Container. If editing, the editor will be placed at offset
+ * in the x direction and 0 for y.
*/
public void doLayout()
{
- // TODO
+ if (DefaultTreeCellEditor.this.tree.isEditing())
+ setLocation(offset, 0);
+ super.doLayout();
}
}
@@ -137,12 +183,22 @@ public class DefaultTreeCellEditor
}
/**
- * getFont
- * @return Font
+ * Gets the font of this component.
+ * @return this component's font; if a font has not been set for
+ * this component, the font of its parent is returned (if the parent
+ * is not null, otherwise null is returned).
*/
public Font getFont()
{
- return null; // TODO
+ Font font = super.getFont();
+ if (font == null)
+ {
+ Component parent = getParent();
+ if (parent != null)
+ return parent.getFont();
+ return null;
+ }
+ return font;
}
/**
@@ -156,108 +212,184 @@ public class DefaultTreeCellEditor
}
/**
- * getPreferredSize
- * @return Dimension
+ * Overrides JTextField.getPreferredSize to return the preferred size
+ * based on current font, if set, or else use renderer's font.
+ *
+ * @return the Dimension of this textfield.
*/
public Dimension getPreferredSize()
{
- return null; // TODO
+ String s = getText();
+
+ Font f = getFont();
+
+ if (f != null)
+ {
+ FontMetrics fm = getToolkit().getFontMetrics(f);
+
+ return new Dimension(SwingUtilities.computeStringWidth(fm, s),
+ fm.getHeight());
+ }
+ return renderer.getPreferredSize();
}
}
private EventListenerList listenerList = new EventListenerList();
-
+
/**
- * realEditor
+ * Editor handling the editing.
*/
protected TreeCellEditor realEditor;
/**
- * renderer
+ * Renderer, used to get border and offsets from.
*/
protected DefaultTreeCellRenderer renderer;
/**
- * editingContainer
+ * Editing container, will contain the editorComponent.
*/
protected Container editingContainer;
/**
- * editingComponent
+ * Component used in editing, obtained from the editingContainer.
*/
protected transient Component editingComponent;
/**
- * canEdit
+ * As of Java 2 platform v1.4 this field should no longer be used.
+ * If you wish to provide similar behavior you should directly
+ * override isCellEditable.
*/
protected boolean canEdit;
/**
- * offset
+ * Used in editing. Indicates x position to place editingComponent.
*/
protected transient int offset;
/**
- * tree
+ * JTree instance listening too.
*/
protected transient JTree tree;
/**
- * lastPath
+ * Last path that was selected.
*/
protected transient TreePath lastPath;
/**
- * timer
+ * Used before starting the editing session.
*/
- protected transient javax.swing.Timer timer; // TODO
+ protected transient javax.swing.Timer timer;
/**
- * lastRow
+ * Row that was last passed into getTreeCellEditorComponent.
*/
protected transient int lastRow;
/**
- * borderSelectionColor
+ * True if the border selection color should be drawn.
*/
protected Color borderSelectionColor;
/**
- * editingIcon
+ * Icon to use when editing.
*/
protected transient Icon editingIcon;
/**
- * font
+ * Font to paint with, null indicates font of renderer is to be used.
*/
protected Font font;
-
+
/**
- * Constructor DefaultTreeCellEditor
- * @param value0 TODO
- * @param value1 TODO
+ * Helper field used to save the last path seen while the timer was
+ * running.
*/
- public DefaultTreeCellEditor(JTree value0, DefaultTreeCellRenderer value1)
+ private TreePath tPath;
+
+ /**
+ * Constructs a DefaultTreeCellEditor object for a JTree using the
+ * specified renderer and a default editor. (Use this constructor
+ * for normal editing.)
+ *
+ * @param tree - a JTree object
+ * @param renderer - a DefaultTreeCellRenderer object
+ */
+ public DefaultTreeCellEditor(JTree tree, DefaultTreeCellRenderer renderer)
{
- // TODO
+ this(tree, renderer, null);
}
/**
- * Constructor DefaultTreeCellEditor
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
+ * Constructs a DefaultTreeCellEditor object for a JTree using the specified
+ * renderer and the specified editor. (Use this constructor
+ * for specialized editing.)
+ *
+ * @param tree - a JTree object
+ * @param renderer - a DefaultTreeCellRenderer object
+ * @param editor - a TreeCellEditor object
*/
- public DefaultTreeCellEditor(JTree value0, DefaultTreeCellRenderer value1,
- TreeCellEditor value2)
+ public DefaultTreeCellEditor(JTree tree, DefaultTreeCellRenderer renderer,
+ TreeCellEditor editor)
{
- // TODO
+ setTree(tree);
+ this.renderer = renderer;
+
+ if (editor == null)
+ editor = createTreeCellEditor();
+ realEditor = editor;
+
+ lastPath = tree.getLeadSelectionPath();
+ tree.addTreeSelectionListener(this);
+ editingContainer = createContainer();
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ setFont(defaults.getFont("Tree.font"));
+ setBorderSelectionColor(defaults.getColor("Tree.selectionBorderColor"));
+ editingIcon = renderer.getIcon();
+ timer = new javax.swing.Timer(1200, this);
}
/**
+ * Configures the editing component whenever it is null.
+ *
+ * @param tree- the tree to configure to component for.
+ * @param renderer- the renderer used to set up the nodes
+ * @param editor- the editor used
+ */
+ private void configureEditingComponent(JTree tree,
+ DefaultTreeCellRenderer renderer,
+ TreeCellEditor editor)
+ {
+ if (tree != null && lastPath != null)
+ {
+ Object val = lastPath.getLastPathComponent();
+ boolean isLeaf = tree.getModel().isLeaf(val);
+ boolean expanded = tree.isExpanded(lastPath);
+ determineOffset(tree, val, true, expanded, isLeaf, lastRow);
+
+ // set up icon
+ if (isLeaf)
+ renderer.setIcon(renderer.getLeafIcon());
+ else if (expanded)
+ renderer.setIcon(renderer.getOpenIcon());
+ else
+ renderer.setIcon(renderer.getClosedIcon());
+ editingIcon = renderer.getIcon();
+
+ editingComponent = getTreeCellEditorComponent(tree, val, true,
+ expanded, isLeaf, lastRow);
+ }
+ }
+
+ /**
* writeObject
- * @param value0 TODO
- * @exception IOException TODO
+ *
+ * @param value0
+ * TODO
+ * @exception IOException
+ * TODO
*/
private void writeObject(ObjectOutputStream value0) throws IOException
{
@@ -277,102 +409,152 @@ public class DefaultTreeCellEditor
}
/**
- * setBorderSelectionColor
- * @param value0 TODO
+ * Sets the color to use for the border.
+ * @param newColor - the new border color
*/
- public void setBorderSelectionColor(Color value0)
+ public void setBorderSelectionColor(Color newColor)
{
- // TODO
+ this.borderSelectionColor = newColor;
}
/**
- * getBorderSelectionColor
+ * Returns the color the border is drawn.
* @return Color
*/
public Color getBorderSelectionColor()
{
- return null; // TODO
+ return borderSelectionColor;
}
/**
- * setFont
- * @param value0 TODO
+ * Sets the font to edit with. null indicates the renderers
+ * font should be used. This will NOT override any font you have
+ * set in the editor the receiver was instantied with. If null for
+ * an editor was passed in, a default editor will be created that
+ * will pick up this font.
+ *
+ * @param font - the editing Font
*/
- public void setFont(Font value0)
+ public void setFont(Font font)
{
- // TODO
+ if (font != null)
+ this.font = font;
+ else
+ this.font = renderer.getFont();
}
/**
- * getFont
- * @return Font
+ * Gets the font used for editing.
+ *
+ * @return the editing font
*/
public Font getFont()
{
- return null; // TODO
+ return font;
}
/**
- * getTreeCellEditorComponent
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- * @param value3 TODO
- * @param value4 TODO
- * @param value5 TODO
- * @return Component
- */
- public Component getTreeCellEditorComponent(JTree value0, Object value1,
- boolean value2, boolean value3,
- boolean value4, int value5)
+ * Configures the editor. Passed onto the realEditor.
+ * Sets an initial value for the editor. This will cause
+ * the editor to stopEditing and lose any partially edited value
+ * if the editor is editing when this method is called.
+ * Returns the component that should be added to the client's Component
+ * hierarchy. Once installed in the client's hierarchy this component will
+ * then be able to draw and receive user input.
+ *
+ * @param tree - the JTree that is asking the editor to edit; this parameter can be null
+ * @param value - the value of the cell to be edited
+ * @param isSelected - true is the cell is to be rendered with selection highlighting
+ * @param expanded - true if the node is expanded
+ * @param leaf - true if the node is a leaf node
+ * @param row - the row index of the node being edited
+ *
+ * @return the component for editing
+ */
+ public Component getTreeCellEditorComponent(JTree tree, Object value,
+ boolean isSelected, boolean expanded,
+ boolean leaf, int row)
{
- return null; // TODO
+ if (realEditor == null)
+ createTreeCellEditor();
+
+ return realEditor.getTreeCellEditorComponent(tree, value, isSelected,
+ expanded, leaf, row);
}
/**
- * getCellEditorValue
- * @return Object
+ * Returns the value currently being edited.
+ *
+ * @return the value currently being edited
*/
public Object getCellEditorValue()
{
- return null; // TODO
+ return editingComponent;
}
-
- /**
- * isCellEditable
- * @param value0 TODO
- * @return boolean
- */
- public boolean isCellEditable(EventObject value0)
- {
- return false; // TODO
+
+ /**
+ * If the realEditor returns true to this message, prepareForEditing
+ * is messaged and true is returned.
+ *
+ * @param event - the event the editor should use to consider whether to begin editing or not
+ * @return true if editing can be started
+ */
+ public boolean isCellEditable(EventObject event)
+ {
+ if (editingComponent == null)
+ configureEditingComponent(tree, renderer, realEditor);
+
+ if (editingComponent != null && realEditor.isCellEditable(event))
+ {
+ prepareForEditing();
+ return true;
+ }
+
+ // Cell may not be currently editable, but may need to start timer.
+ if (shouldStartEditingTimer(event))
+ startEditingTimer();
+ return false;
}
/**
- * shouldSelectCell
- * @param value0 TODO
- * @return boolean
+ * Messages the realEditor for the return value.
+ *
+ * @param event -
+ * the event the editor should use to start editing
+ * @return true if the editor would like the editing cell to be selected;
+ * otherwise returns false
*/
- public boolean shouldSelectCell(EventObject value0)
+ public boolean shouldSelectCell(EventObject event)
{
- return false; // TODO
+ return true;
}
/**
- * stopCellEditing
- * @return boolean
+ * If the realEditor will allow editing to stop, the realEditor
+ * is removed and true is returned, otherwise false is returned.
+ * @return true if editing was stopped; false otherwise
*/
public boolean stopCellEditing()
{
- return false; // TODO
+ if (editingComponent != null && realEditor.stopCellEditing())
+ {
+ timer.stop();
+ return true;
+ }
+ return false;
}
/**
- * cancelCellEditing
+ * Messages cancelCellEditing to the realEditor and removes it
+ * from this instance.
*/
public void cancelCellEditing()
{
- // TODO
+ if (editingComponent != null)
+ {
+ timer.stop();
+ realEditor.cancelCellEditing();
+ }
}
/**
@@ -382,7 +564,7 @@ public class DefaultTreeCellEditor
*/
public void addCellEditorListener(CellEditorListener listener)
{
- listenerList.add(CellEditorListener.class, listener);
+ realEditor.addCellEditorListener(listener);
}
/**
@@ -392,7 +574,7 @@ public class DefaultTreeCellEditor
*/
public void removeCellEditorListener(CellEditorListener listener)
{
- listenerList.remove(CellEditorListener.class, listener);
+ realEditor.removeCellEditorListener(listener);
}
/**
@@ -408,109 +590,157 @@ public class DefaultTreeCellEditor
}
/**
- * valueChanged
- * @param value0 TODO
+ * Resets lastPath.
+ *
+ * @param e - the event that characterizes the change.
*/
- public void valueChanged(TreeSelectionEvent value0)
+ public void valueChanged(TreeSelectionEvent e)
{
- // TODO
+ tPath = lastPath;
+ lastPath = e.getNewLeadSelectionPath();
+ lastRow = tree.getRowForPath(lastPath);
+ configureEditingComponent(tree, renderer, realEditor);
}
-
+
/**
- * actionPerformed
- * @param value0 TODO
+ * Messaged when the timer fires, this will start the editing session.
+ *
+ * @param @param e - the event that characterizes the action.
*/
- public void actionPerformed(ActionEvent value0)
+ public void actionPerformed(ActionEvent e)
{
- // TODO
+ if (lastPath != null && tPath != null && tPath.equals(lastPath))
+ {
+ tree.startEditingAtPath(lastPath);
+ timer.stop();
+ }
}
/**
- * setTree
- * @param value0 TODO
+ * Sets the tree currently editing for. This is needed to add a selection
+ * listener.
+ *
+ * @param newTree -
+ * the new tree to be edited
*/
- protected void setTree(JTree value0)
+ protected void setTree(JTree newTree)
{
- // TODO
+ tree = newTree;
}
/**
- * shouldStartEditingTimer
- * @param value0 TODO
- * @return boolean
+ * Returns true if event is a MouseEvent and the click count is 1.
+ *
+ * @param event - the event being studied
+ * @return true if editing should start
*/
- protected boolean shouldStartEditingTimer(EventObject value0)
+ protected boolean shouldStartEditingTimer(EventObject event)
{
- return false; // TODO
+ if ((event instanceof MouseEvent) &&
+ ((MouseEvent) event).getClickCount() == 1)
+ return true;
+ return false;
}
/**
- * startEditingTimer
+ * Starts the editing timer.
*/
protected void startEditingTimer()
{
- // TODO
+ if (timer == null)
+ timer = new javax.swing.Timer(1200, this);
+ if (!timer.isRunning())
+ timer.start();
}
/**
- * canEditImmediately
- * @param value0 TODO
- * @return boolean
+ * Returns true if event is null, or it is a MouseEvent with
+ * a click count > 2 and inHitRegion returns true.
+ *
+ * @param event - the event being studied
+ * @return true if event is null, or it is a MouseEvent with
+ * a click count > 2 and inHitRegion returns true
*/
- protected boolean canEditImmediately(EventObject value0)
+ protected boolean canEditImmediately(EventObject event)
{
- return false; // TODO
+ if (event == null || !(event instanceof MouseEvent) || (((MouseEvent) event).
+ getClickCount() > 2 && inHitRegion(((MouseEvent) event).getX(),
+ ((MouseEvent) event).getY())))
+ return true;
+ return false;
}
/**
- * inHitRegion
- * @param value0 TODO
- * @param value1 TODO
- * @return boolean
+ * Returns true if the passed in location is a valid mouse location
+ * to start editing from. This is implemented to return false if x is
+ * less than or equal to the width of the icon and icon
+ * gap displayed by the renderer. In other words this returns true if
+ * the user clicks over the text part displayed by the renderer, and
+ * false otherwise.
+ *
+ * @param x - the x-coordinate of the point
+ * @param y - the y-coordinate of the point
+ *
+ * @return true if the passed in location is a valid mouse location
*/
- protected boolean inHitRegion(int value0, int value1)
+ protected boolean inHitRegion(int x, int y)
{
- return false; // TODO
+ Rectangle bounds = tree.getPathBounds(lastPath);
+
+ return bounds.contains(x, y);
}
/**
* determineOffset
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- * @param value3 TODO
- * @param value4 TODO
- * @param value5 TODO
- */
- protected void determineOffset(JTree value0, Object value1, boolean value2,
- boolean value3, boolean value4, int value5)
+ * @param tree -
+ * @param value -
+ * @param isSelected -
+ * @param expanded -
+ * @param leaf -
+ * @param row -
+ */
+ protected void determineOffset(JTree tree, Object value, boolean isSelected,
+ boolean expanded, boolean leaf, int row)
{
- // TODO
+ renderer.getTreeCellRendererComponent(tree, value, isSelected, expanded,
+ leaf, row, true);
+ Icon c = renderer.getIcon();
+ if (c != null)
+ offset = renderer.getIconTextGap() + c.getIconWidth();
+ else
+ offset = 0;
}
/**
- * prepareForEditing
+ * Invoked just before editing is to start. Will add the
+ * editingComponent to the editingContainer.
*/
protected void prepareForEditing()
{
- // TODO
+ editingContainer.add(editingComponent);
}
/**
- * createContainer
- * @return Container
+ * Creates the container to manage placement of editingComponent.
+ *
+ * @return the container to manage the placement of the editingComponent.
*/
protected Container createContainer()
{
- return null; // TODO
+ return new DefaultTreeCellEditor.EditorContainer();
}
/**
- * createTreeCellEditor
- * @return TreeCellEditor
+ * This is invoked if a TreeCellEditor is not supplied in the constructor.
+ * It returns a TextField editor.
+ *
+ * @return a new TextField editor
*/
protected TreeCellEditor createTreeCellEditor()
{
- return null; // TODO
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ realEditor = new DefaultCellEditor(new DefaultTreeCellEditor.DefaultTextField(
+ defaults.getBorder("Tree.selectionBorder")));
+ return realEditor;
}
}
diff --git a/libjava/classpath/javax/swing/tree/DefaultTreeCellRenderer.java b/libjava/classpath/javax/swing/tree/DefaultTreeCellRenderer.java
index db69c60..4a353b3 100644
--- a/libjava/classpath/javax/swing/tree/DefaultTreeCellRenderer.java
+++ b/libjava/classpath/javax/swing/tree/DefaultTreeCellRenderer.java
@@ -1,39 +1,40 @@
/* DefaultTreeCellRenderer.java
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ 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., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
package javax.swing.tree;
@@ -41,14 +42,18 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
+import java.awt.FontMetrics;
import java.awt.Graphics;
+import java.awt.Insets;
import java.awt.Rectangle;
+import javax.swing.border.Border;
import javax.swing.Icon;
import javax.swing.JLabel;
import javax.swing.JTree;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
+import javax.swing.SwingUtilities;
import javax.swing.plaf.UIResource;
/**
@@ -57,535 +62,626 @@ import javax.swing.plaf.UIResource;
* @author Andrew Selkirk
*/
public class DefaultTreeCellRenderer
- extends JLabel
- implements TreeCellRenderer
+ extends JLabel
+ implements TreeCellRenderer
{
- // -------------------------------------------------------------
- // Variables --------------------------------------------------
- // -------------------------------------------------------------
-
- /**
- * selected
- */
- protected boolean selected;
-
- /**
- * hasFocus
- */
- protected boolean hasFocus;
-
- /**
- * drawsFocusBorderAroundIcon
- */
- private boolean drawsFocusBorderAroundIcon;
-
- /**
- * closedIcon
- */
- protected transient Icon closedIcon;
-
- /**
- * leafIcon
- */
- protected transient Icon leafIcon;
-
- /**
- * openIcon
- */
- protected transient Icon openIcon;
-
- /**
- * textSelectionColor
- */
- protected Color textSelectionColor;
-
- /**
- * textNonSelectionColor
- */
- protected Color textNonSelectionColor;
-
- /**
- * backgroundSelectionColor
- */
- protected Color backgroundSelectionColor;
-
- /**
- * backgroundNonSelectionColor
- */
- protected Color backgroundNonSelectionColor;
-
- /**
- * borderSelectionColor
- */
- protected Color borderSelectionColor;
-
-
- // -------------------------------------------------------------
- // Initialization ---------------------------------------------
- // -------------------------------------------------------------
-
- /**
- * Constructor DefaultTreeCellRenderer
- */
- public DefaultTreeCellRenderer()
- {
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- setLeafIcon(getDefaultLeafIcon());
- setOpenIcon(getDefaultOpenIcon());
- setClosedIcon(getDefaultClosedIcon());
-
- setTextNonSelectionColor(defaults.getColor("Tree.textForeground"));
- setTextSelectionColor(defaults.getColor("Tree.selectionForeground"));
- setBackgroundNonSelectionColor(defaults
- .getColor("Tree.nonSelectionBackground"));
- setBackgroundSelectionColor(defaults
- .getColor("Tree.selectionBackground"));
- setBorderSelectionColor(defaults
- .getColor("Tree.selectionBorderColor"));
- }
-
- // -------------------------------------------------------------
- // Methods ----------------------------------------------------
- // -------------------------------------------------------------
-
- /**
- * getDefaultOpenIcon
- *
- * @returns Icon
- */
- public Icon getDefaultOpenIcon()
- {
- return UIManager.getLookAndFeelDefaults().getIcon("Tree.openIcon");
- }
-
- /**
- * getDefaultClosedIcon
- *
- * @returns Icon
- */
- public Icon getDefaultClosedIcon()
- {
- return UIManager.getLookAndFeelDefaults().getIcon("Tree.closedIcon");
- }
-
- /**
- * getDefaultLeafIcon
- *
- * @returns Icon
- */
- public Icon getDefaultLeafIcon()
- {
- return UIManager.getLookAndFeelDefaults().getIcon("Tree.leafIcon");
- }
-
- /**
- * setOpenIcon
- *
- * @param value0 TODO
- */
- public void setOpenIcon(Icon i)
- {
- openIcon = i;
- }
-
- /**
- * getOpenIcon
- *
- * @returns Icon
- */
- public Icon getOpenIcon()
- {
- return openIcon;
- }
-
- /**
- * setClosedIcon
- *
- * @param value0 TODO
- */
- public void setClosedIcon(Icon i)
- {
- closedIcon = i;
- }
-
- /**
- * getClosedIcon
- *
- * @returns Icon
- */
- public Icon getClosedIcon()
- {
- return closedIcon;
- }
-
- /**
- * setLeafIcon
- *
- * @param value0 TODO
- */
- public void setLeafIcon(Icon i)
- {
- leafIcon = i;
- }
-
- /**
- * getLeafIcon
- *
- * @returns Icon
- */
- public Icon getLeafIcon()
- {
- return leafIcon;
- }
-
- /**
- * setTextSelectionColor
- *
- * @param value0 TODO
- */
- public void setTextSelectionColor(Color c)
- {
- textSelectionColor = c;
- }
-
- /**
- * getTextSelectionColor
- *
- * @returns Color
- */
- public Color getTextSelectionColor()
- {
- return textSelectionColor;
- }
-
- /**
- * setTextNonSelectionColor
- *
- * @param value0 TODO
- */
- public void setTextNonSelectionColor(Color c)
- {
- textNonSelectionColor = c;
- }
-
- /**
- * getTextNonSelectionColor
- *
- * @returns Color
- */
- public Color getTextNonSelectionColor()
- {
- return textNonSelectionColor;
- }
-
- /**
- * setBackgroundSelectionColor
- *
- * @param value0 TODO
- */
- public void setBackgroundSelectionColor(Color c)
- {
- backgroundSelectionColor = c;
- }
-
- /**
- * getBackgroundSelectionColor
- *
- * @returns Color
- */
- public Color getBackgroundSelectionColor()
- {
- return backgroundSelectionColor;
- }
-
- /**
- * setBackgroundNonSelectionColor
- *
- * @param value0 TODO
- */
- public void setBackgroundNonSelectionColor(Color c)
- {
- backgroundNonSelectionColor = c;
- }
-
- /**
- * getBackgroundNonSelectionColor
- *
- * @returns Color
- */
- public Color getBackgroundNonSelectionColor()
- {
- return backgroundNonSelectionColor;
- }
-
- /**
- * setBorderSelectionColor
- *
- * @param value0 TODO
- */
- public void setBorderSelectionColor(Color c)
- {
- borderSelectionColor = c;
- }
-
- /**
- * getBorderSelectionColor
- *
- * @returns Color
- */
- public Color getBorderSelectionColor()
- {
- return borderSelectionColor;
- }
-
- /**
- * setFont
- *
- * @param value0 TODO
- */
- public void setFont(Font f)
- {
- if (f != null && f instanceof UIResource)
- f = null;
- super.setFont(f);
- }
-
- /**
- * setBackground
- *
- * @param value0 TODO
- */
- public void setBackground(Color c)
- {
- if (c != null && c instanceof UIResource)
- c = null;
- super.setBackground(c);
- }
-
- /**
- * getTreeCellRendererComponent
- *
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- * @param value3 TODO
- * @param value4 TODO
- * @param value5 TODO
- * @param value6 TODO
- * @returns Component
- */
- public Component getTreeCellRendererComponent(JTree tree, Object val,
- boolean selected, boolean expanded, boolean leaf, int row,
- boolean hasFocus)
- {
- if (val instanceof Icon)
- setIcon((Icon) val);
- else
+ // -------------------------------------------------------------
+ // Variables --------------------------------------------------
+ // -------------------------------------------------------------
+
+ /**
+ * selected
+ */
+ protected boolean selected;
+
+ /**
+ * hasFocus
+ */
+ protected boolean hasFocus;
+
+ /**
+ * drawsFocusBorderAroundIcon
+ */
+ private boolean drawsFocusBorderAroundIcon;
+
+ /**
+ * closedIcon
+ */
+ protected transient Icon closedIcon;
+
+ /**
+ * leafIcon
+ */
+ protected transient Icon leafIcon;
+
+ /**
+ * openIcon
+ */
+ protected transient Icon openIcon;
+
+ /**
+ * textSelectionColor
+ */
+ protected Color textSelectionColor;
+
+ /**
+ * textNonSelectionColor
+ */
+ protected Color textNonSelectionColor;
+
+ /**
+ * backgroundSelectionColor
+ */
+ protected Color backgroundSelectionColor;
+
+ /**
+ * backgroundNonSelectionColor
+ */
+ protected Color backgroundNonSelectionColor;
+
+ /**
+ * borderSelectionColor
+ */
+ protected Color borderSelectionColor;
+
+ // -------------------------------------------------------------
+ // Initialization ---------------------------------------------
+ // -------------------------------------------------------------
+
+ /**
+ * Constructor DefaultTreeCellRenderer
+ */
+ public DefaultTreeCellRenderer()
+ {
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+
+ setLeafIcon(getDefaultLeafIcon());
+ setOpenIcon(getDefaultOpenIcon());
+ setClosedIcon(getDefaultClosedIcon());
+
+ setTextNonSelectionColor(defaults.getColor("Tree.textForeground"));
+ setTextSelectionColor(defaults.getColor("Tree.selectionForeground"));
+ setBackgroundNonSelectionColor(defaults.getColor("Tree.nonSelectionBackground"));
+ setBackgroundSelectionColor(defaults.getColor("Tree.selectionBackground"));
+ setBorderSelectionColor(defaults.getColor("Tree.selectionBorderColor"));
+ }
+
+ // -------------------------------------------------------------
+ // Methods ----------------------------------------------------
+ // -------------------------------------------------------------
+
+ /**
+ * getDefaultOpenIcon
+ *
+ * @returns Icon
+ */
+ public Icon getDefaultOpenIcon()
+ {
+ return UIManager.getLookAndFeelDefaults().getIcon("Tree.openIcon");
+ }
+
+ /**
+ * getDefaultClosedIcon
+ *
+ * @returns Icon
+ */
+ public Icon getDefaultClosedIcon()
+ {
+ return UIManager.getLookAndFeelDefaults().getIcon("Tree.closedIcon");
+ }
+
+ /**
+ * getDefaultLeafIcon
+ *
+ * @returns Icon
+ */
+ public Icon getDefaultLeafIcon()
+ {
+ return UIManager.getLookAndFeelDefaults().getIcon("Tree.leafIcon");
+ }
+
+ /**
+ * setOpenIcon
+ *
+ * @param i
+ * the icon.
+ */
+ public void setOpenIcon(Icon i)
+ {
+ openIcon = i;
+ }
+
+ /**
+ * getOpenIcon
+ *
+ * @returns Icon
+ */
+ public Icon getOpenIcon()
+ {
+ return openIcon;
+ }
+
+ /**
+ * setClosedIcon
+ *
+ * @param i
+ * the icon.
+ */
+ public void setClosedIcon(Icon i)
+ {
+ closedIcon = i;
+ }
+
+ /**
+ * getClosedIcon
+ *
+ * @returns Icon
+ */
+ public Icon getClosedIcon()
+ {
+ return closedIcon;
+ }
+
+ /**
+ * setLeafIcon
+ *
+ * @param i
+ * the icon.
+ */
+ public void setLeafIcon(Icon i)
+ {
+ leafIcon = i;
+ }
+
+ /**
+ * getLeafIcon
+ *
+ * @returns Icon
+ */
+ public Icon getLeafIcon()
+ {
+ return leafIcon;
+ }
+
+ /**
+ * setTextSelectionColor
+ *
+ * @param c
+ * the color.
+ */
+ public void setTextSelectionColor(Color c)
+ {
+ textSelectionColor = c;
+ }
+
+ /**
+ * getTextSelectionColor
+ *
+ * @returns Color
+ */
+ public Color getTextSelectionColor()
+ {
+ return textSelectionColor;
+ }
+
+ /**
+ * setTextNonSelectionColor
+ *
+ * @param c
+ * the color.
+ */
+ public void setTextNonSelectionColor(Color c)
+ {
+ textNonSelectionColor = c;
+ }
+
+ /**
+ * getTextNonSelectionColor
+ *
+ * @returns Color
+ */
+ public Color getTextNonSelectionColor()
+ {
+ return textNonSelectionColor;
+ }
+
+ /**
+ * setBackgroundSelectionColor
+ *
+ * @param c
+ * the color.
+ */
+ public void setBackgroundSelectionColor(Color c)
+ {
+ backgroundSelectionColor = c;
+ }
+
+ /**
+ * getBackgroundSelectionColor
+ *
+ * @returns Color
+ */
+ public Color getBackgroundSelectionColor()
+ {
+ return backgroundSelectionColor;
+ }
+
+ /**
+ * setBackgroundNonSelectionColor
+ *
+ * @param c
+ * the color.
+ */
+ public void setBackgroundNonSelectionColor(Color c)
+ {
+ backgroundNonSelectionColor = c;
+ }
+
+ /**
+ * getBackgroundNonSelectionColor
+ *
+ * @returns Color
+ */
+ public Color getBackgroundNonSelectionColor()
+ {
+ return backgroundNonSelectionColor;
+ }
+
+ /**
+ * setBorderSelectionColor
+ *
+ * @param c
+ * the color.
+ */
+ public void setBorderSelectionColor(Color c)
+ {
+ borderSelectionColor = c;
+ }
+
+ /**
+ * getBorderSelectionColor
+ *
+ * @returns Color
+ */
+ public Color getBorderSelectionColor()
+ {
+ return borderSelectionColor;
+ }
+
+ /**
+ * setFont
+ *
+ * @param f
+ * the font.
+ */
+ public void setFont(Font f)
+ {
+ if (f != null && f instanceof UIResource)
+ f = null;
+ super.setFont(f);
+ }
+
+ /**
+ * setBackground
+ *
+ * @param c
+ * the color.
+ */
+ public void setBackground(Color c)
+ {
+ if (c != null && c instanceof UIResource)
+ c = null;
+ super.setBackground(c);
+ }
+
+ /**
+ * getTreeCellRendererComponent
+ *
+ * @param tree
+ * TODO
+ * @param val
+ * TODO
+ * @param selected
+ * TODO
+ * @param expanded
+ * TODO
+ * @param leaf
+ * TODO
+ * @param row
+ * TODO
+ * @param hasFocus
+ * TODO
+ * @returns Component
+ */
+ public Component getTreeCellRendererComponent(JTree tree, Object val,
+ boolean selected,
+ boolean expanded, boolean leaf,
+ int row, boolean hasFocus)
+ {
+ if (leaf)
+ setIcon(getLeafIcon());
+ else if (expanded)
+ setIcon(getOpenIcon());
+ else
+ setIcon(getClosedIcon());
+
+ setText(val.toString());
+ this.selected = selected;
+ this.hasFocus = hasFocus;
+ setHorizontalAlignment(LEFT);
+ setOpaque(false);
+ setVerticalAlignment(TOP);
+ setEnabled(true);
+ super.setFont(UIManager.getLookAndFeelDefaults().getFont("Tree.font"));
+
+ if (selected)
+ {
+ super.setBackground(getBackgroundSelectionColor());
+ setForeground(getTextSelectionColor());
+
+ if (tree.getLeadSelectionPath() == null ||
+ (tree.getLeadSelectionPath().getLastPathComponent()).equals(val))
+ setBorderSelectionColor(UIManager.getLookAndFeelDefaults().
+ getColor("Tree.selectionBorderColor"));
+ else
+ setBorderSelectionColor(null);
+ }
+ else
{
- setText(val.toString());
- setIcon(null);
- this.selected = selected;
- this.hasFocus = hasFocus;
- setHorizontalAlignment(LEFT);
- setOpaque(true);
- setVerticalAlignment(TOP);
- setEnabled(true);
- super.setFont(UIManager.getLookAndFeelDefaults().getFont("Tree.font"));
+ super.setBackground(getBackgroundNonSelectionColor());
+ setForeground(getTextNonSelectionColor());
+ setBorderSelectionColor(null);
}
- if (selected)
- {
- super.setBackground(getBackgroundSelectionColor());
- setForeground(getTextSelectionColor());
- }
- else
- {
- super.setBackground(getBackgroundNonSelectionColor());
- setForeground(getTextNonSelectionColor());
- }
-
- return this;
- }
-
- /**
- * getFont
- *
- * @return the current Font
- */
- public Font getFont()
- {
- return super.getFont();
- }
-
- /**
- * paint
- *
- * @param value0 TODO
- */
- public void paint(Graphics g)
- {
- super.paint(g);
- }
-
- /**
- * getPreferredSize
- *
- * @returns Dimension
- */
- public Dimension getPreferredSize()
- {
- return null; // TODO
- } // getPreferredSize()
-
- /**
- * validate
- */
- public void validate()
- {
- // Overridden for performance reasons.
- } // validate()
-
- /**
- * revalidate
- */
- public void revalidate()
- {
- // Overridden for performance reasons.
- } // revalidate()
-
- /**
- * repaint
- *
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- * @param value3 TODO
- * @param value4 TODO
- */
- public void repaint(long value0, int value1, int value2, int value3,
- int value4)
- {
- // Overridden for performance reasons.
- } // repaint()
-
- /**
- * repaint
- *
- * @param value0 TODO
- */
- public void repaint(Rectangle value0)
- {
- // Overridden for performance reasons.
- } // repaint()
-
- /**
- * firePropertyChange
- *
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- */
- protected void firePropertyChange(String value0, Object value1,
- Object value2)
- {
- // Overridden for performance reasons.
- } // firePropertyChange()
-
- /**
- * firePropertyChange
- *
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- */
- public void firePropertyChange(String value0, byte value1, byte value2)
- {
- // Overridden for performance reasons.
- } // firePropertyChange()
-
- /**
- * firePropertyChange
- *
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- */
- public void firePropertyChange(String value0, char value1, char value2)
- {
- // Overridden for performance reasons.
- } // firePropertyChange()
-
- /**
- * firePropertyChange
- *
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- */
- public void firePropertyChange(String value0, short value1, short value2)
- {
- // Overridden for performance reasons.
- } // firePropertyChange()
-
- /**
- * firePropertyChange
- *
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- */
- public void firePropertyChange(String value0, int value1, int value2)
- {
- // Overridden for performance reasons.
- } // firePropertyChange()
-
- /**
- * firePropertyChange
- *
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- */
- public void firePropertyChange(String value0, long value1, long value2)
- {
- // Overridden for performance reasons.
- } // firePropertyChange()
-
- /**
- * firePropertyChange
- *
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- */
- public void firePropertyChange(String value0, float value1, float value2)
- {
- // Overridden for performance reasons.
- } // firePropertyChange()
-
- /**
- * firePropertyChange
- *
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- */
- public void firePropertyChange(String value0, double value1, double value2)
- {
- // Overridden for performance reasons.
- } // firePropertyChange()
-
- /**
- * firePropertyChange
- *
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- */
- public void firePropertyChange(String value0, boolean v1, boolean v2)
- {
- // Overridden for performance reasons.
- } // firePropertyChange()
+ return this;
+ }
+
+ /**
+ * getFont
+ *
+ * @return the current Font
+ */
+ public Font getFont()
+ {
+ return super.getFont();
+ }
+
+ /**
+ * Paints the value. The background is filled based on selected.
+ *
+ * @param g
+ * the graphics device.
+ */
+ public void paint(Graphics g)
+ {
+ // paint background
+ Rectangle vr = new Rectangle();
+ Rectangle ir = new Rectangle();
+ Rectangle tr = new Rectangle();
+
+ Insets insets = new Insets(0, 0, 0, 0);
+ Border border = UIManager.getLookAndFeelDefaults().getBorder(
+ "Tree.selectionBorder");
+ if (border != null)
+ insets = border.getBorderInsets(this);
+
+ FontMetrics fm = getToolkit().getFontMetrics(getFont());
+ SwingUtilities.layoutCompoundLabel(((JLabel) this), fm, getText(),
+ getIcon(), getVerticalAlignment(),
+ getHorizontalAlignment(),
+ getVerticalTextPosition(),
+ getHorizontalTextPosition(), vr, ir, tr,
+ getIconTextGap());
+
+ g.setColor(super.getBackground());
+ g.fillRect(tr.x, tr.y, tr.width, tr.height - insets.top - insets.bottom);
+
+ // paint border
+ Color b = getBorderSelectionColor();
+ if (b != null)
+ {
+ g.setColor(b);
+ g.drawRect(tr.x, tr.y, tr.width, tr.height - insets.top - insets.bottom);
+ }
+ super.paint(g);
+ }
+
+ /**
+ * returns the preferred size of the cell.
+ *
+ * @returns Dimension
+ */
+ public Dimension getPreferredSize()
+ {
+ Rectangle vr = new Rectangle();
+ Rectangle ir = new Rectangle();
+ Rectangle tr = new Rectangle();
+
+ FontMetrics fm = getToolkit().getFontMetrics(getFont());
+ SwingUtilities.layoutCompoundLabel(((JLabel) this), fm, getText(),
+ getIcon(), getVerticalAlignment(),
+ getHorizontalAlignment(),
+ getVerticalTextPosition(),
+ getHorizontalTextPosition(), vr, ir, tr,
+ getIconTextGap());
+ Rectangle cr = ir.union(tr);
+ return new Dimension(cr.width, cr.height);
+ } // getPreferredSize()
+
+ /**
+ * validate
+ */
+ public void validate()
+ {
+ // Overridden for performance reasons.
+ } // validate()
+
+ /**
+ * revalidate
+ */
+ public void revalidate()
+ {
+ // Overridden for performance reasons.
+ } // revalidate()
+
+ /**
+ * repaint
+ *
+ * @param value0
+ * TODO
+ * @param value1
+ * TODO
+ * @param value2
+ * TODO
+ * @param value3
+ * TODO
+ * @param value4
+ * TODO
+ */
+ public void repaint(long value0, int value1, int value2, int value3,
+ int value4)
+ {
+ // Overridden for performance reasons.
+ } // repaint()
+
+ /**
+ * repaint
+ *
+ * @param value0
+ * TODO
+ */
+ public void repaint(Rectangle value0)
+ {
+ // Overridden for performance reasons.
+ } // repaint()
+
+ /**
+ * firePropertyChange
+ *
+ * @param value0
+ * TODO
+ * @param value1
+ * TODO
+ * @param value2
+ * TODO
+ */
+ protected void firePropertyChange(String value0, Object value1, Object value2)
+ {
+ // Overridden for performance reasons.
+ } // firePropertyChange()
+
+ /**
+ * firePropertyChange
+ *
+ * @param value0
+ * TODO
+ * @param value1
+ * TODO
+ * @param value2
+ * TODO
+ */
+ public void firePropertyChange(String value0, byte value1, byte value2)
+ {
+ // Overridden for performance reasons.
+ } // firePropertyChange()
+
+ /**
+ * firePropertyChange
+ *
+ * @param value0
+ * TODO
+ * @param value1
+ * TODO
+ * @param value2
+ * TODO
+ */
+ public void firePropertyChange(String value0, char value1, char value2)
+ {
+ // Overridden for performance reasons.
+ } // firePropertyChange()
+
+ /**
+ * firePropertyChange
+ *
+ * @param value0
+ * TODO
+ * @param value1
+ * TODO
+ * @param value2
+ * TODO
+ */
+ public void firePropertyChange(String value0, short value1, short value2)
+ {
+ // Overridden for performance reasons.
+ } // firePropertyChange()
+
+ /**
+ * firePropertyChange
+ *
+ * @param value0
+ * TODO
+ * @param value1
+ * TODO
+ * @param value2
+ * TODO
+ */
+ public void firePropertyChange(String value0, int value1, int value2)
+ {
+ // Overridden for performance reasons.
+ } // firePropertyChange()
+
+ /**
+ * firePropertyChange
+ *
+ * @param value0
+ * TODO
+ * @param value1
+ * TODO
+ * @param value2
+ * TODO
+ */
+ public void firePropertyChange(String value0, long value1, long value2)
+ {
+ // Overridden for performance reasons.
+ } // firePropertyChange()
+
+ /**
+ * firePropertyChange
+ *
+ * @param value0
+ * TODO
+ * @param value1
+ * TODO
+ * @param value2
+ * TODO
+ */
+ public void firePropertyChange(String value0, float value1, float value2)
+ {
+ // Overridden for performance reasons.
+ } // firePropertyChange()
+
+ /**
+ * firePropertyChange
+ *
+ * @param value0 TODO
+ * @param value1 TODO
+ * @param value2 TODO
+ */
+ public void firePropertyChange(String value0, double value1, double value2)
+ {
+ // Overridden for performance reasons.
+ } // firePropertyChange()
+
+ /**
+ * firePropertyChange
+ *
+ * @param name the property name.
+ * @param v1 the old value.
+ * @param v2 the new value.
+ */
+ public void firePropertyChange(String name, boolean v1, boolean v2)
+ {
+ // Overridden for performance reasons.
+ } // firePropertyChange()
} // DefaultTreeCellRenderer
diff --git a/libjava/classpath/javax/swing/tree/DefaultTreeModel.java b/libjava/classpath/javax/swing/tree/DefaultTreeModel.java
index 3278ffa..5b5e039 100644
--- a/libjava/classpath/javax/swing/tree/DefaultTreeModel.java
+++ b/libjava/classpath/javax/swing/tree/DefaultTreeModel.java
@@ -1,6 +1,6 @@
-/* DefaultTreeModel.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
-
+/* DefaultTreeModel.java --
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
@@ -10,16 +10,16 @@ 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
+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
+along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
+making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
@@ -29,13 +29,12 @@ 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
+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
+obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-
package javax.swing.tree;
import java.io.IOException;
@@ -51,405 +50,516 @@ import javax.swing.tree.DefaultMutableTreeNode;
/**
* DefaultTreeModel
+ *
* @author Andrew Selkirk
*/
public class DefaultTreeModel
- implements Serializable, TreeModel
+ implements Serializable, TreeModel
{
- static final long serialVersionUID = -2621068368932566998L;
-
- /**
- * root
- */
- protected TreeNode root = null;
-
- /**
- * listenerList
- */
- protected EventListenerList listenerList = new EventListenerList();
-
- /**
- * asksAllowsChildren
- */
- protected boolean asksAllowsChildren;
-
- /**
- * Constructor DefaultTreeModel
- * @param value0 TODO
- */
- public DefaultTreeModel(TreeNode root)
- {
- if (root == null)
- root = new DefaultMutableTreeNode();
- setRoot(root);
- }
-
- /**
- * Constructor DefaultTreeModel
- * @param value0 TODO
- * @param value1 TODO
- */
- public DefaultTreeModel(TreeNode root, boolean asksAllowsChildren)
- {
- setRoot(root);
- this.asksAllowsChildren = asksAllowsChildren;
- }
-
- /**
- * writeObject
- * @param value0 TODO
- * @exception IOException TODO
- */
- private void writeObject(ObjectOutputStream value0) throws IOException
- {
- // TODO
- }
-
- /**
- * readObject
- * @param value0 TODO
- * @exception IOException TODO
- * @exception ClassNotFoundException TODO
- */
- private void readObject(ObjectInputStream value0) throws IOException,
- ClassNotFoundException
- {
- // TODO
- }
-
- /**
- * asksAllowsChildren
- * @return boolean
- */
- public boolean asksAllowsChildren()
- {
- return asksAllowsChildren;
- }
-
- /**
- * setAsksAllowsChildren
- * @param value0 TODO
- */
- public void setAsksAllowsChildren(boolean value)
- {
- asksAllowsChildren = value; // TODO
- }
-
- /**
- * setRoot
- * @param value0 TODO
- */
- public void setRoot(TreeNode root)
- {
- // Sanity Check
- if (root == null)
- {
- throw new IllegalArgumentException("null root");
- }
- // Set new root
- this.root = root;
-
- // TODO
- }
-
- /**
- * getRoot
- * @return Object
- */
- public Object getRoot()
- {
- return root;
- }
-
- /**
- * getIndexOfChild
- * @param value0 TODO
- * @param value1 TODO
- * @return int
- */
- public int getIndexOfChild(Object parent, Object child)
- {
- return 0; // TODO
- }
-
- /**
- * getChild
- * @param value0 TODO
- * @param value1 TODO
- * @return Object
- */
- public Object getChild(Object node, int idx)
- {
- if (node instanceof TreeNode)
- return ((TreeNode) node).getChildAt(idx);
- else
- return null;
- }
-
- /**
- * getChildCount
- * @param value0 TODO
- * @return int
- */
- public int getChildCount(Object node)
- {
- if (node instanceof TreeNode)
- return ((TreeNode) node).getChildCount();
- else
- return 0;
- }
-
- /**
- * isLeaf
- * @param value0 TODO
- * @return boolean
- */
- public boolean isLeaf(Object node)
- {
- if (node instanceof TreeNode)
- return ((TreeNode) node).isLeaf();
- else
- return true;
- }
-
- /**
- * reload
- */
- public void reload()
- {
- // TODO
- }
-
- /**
- * reload
- * @param value0 TODO
- */
- public void reload(TreeNode value0)
- {
- // TODO
- }
-
- /**
- * valueForPathChanged
- * @param value0 TODO
- * @param value1 TODO
- */
- public void valueForPathChanged(TreePath value0, Object value1)
- {
- // TODO
- }
-
- /**
- * insertNodeInto
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- */
- public void insertNodeInto(MutableTreeNode value0, MutableTreeNode value1,
- int value2)
- {
- // TODO
- }
-
- /**
- * removeNodeFromParent
- * @param value0 TODO
- */
- public void removeNodeFromParent(MutableTreeNode value0)
- {
- // TODO
- }
-
- /**
- * nodeChanged
- * @param value0 TODO
- */
- public void nodeChanged(TreeNode value0)
- {
- // TODO
- }
-
- /**
- * nodesWereInserted
- * @param value0 TODO
- * @param value1 TODO
- */
- public void nodesWereInserted(TreeNode value0, int[] value1)
- {
- // TODO
- }
-
- /**
- * nodesWereRemoved
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- */
- public void nodesWereRemoved(TreeNode value0, int[] value1, Object[] value2)
- {
- // TODO
- }
-
- /**
- * nodesChanged
- * @param value0 TODO
- * @param value1 TODO
- */
- public void nodesChanged(TreeNode value0, int[] value1)
- {
- // TODO
- }
-
- /**
- * nodeStructureChanged
- * @param value0 TODO
- */
- public void nodeStructureChanged(TreeNode value0)
- {
- // TODO
- }
-
- /**
- * getPathToRoot
- * @param value0 TODO
- * @return TreeNode[]
- */
- public TreeNode[] getPathToRoot(TreeNode value0)
- {
- return null; // TODO
- }
-
- /**
- * getPathToRoot
- * @param value0 TODO
- * @param value1 TODO
- * @return TreeNode[]
- */
- protected TreeNode[] getPathToRoot(TreeNode value0, int value1)
- {
- return null; // TODO
- }
-
- /**
- * Registers a listere to the model.
- *
- * @param listener the listener to add
- */
- public void addTreeModelListener(TreeModelListener listener)
- {
- listenerList.add(TreeModelListener.class, listener);
- }
-
- /**
- * Removes a listener from the model.
- *
- * @param listener the listener to remove
- */
- public void removeTreeModelListener(TreeModelListener listener)
- {
- listenerList.remove(TreeModelListener.class, listener);
- }
-
- /**
- * Returns all registered <code>TreeModelListener</code> listeners.
- *
- * @return an array of listeners.
- *
- * @since 1.4
- */
- public TreeModelListener[] getTreeModelListeners()
- {
- return (TreeModelListener[]) listenerList
- .getListeners(TreeModelListener.class);
- }
-
- /**
- * fireTreeNodesChanged
- *
- * @param source the node being changed
- * @param path the path to the root node
- * @param childIndices the indices of the changed elements
- * @param children the changed elements
- */
- protected void fireTreeNodesChanged(Object source, Object[] path,
- int[] childIndices, Object[] children)
- {
- TreeModelEvent event = new TreeModelEvent(source, path, childIndices,
- children);
- TreeModelListener[] listeners = getTreeModelListeners();
-
- for (int i = listeners.length - 1; i >= 0; --i)
- listeners[i].treeNodesChanged(event);
- }
-
- /**
- * fireTreeNodesInserted
- *
- * @param source the node where new nodes got inserted
- * @param path the path to the root node
- * @param childIndices the indices of the new elements
- * @param children the new elements
- */
- protected void fireTreeNodesInserted(Object source, Object[] path,
- int[] childIndices, Object[] children)
- {
- TreeModelEvent event = new TreeModelEvent(source, path, childIndices,
- children);
- TreeModelListener[] listeners = getTreeModelListeners();
-
- for (int i = listeners.length - 1; i >= 0; --i)
- listeners[i].treeNodesInserted(event);
- }
-
- /**
- * fireTreeNodesRemoved
- *
- * @param source the node where nodes got removed-
- * @param path the path to the root node
- * @param childIndices the indices of the removed elements
- * @param children the removed elements
- */
- protected void fireTreeNodesRemoved(Object source, Object[] path,
- int[] childIndices, Object[] children)
- {
- TreeModelEvent event = new TreeModelEvent(source, path, childIndices,
- children);
- TreeModelListener[] listeners = getTreeModelListeners();
-
- for (int i = listeners.length - 1; i >= 0; --i)
- listeners[i].treeNodesRemoved(event);
- }
-
- /**
- * fireTreeStructureChanged
- *
- * @param source the node where the model has changed
- * @param path the path to the root node
- * @param childIndices the indices of the affected elements
- * @param children the affected elements
- */
- protected void fireTreeStructureChanged(Object source, Object[] path,
- int[] childIndices, Object[] children)
- {
- TreeModelEvent event = new TreeModelEvent(source, path, childIndices,
- children);
- TreeModelListener[] listeners = getTreeModelListeners();
-
- for (int i = listeners.length - 1; i >= 0; --i)
- listeners[i].treeStructureChanged(event);
- }
-
- /**
- * Returns the registered listeners of a given type.
- *
- * @param listenerType the listener type to return
- *
- * @return an array of listeners
- *
- * @since 1.3
- */
- public EventListener[] getListeners(Class listenerType)
- {
- return listenerList.getListeners(listenerType);
- }
+ static final long serialVersionUID = -2621068368932566998L;
+
+ /**
+ * root
+ */
+ protected TreeNode root = null;
+
+ /**
+ * listenerList
+ */
+ protected EventListenerList listenerList = new EventListenerList();
+
+ /**
+ * asksAllowsChildren
+ */
+ protected boolean asksAllowsChildren;
+
+ /**
+ * Constructor DefaultTreeModel
+ *
+ * @param root the tree root.
+ */
+ public DefaultTreeModel(TreeNode root)
+ {
+ if (root == null)
+ root = new DefaultMutableTreeNode();
+ setRoot(root);
+ }
+
+ /**
+ * Constructor DefaultTreeModel
+ *
+ * @param root the tree root.
+ * @param asksAllowsChildren TODO
+ */
+ public DefaultTreeModel(TreeNode root, boolean asksAllowsChildren)
+ {
+ setRoot(root);
+ this.asksAllowsChildren = asksAllowsChildren;
+ }
+
+ /**
+ * writeObject
+ *
+ * @param obj the object.
+ * @exception IOException TODO
+ */
+ private void writeObject(ObjectOutputStream obj) throws IOException
+ {
+ // TODO
+ }
+
+ /**
+ * readObject
+ *
+ * @param value0 TODO
+ * @exception IOException TODO
+ * @exception ClassNotFoundException TODO
+ */
+ private void readObject(ObjectInputStream value0) throws IOException,
+ ClassNotFoundException
+ {
+ // TODO
+ }
+
+ /**
+ * asksAllowsChildren
+ *
+ * @return boolean
+ */
+ public boolean asksAllowsChildren()
+ {
+ return asksAllowsChildren;
+ }
+
+ /**
+ * setAsksAllowsChildren
+ *
+ * @param value TODO
+ */
+ public void setAsksAllowsChildren(boolean value)
+ {
+ asksAllowsChildren = value;
+ }
+
+ /**
+ * setRoot
+ *
+ * @param root the root node.
+ */
+ public void setRoot(TreeNode root)
+ {
+ // Sanity Check
+ if (root == null)
+ {
+ throw new IllegalArgumentException("null root");
+ }
+ // Set new root
+ this.root = root;
+ }
+
+ /**
+ * getRoot
+ *
+ * @return Object
+ */
+ public Object getRoot()
+ {
+ return root;
+ }
+
+ /**
+ * getIndexOfChild
+ *
+ * @param parent TODO
+ * @param child TODO
+ * @return int
+ */
+ public int getIndexOfChild(Object parent, Object child)
+ {
+ for (int i = 0; i < getChildCount(parent); i++)
+ {
+ if (getChild(parent, i).equals(child))
+ return i;
+ }
+ return -1;
+ }
+
+ /**
+ * getChild
+ *
+ * @param node TODO
+ * @param idx TODO
+ * @return Object
+ */
+ public Object getChild(Object node, int idx)
+ {
+ if (node instanceof TreeNode)
+ return ((TreeNode) node).getChildAt(idx);
+ else
+ return null;
+ }
+
+ /**
+ * getChildCount
+ *
+ * @param node TODO
+ * @return int
+ */
+ public int getChildCount(Object node)
+ {
+ if (node instanceof TreeNode)
+ return ((TreeNode) node).getChildCount();
+ else
+ return 0;
+ }
+
+ /**
+ * isLeaf
+ *
+ * @param node TODO
+ * @return boolean
+ */
+ public boolean isLeaf(Object node)
+ {
+ if (node instanceof TreeNode)
+ return ((TreeNode) node).isLeaf();
+ else
+ return true;
+ }
+
+ /**
+ * Invoke this method if you've modified the TreeNodes upon
+ * which this model depends. The model will notify all of its
+ * listeners that the model has changed.
+ */
+ public void reload()
+ {
+ // TODO
+ }
+
+ /**
+ * Invoke this method if you've modified the TreeNodes upon
+ * which this model depends. The model will notify all of its
+ * listeners that the model has changed.
+ *
+ * @param node - TODO
+ */
+ public void reload(TreeNode node)
+ {
+ // TODO
+ }
+
+ /**
+ * Messaged when the user has altered the value for the item
+ * identified by path to newValue. If newValue signifies a truly new
+ * value the model should post a treeNodesChanged event.
+ * This sets the user object of the TreeNode identified by
+ * path and posts a node changed. If you use custom user objects
+ * in the TreeModel you're going to need to subclass this and set
+ * the user object of the changed node to something meaningful.
+ *
+ * @param path - path to the node that the user has altered
+ * @param newValue - the new value from the TreeCellEditor
+ */
+ public void valueForPathChanged(TreePath path, Object newValue)
+ {
+ Object node = path.getLastPathComponent();
+ if (node instanceof MutableTreeNode)
+ {
+ ((MutableTreeNode) node).setUserObject(newValue);
+ int[] ci = null;
+ Object[] c = null;
+ Object[] parentPath = path.getPath();
+ if (path.getPathCount() > 1)
+ {
+ Object parent = ((TreeNode) node).getParent();
+ ci = new int[1];
+ ci[0] = getIndexOfChild(parent, node);
+ node = newValue;
+ path = path.getParentPath().pathByAddingChild(node);
+ c = new Object[1];
+ c[0] = node;
+ parentPath = path.getParentPath().getPath();
+ }
+
+ fireTreeNodesChanged(this, parentPath, ci, c);
+ }
+ }
+
+ /**
+ * Invoked this to insert newChild at location index in parents children.
+ * This will then message nodesWereInserted to create the appropriate event.
+ * This is the preferred way to add children as it will create the
+ * appropriate event.
+ *
+ * @param newChild is the node to add to the parent's children
+ * @param parent is the parent of the newChild
+ * @param index is the index of the newChild
+ */
+ public void insertNodeInto(MutableTreeNode newChild, MutableTreeNode parent,
+ int index)
+ {
+ parent.insert(newChild, index);
+ int[] childIndices = new int[1];
+ childIndices[0] = index;
+ nodesWereInserted(parent, childIndices);
+ }
+
+ /**
+ * Message this to remove node from its parent. This will message
+ * nodesWereRemoved to create the appropriate event. This is the preferred
+ * way to remove a node as it handles the event creation for you.
+ *
+ * @param node to be removed
+ */
+ public void removeNodeFromParent(MutableTreeNode node)
+ {
+ TreeNode parent = node.getParent();
+ Object[] children = new Object[1];
+ children[0] = node;
+ int[] childIndices = new int[1];
+ childIndices[0] = getIndexOfChild(parent, node);
+ node.removeFromParent();
+ nodesWereRemoved(parent, childIndices, children);
+ }
+
+ /**
+ * Invoke this method after you've changed how node is to be represented
+ * in the tree.
+ *
+ * @param node that was changed
+ */
+ public void nodeChanged(TreeNode node)
+ {
+ TreeNode parent = node.getParent();
+ int[] childIndices = new int[1];
+ childIndices[0] = getIndexOfChild(parent, node);
+ Object[] children = new Object[1];
+ children[0] = node;
+ fireTreeNodesChanged(this, getPathToRoot(node), childIndices, children);
+ }
+
+ /**
+ * Invoke this method after you've inserted some TreeNodes
+ * into node. childIndices should be the index of the new elements and must
+ * be sorted in ascending order.
+ *
+ * @param parent that had a child added to
+ * @param childIndices of the children added
+ */
+ public void nodesWereInserted(TreeNode parent, int[] childIndices)
+ {
+ Object[] children = new Object[childIndices.length];
+ for (int i = 0; i < children.length; i++)
+ children[i] = getChild(parent, childIndices[i]);
+ fireTreeNodesInserted(this, getPathToRoot(parent), childIndices, children);
+ }
+
+ /**
+ * Invoke this method after you've removed some TreeNodes from node.
+ * childIndices should be the index of the removed elements and
+ * must be sorted in ascending order. And removedChildren should be the
+ * array of the children objects that were removed.
+ *
+ * @param parent that had a child added to
+ * @param childIndices of the children added
+ * @param removedChildren are all the children removed from parent.
+ */
+ public void nodesWereRemoved(TreeNode parent, int[] childIndices,
+ Object[] removedChildren)
+ {
+ fireTreeNodesRemoved(this, getPathToRoot(parent), childIndices,
+ removedChildren);
+ }
+
+ /**
+ * Invoke this method after you've changed how the children identified by
+ * childIndices are to be represented in the tree.
+ *
+ * @param node that is the parent of the children that changed in a tree.
+ * @param childIndices are the child nodes that changed.
+ */
+ public void nodesChanged(TreeNode node, int[] childIndices)
+ {
+ Object[] children = new Object[childIndices.length];
+ for (int i = 0; i < children.length; i++)
+ children[i] = getChild(node, childIndices[i]);
+ fireTreeNodesChanged(this, getPathToRoot(node), childIndices, children);
+ }
+
+ /**
+ * Invoke this method if you've totally changed the children of node and
+ * its childrens children. This will post a treeStructureChanged event.
+ *
+ * @param node that had its children and grandchildren changed.
+ */
+ public void nodeStructureChanged(TreeNode node)
+ {
+ // TODO
+ }
+
+ /**
+ * Builds the parents of node up to and including the root node, where
+ * the original node is the last element in the returned array. The
+ * length of the returned array gives the node's depth in the tree.
+ *
+ * @param node - the TreeNode to get the path for
+ * @return TreeNode[] - the path from node to the root
+ */
+ public TreeNode[] getPathToRoot(TreeNode node)
+ {
+ return getPathToRoot(node, 0);
+ }
+
+ /**
+ * Builds the parents of node up to and including the root node, where
+ * the original node is the last element in the returned array. The
+ * length of the returned array gives the node's depth in the tree.
+ *
+ * @param node - the TreeNode to get the path for
+ * @param depth - an int giving the number of steps already taken
+ * towards the root (on recursive calls), used to size the returned array
+ * @return an array of TreeNodes giving the path from the root to the
+ * specified node
+ */
+ protected TreeNode[] getPathToRoot(TreeNode node, int depth)
+ {
+ if (node == null)
+ {
+ if (depth == 0)
+ return null;
+
+ return new TreeNode[depth];
+ }
+
+ TreeNode[] path = getPathToRoot(node.getParent(), depth + 1);
+ path[path.length - depth - 1] = node;
+ return path;
+ }
+
+ /**
+ * Registers a listere to the model.
+ *
+ * @param listener the listener to add
+ */
+ public void addTreeModelListener(TreeModelListener listener)
+ {
+ listenerList.add(TreeModelListener.class, listener);
+ }
+
+ /**
+ * Removes a listener from the model.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeTreeModelListener(TreeModelListener listener)
+ {
+ listenerList.remove(TreeModelListener.class, listener);
+ }
+
+ /**
+ * Returns all registered <code>TreeModelListener</code> listeners.
+ *
+ * @return an array of listeners.
+ *
+ * @since 1.4
+ */
+ public TreeModelListener[] getTreeModelListeners()
+ {
+ return (TreeModelListener[]) listenerList
+ .getListeners(TreeModelListener.class);
+ }
+
+ /**
+ * Notifies all listeners that have registered interest for notification
+ * on this event type. The event instance is lazily created using the parameters
+ * passed into the fire method.
+ *
+ * @param source the node being changed
+ * @param path the path to the root node
+ * @param childIndices the indices of the changed elements
+ * @param children the changed elements
+ */
+ protected void fireTreeNodesChanged(Object source, Object[] path,
+ int[] childIndices, Object[] children)
+ {
+ TreeModelEvent event = new TreeModelEvent(source, path, childIndices,
+ children);
+
+ TreeModelListener[] listeners = getTreeModelListeners();
+
+ for (int i = listeners.length - 1; i >= 0; --i)
+ listeners[i].treeNodesChanged(event);
+ }
+
+ /**
+ * fireTreeNodesInserted
+ *
+ * @param source the node where new nodes got inserted
+ * @param path the path to the root node
+ * @param childIndices the indices of the new elements
+ * @param children the new elements
+ */
+ protected void fireTreeNodesInserted(Object source, Object[] path,
+ int[] childIndices, Object[] children)
+ {
+ TreeModelEvent event = new TreeModelEvent(source, path, childIndices,
+ children);
+ TreeModelListener[] listeners = getTreeModelListeners();
+
+ for (int i = listeners.length - 1; i >= 0; --i)
+ listeners[i].treeNodesInserted(event);
+ }
+
+ /**
+ * fireTreeNodesRemoved
+ *
+ * @param source the node where nodes got removed-
+ * @param path the path to the root node
+ * @param childIndices the indices of the removed elements
+ * @param children the removed elements
+ */
+ protected void fireTreeNodesRemoved(Object source, Object[] path,
+ int[] childIndices, Object[] children)
+ {
+ TreeModelEvent event = new TreeModelEvent(source, path, childIndices,
+ children);
+ TreeModelListener[] listeners = getTreeModelListeners();
+
+ for (int i = listeners.length - 1; i >= 0; --i)
+ listeners[i].treeNodesRemoved(event);
+ }
+
+ /**
+ * fireTreeStructureChanged
+ *
+ * @param source the node where the model has changed
+ * @param path the path to the root node
+ * @param childIndices the indices of the affected elements
+ * @param children the affected elements
+ */
+ protected void fireTreeStructureChanged(Object source, Object[] path,
+ int[] childIndices, Object[] children)
+ {
+ TreeModelEvent event = new TreeModelEvent(source, path, childIndices,
+ children);
+ TreeModelListener[] listeners = getTreeModelListeners();
+
+ for (int i = listeners.length - 1; i >= 0; --i)
+ listeners[i].treeStructureChanged(event);
+ }
+
+ /**
+ * Returns the registered listeners of a given type.
+ *
+ * @param listenerType the listener type to return
+ *
+ * @return an array of listeners
+ *
+ * @since 1.3
+ */
+ public EventListener[] getListeners(Class listenerType)
+ {
+ return listenerList.getListeners(listenerType);
+ }
}
diff --git a/libjava/classpath/javax/swing/tree/DefaultTreeSelectionModel.java b/libjava/classpath/javax/swing/tree/DefaultTreeSelectionModel.java
index de27dad..75b76a9 100644
--- a/libjava/classpath/javax/swing/tree/DefaultTreeSelectionModel.java
+++ b/libjava/classpath/javax/swing/tree/DefaultTreeSelectionModel.java
@@ -116,7 +116,7 @@ public class DefaultTreeSelectionModel
*/
public DefaultTreeSelectionModel()
{
- setSelectionMode(DISCONTIGUOUS_TREE_SELECTION);
+ setSelectionMode(SINGLE_TREE_SELECTION);
listenerList = new EventListenerList();
}
diff --git a/libjava/classpath/javax/swing/tree/FixedHeightLayoutCache.java b/libjava/classpath/javax/swing/tree/FixedHeightLayoutCache.java
index 67a21f0..535417e 100644
--- a/libjava/classpath/javax/swing/tree/FixedHeightLayoutCache.java
+++ b/libjava/classpath/javax/swing/tree/FixedHeightLayoutCache.java
@@ -125,7 +125,7 @@ public class FixedHeightLayoutCache
/**
* getPathForRow
*
- * @param value0 TODO
+ * @param row TODO
* @returns TreePath
*/
public TreePath getPathForRow(int row)
diff --git a/libjava/classpath/javax/xml/datatype/DatatypeFactory.java b/libjava/classpath/javax/xml/datatype/DatatypeFactory.java
index 3f3a224..98a5690 100644
--- a/libjava/classpath/javax/xml/datatype/DatatypeFactory.java
+++ b/libjava/classpath/javax/xml/datatype/DatatypeFactory.java
@@ -91,7 +91,7 @@ public abstract class DatatypeFactory
/**
* Returns a new duration.
- * @param durationInMilliseconds the duration in milliseconds
+ * @param durationInMilliSeconds the duration in milliseconds
*/
public abstract Duration newDuration(long durationInMilliSeconds);
@@ -231,10 +231,6 @@ public abstract class DatatypeFactory
* @param isPositive whether the duration is positive
* @param years the number of years
* @param months the number of months
- * @param days the number of days
- * @param hours the number of hours
- * @param minutes th number of minutes
- * @param seconds the number of seconds
*/
public Duration newDurationYearMonth(boolean isPositive,
BigInteger years,
@@ -254,10 +250,6 @@ public abstract class DatatypeFactory
* @param isPositive whether the duration is positive
* @param years the number of years
* @param months the number of months
- * @param days the number of days
- * @param hours the number of hours
- * @param minutes th number of minutes
- * @param seconds the number of seconds
*/
public Duration newDurationYearMonth(boolean isPositive,
int years,
diff --git a/libjava/classpath/javax/xml/namespace/QName.java b/libjava/classpath/javax/xml/namespace/QName.java
index c1ec451..7b8b194 100644
--- a/libjava/classpath/javax/xml/namespace/QName.java
+++ b/libjava/classpath/javax/xml/namespace/QName.java
@@ -1,40 +1,40 @@
-/*
- * QName.java
- * Copyright (C) 2004 The Free Software Foundation
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP 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 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP 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 this program; 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
- * obliged to do so. If you do not wish to do so, delete this
- * exception statement from your version.
- */
+/* QName.java - An XML qualified name.
+ 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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
package javax.xml.namespace;
@@ -80,13 +80,13 @@ public class QName
this.prefix = prefix;
StringBuffer buf = new StringBuffer();
- if (namespaceURI != null && namespaceURI.length() > 0)
+ if (namespaceURI.length() > 0)
{
buf.append('{');
buf.append(namespaceURI);
buf.append('}');
}
- if (prefix != null && prefix.length() > 0)
+ if (prefix.length() > 0)
{
buf.append(prefix);
buf.append(':');
diff --git a/libjava/classpath/javax/xml/parsers/DocumentBuilder.java b/libjava/classpath/javax/xml/parsers/DocumentBuilder.java
index 56c55a3..a574c98 100644
--- a/libjava/classpath/javax/xml/parsers/DocumentBuilder.java
+++ b/libjava/classpath/javax/xml/parsers/DocumentBuilder.java
@@ -132,7 +132,7 @@ public abstract class DocumentBuilder
/**
* Parse the specified input source and return a DOM Document.
- * @param is the input source
+ * @param source the input source
* @exception IllegalArgumentException if the input source is null
*/
public abstract Document parse(InputSource source)
diff --git a/libjava/classpath/javax/xml/parsers/SAXParser.java b/libjava/classpath/javax/xml/parsers/SAXParser.java
index 1a6b155..d38c657 100644
--- a/libjava/classpath/javax/xml/parsers/SAXParser.java
+++ b/libjava/classpath/javax/xml/parsers/SAXParser.java
@@ -254,7 +254,7 @@ public abstract class SAXParser
/**
* Parse the specified input source, reporting SAX2 events to the
* given handler.
- * @param f an XML file
+ * @param is an XML file
* @param dh the SAX2 handler
* @exception IllegalArgumentException if the input source is null
*/
diff --git a/libjava/classpath/javax/xml/transform/Source.java b/libjava/classpath/javax/xml/transform/Source.java
index d6edb03..2143b4e 100644
--- a/libjava/classpath/javax/xml/transform/Source.java
+++ b/libjava/classpath/javax/xml/transform/Source.java
@@ -48,7 +48,7 @@ public interface Source
/**
* Sets the XML system ID for this source.
* This can be used to resolve external entities in the source.
- * @param systemID the system ID URI
+ * @param systemId the system ID URI
*/
public void setSystemId(String systemId);
diff --git a/libjava/classpath/lib/.cvsignore b/libjava/classpath/lib/.cvsignore
index b5915f0..b99c650 100644
--- a/libjava/classpath/lib/.cvsignore
+++ b/libjava/classpath/lib/.cvsignore
@@ -27,3 +27,6 @@ gen_nio.sh
classes.1
resources
org
+META-INF
+Makefile.deps
+lists
diff --git a/libjava/classpath/lib/Makefile.am b/libjava/classpath/lib/Makefile.am
index 983622d..ada3b2b 100644
--- a/libjava/classpath/lib/Makefile.am
+++ b/libjava/classpath/lib/Makefile.am
@@ -7,17 +7,16 @@ sinclude $(JAVA_DEPEND)
propertydirs := $(shell cd $(top_srcdir)/resource && $(FIND) gnu java org META-INF -type d ! -name CVS -print)
propertyfiles := $(shell cd $(top_srcdir)/resource && $(FIND) gnu java org -name \*\.properties -print)
-metafiles := $(shell cd $(top_srcdir)/resource && $(FIND) META-INF -path \*/CVS -prune -o -type f -print)
+metafiles := $(shell cd $(top_srcdir)/resource && $(FIND) META-INF -name CVS -prune -o -type f -print)
iconfiles := $(shell cd $(top_srcdir) && $(FIND) gnu/javax/swing/plaf/gtk/icons -name *.png -type f -print)
compile_classpath = $(vm_classes):$(top_srcdir):$(top_srcdir)/external/w3c_dom:$(top_srcdir)/external/sax:.:$(USER_CLASSLIB)
# handling source to bytecode compiler programs like gcj, jikes and kjc
if FOUND_GCJ
-# Since we don't feed all classes at once gcj needs to know where to find
-# the generated classes (in top_builddir).
-JAVAC = $(srcdir)/split-for-gcj.sh && $(MAKE) -f $(srcdir)/Makefile.gcj \
- GCJ='$(GCJ)' compile_classpath='$(top_builddir):$(compile_classpath)'
+## This should never be used when gcj is the compiler.
+## See the compile-classes target.
+JAVAC = exit 1
else
if FOUND_JIKES
JAVAC = $(JIKES) +Pno-shadow +Pno-switchcheck +F $(JIKESENCODING) -bootclasspath '' -extdirs '' -sourcepath '' --classpath $(compile_classpath) -d . @classes
@@ -30,7 +29,7 @@ if FOUND_GCJX
JAVAC = $(GCJX) -encoding UTF-8 -classpath .:$(USER_CLASSLIB) -d . @classes
else
if FOUND_ECJ
-JAVAC = $(ECJ) -encoding UTF-8 -warn:-deprecation,serial -proceedOnError -bootclasspath '' -classpath $(compile_classpath) -d . @classes
+JAVAC = $(ECJ) -encoding UTF-8 -warn:none -proceedOnError -bootclasspath '' -classpath $(compile_classpath) -d . @classes
endif # FOUND_ECJ
endif # FOUND_GCJX
endif # FOUND_KJC
@@ -119,13 +118,24 @@ endif # REGEN_PARSER
$(JAVA_DEPEND): genclasses
+if FOUND_GCJ
+## When building with gcj, we do a recursive make. We split this rule
+## out specially, rather than simply defining JAVAC, so that GNU make
+## will see the recursive make invocation and still allow parallel
+## builds.
+compile-classes: classes $(JAVA_SRCS) Makefile
+ $(MAKE) -f $(srcdir)/Makefile.gcj \
+ GCJ='$(GCJ)' \
+ compile_classpath='$(top_builddir):$(compile_classpath)' \
+ top_srcdir=$(top_srcdir)
+else
compile-classes: classes $(JAVA_SRCS) Makefile
$(JAVAC)
touch compile-classes
+endif
EXTRA_DIST = standard.omit mkcollections.pl.in Makefile.gcj split-for-gcj.sh
CLEANFILES = compile-classes resources classes \
- classes.standard classes.awt classes.standardx classes.xml \
glibj.zip classes.1 \
$(top_builddir)/java/util/LocaleData.java \
$(JAVA_DEPEND)
@@ -148,5 +158,3 @@ dist-hook:
$(FIND) $(top_distdir)/gnu $(top_distdir)/java $(top_distdir)/javax $(top_distdir)/org $(top_distdir)/vm -name class-dependencies.conf -print | xargs rm -f
rm -f $(top_distdir)/gnu/classpath/Configuration.java
rm -f $(top_distdir)/java/util/LocaleData.java
-# Omit files listed in standard.omit.
- ( cd $(top_distdir)/lib ; cat $(top_builddir)/lib/standard.omit | sed -e 's/\$$//' | sed -e 's/\/\.\*//' | xargs rm -fr )
diff --git a/libjava/classpath/lib/Makefile.gcj b/libjava/classpath/lib/Makefile.gcj
index a9d520c..7bac691 100644
--- a/libjava/classpath/lib/Makefile.gcj
+++ b/libjava/classpath/lib/Makefile.gcj
@@ -17,6 +17,11 @@ all_deps_files := $(all_list_files:.list=.deps)
all: $(all_stamp_files)
+# Ensure this is rebuilt whenever the list of classes changes.
+# The list will always exist when this Makefile is used.
+Makefile.deps: classes
+ $(SHELL) $(top_srcdir)/lib/split-for-gcj.sh
+
-include Makefile.deps $(all_deps_files)
## Like GCJ but include some common flags.
@@ -28,5 +33,5 @@ GCJF = $(GCJ) -Wno-deprecated --encoding=UTF-8 \
# make the target be the stamp file. This ensures that if a needed
# source is changed, this rule is re-run for the appropriate package.
%.stamp: %.list
- $(GCJF) -MD -MF ${@:.stamp=.deps} -MT $@ @$<
+ $(GCJF) -MD -MF ${@:.stamp=.deps} -MT $@ -MP @$<
echo timestamp > $@
diff --git a/libjava/classpath/lib/Makefile.in b/libjava/classpath/lib/Makefile.in
index 4cef45f..29b5cb2 100644
--- a/libjava/classpath/lib/Makefile.in
+++ b/libjava/classpath/lib/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -93,8 +93,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -156,6 +162,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -167,12 +174,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -194,10 +202,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -240,26 +251,21 @@ vm_classes = @vm_classes@
JAVA_DEPEND = java.dep
propertydirs := $(shell cd $(top_srcdir)/resource && $(FIND) gnu java org META-INF -type d ! -name CVS -print)
propertyfiles := $(shell cd $(top_srcdir)/resource && $(FIND) gnu java org -name \*\.properties -print)
-metafiles := $(shell cd $(top_srcdir)/resource && $(FIND) META-INF -path \*/CVS -prune -o -type f -print)
+metafiles := $(shell cd $(top_srcdir)/resource && $(FIND) META-INF -name CVS -prune -o -type f -print)
iconfiles := $(shell cd $(top_srcdir) && $(FIND) gnu/javax/swing/plaf/gtk/icons -name *.png -type f -print)
compile_classpath = $(vm_classes):$(top_srcdir):$(top_srcdir)/external/w3c_dom:$(top_srcdir)/external/sax:.:$(USER_CLASSLIB)
-@FOUND_ECJ_TRUE@@FOUND_GCJX_FALSE@@FOUND_GCJ_FALSE@@FOUND_JIKES_FALSE@@FOUND_KJC_FALSE@JAVAC = $(ECJ) -encoding UTF-8 -warn:-deprecation,serial -proceedOnError -bootclasspath '' -classpath $(compile_classpath) -d . @classes
+@FOUND_ECJ_TRUE@@FOUND_GCJX_FALSE@@FOUND_GCJ_FALSE@@FOUND_JIKES_FALSE@@FOUND_KJC_FALSE@JAVAC = $(ECJ) -encoding UTF-8 -warn:none -proceedOnError -bootclasspath '' -classpath $(compile_classpath) -d . @classes
@FOUND_GCJX_TRUE@@FOUND_GCJ_FALSE@@FOUND_JIKES_FALSE@@FOUND_KJC_FALSE@JAVAC = $(GCJX) -encoding UTF-8 -classpath .:$(USER_CLASSLIB) -d . @classes
@FOUND_GCJ_FALSE@@FOUND_JIKES_FALSE@@FOUND_KJC_TRUE@JAVAC = $(KJC) -classpath .:$(USER_CLASSLIB) -d . @classes
@FOUND_GCJ_FALSE@@FOUND_JIKES_TRUE@JAVAC = $(JIKES) +Pno-shadow +Pno-switchcheck +F $(JIKESENCODING) -bootclasspath '' -extdirs '' -sourcepath '' --classpath $(compile_classpath) -d . @classes
# handling source to bytecode compiler programs like gcj, jikes and kjc
-# Since we don't feed all classes at once gcj needs to know where to find
-# the generated classes (in top_builddir).
-@FOUND_GCJ_TRUE@JAVAC = $(srcdir)/split-for-gcj.sh && $(MAKE) -f $(srcdir)/Makefile.gcj \
-@FOUND_GCJ_TRUE@ GCJ='$(GCJ)' compile_classpath='$(top_builddir):$(compile_classpath)'
-
+@FOUND_GCJ_TRUE@JAVAC = exit 1
JAVAH = $(USER_JAVAH) -jni -classpath .:$(USER_CLASSLIB)
@INSTALL_GLIBJ_ZIP_TRUE@pkgdata_DATA = glibj.zip
@BUILD_CLASS_FILES_TRUE@noinst_DATA = genclasses compile-classes resources
EXTRA_DIST = standard.omit mkcollections.pl.in Makefile.gcj split-for-gcj.sh
CLEANFILES = compile-classes resources classes \
- classes.standard classes.awt classes.standardx classes.xml \
glibj.zip classes.1 \
$(top_builddir)/java/util/LocaleData.java \
$(JAVA_DEPEND)
@@ -518,9 +524,14 @@ genclasses: gen-classlist.sh standard.omit $(top_builddir)/java/util/LocaleData.
$(JAVA_DEPEND): genclasses
-compile-classes: classes $(JAVA_SRCS) Makefile
- $(JAVAC)
- touch compile-classes
+@FOUND_GCJ_TRUE@compile-classes: classes $(JAVA_SRCS) Makefile
+@FOUND_GCJ_TRUE@ $(MAKE) -f $(srcdir)/Makefile.gcj \
+@FOUND_GCJ_TRUE@ GCJ='$(GCJ)' \
+@FOUND_GCJ_TRUE@ compile_classpath='$(top_builddir):$(compile_classpath)' \
+@FOUND_GCJ_TRUE@ top_srcdir=$(top_srcdir)
+@FOUND_GCJ_FALSE@compile-classes: classes $(JAVA_SRCS) Makefile
+@FOUND_GCJ_FALSE@ $(JAVAC)
+@FOUND_GCJ_FALSE@ touch compile-classes
clean-local:
-rm -rf gnu
@@ -540,8 +551,6 @@ dist-hook:
$(FIND) $(top_distdir)/gnu $(top_distdir)/java $(top_distdir)/javax $(top_distdir)/org $(top_distdir)/vm -name class-dependencies.conf -print | xargs rm -f
rm -f $(top_distdir)/gnu/classpath/Configuration.java
rm -f $(top_distdir)/java/util/LocaleData.java
-# Omit files listed in standard.omit.
- ( cd $(top_distdir)/lib ; cat $(top_builddir)/lib/standard.omit | sed -e 's/\$$//' | sed -e 's/\/\.\*//' | xargs rm -fr )
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/libjava/classpath/lib/gen-classlist.sh.in b/libjava/classpath/lib/gen-classlist.sh.in
index c091caa..12845f2 100755
--- a/libjava/classpath/lib/gen-classlist.sh.in
+++ b/libjava/classpath/lib/gen-classlist.sh.in
@@ -1,10 +1,13 @@
-#! @SH@
+#! @SHELL@
# @configure_input@
# Make sure sorting is done the same on all configurations
LC_ALL=C; export LC_ALL
LANG=C; export LANG
+# We use this to decide whether we need to invoke the split script.
+GCJ="@GCJ@"
+
echo "Adding java source files from srcdir '@top_srcdir@'."
@FIND@ @top_srcdir@/java @top_srcdir@/javax @top_srcdir@/gnu \
@top_srcdir@/org \
diff --git a/libjava/classpath/lib/split-for-gcj.sh b/libjava/classpath/lib/split-for-gcj.sh
index 477e0a8..0f5ffaf 100755
--- a/libjava/classpath/lib/split-for-gcj.sh
+++ b/libjava/classpath/lib/split-for-gcj.sh
@@ -1,19 +1,42 @@
#! /bin/sh
-# Split in multiple parts for gcj. This uses a somewhat hacky
-# procedure for finding the package of a given file.
+# This script is used when compiling Classpath with gcj. The idea is
+# to compile one package at a time, and only recompile packages when
+# actually required.
+
+# We build java->class by package so we need to know what .java files
+# correspond to what package.
+
+# We have a .stamp file for each package; this is the makefile target.
+# We also have a .list file for each package, which lists all the
+# input files in that package.
+
+# gen-classlist.sh makes a list of all the .java files we are going to compile.
+
+# This script generates Makefile.deps, which looks like this:
+#
+# java/awt/AWTUtilities.class: lists/java-awt.stamp
+# lists/java-awt.list: /home/aph/gcc/gcc/libjava/classpath/gnu/java/awt/AWTUtilities.java
+# java/awt/BitMaskExtent.class: lists/java-awt.stamp
+# lists/java-awt.list: /home/aph/gcc/gcc/libjava/classpath/gnu/java/awt/BitMaskExtent.java
+# java/awt/BitwiseXORComposite.class: lists/java-awt.stamp
+# lists/java-awt.list: /home/aph/gcc/gcc/libjava/classpath/gnu/java/awt/BitwiseXORComposite.java
+
+# This uses a somewhat hacky procedure for finding the package of a
+# given file.
+
echo "Splitting for gcj"
-rm -f Makefile.deps > /dev/null 2>&1
+rm -f Makefile.dtmp > /dev/null 2>&1
test -d lists || mkdir lists
for dir in java javax gnu org; do
- for file in `cat classes | fgrep /$dir/`; do
+ fgrep /$dir/ classes | while read file; do
pkg=`echo "$file " | sed -n -e "s,^.*/\($dir/.*\)/[^/]*$,\1,p"`
list=lists/`echo $pkg | sed -e 's,/,-,g'`
echo "$file" >> ${list}.list.1
f2=`echo "$file" | sed -n -e "s,^.*/\($dir/.*\)$,\1,p"`
f2=`echo "$f2" | sed -e 's/.java$//'`.class
- echo "$f2: ${list}.stamp" >> Makefile.deps
- echo "${list}.list: $file" >> Makefile.deps
+ echo "$f2: ${list}.stamp" >> Makefile.dtmp
+ echo "${list}.list: $file" >> Makefile.dtmp
done
done
@@ -26,3 +49,6 @@ for file in lists/*.list.1; do
mv $file $real
fi
done
+
+# If we were run we must update Makefile.deps.
+mv Makefile.dtmp Makefile.deps
diff --git a/libjava/classpath/lib/standard.omit b/libjava/classpath/lib/standard.omit
index 66f5a78..c95c4ed 100644
--- a/libjava/classpath/lib/standard.omit
+++ b/libjava/classpath/lib/standard.omit
@@ -1,4 +1,4 @@
../gnu/test/.*$
-../gnu/javax/swing/plaf/gtk/.*java$
-../gnu/javax/swing/plaf/gtk/README$
../gnu/classpath/jdwp/.*$
+../gnu/xml/stream/.*$
+../javax/xml/stream/.*$
diff --git a/libjava/classpath/ltcf-c.sh b/libjava/classpath/ltcf-c.sh
index f2e5ed0..d4d8b63 100644
--- a/libjava/classpath/ltcf-c.sh
+++ b/libjava/classpath/ltcf-c.sh
@@ -17,7 +17,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
diff --git a/libjava/classpath/ltcf-cxx.sh b/libjava/classpath/ltcf-cxx.sh
index 240e40d..e264452 100644
--- a/libjava/classpath/ltcf-cxx.sh
+++ b/libjava/classpath/ltcf-cxx.sh
@@ -22,7 +22,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
diff --git a/libjava/classpath/ltcf-gcj.sh b/libjava/classpath/ltcf-gcj.sh
index 4c6afeb..3f1c281 100644
--- a/libjava/classpath/ltcf-gcj.sh
+++ b/libjava/classpath/ltcf-gcj.sh
@@ -20,7 +20,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
diff --git a/libjava/classpath/ltconfig b/libjava/classpath/ltconfig
index 53eb942..b00e0ef 100755
--- a/libjava/classpath/ltconfig
+++ b/libjava/classpath/ltconfig
@@ -17,7 +17,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -2215,7 +2215,7 @@ case $ltmain in
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -2648,7 +2648,7 @@ EOF
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# */
#
# #include <stdio.h> /* for printf() */
diff --git a/libjava/classpath/m4/acinclude.m4 b/libjava/classpath/m4/acinclude.m4
index e9cb21e..e05a2f8e 100644
--- a/libjava/classpath/m4/acinclude.m4
+++ b/libjava/classpath/m4/acinclude.m4
@@ -319,38 +319,39 @@ dnl CLASSPATH_WITH_GLIBJ - specify what to install
dnl -----------------------------------------------------------
AC_DEFUN([CLASSPATH_WITH_GLIBJ],
[
+ AC_PATH_PROG(ZIP, zip)
AC_ARG_WITH([glibj],
[AS_HELP_STRING([--with-glibj],[define what to install (zip|flat|both|none|build) [default=zip]])],
[
if test "x${withval}" = xyes || test "x${withval}" = xzip; then
- AC_PATH_PROG(ZIP, zip)
install_class_files=no
build_class_files=yes
+ use_zip=yes
elif test "x${withval}" = xboth; then
- AC_PATH_PROG(ZIP, zip)
install_class_files=yes
build_class_files=yes
+ use_zip=yes
elif test "x${withval}" = xflat; then
- ZIP=
install_class_files=yes
build_class_files=yes
+ use_zip=no
elif test "x${withval}" = xno || test "x${withval}" = xnone; then
- ZIP=
install_class_files=no
build_class_files=no
+ use_zip=no
elif test "x${withval}" = xbuild; then
- ZIP=
install_class_files=no
build_class_files=yes
+ use_zip=no
else
AC_MSG_ERROR([unknown value given to --with-glibj])
fi
],
[
- AC_PATH_PROG(ZIP, zip)
install_class_files=no
+ use_zip=yes
])
- AM_CONDITIONAL(INSTALL_GLIBJ_ZIP, test "x${ZIP}" != x)
+ AM_CONDITIONAL(INSTALL_GLIBJ_ZIP, test "x${use_zip}" = xyes)
AM_CONDITIONAL(INSTALL_CLASS_FILES, test "x${install_class_files}" = xyes)
AM_CONDITIONAL(BUILD_CLASS_FILES, test "x${build_class_files}" = xyes)
@@ -362,7 +363,7 @@ AC_DEFUN([CLASSPATH_WITH_GLIBJ],
*) AC_MSG_ERROR(bad value ${enableval} for --enable-examples) ;;
esac],
[EXAMPLESDIR="examples"])
- if test "x${ZIP}" = x && test "x${install_class_files}" = xno; then
+ if test "x${use_zip}" = xno && test "x${install_class_files}" = xno; then
EXAMPLESDIR=""
fi
AC_SUBST(EXAMPLESDIR)
diff --git a/libjava/classpath/native/Makefile.am b/libjava/classpath/native/Makefile.am
index 6cc3090..4fa593e 100644
--- a/libjava/classpath/native/Makefile.am
+++ b/libjava/classpath/native/Makefile.am
@@ -4,6 +4,10 @@ if CREATE_JNI_LIBRARIES
JNIDIR = jni
endif
-SUBDIRS = fdlibm $(JNIDIR) target
-DIST_SUBDIRS = fdlibm jni target
+if CREATE_GTK_PEER_LIBRARIES
+ JAWTDIR = jawt
+endif
+
+SUBDIRS = fdlibm $(JNIDIR) $(JAWTDIR) target
+DIST_SUBDIRS = fdlibm jni jawt target
diff --git a/libjava/classpath/native/Makefile.in b/libjava/classpath/native/Makefile.in
index 5c9f48e..ac1f7c1 100644
--- a/libjava/classpath/native/Makefile.in
+++ b/libjava/classpath/native/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -90,8 +90,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -153,6 +159,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -164,12 +171,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -191,10 +199,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -235,8 +246,9 @@ target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
@CREATE_JNI_LIBRARIES_TRUE@JNIDIR = jni
-SUBDIRS = fdlibm $(JNIDIR) target
-DIST_SUBDIRS = fdlibm jni target
+@CREATE_GTK_PEER_LIBRARIES_TRUE@JAWTDIR = jawt
+SUBDIRS = fdlibm $(JNIDIR) $(JAWTDIR) target
+DIST_SUBDIRS = fdlibm jni jawt target
all: all-recursive
.SUFFIXES:
@@ -287,13 +299,7 @@ uninstall-info-am:
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
- @failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+ @set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -305,7 +311,7 @@ $(RECURSIVE_TARGETS):
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@@ -313,13 +319,7 @@ $(RECURSIVE_TARGETS):
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
- @failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+ @set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@@ -340,7 +340,7 @@ maintainer-clean-recursive:
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
diff --git a/libjava/classpath/native/fdlibm/Makefile.in b/libjava/classpath/native/fdlibm/Makefile.in
index 7b16338..f35614f 100644
--- a/libjava/classpath/native/fdlibm/Makefile.in
+++ b/libjava/classpath/native/fdlibm/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -109,8 +109,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -172,6 +178,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -183,12 +190,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -210,10 +218,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
diff --git a/libjava/classpath/native/jni/Makefile.am b/libjava/classpath/native/jni/Makefile.am
index 41d9a91..fce6b1a 100644
--- a/libjava/classpath/native/jni/Makefile.am
+++ b/libjava/classpath/native/jni/Makefile.am
@@ -8,13 +8,17 @@ if CREATE_GTK_PEER_LIBRARIES
GTKDIR = gtk-peer
endif
+if CREATE_QT_PEER_LIBRARIES
+ CLASSPATH_QT_PEER_DIR = qt-peer
+endif
+
if CREATE_XMLJ_LIBRARY
XMLJDIR = xmlj
endif
-SUBDIRS = classpath $(JNIDIRS) $(GTKDIR) $(XMLJDIR)
+SUBDIRS = classpath $(JNIDIRS) $(GTKDIR) $(CLASSPATH_QT_PEER_DIR) $(XMLJDIR)
DIST_SUBDIRS = classpath java-io java-lang java-net java-nio java-util \
- gtk-peer xmlj
+ gtk-peer qt-peer xmlj
all-local:
- cd $(top_srcdir) && scripts/check_jni_methods.sh
+ cd $(top_srcdir) && $(SHELL) ./scripts/check_jni_methods.sh
diff --git a/libjava/classpath/native/jni/Makefile.in b/libjava/classpath/native/jni/Makefile.in
index 4b263fc..825dda3 100644
--- a/libjava/classpath/native/jni/Makefile.in
+++ b/libjava/classpath/native/jni/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -90,8 +90,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -153,6 +159,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -164,12 +171,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -191,10 +199,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -236,10 +247,11 @@ target_vendor = @target_vendor@
vm_classes = @vm_classes@
@CREATE_CORE_JNI_LIBRARIES_TRUE@JNIDIRS = java-io java-lang java-net java-nio java-util
@CREATE_GTK_PEER_LIBRARIES_TRUE@GTKDIR = gtk-peer
+@CREATE_QT_PEER_LIBRARIES_TRUE@CLASSPATH_QT_PEER_DIR = qt-peer
@CREATE_XMLJ_LIBRARY_TRUE@XMLJDIR = xmlj
-SUBDIRS = classpath $(JNIDIRS) $(GTKDIR) $(XMLJDIR)
+SUBDIRS = classpath $(JNIDIRS) $(GTKDIR) $(CLASSPATH_QT_PEER_DIR) $(XMLJDIR)
DIST_SUBDIRS = classpath java-io java-lang java-net java-nio java-util \
- gtk-peer xmlj
+ gtk-peer qt-peer xmlj
all: all-recursive
@@ -291,13 +303,7 @@ uninstall-info-am:
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
- @failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+ @set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -309,7 +315,7 @@ $(RECURSIVE_TARGETS):
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@@ -317,13 +323,7 @@ $(RECURSIVE_TARGETS):
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
- @failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+ @set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@@ -344,7 +344,7 @@ maintainer-clean-recursive:
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -551,7 +551,7 @@ uninstall-info: uninstall-info-recursive
all-local:
- cd $(top_srcdir) && scripts/check_jni_methods.sh
+ cd $(top_srcdir) && $(SHELL) ./scripts/check_jni_methods.sh
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/libjava/classpath/native/jni/classpath/Makefile.am b/libjava/classpath/native/jni/classpath/Makefile.am
index 0171d37..2baa60a 100644
--- a/libjava/classpath/native/jni/classpath/Makefile.am
+++ b/libjava/classpath/native/jni/classpath/Makefile.am
@@ -1,3 +1,6 @@
+# Header needed for jawt implementations such as the one found in ../gtk-peer.
+EXTRA_DIST = classpath_jawt.h
+
noinst_LTLIBRARIES = libclasspath.la
libclasspath_la_SOURCES = jcl.c jcl.h \
diff --git a/libjava/classpath/native/jni/classpath/Makefile.in b/libjava/classpath/native/jni/classpath/Makefile.in
index 3d55605..f402ced 100644
--- a/libjava/classpath/native/jni/classpath/Makefile.in
+++ b/libjava/classpath/native/jni/classpath/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -103,8 +103,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -166,6 +172,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -177,12 +184,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -204,10 +212,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -247,6 +258,9 @@ target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
+
+# Header needed for jawt implementations such as the one found in ../gtk-peer.
+EXTRA_DIST = classpath_jawt.h
noinst_LTLIBRARIES = libclasspath.la
libclasspath_la_SOURCES = jcl.c jcl.h \
jnilink.c jnilink.h \
diff --git a/libjava/classpath/native/jni/classpath/classpath_jawt.h b/libjava/classpath/native/jni/classpath/classpath_jawt.h
index 6ff5c53..32a04dc 100644
--- a/libjava/classpath/native/jni/classpath/classpath_jawt.h
+++ b/libjava/classpath/native/jni/classpath/classpath_jawt.h
@@ -1,39 +1,39 @@
/* classpath_awt.h -- libjawt's interface to the peer library
Copyright (C) 2005 Free Software Foundation, Inc.
- This file is part of GNU Classpath.
+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 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. */
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
/*
* libjawt.so is linked directly to the peer library with -l. This
@@ -50,15 +50,11 @@
#define CLASSPATH_JAWT_VERSION 0x10004
-jint classpath_jawt_get_awt_version ();
+jint classpath_jawt_get_awt_version (void);
Display* classpath_jawt_get_default_display (JNIEnv* env, jobject canvas);
Drawable classpath_jawt_get_drawable (JNIEnv* env, jobject canvas);
VisualID classpath_jawt_get_visualID (JNIEnv* env, jobject canvas);
-jint classpath_jawt_object_lock (jobject lock);
-void classpath_jawt_object_unlock (jobject lock);
-jint classpath_jawt_lock ();
-void classpath_jawt_unlock ();
-jobject classpath_jawt_create_lock ();
-void classpath_jawt_destroy_lock (jobject lock);
+jint classpath_jawt_lock (void);
+void classpath_jawt_unlock (void);
#endif /* __classpath_jawt_h__ */
diff --git a/libjava/classpath/native/jni/classpath/jcl.c b/libjava/classpath/native/jni/classpath/jcl.c
index 03f9b37..4821770 100644
--- a/libjava/classpath/native/jni/classpath/jcl.c
+++ b/libjava/classpath/native/jni/classpath/jcl.c
@@ -178,3 +178,94 @@ JCL_FindClass (JNIEnv * env, const char *className)
}
return retval;
}
+
+
+/*
+ * Build a Pointer object. The function caches the class type
+ */
+
+static jclass rawDataClass;
+static jfieldID rawData_fid;
+static jmethodID rawData_mid;
+
+JNIEXPORT jobject JNICALL
+JCL_NewRawDataObject (JNIEnv * env, void *data)
+{
+ if (rawDataClass == NULL)
+ {
+#ifdef POINTERS_ARE_64BIT
+ rawDataClass = (*env)->FindClass (env, "gnu/classpath/Pointer64");
+ if (rawDataClass == NULL)
+ {
+ JCL_ThrowException (env, "java/lang/InternalError",
+ "unable to find internal class");
+ return NULL;
+ }
+
+ rawData_mid = (*env)->GetMethodID (env, rawDataClass, "<init>", "(J)V");
+ if (rawData_mid == NULL)
+ {
+ JCL_ThrowException (env, "java/lang/InternalError",
+ "unable to find internal constructor");
+ return NULL;
+ }
+
+ rawData_fid = (*env)->GetFieldID (env, rawDataClass, "data", "J");
+ if (rawData_fid == NULL)
+ {
+ JCL_ThrowException (env, "java/lang/InternalError",
+ "unable to find internal field");
+ return NULL;
+ }
+#else
+ rawDataClass = (*env)->FindClass (env, "gnu/classpath/Pointer32");
+ if (rawDataClass == NULL)
+ {
+ JCL_ThrowException (env, "java/lang/InternalError",
+ "unable to find internal class");
+ return NULL;
+ }
+
+ rawData_mid = (*env)->GetMethodID (env, rawDataClass, "<init>", "(I)V");
+ if (rawData_mid == NULL)
+ {
+ JCL_ThrowException (env, "java/lang/InternalError",
+ "unable to find internal constructor");
+ return NULL;
+ }
+
+ rawData_fid = (*env)->GetFieldID (env, rawDataClass, "data", "I");
+ if (rawData_fid == NULL)
+ {
+ JCL_ThrowException (env, "java/lang/InternalError",
+ "unable to find internal field");
+ return NULL;
+ }
+
+#endif
+ (*env)->DeleteLocalRef(env, rawDataClass);
+ rawDataClass = (*env)->NewGlobalRef (env, rawDataClass);
+ if (rawDataClass == NULL)
+ {
+ JCL_ThrowException (env, "java/lang/InternalError",
+ "unable to create an internal global ref");
+ return NULL;
+ }
+ }
+
+#ifdef POINTERS_ARE_64BIT
+ return (*env)->NewObject (env, rawDataClass, rawData_mid, (jlong) data);
+#else
+ return (*env)->NewObject (env, rawDataClass, rawData_mid, (jint) data);
+#endif
+}
+
+JNIEXPORT void * JNICALL
+JCL_GetRawData (JNIEnv * env, jobject rawdata)
+{
+#ifdef POINTERS_ARE_64BIT
+ return (void *) (*env)->GetLongField (env, rawdata, rawData_fid);
+#else
+ return (void *) (*env)->GetIntField (env, rawdata, rawData_fid);
+#endif
+}
diff --git a/libjava/classpath/native/jni/classpath/jcl.h b/libjava/classpath/native/jni/classpath/jcl.h
index e526b29..25662c0 100644
--- a/libjava/classpath/native/jni/classpath/jcl.h
+++ b/libjava/classpath/native/jni/classpath/jcl.h
@@ -42,6 +42,14 @@ exception statement from your version. */
#include <jni.h>
#include <config.h>
+#if SIZEOF_VOID_P == 4
+typedef jint jpointer;
+#elif SIZEOF_VOID_P == 8
+typedef jlong jpointer;
+#else
+#error "Unknown pointer size"
+#endif
+
JNIEXPORT jclass JNICALL JCL_FindClass (JNIEnv * env, const char *className);
JNIEXPORT void JNICALL JCL_ThrowException (JNIEnv * env,
const char *className,
@@ -56,6 +64,9 @@ JNIEXPORT void JNICALL JCL_free_cstring (JNIEnv * env, jstring s,
JNIEXPORT jint JNICALL JCL_MonitorEnter (JNIEnv * env, jobject o);
JNIEXPORT jint JNICALL JCL_MonitorExit (JNIEnv * env, jobject o);
+JNIEXPORT jobject JNICALL JCL_NewRawDataObject (JNIEnv * env, void *data);
+JNIEXPORT void * JNICALL JCL_GetRawData (JNIEnv * env, jobject rawdata);
+
#define JCL_RETHROW_EXCEPTION(env) if((*(env))->ExceptionOccurred((env)) != NULL) return NULL;
/* Simple debug macro */
diff --git a/libjava/classpath/native/jni/classpath/native_state.c b/libjava/classpath/native/jni/classpath/native_state.c
index 3c11b83..2cb43d61 100644
--- a/libjava/classpath/native/jni/classpath/native_state.c
+++ b/libjava/classpath/native/jni/classpath/native_state.c
@@ -36,6 +36,7 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
#include <stdlib.h>
+#include <assert.h>
#include <jni.h>
#include "native_state.h"
@@ -165,6 +166,18 @@ add_node (struct state_node **head, jint obj_id, void *state)
*head = new_node;
}
+#ifndef NDEBUG
+static void
+cp_gtk_check_compat (JNIEnv * env, jobject obj, struct state_table *table)
+{
+ jclass objclazz;
+
+ objclazz = (*env)->GetObjectClass(env, obj);
+ assert ((*env)->IsAssignableFrom(env, objclazz, table->clazz));
+ (*env)->DeleteLocalRef(env, objclazz);
+}
+#endif
+
void
cp_gtk_set_state_oid (JNIEnv * env, jobject lock, struct state_table *table,
jint obj_id, void *state)
@@ -214,6 +227,11 @@ int
cp_gtk_set_state (JNIEnv * env, jobject obj, struct state_table *table, void *state)
{
jint obj_id;
+
+#ifndef NDEBUG
+ cp_gtk_check_compat(env, obj, table);
+#endif
+
obj_id = (*env)->GetIntField (env, obj, table->hash);
if ((*env)->ExceptionOccurred (env) != NULL)
@@ -227,6 +245,11 @@ void *
cp_gtk_get_state (JNIEnv * env, jobject obj, struct state_table *table)
{
jint obj_id;
+
+#ifndef NDEBUG
+ cp_gtk_check_compat(env, obj, table);
+#endif
+
obj_id = (*env)->GetIntField (env, obj, table->hash);
if ((*env)->ExceptionOccurred (env) != NULL)
@@ -239,6 +262,11 @@ void *
cp_gtk_remove_state_slot (JNIEnv * env, jobject obj, struct state_table *table)
{
jint obj_id;
+
+#ifndef NDEBUG
+ cp_gtk_check_compat(env, obj, table);
+#endif
+
obj_id = (*env)->GetIntField (env, obj, table->hash);
if ((*env)->ExceptionOccurred (env) != NULL)
diff --git a/libjava/classpath/native/jni/gtk-peer/Makefile.am b/libjava/classpath/native/jni/gtk-peer/Makefile.am
index f4e7bdf..6f21057 100644
--- a/libjava/classpath/native/jni/gtk-peer/Makefile.am
+++ b/libjava/classpath/native/jni/gtk-peer/Makefile.am
@@ -39,6 +39,7 @@ libgtkpeer_la_SOURCES = $(gtk_cairo_c_source_files) \
gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c \
gnu_java_awt_peer_gtk_GtkScrollbarPeer.c \
gnu_java_awt_peer_gtk_GtkScrollPanePeer.c \
+ gnu_java_awt_peer_gtk_GtkSelection.c \
gnu_java_awt_peer_gtk_GtkTextAreaPeer.c \
gnu_java_awt_peer_gtk_GtkTextFieldPeer.c \
gnu_java_awt_peer_gtk_GtkToolkit.c \
@@ -47,6 +48,7 @@ libgtkpeer_la_SOURCES = $(gtk_cairo_c_source_files) \
gdkfont.h \
gthread-jni.h \
gtkcairopeer.h \
+ gtk_jawt.c \
gtkpeer.h
libgtkpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/native_state.lo \
diff --git a/libjava/classpath/native/jni/gtk-peer/Makefile.in b/libjava/classpath/native/jni/gtk-peer/Makefile.in
index fdf3fd1..f49d2a5 100644
--- a/libjava/classpath/native/jni/gtk-peer/Makefile.in
+++ b/libjava/classpath/native/jni/gtk-peer/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -96,11 +96,12 @@ am__libgtkpeer_la_SOURCES_DIST = \
gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c \
gnu_java_awt_peer_gtk_GtkScrollbarPeer.c \
gnu_java_awt_peer_gtk_GtkScrollPanePeer.c \
+ gnu_java_awt_peer_gtk_GtkSelection.c \
gnu_java_awt_peer_gtk_GtkTextAreaPeer.c \
gnu_java_awt_peer_gtk_GtkTextFieldPeer.c \
gnu_java_awt_peer_gtk_GtkToolkit.c \
gnu_java_awt_peer_gtk_GtkWindowPeer.c gthread-jni.c gdkfont.h \
- gthread-jni.h gtkcairopeer.h gtkpeer.h
+ gthread-jni.h gtkcairopeer.h gtk_jawt.c gtkpeer.h
@GTK_CAIRO_TRUE@am__objects_1 = \
@GTK_CAIRO_TRUE@ gnu_java_awt_peer_gtk_GdkGraphics2D.lo
am_libgtkpeer_la_OBJECTS = $(am__objects_1) \
@@ -134,10 +135,12 @@ am_libgtkpeer_la_OBJECTS = $(am__objects_1) \
gnu_java_awt_peer_gtk_GtkPopupMenuPeer.lo \
gnu_java_awt_peer_gtk_GtkScrollbarPeer.lo \
gnu_java_awt_peer_gtk_GtkScrollPanePeer.lo \
+ gnu_java_awt_peer_gtk_GtkSelection.lo \
gnu_java_awt_peer_gtk_GtkTextAreaPeer.lo \
gnu_java_awt_peer_gtk_GtkTextFieldPeer.lo \
gnu_java_awt_peer_gtk_GtkToolkit.lo \
- gnu_java_awt_peer_gtk_GtkWindowPeer.lo gthread-jni.lo
+ gnu_java_awt_peer_gtk_GtkWindowPeer.lo gthread-jni.lo \
+ gtk_jawt.lo
libgtkpeer_la_OBJECTS = $(am_libgtkpeer_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -185,8 +188,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -248,6 +257,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -259,12 +269,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -286,10 +297,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -367,6 +381,7 @@ libgtkpeer_la_SOURCES = $(gtk_cairo_c_source_files) \
gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c \
gnu_java_awt_peer_gtk_GtkScrollbarPeer.c \
gnu_java_awt_peer_gtk_GtkScrollPanePeer.c \
+ gnu_java_awt_peer_gtk_GtkSelection.c \
gnu_java_awt_peer_gtk_GtkTextAreaPeer.c \
gnu_java_awt_peer_gtk_GtkTextFieldPeer.c \
gnu_java_awt_peer_gtk_GtkToolkit.c \
@@ -375,6 +390,7 @@ libgtkpeer_la_SOURCES = $(gtk_cairo_c_source_files) \
gdkfont.h \
gthread-jni.h \
gtkcairopeer.h \
+ gtk_jawt.c \
gtkpeer.h
libgtkpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/native_state.lo \
@@ -488,11 +504,13 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkScrollPanePeer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkScrollbarPeer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkSelection.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkTextAreaPeer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkTextFieldPeer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkToolkit.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_java_awt_peer_gtk_GtkWindowPeer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gthread-jni.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtk_jawt.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
index 401d623..6f2a1ae 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
@@ -150,12 +150,8 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_getGlyphVector
if (i == NULL)
{
- gdk_threads_leave ();
-
java_extents = (*env)->NewDoubleArray (env, 0);
java_codes = (*env)->NewIntArray (env, 0);
-
- gdk_threads_enter ();
}
else
{
@@ -177,13 +173,9 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_getGlyphVector
int x = 0;
double scale = ((double) PANGO_SCALE);
- gdk_threads_leave ();
-
java_extents = (*env)->NewDoubleArray (env, glyphs->num_glyphs * NUM_GLYPH_METRICS);
java_codes = (*env)->NewIntArray (env, glyphs->num_glyphs);
- gdk_threads_enter ();
-
native_extents = (*env)->GetDoubleArrayElements (env, java_extents, NULL);
native_codes = (*env)->GetIntArrayElements (env, java_codes, NULL);
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
index 9b2f16e..b122eb0 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
@@ -41,7 +41,7 @@ exception statement from your version. */
#include <gdk/gdkprivate.h>
#include <gdk/gdkx.h>
-static jmethodID initComponentGraphicsID;
+static jmethodID initComponentGraphicsUnlockedID;
void
cp_gtk_graphics_init_jni (void)
@@ -51,9 +51,44 @@ cp_gtk_graphics_init_jni (void)
gdkgraphics = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
"gnu/java/awt/peer/gtk/GdkGraphics");
- initComponentGraphicsID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gdkgraphics,
- "initComponentGraphics",
- "()V");
+ initComponentGraphicsUnlockedID =
+ (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gdkgraphics,
+ "initComponentGraphicsUnlocked",
+ "()V");
+}
+
+struct state_table *cp_gtk_native_graphics_state_table;
+
+static struct state_table *native_graphics_global_ref_table;
+
+#define NSA_GLOBAL_G_INIT(env, clazz) \
+ native_graphics_global_ref_table = cp_gtk_init_state_table (env, clazz)
+
+#define NSA_GET_GLOBAL_G_REF(env, obj) \
+ cp_gtk_get_state (env, obj, native_graphics_global_ref_table)
+
+#define NSA_SET_GLOBAL_G_REF(env, obj) \
+ do {jobject *globRefPtr; \
+ globRefPtr = (jobject *) malloc (sizeof (jobject)); \
+ *globRefPtr = (*env)->NewGlobalRef (env, obj); \
+ cp_gtk_set_state (env, obj, native_graphics_global_ref_table, (void *)globRefPtr);} while (0)
+
+#define NSA_DEL_GLOBAL_G_REF(env, obj) \
+ do {jobject *globRefPtr = cp_gtk_get_state (env, obj, native_graphics_global_ref_table); \
+ cp_gtk_remove_state_slot (env, obj, native_graphics_global_ref_table); \
+ (*env)->DeleteGlobalRef (env, *globRefPtr); \
+ free (globRefPtr);} while (0)
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_initStaticState
+ (JNIEnv *env, jclass clazz)
+{
+ gdk_threads_enter();
+
+ NSA_G_INIT (env, clazz);
+ NSA_GLOBAL_G_INIT (env, clazz);
+
+ gdk_threads_leave();
}
#define GDK_STABLE_IS_PIXMAP(d) (GDK_IS_PIXMAP(d))
@@ -73,7 +108,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_copyState
gdk_threads_enter ();
g = (struct graphics *) g_malloc (sizeof (struct graphics));
- g_old = (struct graphics *) NSA_GET_PTR (env, old);
+ g_old = (struct graphics *) NSA_GET_G_PTR (env, old);
*g = *g_old;
@@ -87,7 +122,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_copyState
gdk_colormap_ref (g->cm);
- NSA_SET_PTR (env, obj, g);
+ NSA_SET_G_PTR (env, obj, g);
gdk_threads_leave ();
}
@@ -109,7 +144,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__II
gdk_colormap_ref (g->cm);
g->gc = gdk_gc_new (g->drawable);
- NSA_SET_PTR (env, obj, g);
+ NSA_SET_G_PTR (env, obj, g);
gdk_threads_leave ();
}
@@ -136,15 +171,13 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_initFromImage
gdk_colormap_ref (g->cm);
g->gc = gdk_gc_new (g->drawable);
- NSA_SET_PTR (env, obj, g);
+ NSA_SET_G_PTR (env, obj, g);
gdk_threads_leave ();
}
-/* copy the native state of the peer (GtkWidget *) to the native state
- of the graphics object */
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2
+Java_gnu_java_awt_peer_gtk_GdkGraphics_initStateUnlocked
(JNIEnv *env, jobject obj, jobject peer)
{
struct graphics *g = NULL;
@@ -152,8 +185,6 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__Lgnu_java_awt_peer_gtk_GtkComp
GtkWidget *widget = NULL;
GdkColor color;
- gdk_threads_enter ();
-
g = (struct graphics *) g_malloc (sizeof (struct graphics));
ptr = NSA_GET_PTR (env, peer);
g->x_offset = 0;
@@ -169,8 +200,18 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__Lgnu_java_awt_peer_gtk_GtkComp
gdk_gc_copy (g->gc, widget->style->fg_gc[GTK_STATE_NORMAL]);
color = widget->style->fg[GTK_STATE_NORMAL];
- NSA_SET_PTR (env, obj, g);
+ NSA_SET_G_PTR (env, obj, g);
+}
+/* copy the native state of the peer (GtkWidget *) to the native state
+ of the graphics object */
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2
+ (JNIEnv *env, jobject obj, jobject peer)
+{
+ gdk_threads_enter ();
+ Java_gnu_java_awt_peer_gtk_GdkGraphics_initStateUnlocked
+ (env, obj, peer);
gdk_threads_leave ();
}
@@ -183,8 +224,8 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_connectSignals
gdk_threads_enter ();
- NSA_SET_GLOBAL_REF (env, obj);
- gref = NSA_GET_GLOBAL_REF (env, obj);
+ NSA_SET_GLOBAL_G_REF (env, obj);
+ gref = NSA_GET_GLOBAL_G_REF (env, obj);
ptr = NSA_GET_PTR (env, peer);
@@ -202,7 +243,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_dispose
gdk_threads_enter ();
- g = (struct graphics *) NSA_DEL_PTR (env, obj);
+ g = (struct graphics *) NSA_DEL_G_PTR (env, obj);
/* check if dispose has been called already */
if (!g)
@@ -235,7 +276,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_translateNative
gdk_threads_enter ();
- g = (struct graphics *) NSA_GET_PTR (env, obj);
+ g = (struct graphics *) NSA_GET_G_PTR (env, obj);
g->x_offset += x;
g->y_offset += y;
@@ -255,7 +296,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_drawString
gdk_threads_enter ();
- g = (struct graphics *) NSA_GET_PTR (env, obj);
+ g = (struct graphics *) NSA_GET_G_PTR (env, obj);
g_assert (g != NULL);
pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, font);
@@ -292,7 +333,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_drawLine
gdk_threads_enter ();
- g = (struct graphics *) NSA_GET_PTR (env, obj);
+ g = (struct graphics *) NSA_GET_G_PTR (env, obj);
gdk_draw_line (g->drawable, g->gc,
x + g->x_offset, y + g->y_offset,
@@ -310,7 +351,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_fillRect
gdk_threads_enter ();
- g = (struct graphics *) NSA_GET_PTR (env, obj);
+ g = (struct graphics *) NSA_GET_G_PTR (env, obj);
gdk_draw_rectangle (g->drawable, g->gc, TRUE,
x + g->x_offset, y + g->y_offset, width, height);
@@ -327,7 +368,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_drawRect
gdk_threads_enter ();
- g = (struct graphics *) NSA_GET_PTR (env, obj);
+ g = (struct graphics *) NSA_GET_G_PTR (env, obj);
gdk_draw_rectangle (g->drawable, g->gc, FALSE,
x + g->x_offset, y + g->y_offset, width, height);
@@ -345,7 +386,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_copyArea
gdk_threads_enter ();
- g = (struct graphics *) NSA_GET_PTR (env, obj);
+ g = (struct graphics *) NSA_GET_G_PTR (env, obj);
gdk_window_copy_area ((GdkWindow *)g->drawable,
g->gc,
@@ -369,7 +410,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_clearRect
gdk_threads_enter ();
- g = (struct graphics *) NSA_GET_PTR (env, obj);
+ g = (struct graphics *) NSA_GET_G_PTR (env, obj);
if (!g)
{
@@ -408,7 +449,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_setFunction
gdk_threads_enter ();
- g = (struct graphics *) NSA_GET_PTR (env, obj);
+ g = (struct graphics *) NSA_GET_G_PTR (env, obj);
gdk_gc_set_function (g->gc, func);
@@ -429,7 +470,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_setFGColor
color.green = green << 8;
color.blue = blue << 8;
- g = (struct graphics *) NSA_GET_PTR (env, obj);
+ g = (struct graphics *) NSA_GET_G_PTR (env, obj);
gdk_color_alloc (g->cm, &color);
gdk_gc_set_foreground (g->gc, &color);
@@ -446,7 +487,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_drawArc
gdk_threads_enter ();
- g = (struct graphics *) NSA_GET_PTR (env, obj);
+ g = (struct graphics *) NSA_GET_G_PTR (env, obj);
gdk_draw_arc (g->drawable, g->gc, FALSE,
x + g->x_offset, y + g->y_offset,
@@ -493,7 +534,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolyline
gdk_threads_enter ();
- g = (struct graphics *) NSA_GET_PTR (env, obj);
+ g = (struct graphics *) NSA_GET_G_PTR (env, obj);
points = translate_points (env, xpoints, ypoints, npoints,
g->x_offset, g->y_offset);
@@ -515,7 +556,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolygon
gdk_threads_enter ();
- g = (struct graphics *) NSA_GET_PTR (env, obj);
+ g = (struct graphics *) NSA_GET_G_PTR (env, obj);
points = translate_points (env, xpoints, ypoints, npoints,
g->x_offset, g->y_offset);
@@ -542,7 +583,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_fillPolygon
gdk_threads_enter ();
- g = (struct graphics *) NSA_GET_PTR (env, obj);
+ g = (struct graphics *) NSA_GET_G_PTR (env, obj);
points = translate_points (env, xpoints, ypoints, npoints,
g->x_offset, g->y_offset);
gdk_draw_polygon (g->drawable, g->gc, TRUE, points, npoints);
@@ -562,7 +603,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_fillArc
gdk_threads_enter ();
- g = (struct graphics *) NSA_GET_PTR (env, obj);
+ g = (struct graphics *) NSA_GET_G_PTR (env, obj);
gdk_draw_arc (g->drawable, g->gc, TRUE,
x + g->x_offset, y + g->y_offset,
@@ -580,7 +621,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_drawOval
gdk_threads_enter ();
- g = (struct graphics *) NSA_GET_PTR (env, obj);
+ g = (struct graphics *) NSA_GET_G_PTR (env, obj);
gdk_draw_arc (g->drawable, g->gc, FALSE,
x + g->x_offset, y + g->y_offset,
@@ -598,7 +639,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_fillOval
gdk_threads_enter ();
- g = (struct graphics *) NSA_GET_PTR (env, obj);
+ g = (struct graphics *) NSA_GET_G_PTR (env, obj);
gdk_draw_arc (g->drawable, g->gc, TRUE,
x + g->x_offset, y + g->y_offset,
@@ -617,7 +658,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_setClipRectangle
gdk_threads_enter ();
- g = (struct graphics *) NSA_GET_PTR (env, obj);
+ g = (struct graphics *) NSA_GET_G_PTR (env, obj);
rectangle.x = x + g->x_offset;
rectangle.y = y + g->y_offset;
@@ -632,11 +673,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_setClipRectangle
static void
realize_cb (GtkWidget *widget __attribute__ ((unused)), jobject jgraphics)
{
- gdk_threads_leave ();
+ (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(),
+ jgraphics,
+ initComponentGraphicsUnlockedID);
- (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), jgraphics, initComponentGraphicsID);
-
- NSA_DEL_GLOBAL_REF (cp_gtk_gdk_env(), jgraphics);
-
- gdk_threads_enter ();
+ NSA_DEL_GLOBAL_G_REF (cp_gtk_gdk_env(), jgraphics);
}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
index b4bd676..fe9980f 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
@@ -52,7 +52,7 @@
#include <stdio.h>
#include <stdlib.h>
-static jmethodID initComponentGraphics2DID;
+static jmethodID initComponentGraphics2DUnlockedID;
void
cp_gtk_graphics2d_init_jni (void)
@@ -62,8 +62,8 @@ cp_gtk_graphics2d_init_jni (void)
gdkgraphics2d = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
"gnu/java/awt/peer/gtk/GdkGraphics2D");
- initComponentGraphics2DID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gdkgraphics2d,
- "initComponentGraphics2D",
+ initComponentGraphics2DUnlockedID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gdkgraphics2d,
+ "initComponentGraphics2DUnlocked",
"()V");
}
@@ -369,11 +369,9 @@ check_for_debug (struct graphics2d *gr)
static void
realize_cb (GtkWidget *widget __attribute__ ((unused)), jobject peer)
{
- gdk_threads_leave ();
-
- (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer, initComponentGraphics2DID);
-
- gdk_threads_enter ();
+ (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(),
+ peer,
+ initComponentGraphics2DUnlockedID);
}
JNIEXPORT void JNICALL
@@ -593,6 +591,43 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable
}
JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initStateUnlocked
+ (JNIEnv *env, jobject obj, jobject peer)
+{
+ struct graphics2d *gr = NULL;
+ GtkWidget *widget = NULL;
+ void *ptr = NULL;
+
+ if (peer_is_disposed(env, obj))
+ return;
+
+ ptr = NSA_GET_PTR (env, peer);
+ g_assert (ptr != NULL);
+
+ gr = (struct graphics2d *) g_malloc (sizeof (struct graphics2d));
+ g_assert (gr != NULL);
+ memset (gr, 0, sizeof(struct graphics2d));
+
+ check_for_debug (gr);
+
+ widget = GTK_WIDGET (ptr);
+ g_assert (widget != NULL);
+
+ grab_current_drawable (widget, &(gr->drawable), &(gr->win));
+ g_assert (gr->drawable != NULL);
+
+ gr->width = widget->allocation.width;
+ gr->height = widget->allocation.height;
+
+ if (x_server_has_render_extension ())
+ init_graphics2d_as_renderable (gr);
+ else
+ init_graphics2d_as_pixbuf (gr);
+
+ NSA_SET_G2D_PTR (env, obj, gr);
+}
+
+JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2
(JNIEnv *env, jobject obj, jobject peer)
{
@@ -711,21 +746,36 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setGradient
jint r2, jint g2, jint b2, jint a2,
jboolean cyclic)
{
+ gdk_threads_enter();
+ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setGradientUnlocked
+ (env, obj,
+ x1, y1, x2, y2,
+ r1, g1, b1, a1,
+ r2, g2, b2, a2,
+ cyclic);
+
+ gdk_threads_leave();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setGradientUnlocked
+ (JNIEnv *env, jobject obj,
+ jdouble x1, jdouble y1,
+ jdouble x2, jdouble y2,
+ jint r1, jint g1, jint b1, jint a1,
+ jint r2, jint g2, jint b2, jint a2,
+ jboolean cyclic)
+{
struct graphics2d *gr = NULL;
cairo_surface_t *surf = NULL;
cairo_t *cr2 = NULL;
cairo_matrix_t mat;
- gdk_threads_enter();
-
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
g_assert (gr != NULL);
if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave ();
- return;
- }
+ return;
if (gr->debug) printf ("setGradient (%f,%f) -> (%f,%f); (%d,%d,%d,%d) -> (%d,%d,%d,%d)\n",
x1, y1,
@@ -826,24 +876,29 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setGradient
gr->pattern = cairo_pattern_create_for_surface(surf);
cairo_set_source (gr->cr, gr->pattern);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixels
+ (JNIEnv *env, jobject obj, jintArray jarr, jint w, jint h, jint stride)
+{
+ gdk_threads_enter();
+
+ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixelsUnlocked
+ (env, obj, jarr, w, h, stride);
gdk_threads_leave();
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixels
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixelsUnlocked
(JNIEnv *env, jobject obj, jintArray jarr, jint w, jint h, jint stride)
{
struct graphics2d *gr = NULL;
jint *jpixels = NULL;
- gdk_threads_enter();
-
if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave ();
- return;
- }
+ return;
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
g_assert (gr != NULL);
@@ -880,8 +935,6 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixels
gr->pattern = cairo_pattern_create_for_surface (gr->pattern_surface);
g_assert (gr->pattern != NULL);
cairo_set_source (gr->cr, gr->pattern);
-
- gdk_threads_leave();
}
JNIEXPORT void JNICALL
@@ -996,26 +1049,30 @@ JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrix
(JNIEnv *env, jobject obj, jdoubleArray java_matrix)
{
+ gdk_threads_enter();
+
+ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrixUnlocked
+ (env, obj, java_matrix);
+
+ gdk_threads_leave();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrixUnlocked
+ (JNIEnv *env, jobject obj, jdoubleArray java_matrix)
+{
struct graphics2d *gr = NULL;
jdouble *native_matrix = NULL;
- gdk_threads_enter();
-
if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave ();
- return;
- }
+ return;
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
/* cairoSetMatrix was called before this graphics object's component
was realized. */
if (gr == NULL)
- {
- gdk_threads_leave ();
- return;
- }
+ return;
native_matrix = (*env)->GetDoubleArrayElements (env, java_matrix, NULL);
g_assert (native_matrix != NULL);
@@ -1039,8 +1096,6 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrix
(*env)->ReleaseDoubleArrayElements (env, java_matrix, native_matrix, 0);
update_pattern_transform (gr);
-
- gdk_threads_leave();
}
static void
@@ -1357,15 +1412,22 @@ JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBAColor
(JNIEnv *env, jobject obj, jdouble r, jdouble g, jdouble b, jdouble a)
{
- struct graphics2d *gr = NULL;
-
gdk_threads_enter();
+ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBAColorUnlocked
+ (env, obj, r, g, b, a);
+
+ gdk_threads_leave();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBAColorUnlocked
+ (JNIEnv *env, jobject obj, jdouble r, jdouble g, jdouble b, jdouble a)
+{
+ struct graphics2d *gr = NULL;
+
if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave ();
- return;
- }
+ return;
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
g_assert (gr != NULL);
@@ -1381,8 +1443,6 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBAColor
cairo_set_source_rgba (gr->cr, b, g, r, a);
else
cairo_set_source_rgba (gr->cr, r, g, b, a);
-
- gdk_threads_leave();
}
JNIEXPORT void JNICALL
@@ -1419,10 +1479,20 @@ JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineWidth
(JNIEnv *env, jobject obj, jdouble width)
{
- struct graphics2d *gr = NULL;
-
gdk_threads_enter();
+ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineWidthUnlocked
+ (env, obj, width);
+
+ gdk_threads_leave();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineWidthUnlocked
+ (JNIEnv *env, jobject obj, jdouble width)
+{
+ struct graphics2d *gr = NULL;
+
if (peer_is_disposed(env, obj))
return;
@@ -1430,23 +1500,28 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineWidth
g_assert (gr != NULL);
if (gr->debug) printf ("cairo_set_line_width %f\n", width);
cairo_set_line_width (gr->cr, width);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineCap
+ (JNIEnv *env, jobject obj, jint cap)
+{
+ gdk_threads_enter();
+
+ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineCapUnlocked
+ (env, obj, cap);
gdk_threads_leave();
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineCap
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineCapUnlocked
(JNIEnv *env, jobject obj, jint cap)
{
struct graphics2d *gr = NULL;
- gdk_threads_enter();
-
if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave ();
- return;
- }
+ return;
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
g_assert (gr != NULL);
@@ -1465,23 +1540,28 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineCap
cairo_set_line_cap (gr->cr, CAIRO_LINE_CAP_SQUARE);
break;
}
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineJoin
+ (JNIEnv *env, jobject obj, jint join)
+{
+ gdk_threads_enter();
+
+ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineJoinUnlocked
+ (env, obj, join);
gdk_threads_leave();
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineJoin
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineJoinUnlocked
(JNIEnv *env, jobject obj, jint join)
{
struct graphics2d *gr = NULL;
- gdk_threads_enter();
-
if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave ();
- return;
- }
+ return;
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
g_assert (gr != NULL);
@@ -1500,24 +1580,29 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineJoin
cairo_set_line_join (gr->cr, CAIRO_LINE_JOIN_BEVEL);
break;
}
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetDash
+ (JNIEnv *env, jobject obj, jdoubleArray dashes, jint ndash, jdouble offset)
+{
+ gdk_threads_enter();
+
+ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetDashUnlocked
+ (env, obj, dashes, ndash, offset);
gdk_threads_leave();
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetDash
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetDashUnlocked
(JNIEnv *env, jobject obj, jdoubleArray dashes, jint ndash, jdouble offset)
{
struct graphics2d *gr = NULL;
jdouble *dasharr = NULL;
- gdk_threads_enter();
-
if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave ();
- return;
- }
+ return;
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
g_assert (gr != NULL);
@@ -1526,30 +1611,33 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetDash
g_assert (dasharr != NULL);
cairo_set_dash (gr->cr, dasharr, ndash, offset);
(*env)->ReleaseDoubleArrayElements (env, dashes, dasharr, 0);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMiterLimit
+ (JNIEnv *env, jobject obj, jdouble miter)
+{
+ gdk_threads_enter();
+
+ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMiterLimitUnlocked
+ (env, obj, miter);
gdk_threads_leave();
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMiterLimit
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMiterLimitUnlocked
(JNIEnv *env, jobject obj, jdouble miter)
{
struct graphics2d *gr = NULL;
- gdk_threads_enter();
-
if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave ();
- return;
- }
+ return;
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
g_assert (gr != NULL);
if (gr->debug) printf ("cairo_set_miter_limit %f\n", miter);
cairo_set_miter_limit (gr->cr, miter);
-
- gdk_threads_leave();
}
JNIEXPORT void JNICALL
@@ -1845,15 +1933,22 @@ JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilter
(JNIEnv *env, jobject obj, jint filter)
{
- struct graphics2d *gr = NULL;
-
gdk_threads_enter();
+ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilterUnlocked
+ (env, obj, filter);
+
+ gdk_threads_leave();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilterUnlocked
+ (JNIEnv *env, jobject obj, jint filter)
+{
+ struct graphics2d *gr = NULL;
+
if (peer_is_disposed(env, obj))
- {
- gdk_threads_leave ();
- return;
- }
+ return;
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
g_assert (gr != NULL);
@@ -1876,6 +1971,4 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilter
cairo_pattern_set_filter (gr->pattern, CAIRO_FILTER_BEST);
break;
}
-
- gdk_threads_leave();
}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
index 648cd66..74103b5 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
@@ -97,14 +97,10 @@ area_prepared_cb (GdkPixbufLoader *loader,
e.jni_env = &env;
(*vm)->GetEnv (vm, e.void_env, JNI_VERSION_1_1);
- gdk_threads_leave ();
-
(*env)->CallVoidMethod (env,
*decoder,
areaPreparedID,
width, height);
-
- gdk_threads_enter ();
}
static void
@@ -143,12 +139,8 @@ area_updated_cb (GdkPixbufLoader *loader,
e.jni_env = &env;
(*vm)->GetEnv (vm, e.void_env, JNI_VERSION_1_1);
- gdk_threads_leave ();
-
jpixels = (*env)->NewIntArray (env, n_pixels);
- gdk_threads_enter ();
-
java_pixels = (*env)->GetIntArrayElements (env, jpixels, NULL);
memcpy (java_pixels,
@@ -165,8 +157,6 @@ area_updated_cb (GdkPixbufLoader *loader,
g_object_unref (pixbuf);
- gdk_threads_leave ();
-
(*env)->ReleaseIntArrayElements (env, jpixels, java_pixels, 0);
(*env)->CallVoidMethod (env,
@@ -178,8 +168,6 @@ area_updated_cb (GdkPixbufLoader *loader,
stride_pixels);
(*env)->DeleteLocalRef(env, jpixels);
-
- gdk_threads_enter ();
}
static void
@@ -190,12 +178,8 @@ closed_cb (GdkPixbufLoader *loader __attribute__((unused)), jobject *decoder)
e.jni_env = &env;
(*vm)->GetEnv (vm, e.void_env, JNI_VERSION_1_1);
- gdk_threads_leave ();
-
(*env)->DeleteGlobalRef (env, *decoder);
g_free (decoder);
-
- gdk_threads_enter ();
}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c
index 8c0ac6c..7389fa3 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c
@@ -311,12 +311,8 @@ Java_gnu_java_awt_peer_gtk_GdkRobotPeer_nativeGetRGBPixels
n_pixels = height * stride_pixels;
gdk_pixels = gdk_pixbuf_get_pixels (pixbuf);
- gdk_threads_leave ();
-
jpixels = (*env)->NewIntArray (env, n_pixels);
- gdk_threads_enter ();
-
java_pixels = (*env)->GetIntArrayElements (env, jpixels, NULL);
memcpy (java_pixels,
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
index 5e8ab26..6a9066c 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
@@ -39,9 +39,8 @@ exception statement from your version. */
#include "gtkpeer.h"
#include "gnu_java_awt_peer_gtk_GtkButtonPeer.h"
-static jmethodID beginNativeRepaintID;
-static jmethodID endNativeRepaintID;
-
+static jmethodID postActionEventID;
+
void
cp_gtk_button_init_jni (void)
{
@@ -50,16 +49,13 @@ cp_gtk_button_init_jni (void)
gtkbuttonpeer = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
"gnu/java/awt/peer/gtk/GtkButtonPeer");
- beginNativeRepaintID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gtkbuttonpeer,
- "beginNativeRepaint",
- "()V");
-
- endNativeRepaintID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gtkbuttonpeer,
- "endNativeRepaint", "()V");
+ postActionEventID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(),
+ gtkbuttonpeer,
+ "postActionEvent", "(I)V");
}
-static void block_expose_event_cb (GtkWidget *widget,
- jobject peer);
+static void clicked_cb (GtkButton *button,
+ jobject peer);
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkButtonPeer_create
@@ -86,6 +82,56 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_create
gdk_threads_leave ();
}
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetGetPreferredDimensions
+ (JNIEnv *env, jobject obj, jintArray jdims)
+{
+ void *ptr;
+ jint *dims;
+ GtkWidget *button;
+ GtkWidget *label;
+ GtkRequisition current_req;
+ GtkRequisition current_label_req;
+ GtkRequisition natural_req;
+
+ gdk_threads_enter ();
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ button = gtk_bin_get_child (GTK_BIN (ptr));
+ label = gtk_bin_get_child (GTK_BIN (button));
+
+ dims = (*env)->GetIntArrayElements (env, jdims, 0);
+ dims[0] = dims[1] = 0;
+
+ /* Save the button's current size request. */
+ gtk_widget_size_request (GTK_WIDGET (button), &current_req);
+
+ /* Save the label's current size request. */
+ gtk_widget_size_request (GTK_WIDGET (label), &current_label_req);
+
+ /* Get the widget's "natural" size request. */
+ gtk_widget_set_size_request (GTK_WIDGET (button), -1, -1);
+ gtk_widget_set_size_request (GTK_WIDGET (label), -1, -1);
+
+ gtk_widget_size_request (GTK_WIDGET (button), &natural_req);
+
+ /* Reset the button's size request. */
+ gtk_widget_set_size_request (GTK_WIDGET (button),
+ current_req.width, current_req.height);
+
+ /* Reset the label's size request. */
+ gtk_widget_set_size_request (GTK_WIDGET (label),
+ current_label_req.width, current_label_req.height);
+
+ dims[0] = natural_req.width;
+ dims[1] = natural_req.height;
+
+ (*env)->ReleaseIntArrayElements (env, jdims, dims, 0);
+
+ gdk_threads_leave ();
+}
+
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkButtonPeer_connectSignals
(JNIEnv *env, jobject obj)
@@ -102,11 +148,8 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_connectSignals
button = gtk_bin_get_child (GTK_BIN (ptr));
/* Button signals */
- g_signal_connect_after (G_OBJECT (button), "pressed",
- G_CALLBACK (block_expose_event_cb), *gref);
-
- g_signal_connect_after (G_OBJECT (button), "released",
- G_CALLBACK (block_expose_event_cb), *gref);
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (clicked_cb), *gref);
/* Component signals */
cp_gtk_component_connect_signals (G_OBJECT (button), gref);
@@ -318,21 +361,17 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_setNativeBounds
}
static void
-block_expose_event_cb (GtkWidget *widget, jobject peer)
+clicked_cb (GtkButton* button __attribute__((unused)),
+ jobject peer)
{
- gdk_threads_leave ();
+ GdkEventButton* event;
- (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
- beginNativeRepaintID);
-
- gdk_threads_enter ();
-
- gdk_window_process_updates (widget->window, TRUE);
-
- gdk_threads_leave ();
+ event = (GdkEventButton*) gtk_get_current_event ();
+ g_assert (event);
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
- endNativeRepaintID);
+ postActionEventID,
+ cp_gtk_state_to_awt_mods (event->state));
- gdk_threads_enter ();
+ gdk_event_free ((GdkEvent*) event);
}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
index cf883dd..7012bd8 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
@@ -227,14 +227,10 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkButtonSetLabel
static void
item_toggled_cb (GtkToggleButton *item, jobject peer)
{
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postItemEventID,
peer,
item->active ?
(jint) AWT_ITEM_SELECTED :
(jint) AWT_ITEM_DESELECTED);
-
- gdk_threads_enter ();
}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
index ed9df54..c5bf5a3 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
@@ -187,18 +187,26 @@ Java_gnu_java_awt_peer_gtk_GtkChoicePeer_nativeRemoveAll
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkChoicePeer_select
+Java_gnu_java_awt_peer_gtk_GtkChoicePeer_selectNative
(JNIEnv *env, jobject obj, jint index)
{
- void *ptr;
-
gdk_threads_enter ();
+ Java_gnu_java_awt_peer_gtk_GtkChoicePeer_selectNativeUnlocked
+ (env, obj, index);
+
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkChoicePeer_selectNativeUnlocked
+ (JNIEnv *env, jobject obj, jint index)
+{
+ void *ptr;
+
ptr = NSA_GET_PTR (env, obj);
gtk_combo_box_set_active (GTK_COMBO_BOX (ptr), index);
-
- gdk_threads_leave ();
}
JNIEXPORT jint JNICALL
@@ -219,7 +227,8 @@ Java_gnu_java_awt_peer_gtk_GtkChoicePeer_nativeGetSelected
return index;
}
-static void selection_changed_cb (GtkComboBox *combobox, jobject peer)
+static void
+selection_changed_cb (GtkComboBox *combobox, jobject peer)
{
jstring label;
GtkTreeModel *model;
@@ -236,13 +245,9 @@ static void selection_changed_cb (GtkComboBox *combobox, jobject peer)
gtk_tree_model_get (model, &iter, 0, &selected, -1);
label = (*cp_gtk_gdk_env())->NewStringUTF (cp_gtk_gdk_env(), selected);
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postChoiceItemEventID,
label,
(jint) AWT_ITEM_SELECTED);
-
- gdk_threads_enter ();
}
}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
index dea9d4c..f10a80d 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
@@ -1,5 +1,5 @@
/* gtkclipboard.c
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,169 +36,377 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+#include "jcl.h"
#include "gtkpeer.h"
#include "gnu_java_awt_peer_gtk_GtkClipboard.h"
-static jmethodID stringSelectionReceivedID;
-static jmethodID stringSelectionHandlerID;
-static jmethodID selectionClearID;
+#define OBJECT_TARGET 1
+#define TEXT_TARGET 2
+#define IMAGE_TARGET 3
+#define URI_TARGET 4
-static void selection_received_cb (GtkWidget *, GtkSelectionData *,
- guint, gpointer);
-static void selection_get_cb (GtkWidget *, GtkSelectionData *, guint,
- guint, gpointer);
-static gint selection_clear_cb (GtkWidget *, GdkEventSelection *);
+/* The clipboard and standard (string targets) shared with GtkSelection. */
+GtkClipboard *cp_gtk_clipboard;
-static GtkWidget *clipboard;
-static jobject cb_obj;
+jstring cp_gtk_stringTarget;
+jstring cp_gtk_imageTarget;
+jstring cp_gtk_filesTarget;
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkClipboard_initNativeState (JNIEnv *env,
- jobject obj)
-{
- gdk_threads_enter ();
+/* Simple id to keep track of the selection we are currently managing. */
+static int current_selection = 0;
- if (!stringSelectionReceivedID)
- {
- jclass gtkclipboard;
-
- gtkclipboard = (*env)->FindClass (env,
- "gnu/java/awt/peer/gtk/GtkClipboard");
- stringSelectionReceivedID = (*env)->GetMethodID (env, gtkclipboard,
- "stringSelectionReceived",
- "(Ljava/lang/String;)V");
- stringSelectionHandlerID = (*env)->GetMethodID (env, gtkclipboard,
- "stringSelectionHandler",
- "()Ljava/lang/String;");
- selectionClearID = (*env)->GetMethodID (env, gtkclipboard,
- "selectionClear", "()V");
- }
+/* Whether we "own" the clipboard. And may clear it. */
+static int owner = 0;
- cb_obj = (*env)->NewGlobalRef (env, obj);
+static jclass gtk_clipboard_class;
+static jmethodID setSystemContentsID;
- clipboard = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+static jobject gtk_clipboard_instance = NULL;
+static jmethodID provideContentID;
+static jmethodID provideTextID;
+static jmethodID provideImageID;
+static jmethodID provideURIsID;
- g_signal_connect (G_OBJECT(clipboard), "selection_received",
- G_CALLBACK (selection_received_cb), NULL);
-
- g_signal_connect (G_OBJECT(clipboard), "selection_clear_event",
- G_CALLBACK (selection_clear_cb), NULL);
-
- gtk_selection_add_target (clipboard, GDK_SELECTION_PRIMARY,
- GDK_TARGET_STRING, 0);
+/* Called when clipboard owner changes. Used to update available targets. */
+#if GTK_MINOR_VERSION > 4
+static void
+clipboard_owner_change_cb (GtkClipboard *clipboard __attribute__((unused)),
+ GdkEvent *event __attribute__((unused)),
+ gpointer user_data __attribute__((unused)))
+{
+ /* These are only interesting when we are not the owner. Otherwise
+ we will have the set and clear functions doing the updating. */
+ JNIEnv *env = cp_gtk_gdk_env ();
+ if (!owner)
+ (*env)->CallStaticVoidMethod (env, gtk_clipboard_class,
+ setSystemContentsID);
+}
+#endif
+
+JNIEXPORT jboolean JNICALL
+Java_gnu_java_awt_peer_gtk_GtkClipboard_initNativeState (JNIEnv *env,
+ jclass gtkclipboard,
+ jstring string,
+ jstring image,
+ jstring files)
+{
+ GdkDisplay* display;
+ jboolean can_cache;
- g_signal_connect (G_OBJECT(clipboard), "selection_get",
- G_CALLBACK (selection_get_cb), NULL);
+ gtk_clipboard_class = gtkclipboard;
+ setSystemContentsID = (*env)->GetStaticMethodID (env, gtk_clipboard_class,
+ "setSystemContents",
+ "()V");
+ if (setSystemContentsID == NULL)
+ return JNI_FALSE;
- gdk_threads_leave ();
-}
+ cp_gtk_stringTarget = (*env)->NewGlobalRef(env, string);
+ cp_gtk_imageTarget = (*env)->NewGlobalRef(env, image);
+ cp_gtk_filesTarget = (*env)->NewGlobalRef(env, files);
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkClipboard_requestStringConversion
- (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)))
-{
gdk_threads_enter ();
+ cp_gtk_clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
- gtk_selection_convert (clipboard, GDK_SELECTION_PRIMARY,
- GDK_TARGET_STRING, GDK_CURRENT_TIME);
-
+ display = gtk_clipboard_get_display (cp_gtk_clipboard);
+ /* Check for support for clipboard owner changes. */
+#if GTK_MINOR_VERSION > 4
+ if (gdk_display_supports_selection_notification (display))
+ {
+ g_signal_connect (cp_gtk_clipboard, "owner-change",
+ G_CALLBACK (clipboard_owner_change_cb), NULL);
+ gdk_display_request_selection_notification (display,
+ GDK_SELECTION_CLIPBOARD);
+ can_cache = JNI_TRUE;
+ }
+ else
+#endif
+ can_cache = JNI_FALSE;
gdk_threads_leave ();
+
+ return can_cache;
}
static void
-selection_received_cb (GtkWidget *widget __attribute__((unused)),
- GtkSelectionData *selection_data __attribute__((unused)),
- guint time __attribute__((unused)),
- gpointer data __attribute__((unused)))
+clipboard_get_func (GtkClipboard *clipboard __attribute__((unused)),
+ GtkSelectionData *selection,
+ guint info,
+ gpointer user_data __attribute__((unused)))
{
- /* Check to see if retrieval succeeded */
- if (selection_data->length < 0
- || selection_data->type != GDK_SELECTION_TYPE_STRING)
+ JNIEnv *env = cp_gtk_gdk_env ();
+
+ if (info == OBJECT_TARGET)
{
- gdk_threads_leave ();
-
- (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), cb_obj, stringSelectionReceivedID,
- NULL);
+ const gchar *target_name;
+ jstring target_string;
+ jbyteArray bytes;
+ jint len;
+ jbyte *barray;
+
+ target_name = gdk_atom_name (selection->target);
+ if (target_name == NULL)
+ return;
+ target_string = (*env)->NewStringUTF (env, target_name);
+ if (target_string == NULL)
+ return;
+ bytes = (*env)->CallObjectMethod(env,
+ gtk_clipboard_instance,
+ provideContentID,
+ target_string);
+ if (bytes == NULL)
+ return;
+ len = (*env)->GetArrayLength(env, bytes);
+ if (len <= 0)
+ return;
+ barray = (*env)->GetByteArrayElements(env, bytes, NULL);
+ if (barray == NULL)
+ return;
+ gtk_selection_data_set (selection, selection->target, 8,
+ (guchar *) barray, len);
+
+ (*env)->ReleaseByteArrayElements(env, bytes, barray, 0);
- gdk_threads_enter ();
}
- else
+ else if (info == TEXT_TARGET)
+ {
+ jstring string;
+ const gchar *text;
+ int len;
+ string = (*env)->CallObjectMethod(env,
+ gtk_clipboard_instance,
+ provideTextID);
+ if (string == NULL)
+ return;
+ len = (*env)->GetStringUTFLength (env, string);
+ if (len == -1)
+ return;
+ text = (*env)->GetStringUTFChars (env, string, NULL);
+ if (text == NULL)
+ return;
+
+ gtk_selection_data_set_text (selection, text, len);
+ (*env)->ReleaseStringUTFChars (env, string, text);
+ }
+ /* Images and URIs/Files support only available with gtk+2.6 or higher. */
+#if GTK_MINOR_VERSION > 4
+ else if (info == IMAGE_TARGET)
{
- char *str = (char *) selection_data->data;
+ jobject gtkimage;
+ GdkPixbuf *pixbuf = NULL;
- gdk_threads_leave ();
-
- (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), cb_obj, stringSelectionReceivedID,
- (*cp_gtk_gdk_env())->NewStringUTF (cp_gtk_gdk_env(), str));
-
- gdk_threads_enter ();
+ gtkimage = (*env)->CallObjectMethod(env,
+ gtk_clipboard_instance,
+ provideImageID);
+ if (gtkimage == NULL)
+ return;
+
+ pixbuf = cp_gtk_image_get_pixbuf (env, gtkimage);
+ if (pixbuf != NULL)
+ {
+ gtk_selection_data_set_pixbuf (selection, pixbuf);
+
+ /* if the GtkImage is offscreen, this is a temporary pixbuf
+ which should be thrown out. */
+ if(cp_gtk_image_is_offscreen (env, gtkimage) == JNI_TRUE)
+ gdk_pixbuf_unref (pixbuf);
+ }
}
-
- return;
+ else if (info == URI_TARGET)
+ {
+ jobjectArray uris;
+ jint count;
+ int i;
+ gchar **list;
+
+ uris = (*env)->CallObjectMethod(env,
+ gtk_clipboard_instance,
+ provideURIsID);
+ if (uris == NULL)
+ return;
+ count = (*env)->GetArrayLength (env, uris);
+ if (count <= 0)
+ return;
+
+ list = (gchar **) JCL_malloc (env, (count + 1) * sizeof (gchar *));
+ for (i = 0; i < count; i++)
+ {
+ const char *text;
+ jstring uri;
+
+ /* Mark NULL in so case of some error we can find the end. */
+ list[i] = NULL;
+ uri = (*env)->GetObjectArrayElement (env, uris, i);
+ if (uri == NULL)
+ break;
+ text = (*env)->GetStringUTFChars (env, uri, NULL);
+ if (text == NULL)
+ break;
+ list[i] = strdup (text);
+ (*env)->ReleaseStringUTFChars (env, uri, text);
+ }
+
+ if (i == count)
+ {
+ list[count] = NULL;
+ gtk_selection_data_set_uris (selection, list);
+ }
+
+ for (i = 0; list[i] != NULL; i++)
+ free (list[i]);
+ JCL_free (env, list);
+ }
+#endif
}
static void
-selection_get_cb (GtkWidget *widget __attribute__((unused)),
- GtkSelectionData *selection_data,
- guint info __attribute__((unused)),
- guint time __attribute__((unused)),
- gpointer data __attribute__((unused)))
+clipboard_clear_func (GtkClipboard *clipboard __attribute__((unused)),
+ gpointer user_data)
{
- jstring jstr;
- const char *utf;
- jsize utflen;
-
- gdk_threads_leave ();
-
- jstr = (*cp_gtk_gdk_env())->CallObjectMethod (cp_gtk_gdk_env(), cb_obj,
- stringSelectionHandlerID);
-
- gdk_threads_enter ();
-
- if (!jstr)
+ if (owner && (int) user_data == current_selection)
{
- gtk_selection_data_set (selection_data,
- GDK_TARGET_STRING, 8, NULL, 0);
- return;
+ JNIEnv *env = cp_gtk_gdk_env();
+ owner = 0;
+ (*env)->CallStaticVoidMethod (env, gtk_clipboard_class,
+ setSystemContentsID);
}
-
- utflen = (*cp_gtk_gdk_env())->GetStringUTFLength (cp_gtk_gdk_env(), jstr);
- utf = (*cp_gtk_gdk_env())->GetStringUTFChars (cp_gtk_gdk_env(), jstr, NULL);
-
- gtk_selection_data_set (selection_data, GDK_TARGET_STRING, 8,
- (const unsigned char*)utf, utflen);
-
- (*cp_gtk_gdk_env())->ReleaseStringUTFChars (cp_gtk_gdk_env(), jstr, utf);
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkClipboard_selectionGet
- (JNIEnv *env, jclass clazz __attribute__((unused)))
+Java_gnu_java_awt_peer_gtk_GtkClipboard_advertiseContent
+(JNIEnv *env,
+ jobject instance,
+ jobjectArray mime_array,
+#if GTK_MINOR_VERSION > 4
+ jboolean add_text, jboolean add_images, jboolean add_uris)
+#else
+ jboolean add_text __attribute__((unused)),
+ jboolean add_images __attribute__((unused)),
+ jboolean add_uris __attribute__((unused)))
+#endif
{
- GdkWindow *owner;
+ GtkTargetList *target_list;
+ GList *list;
+ GtkTargetEntry *targets;
+ gint n, i;
gdk_threads_enter ();
+ target_list = gtk_target_list_new (NULL, 0);
- /* if we already own the clipboard, we need to tell the old data object
- that we're no longer going to be using him */
- owner = gdk_selection_owner_get (GDK_SELECTION_PRIMARY);
- if (owner && owner == clipboard->window)
- (*env)->CallVoidMethod (env, cb_obj, selectionClearID);
-
- gtk_selection_owner_set (clipboard, GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME);
+ if (mime_array != NULL)
+ {
+ n = (*env)->GetArrayLength (env, mime_array);
+ for (i = 0; i < n; i++)
+ {
+ const char *text;
+ jstring target;
+ GdkAtom atom;
+
+ target = (*env)->GetObjectArrayElement (env, mime_array, i);
+ if (target == NULL)
+ break;
+ text = (*env)->GetStringUTFChars (env, target, NULL);
+ if (text == NULL)
+ break;
+
+ atom = gdk_atom_intern (text, FALSE);
+ gtk_target_list_add (target_list, atom, 0, OBJECT_TARGET);
+
+ (*env)->ReleaseStringUTFChars (env, target, text);
+ }
+ }
- gdk_threads_leave ();
-}
+ /* Add extra targets that gtk+ can provide/translate for us. */
+#if GTK_MINOR_VERSION > 4
+ if (add_text)
+ gtk_target_list_add_text_targets (target_list, TEXT_TARGET);
+ if (add_images)
+ gtk_target_list_add_image_targets (target_list, IMAGE_TARGET, TRUE);
+ if (add_uris)
+ gtk_target_list_add_uri_targets (target_list, URI_TARGET);
+#else
+ if (add_text)
+ gtk_target_list_add (target_list,
+ gdk_atom_intern ("STRING", FALSE),
+ 0, TEXT_TARGET);
+#endif
+
+
+ /* Turn list into a target table. */
+ n = g_list_length (target_list->list);
+ if (n > 0)
+ {
+ targets = g_new (GtkTargetEntry, n);
+ for (list = target_list->list, i = 0;
+ list != NULL;
+ list = list->next, i++)
+ {
+ GtkTargetPair *pair = (GtkTargetPair *) list->data;
+ targets[i].target = gdk_atom_name (pair->target);
+ targets[i].flags = pair->flags;
+ targets[i].info = pair->info;
+ }
+
+ /* Set the targets plus callback functions and ask for the clipboard
+ to be stored when the application exists if supported. */
+ current_selection++;
+ if (gtk_clipboard_set_with_data (cp_gtk_clipboard, targets, n,
+ clipboard_get_func,
+ clipboard_clear_func,
+ (gpointer) current_selection))
+ {
+ owner = 1;
+ if (gtk_clipboard_instance == NULL)
+ {
+ JNIEnv *env = cp_gtk_gdk_env ();
+ gtk_clipboard_instance = (*env)->NewGlobalRef(env, instance);
+
+ provideContentID
+ = (*env)->GetMethodID (env, gtk_clipboard_class,
+ "provideContent",
+ "(Ljava/lang/String;)[B");
+ if (provideContentID == NULL)
+ return;
+
+ provideTextID
+ = (*env)->GetMethodID (env, gtk_clipboard_class,
+ "provideText", "()Ljava/lang/String;");
+ if (provideTextID == NULL)
+ return;
+
+ provideImageID
+ = (*env)->GetMethodID (env, gtk_clipboard_class,
+ "provideImage",
+ "()Lgnu/java/awt/peer/gtk/GtkImage;");
+ if (provideImageID == NULL)
+ return;
+
+ provideURIsID
+ = (*env)->GetMethodID (env, gtk_clipboard_class,
+ "provideURIs",
+ "()[Ljava/lang/String;");
+ if (provideURIsID == NULL)
+ return;
+ }
+#if GTK_MINOR_VERSION > 4
+ gtk_clipboard_set_can_store (cp_gtk_clipboard, NULL, 0);
+#endif
+ }
+ else
+ {
+ owner = 0;
+ (*env)->CallStaticVoidMethod (env, gtk_clipboard_class,
+ setSystemContentsID);
+ }
+
+ for (i = 0; i < n; i++)
+ g_free (targets[i].target);
+ g_free (targets);
+ }
+ else if (owner)
+ {
+ gtk_clipboard_clear (cp_gtk_clipboard);
+ owner = 0;
+ }
-static gint
-selection_clear_cb (GtkWidget *widget __attribute__((unused)),
- GdkEventSelection *event __attribute__((unused)))
-{
+ gtk_target_list_unref (target_list);
gdk_threads_leave ();
-
- (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), cb_obj, selectionClearID);
-
- gdk_threads_enter ();
-
- return TRUE;
}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
index bd9dde3..f832da5 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
@@ -145,8 +145,8 @@ button_to_awt_mods (int button)
return 0;
}
-static jint
-state_to_awt_mods (guint state)
+jint
+cp_gtk_state_to_awt_mods (guint state)
{
jint result = 0;
@@ -185,13 +185,23 @@ JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursor
(JNIEnv *env, jobject obj, jint type)
{
+ gdk_threads_enter ();
+
+ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursorUnlocked
+ (env, obj, type);
+
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursorUnlocked
+ (JNIEnv *env, jobject obj, jint type)
+{
void *ptr;
GtkWidget *widget;
GdkCursorType gdk_cursor_type;
GdkCursor *gdk_cursor;
- gdk_threads_enter ();
-
ptr = NSA_GET_PTR (env, obj);
switch (type)
@@ -244,8 +254,6 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursor
gdk_cursor = gdk_cursor_new (gdk_cursor_type);
gdk_window_set_cursor (widget->window, gdk_cursor);
gdk_cursor_destroy (gdk_cursor);
-
- gdk_threads_leave ();
}
JNIEXPORT void JNICALL
@@ -602,12 +610,8 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetBackground
bg = GTK_WIDGET (ptr)->style->bg[GTK_STATE_NORMAL];
- gdk_threads_leave ();
-
array = (*env)->NewIntArray (env, 3);
- gdk_threads_enter ();
-
rgb = (*env)->GetIntArrayElements (env, array, NULL);
/* convert color data from 16 bit values down to 8 bit values */
rgb[0] = bg.red >> 8;
@@ -635,12 +639,8 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetForeground
fg = GTK_WIDGET (ptr)->style->fg[GTK_STATE_NORMAL];
- gdk_threads_leave ();
-
array = (*env)->NewIntArray (env, 3);
- gdk_threads_enter ();
-
rgb = (*env)->GetIntArrayElements (env, array, NULL);
/* convert color data from 16 bit values down to 8 bit values */
rgb[0] = fg.red >> 8;
@@ -711,33 +711,29 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetForeground
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkComponentPeer_show
- (JNIEnv *env, jobject obj)
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setVisibleNative
+ (JNIEnv *env, jobject obj, jboolean visible)
{
- void *ptr;
-
gdk_threads_enter();
- ptr = NSA_GET_PTR (env, obj);
-
- gtk_widget_show (GTK_WIDGET (ptr));
+ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setVisibleNativeUnlocked
+ (env, obj, visible);
gdk_threads_leave();
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkComponentPeer_hide
- (JNIEnv *env, jobject obj)
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setVisibleNativeUnlocked
+ (JNIEnv *env, jobject obj, jboolean visible)
{
void *ptr;
- gdk_threads_enter();
-
ptr = NSA_GET_PTR (env, obj);
- gtk_widget_hide (GTK_WIDGET (ptr));
-
- gdk_threads_leave();
+ if (visible)
+ gtk_widget_show (GTK_WIDGET (ptr));
+ else
+ gtk_widget_hide (GTK_WIDGET (ptr));
}
JNIEXPORT jboolean JNICALL
@@ -940,13 +936,11 @@ component_button_press_cb (GtkWidget *widget __attribute__((unused)),
button_window = event->window;
button_number = event->button;
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postMouseEventID,
AWT_MOUSE_PRESSED,
(jlong)event->time,
- state_to_awt_mods (event->state)
+ cp_gtk_state_to_awt_mods (event->state)
| button_to_awt_mods (event->button),
(jint)event->x,
(jint)event->y,
@@ -954,8 +948,6 @@ component_button_press_cb (GtkWidget *widget __attribute__((unused)),
(event->button == 3) ? JNI_TRUE :
JNI_FALSE);
- gdk_threads_enter ();
-
hasBeenDragged = FALSE;
return FALSE;
@@ -968,21 +960,17 @@ component_button_release_cb (GtkWidget *widget __attribute__((unused)),
{
int width, height;
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postMouseEventID,
AWT_MOUSE_RELEASED,
(jlong)event->time,
- state_to_awt_mods (event->state)
+ cp_gtk_state_to_awt_mods (event->state)
| button_to_awt_mods (event->button),
(jint)event->x,
(jint)event->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
the last time it was pressed. */
@@ -993,20 +981,16 @@ component_button_release_cb (GtkWidget *widget __attribute__((unused)),
&& event->x <= width
&& event->y <= height)
{
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postMouseEventID,
AWT_MOUSE_CLICKED,
(jlong)event->time,
- state_to_awt_mods (event->state)
+ cp_gtk_state_to_awt_mods (event->state)
| button_to_awt_mods (event->button),
(jint)event->x,
(jint)event->y,
click_count,
JNI_FALSE);
-
- gdk_threads_enter ();
}
return FALSE;
}
@@ -1022,8 +1006,6 @@ component_motion_notify_cb (GtkWidget *widget __attribute__((unused)),
| GDK_BUTTON4_MASK
| GDK_BUTTON5_MASK))
{
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postMouseEventID,
AWT_MOUSE_DRAGGED,
@@ -1034,24 +1016,18 @@ component_motion_notify_cb (GtkWidget *widget __attribute__((unused)),
0,
JNI_FALSE);
- gdk_threads_enter ();
-
hasBeenDragged = TRUE;
}
else
{
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer, postMouseEventID,
AWT_MOUSE_MOVED,
(jlong)event->time,
- state_to_awt_mods (event->state),
+ cp_gtk_state_to_awt_mods (event->state),
(jint)event->x,
(jint)event->y,
0,
JNI_FALSE);
-
- gdk_threads_enter ();
}
return FALSE;
}
@@ -1065,8 +1041,6 @@ component_enter_notify_cb (GtkWidget *widget __attribute__((unused)),
grab/ungrab and not to actually crossing boundaries */
if (event->mode == GDK_CROSSING_NORMAL)
{
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer, postMouseEventID,
AWT_MOUSE_ENTERED,
(jlong)event->time,
@@ -1075,8 +1049,6 @@ component_enter_notify_cb (GtkWidget *widget __attribute__((unused)),
(jint)event->y,
0,
JNI_FALSE);
-
- gdk_threads_enter ();
}
return FALSE;
}
@@ -1090,8 +1062,6 @@ component_leave_notify_cb (GtkWidget *widget __attribute__((unused)),
grab/ungrab and not to actually crossing boundaries */
if (event->mode == GDK_CROSSING_NORMAL)
{
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postMouseEventID,
AWT_MOUSE_EXITED,
@@ -1101,8 +1071,6 @@ component_leave_notify_cb (GtkWidget *widget __attribute__((unused)),
(jint)event->y,
0,
JNI_FALSE);
-
- gdk_threads_enter ();
}
return FALSE;
}
@@ -1112,8 +1080,6 @@ component_expose_cb (GtkWidget *widget __attribute__((unused)),
GdkEventExpose *event,
jobject peer)
{
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postExposeEventID,
(jint)event->area.x,
@@ -1121,8 +1087,6 @@ component_expose_cb (GtkWidget *widget __attribute__((unused)),
(jint)event->area.width,
(jint)event->area.height);
- gdk_threads_enter ();
-
return FALSE;
}
@@ -1131,15 +1095,11 @@ component_focus_in_cb (GtkWidget *widget __attribute((unused)),
GdkEventFocus *event __attribute((unused)),
jobject peer)
{
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postFocusEventID,
AWT_FOCUS_GAINED,
JNI_FALSE);
- gdk_threads_enter ();
-
return FALSE;
}
@@ -1148,14 +1108,10 @@ component_focus_out_cb (GtkWidget *widget __attribute((unused)),
GdkEventFocus *event __attribute((unused)),
jobject peer)
{
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postFocusEventID,
AWT_FOCUS_LOST,
JNI_FALSE);
- gdk_threads_enter ();
-
return FALSE;
}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
index 48478d3..b9fd54a 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
@@ -40,17 +40,57 @@ exception statement from your version. */
#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
#include "gnu_java_awt_peer_gtk_GtkFileDialogPeer.h"
+#define AWT_FILEDIALOG_LOAD 0
+#define AWT_FILEDIALOG_SAVE 1
+
static void handle_response_cb (GtkDialog *dialog,
gint responseId,
jobject peer_obj);
+static jmethodID gtkSetFilenameID;
+static jmethodID gtkHideFileDialogID;
+static jmethodID gtkDisposeFileDialogID;
+static jmethodID filenameFilterCallbackID;
+
+void
+cp_gtk_filedialog_init_jni (void)
+{
+ jclass gtkfiledialogpeer;
+
+ gtkfiledialogpeer =
+ (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
+ "gnu/java/awt/peer/gtk/GtkFileDialogPeer");
+
+ gtkDisposeFileDialogID =
+ (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(),
+ gtkfiledialogpeer,
+ "gtkDisposeFileDialog", "()V");
+
+ gtkHideFileDialogID =
+ (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(),
+ gtkfiledialogpeer,
+ "gtkHideFileDialog", "()V");
+
+ gtkSetFilenameID =
+ (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(),
+ gtkfiledialogpeer,
+ "gtkSetFilename",
+ "(Ljava/lang/String;)V");
+
+ filenameFilterCallbackID =
+ (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(),
+ gtkfiledialogpeer,
+ "filenameFilterCallback",
+ "(Ljava/lang/String;)Z");
+}
+
/*
* Make a new file selection dialog
*/
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_create
- (JNIEnv *env, jobject obj, jobject parent)
+ (JNIEnv *env, jobject obj, jobject parent, int mode)
{
void *parentp;
gpointer widget;
@@ -62,19 +102,31 @@ Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_create
parentp = NSA_GET_PTR(env, parent);
- /* 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 */
+ if (mode == AWT_FILEDIALOG_LOAD)
+ widget = gtk_file_chooser_dialog_new
+ ("Open File",
+ GTK_WINDOW(parentp),
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ NULL);
+ else
+ {
+ widget = gtk_file_chooser_dialog_new
+ ("Save File",
+ GTK_WINDOW(parentp),
+ GTK_FILE_CHOOSER_ACTION_SAVE,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
+ NULL);
+#if GTK_MINOR_VERSION >= 8
+ gtk_file_chooser_set_do_overwrite_confirmation
+ (GTK_FILE_CHOOSER (widget), TRUE);
+#endif
+ }
+
+
+ /* GtkFileChooserDialog is not modal by default */
gtk_window_set_modal (GTK_WINDOW (widget), TRUE);
/* We must add this window to the group so input in the others are
@@ -132,25 +184,17 @@ Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeGetDirectory
This function extracts the filename from the GtkFileFilterInfo object,
and passes it to the Java method. The Java method will call the filter's
accept() method and will give back the return value. */
-static gboolean filenameFilterCallback (const GtkFileFilterInfo *filter_info,
+static gboolean filename_filter_cb (const GtkFileFilterInfo *filter_info,
gpointer obj)
{
- jclass cx;
- jmethodID id;
jstring *filename;
gboolean accepted;
- cx = (*cp_gtk_gdk_env())->GetObjectClass (cp_gtk_gdk_env(), (jobject) obj);
- id = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), cx, "filenameFilterCallback",
- "(Ljava/lang/String;)Z");
-
filename = (*cp_gtk_gdk_env())->NewStringUTF(cp_gtk_gdk_env(), filter_info->filename);
- gdk_threads_leave();
-
- accepted = (*cp_gtk_gdk_env())->CallBooleanMethod(cp_gtk_gdk_env(), obj, id, filename);
-
- gdk_threads_enter();
+ accepted = (*cp_gtk_gdk_env())->CallBooleanMethod(cp_gtk_gdk_env(), obj,
+ filenameFilterCallbackID,
+ filename);
return accepted;
}
@@ -168,7 +212,7 @@ Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetFilenameFilter
filter = gtk_file_filter_new();
gtk_file_filter_add_custom(filter, GTK_FILE_FILTER_FILENAME,
- filenameFilterCallback, obj, NULL);
+ filename_filter_cb, obj, NULL);
gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(ptr), filter);
@@ -220,11 +264,6 @@ handle_response_cb (GtkDialog *dialog __attribute__((unused)),
gint responseId,
jobject peer_obj)
{
- static int isDisposeIDSet = 0;
- static int isIDSet = 0;
- static jmethodID gtkSetFilenameID;
- static jmethodID hideID;
- static jmethodID disposeID;
void *ptr;
G_CONST_RETURN gchar *fileName;
jstring str_fileName = NULL;
@@ -240,42 +279,24 @@ handle_response_cb (GtkDialog *dialog __attribute__((unused)),
if (responseId == GTK_RESPONSE_DELETE_EVENT)
{
- if (!isDisposeIDSet)
- {
- jclass cx = (*cp_gtk_gdk_env())->GetObjectClass (cp_gtk_gdk_env(), peer_obj);
- disposeID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), cx, "gtkDisposeFileDialog", "()V");
- isDisposeIDSet = 1;
- }
-
/* We can dispose of the dialog now (and unblock show) */
- gdk_threads_leave ();
- (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer_obj, disposeID);
- gdk_threads_enter ();
+ (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer_obj,
+ gtkDisposeFileDialogID);
return;
}
- if (responseId == GTK_RESPONSE_ACCEPT) {
- fileName = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (GTK_WIDGET (ptr)));
- str_fileName = (*cp_gtk_gdk_env())->NewStringUTF (cp_gtk_gdk_env(), fileName);
- }
-
- if (!isIDSet)
+ if (responseId == GTK_RESPONSE_ACCEPT)
{
- jclass cx = (*cp_gtk_gdk_env())->GetObjectClass (cp_gtk_gdk_env(), peer_obj);
- hideID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), cx, "gtkHideFileDialog", "()V");
- gtkSetFilenameID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), cx,
- "gtkSetFilename", "(Ljava/lang/String;)V");
- isIDSet = 1;
+ fileName = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (GTK_WIDGET (ptr)));
+ str_fileName = (*cp_gtk_gdk_env())->NewStringUTF (cp_gtk_gdk_env(), fileName);
}
/* Set the Java object field 'file' with this value. */
- gdk_threads_leave ();
- (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer_obj, gtkSetFilenameID, str_fileName);
+ (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer_obj,
+ gtkSetFilenameID, str_fileName);
/* We can hide the dialog now (and unblock show) */
- (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer_obj, hideID);
-
- gdk_threads_enter ();
+ (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer_obj,
+ gtkHideFileDialogID);
}
-
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c
index 41dfcea..c60f48f 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c
@@ -85,11 +85,15 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarPeer
gdk_threads_enter ();
ptr = NSA_GET_PTR (env, obj);
- mptr = NSA_GET_PTR (env, menubar);
- fixed = gtk_container_get_children (GTK_CONTAINER (ptr))->data;
- gtk_fixed_put (GTK_FIXED (fixed), mptr, 0, 0);
- gtk_widget_show (mptr);
+ if (menubar)
+ {
+ mptr = NSA_GET_PTR (env, menubar);
+
+ fixed = gtk_container_get_children (GTK_CONTAINER (ptr))->data;
+ gtk_fixed_put (GTK_FIXED (fixed), mptr, 0, 0);
+ gtk_widget_show (mptr);
+ }
gdk_threads_leave ();
}
@@ -114,24 +118,35 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_getMenuBarHeight
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarWidth
+ (JNIEnv *env, jobject obj, jobject menubar, jint width)
+{
+ gdk_threads_enter ();
+
+ Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarWidthUnlocked
+ (env, obj, menubar, width);
+
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarWidthUnlocked
(JNIEnv *env, jobject obj __attribute__((unused)), jobject menubar, jint width)
{
GtkWidget *ptr;
GtkRequisition natural_req;
- gdk_threads_enter ();
-
- ptr = NSA_GET_PTR (env, menubar);
-
- /* Get the menubar's natural size request. */
- gtk_widget_set_size_request (GTK_WIDGET (ptr), -1, -1);
- gtk_widget_size_request (GTK_WIDGET (ptr), &natural_req);
+ if (menubar)
+ {
+ ptr = NSA_GET_PTR (env, menubar);
- /* Set the menubar's size request to width by natural_req.height. */
- gtk_widget_set_size_request (GTK_WIDGET (ptr),
- width, natural_req.height);
+ /* Get the menubar's natural size request. */
+ gtk_widget_set_size_request (GTK_WIDGET (ptr), -1, -1);
+ gtk_widget_size_request (GTK_WIDGET (ptr), &natural_req);
- gdk_threads_leave ();
+ /* Set the menubar's size request to width by natural_req.height. */
+ gtk_widget_set_size_request (GTK_WIDGET (ptr),
+ width, natural_req.height);
+ }
}
JNIEXPORT void JNICALL
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
index 0fae1da..c8fb530 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
@@ -58,13 +58,6 @@ Java_gnu_java_awt_peer_gtk_GtkGenericPeer_dispose
NSA_DEL_PTR (env, obj);
gdk_threads_leave ();
-
- /*
- * Wake up the main thread, to make sure it re-checks the window
- * destruction condition.
- */
-
- g_main_context_wakeup (NULL);
}
JNIEXPORT void JNICALL
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
index 86cad14..fdc73cc 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
@@ -35,6 +35,7 @@ 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 "jcl.h"
#include "gtkpeer.h"
#include "gnu_java_awt_peer_gtk_GtkImage.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
@@ -96,6 +97,67 @@ Java_gnu_java_awt_peer_gtk_GtkImage_loadPixbuf
return JNI_TRUE;
}
+/*
+ * Creates the image from an array of java bytes.
+ */
+JNIEXPORT jboolean JNICALL
+Java_gnu_java_awt_peer_gtk_GtkImage_loadImageFromData
+ (JNIEnv *env, jobject obj, jbyteArray data)
+{
+ jbyte *src;
+ GdkPixbuf* pixbuf;
+ GdkPixbufLoader* loader;
+ int len;
+ int width;
+ int height;
+
+ gdk_threads_enter ();
+
+ src = (*env)->GetByteArrayElements (env, data, NULL);
+ len = (*env)->GetArrayLength (env, data);
+
+ loader = gdk_pixbuf_loader_new ();
+
+ gdk_pixbuf_loader_write (loader, (guchar *)src, len, NULL);
+ gdk_pixbuf_loader_close (loader, NULL);
+
+ (*env)->ReleaseByteArrayElements (env, data, src, 0);
+
+ pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
+
+ if (pixbuf == NULL)
+ {
+ createRawData (env, obj, NULL);
+
+ gdk_threads_leave ();
+
+ return JNI_FALSE;
+ }
+
+ width = gdk_pixbuf_get_width (pixbuf);
+ height = gdk_pixbuf_get_height (pixbuf);
+
+ createRawData (env, obj, pixbuf);
+ setWidthHeight(env, obj, width, height);
+
+ gdk_threads_leave ();
+
+ return JNI_TRUE;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkImage_createFromPixbuf
+(JNIEnv *env, jobject obj)
+{
+ int width, heigth;
+ GdkPixbuf *pixbuf = (GdkPixbuf *) getData (env, obj);
+ gdk_threads_enter ();
+ width = gdk_pixbuf_get_width (pixbuf);
+ heigth = gdk_pixbuf_get_height (pixbuf);
+ gdk_threads_leave ();
+ setWidthHeight(env, obj, width, heigth);
+}
+
/**
* Returns a copy of the pixel data as a java array.
*/
@@ -116,15 +178,8 @@ Java_gnu_java_awt_peer_gtk_GtkImage_getPixels(JNIEnv *env, jobject obj)
height = gdk_pixbuf_get_height (pixbuf);
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
- /* Must release the GDK lock before allocating memory through the
- JVM, since some JVMs use the same lock for allocations and
- finalization. Deadlock can occur on those JVMs. */
- gdk_threads_leave ();
-
result_array = (*env)->NewIntArray (env, (width * height));
- gdk_threads_enter ();
-
dst = result_array_iter =
(*env)->GetIntArrayElements (env, result_array, NULL);
@@ -307,10 +362,16 @@ Java_gnu_java_awt_peer_gtk_GtkImage_drawPixelsScaled
gdk_threads_enter ();
+ if (width <= 0 || height <= 0)
+ {
+ gdk_threads_leave ();
+ return;
+ }
+
bgColor = ((bg_red & 0xFF) << 16) |
((bg_green & 0xFF) << 8) | (bg_blue & 0xFF);
- g = (struct graphics *) NSA_GET_PTR (env, gc_obj);
+ g = (struct graphics *) NSA_GET_G_PTR (env, gc_obj);
if (!g || !GDK_IS_DRAWABLE (g->drawable))
{
@@ -368,7 +429,12 @@ JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkImage_drawPixelsScaledFlipped
(JNIEnv *env, jobject obj, jobject gc_obj,
jint bg_red, jint bg_green, jint bg_blue,
+#if GTK_MINOR_VERSION > 4
jboolean flipx, jboolean flipy,
+#else
+ jboolean flipx __attribute__((unused)),
+ jboolean flipy __attribute__((unused)),
+#endif
jint srcx, jint srcy, jint srcwidth, jint srcheight,
jint dstx, jint dsty, jint dstwidth, jint dstheight,
jboolean composite)
@@ -380,10 +446,17 @@ Java_gnu_java_awt_peer_gtk_GtkImage_drawPixelsScaledFlipped
gdk_threads_enter ();
+ if (srcwidth <= 0 || srcheight <= 0
+ || dstwidth <= 0 || dstheight <= 0)
+ {
+ gdk_threads_leave ();
+ return;
+ }
+
bgColor = ((bg_red & 0xFF) << 16) |
((bg_green & 0xFF) << 8) | (bg_blue & 0xFF);
- g = (struct graphics *) NSA_GET_PTR (env, gc_obj);
+ g = (struct graphics *) NSA_GET_G_PTR (env, gc_obj);
if (!g || !GDK_IS_DRAWABLE (g->drawable))
{
@@ -573,24 +646,15 @@ static void
createRawData (JNIEnv * env, jobject obj, void *ptr)
{
jclass cls;
- jmethodID method;
jobject data;
jfieldID data_fid;
cls = (*env)->GetObjectClass (env, obj);
data_fid = (*env)->GetFieldID (env, cls, "pixmap",
- "Lgnu/classpath/RawData;");
+ "Lgnu/classpath/Pointer;");
g_assert (data_fid != 0);
-#if SIZEOF_VOID_P == 8
- cls = (*env)->FindClass (env, "gnu/classpath/RawData64");
- method = (*env)->GetMethodID (env, cls, "<init>", "(J)V");
- data = (*env)->NewObject (env, cls, method, (jlong) ptr);
-#else
- cls = (*env)->FindClass (env, "gnu/classpath/RawData32");
- method = (*env)->GetMethodID (env, cls, "<init>", "(I)V");
- data = (*env)->NewObject (env, cls, method, (jint) ptr);
-#endif
+ data = JCL_NewRawDataObject (env, ptr);
(*env)->SetObjectField (env, obj, data_fid, data);
}
@@ -599,23 +663,14 @@ static void *
getData (JNIEnv * env, jobject obj)
{
jclass cls;
- jfieldID field;
jfieldID data_fid;
jobject data;
cls = (*env)->GetObjectClass (env, obj);
data_fid = (*env)->GetFieldID (env, cls, "pixmap",
- "Lgnu/classpath/RawData;");
+ "Lgnu/classpath/Pointer;");
g_assert (data_fid != 0);
data = (*env)->GetObjectField (env, obj, data_fid);
-#if SIZEOF_VOID_P == 8
- cls = (*env)->FindClass (env, "gnu/classpath/RawData64");
- field = (*env)->GetFieldID (env, cls, "data", "J");
- return (void *) (*env)->GetLongField (env, data, field);
-#else
- cls = (*env)->FindClass (env, "gnu/classpath/RawData32");
- field = (*env)->GetFieldID (env, cls, "data", "I");
- return (void *) (*env)->GetIntField (env, data, field);
-#endif
+ return JCL_GetRawData (env, data);
}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c
index 7968ca7..74180a7 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c
@@ -66,6 +66,44 @@ Java_gnu_java_awt_peer_gtk_GtkLabelPeer_create
gdk_threads_leave ();
}
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkLabelPeer_gtkWidgetGetPreferredDimensions
+ (JNIEnv *env, jobject obj, jintArray jdims)
+{
+ void *ptr;
+ jint *dims;
+ GtkWidget *label;
+ GtkRequisition current_req;
+ GtkRequisition natural_req;
+
+ gdk_threads_enter ();
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ label = gtk_bin_get_child (GTK_BIN (ptr));
+
+ dims = (*env)->GetIntArrayElements (env, jdims, 0);
+ dims[0] = dims[1] = 0;
+
+ /* Save the widget's current size request. */
+ gtk_widget_size_request (GTK_WIDGET (label), &current_req);
+
+ /* Get the widget's "natural" size request. */
+ gtk_widget_set_size_request (GTK_WIDGET (label), -1, -1);
+ gtk_widget_size_request (GTK_WIDGET (label), &natural_req);
+
+ /* Reset the widget's size request. */
+ gtk_widget_set_size_request (GTK_WIDGET (label),
+ current_req.width, current_req.height);
+
+ dims[0] = natural_req.width;
+ dims[1] = natural_req.height;
+
+ (*env)->ReleaseIntArrayElements (env, jdims, dims, 0);
+
+ gdk_threads_leave ();
+}
+
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkLabelPeer_gtkWidgetModifyFont
(JNIEnv *env, jobject obj, jstring name, jint style, jint size)
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
index d513176..fc89ab7 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
@@ -423,12 +423,8 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_getSelectedIndexes
{
current_row = rows = gtk_tree_selection_get_selected_rows (selection, NULL);
- gdk_threads_leave ();
-
result_array = (*env)->NewIntArray (env, count);
- gdk_threads_enter ();
-
result_array_iter = (*env)->GetIntArrayElements (env, result_array, NULL);
for (i = 0; i < count; i++)
@@ -513,25 +509,17 @@ item_highlighted_cb (GtkTreeSelection *selection __attribute__((unused)),
if (!path_currently_selected)
{
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postListItemEventID,
row,
(jint) AWT_ITEM_SELECTED);
-
- gdk_threads_enter ();
}
else
{
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postListItemEventID,
row,
(jint) AWT_ITEM_DESELECTED);
-
- gdk_threads_enter ();
}
}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
index 2746f1e..d2ae148 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
@@ -186,8 +186,6 @@ Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setLabel
static void
item_activate_cb (GtkMenuItem *item __attribute__((unused)), jobject peer_obj)
{
- gdk_threads_leave ();
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer_obj,
- postMenuActionEventID);
- gdk_threads_enter ();
+ postMenuActionEventID);
}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
index eb65833..0ddab05 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
@@ -417,7 +417,5 @@ static void
textcomponent_changed_cb (GtkEditable *editable __attribute__((unused)),
jobject peer)
{
- gdk_threads_leave ();
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer, postTextEventID);
- gdk_threads_enter ();
}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
index a8e1957..040cc92 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
@@ -40,8 +40,7 @@ exception statement from your version. */
#include "gnu_java_awt_peer_gtk_GtkToolkit.h"
#include "gthread-jni.h"
#include "jcl.h"
-
-#include <sys/time.h>
+#include <gdk/gdkx.h>
#define RC_FILE ".classpath-gtkrc"
@@ -157,6 +156,10 @@ Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkInit (JNIEnv *env,
gtk_init (&argc, &argv);
+#if SYNCHRONIZE_GDK
+ XSynchronize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), True);
+#endif
+
gdk_rgb_init ();
gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
gtk_widget_set_default_visual (gdk_rgb_get_visual ());
@@ -190,6 +193,7 @@ Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkInit (JNIEnv *env,
cp_gtk_checkbox_init_jni ();
cp_gtk_choice_init_jni ();
cp_gtk_component_init_jni ();
+ cp_gtk_filedialog_init_jni ();
cp_gtk_list_init_jni ();
cp_gtk_menuitem_init_jni ();
cp_gtk_scrollbar_init_jni ();
@@ -292,20 +296,6 @@ dpi_changed_cb (GtkSettings *settings,
PANGO_SCALE * 72.0 / (int_dpi / PANGO_SCALE);
}
-static int
-within_human_latency_tolerance(struct timeval *init)
-{
- struct timeval curr;
- unsigned long milliseconds_elapsed;
-
- gettimeofday(&curr, NULL);
-
- milliseconds_elapsed = (((curr.tv_sec * 1000) + (curr.tv_usec / 1000))
- - ((init->tv_sec * 1000) + (init->tv_usec / 1000)));
-
- return milliseconds_elapsed < 100;
-}
-
#if GTK_MINOR_VERSION > 4
static void
glog_func (const gchar *log_domain,
@@ -332,69 +322,15 @@ glog_func (const gchar *log_domain,
}
#endif
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkToolkit_iterateNativeQueue
-(JNIEnv *env,
- jobject self __attribute__((unused)),
- jobject lockedQueue,
- jboolean block)
-{
- /* We're holding an EventQueue lock, and we're about to acquire the GDK
- * lock before dropping the EventQueue lock. This can deadlock if someone
- * holds the GDK lock and wants to acquire the EventQueue lock; however
- * all callbacks from GTK happen with the GDK lock released, so this
- * would only happen in an odd case such as some JNI helper code
- * acquiring the GDK lock and calling back into
- * EventQueue.getNextEvent().
- */
-
- struct timeval init;
- gettimeofday(&init, NULL);
-
- gdk_threads_enter ();
- (*env)->MonitorExit (env, lockedQueue);
-
- if (block)
- {
-
- /* If we're blocking-when-empty, we want a do .. while loop. */
- do
- gtk_main_iteration ();
- while (within_human_latency_tolerance (&init)
- && gtk_events_pending ());
- }
- else
- {
- /* If we're not blocking-when-empty, we want a while loop. */
- while (within_human_latency_tolerance (&init)
- && gtk_events_pending ())
- gtk_main_iteration ();
- }
-
- (*env)->MonitorEnter (env, lockedQueue);
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkToolkit_wakeNativeQueue
- (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)))
-{
- g_main_context_wakeup (NULL);
-}
-
-JNIEXPORT jboolean JNICALL
-Java_gnu_java_awt_peer_gtk_GtkToolkit_nativeQueueEmpty
- (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)))
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkMain
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)))
{
- jboolean empty = FALSE;
-
gdk_threads_enter ();
- empty = ! gtk_events_pending();
+ gtk_main ();
gdk_threads_leave ();
-
- return empty;
}
@@ -466,7 +402,11 @@ Java_gnu_java_awt_peer_gtk_GtkToolkit_loadSystemColors
jint *colors;
GtkStyle *style;
+ /* FIXME: this was deadlocking so assume it is thread-safe for now;
+ we need to replace this call with a .properties file anyway. */
+#if 0
gdk_threads_enter ();
+#endif
colors = (*env)->GetIntArrayElements (env, jcolors, 0);
@@ -501,7 +441,9 @@ Java_gnu_java_awt_peer_gtk_GtkToolkit_loadSystemColors
(*env)->ReleaseIntArrayElements(env, jcolors, colors, 0);
+#if 0
gdk_threads_leave ();
+#endif
}
#undef CONVERT
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
index 650d9b6..0f623d1 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
@@ -260,20 +260,12 @@ static jmethodID postConfigureEventID;
static jmethodID postInsetsChangedEventID;
static jmethodID windowGetWidthID;
static jmethodID windowGetHeightID;
-static jmethodID setBoundsCallbackID;
void
cp_gtk_window_init_jni (void)
{
- jclass window;
jclass gtkwindowpeer;
- window = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(), "java/awt/Window");
-
- setBoundsCallbackID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), window,
- "setBoundsCallback",
- "(IIII)V");
-
gtkwindowpeer = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
"gnu/java/awt/peer/gtk/GtkWindowPeer");
@@ -302,9 +294,10 @@ cp_gtk_window_init_jni (void)
}
/* Get the first keyval in the keymap for this event's keycode. The
- first keyval corresponds roughly to Java's notion of a virtual
- key. Returns the uppercase version of the first keyval. */
-static guint
+ first keyval corresponds roughly to Java's notion of a virtual key.
+ Returns the uppercase version of the first keyval or -1 if no
+ keyval was found for the given hardware keycode. */
+static gint
get_first_keyval_from_keymap (GdkEventKey *event)
{
guint keyval;
@@ -317,10 +310,8 @@ get_first_keyval_from_keymap (GdkEventKey *event)
&keyvals,
&n_entries))
{
- g_warning ("No keyval found for hardware keycode %d\n",
- event->hardware_keycode);
- /* Try to recover by using the keyval in the event structure. */
- keyvals = &(event->keyval);
+ /* No keyval found for hardware keycode */
+ return -1;
}
keyval = keyvals[0];
g_free (keyvals);
@@ -328,16 +319,22 @@ get_first_keyval_from_keymap (GdkEventKey *event)
return gdk_keyval_to_upper (keyval);
}
+/* Return the AWT key code for the given keysym or -1 if no keyval was
+ found for the given hardware keycode. */
#ifdef __GNUC__
__inline
#endif
static jint
keysym_to_awt_keycode (GdkEventKey *event)
{
- guint ukeyval;
+ gint ukeyval;
guint state;
ukeyval = get_first_keyval_from_keymap (event);
+
+ if (ukeyval < 0)
+ return -1;
+
state = event->state;
/* VK_A through VK_Z */
@@ -736,13 +733,18 @@ keysym_to_awt_keycode (GdkEventKey *event)
}
}
+/* Return the AWT key location code for the given keysym or -1 if no
+ keyval was found for the given hardware keycode. */
static jint
keysym_to_awt_keylocation (GdkEventKey *event)
{
- guint ukeyval;
+ gint ukeyval;
ukeyval = get_first_keyval_from_keymap (event);
+ if (ukeyval < 0)
+ return -1;
+
/* VK_A through VK_Z */
if (ukeyval >= GDK_A && ukeyval <= GDK_Z)
return AWT_KEY_LOCATION_STANDARD;
@@ -1052,8 +1054,6 @@ window_configure_cb (GtkWidget *widget __attribute__((unused)),
GdkEventConfigure *event,
jobject peer)
{
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postConfigureEventID,
(jint) event->x,
@@ -1061,8 +1061,6 @@ window_configure_cb (GtkWidget *widget __attribute__((unused)),
(jint) event->width,
(jint) event->height);
- gdk_threads_enter ();
-
return FALSE;
}
@@ -1071,18 +1069,25 @@ key_press_cb (GtkWidget *widget __attribute__((unused)),
GdkEventKey *event,
jobject peer)
{
- gdk_threads_leave ();
+ jint keycode;
+ jint keylocation;
+
+ keycode = keysym_to_awt_keycode (event);
+ keylocation = keysym_to_awt_keylocation (event);
+
+ /* Return immediately if an error occurs translating a hardware
+ keycode to a keyval. */
+ if (keycode < 0 || keylocation < 0)
+ return TRUE;
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postKeyEventID,
(jint) AWT_KEY_PRESSED,
(jlong) event->time,
keyevent_state_to_awt_mods (event),
- keysym_to_awt_keycode (event),
+ keycode,
keyevent_to_awt_keychar (event),
- keysym_to_awt_keylocation (event));
-
- gdk_threads_enter ();
+ keylocation);
/* FIXME: generation of key typed events needs to be moved
to GtkComponentPeer.postKeyEvent. If the key in a key
@@ -1098,18 +1103,25 @@ key_release_cb (GtkWidget *widget __attribute__((unused)),
GdkEventKey *event,
jobject peer)
{
- gdk_threads_leave ();
+ jint keycode;
+ jint keylocation;
+
+ keycode = keysym_to_awt_keycode (event);
+ keylocation = keysym_to_awt_keylocation (event);
+
+ /* Return immediately if an error occurs translating a hardware
+ keycode to a keyval. */
+ if (keycode < 0 || keylocation < 0)
+ return TRUE;
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postKeyEventID,
(jint) AWT_KEY_RELEASED,
(jlong) event->time,
keyevent_state_to_awt_mods (event),
- keysym_to_awt_keycode (event),
+ keycode,
keyevent_to_awt_keychar (event),
- keysym_to_awt_keylocation (event));
-
- gdk_threads_enter ();
+ keylocation);
return TRUE;
}
@@ -1218,23 +1230,31 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowSetModal
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetVisible
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setVisibleNative
(JNIEnv *env, jobject obj, jboolean visible)
{
- void *ptr;
-
gdk_threads_enter ();
+ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setVisibleNativeUnlocked
+ (env, obj, visible);
+
+ gdk_flush ();
+
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setVisibleNativeUnlocked
+ (JNIEnv *env, jobject obj, jboolean visible)
+{
+ void *ptr;
+
ptr = NSA_GET_PTR (env, obj);
if (visible)
gtk_widget_show (GTK_WIDGET (ptr));
else
gtk_widget_hide (GTK_WIDGET (ptr));
-
- XFlush (GDK_DISPLAY ());
-
- gdk_threads_leave ();
}
JNIEXPORT void JNICALL
@@ -1349,17 +1369,6 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toFront (JNIEnv *env,
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setBoundsCallback
- (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)),
- jobject window, jint x, jint y, jint width, jint height)
-{
- /* Circumvent package-private access to call Window's
- setBoundsCallback method. */
- (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), window, setBoundsCallbackID,
- x, y, width, height);
-}
-
-JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setSize
(JNIEnv *env, jobject obj, jint width, jint height)
{
@@ -1382,10 +1391,20 @@ JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetBounds
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
{
- void *ptr;
-
gdk_threads_enter ();
+ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetBoundsUnlocked
+ (env, obj, x, y, width, height);
+
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetBoundsUnlocked
+ (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
+{
+ void *ptr;
+
ptr = NSA_GET_PTR (env, obj);
/* Avoid GTK runtime assertion failures. */
@@ -1414,8 +1433,6 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetBounds
by the program and the window's "resizable" property is true then
the size request will not be honoured. */
gtk_window_resize (GTK_WINDOW (ptr), width, height);
-
- gdk_threads_leave ();
}
static void
@@ -1427,10 +1444,20 @@ window_get_frame_extents (GtkWidget *window,
/* Guess frame extents in case _NET_FRAME_EXTENTS is not
supported. */
- *top = 23;
- *left = 6;
- *bottom = 6;
- *right = 6;
+ if (gtk_window_get_decorated (GTK_WINDOW (window)))
+ {
+ *top = 23;
+ *left = 6;
+ *bottom = 6;
+ *right = 6;
+ }
+ else
+ {
+ *top = 0;
+ *left = 0;
+ *bottom = 0;
+ *right = 0;
+ }
/* Request that the window manager set window's
_NET_FRAME_EXTENTS property. */
@@ -1531,15 +1558,11 @@ window_delete_cb (GtkWidget *widget __attribute__((unused)),
GdkEvent *event __attribute__((unused)),
jobject peer)
{
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postWindowEventID,
(jint) AWT_WINDOW_CLOSING,
(jobject) NULL, (jint) 0);
- gdk_threads_enter ();
-
/* Prevents that the Window dissappears ("destroy"
not being signalled). This is necessary because it
should be up to a WindowListener implementation
@@ -1552,28 +1575,20 @@ window_destroy_cb (GtkWidget *widget __attribute__((unused)),
GdkEvent *event __attribute__((unused)),
jobject peer)
{
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_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 ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postWindowEventID,
(jint) AWT_WINDOW_OPENED,
(jobject) NULL, (jint) 0);
-
- gdk_threads_enter ();
}
static void
@@ -1606,8 +1621,6 @@ window_focus_state_change_cb (GtkWidget *widget,
GParamSpec *pspec __attribute__((unused)),
jobject peer)
{
- gdk_threads_leave ();
-
if (GTK_WINDOW (widget)->has_toplevel_focus)
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postWindowEventID,
@@ -1618,8 +1631,6 @@ window_focus_state_change_cb (GtkWidget *widget,
postWindowEventID,
(jint) AWT_WINDOW_DEACTIVATED,
(jobject) NULL, (jint) 0);
-
- gdk_threads_enter ();
}
static gboolean
@@ -1627,15 +1638,11 @@ window_focus_in_cb (GtkWidget * widget __attribute__((unused)),
GdkEventFocus *event __attribute__((unused)),
jobject peer)
{
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postWindowEventID,
(jint) AWT_WINDOW_GAINED_FOCUS,
(jobject) NULL, (jint) 0);
- gdk_threads_enter ();
-
return FALSE;
}
@@ -1644,15 +1651,11 @@ window_focus_out_cb (GtkWidget * widget __attribute__((unused)),
GdkEventFocus *event __attribute__((unused)),
jobject peer)
{
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postWindowEventID,
(jint) AWT_WINDOW_LOST_FOCUS,
(jobject) NULL, (jint) 0);
- gdk_threads_enter ();
-
return FALSE;
}
@@ -1670,26 +1673,18 @@ window_window_state_cb (GtkWidget *widget,
if (event->window_state.new_window_state & GDK_WINDOW_STATE_ICONIFIED)
{
/* We've been iconified. */
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postWindowEventID,
(jint) AWT_WINDOW_ICONIFIED,
(jobject) NULL, (jint) 0);
-
- gdk_threads_enter ();
}
else
{
/* We've been deiconified. */
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postWindowEventID,
(jint) AWT_WINDOW_DEICONIFIED,
(jobject) NULL, (jint) 0);
-
- gdk_threads_enter ();
}
}
@@ -1702,15 +1697,11 @@ window_window_state_cb (GtkWidget *widget,
new_state |= window_get_new_state (widget);
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postWindowEventID,
(jint) AWT_WINDOW_STATE_CHANGED,
(jobject) NULL, new_state);
- gdk_threads_enter ();
-
return TRUE;
}
@@ -1776,16 +1767,12 @@ window_property_changed_cb (GtkWidget *widget __attribute__((unused)),
NULL,
gu_ex.gu_extents))
{
- gdk_threads_leave ();
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postInsetsChangedEventID,
(jint) extents[2], /* top */
(jint) extents[0], /* left */
(jint) extents[3], /* bottom */
(jint) extents[1]); /* right */
-
- gdk_threads_enter ();
}
diff --git a/libjava/classpath/native/jni/gtk-peer/gtkpeer.h b/libjava/classpath/native/jni/gtk-peer/gtkpeer.h
index f291d82..2b16d99 100644
--- a/libjava/classpath/native/jni/gtk-peer/gtkpeer.h
+++ b/libjava/classpath/native/jni/gtk-peer/gtkpeer.h
@@ -83,6 +83,20 @@ extern struct state_table *cp_gtk_native_global_ref_table;
(*env)->DeleteGlobalRef (env, *globRefPtr); \
free (globRefPtr);} while (0)
+extern struct state_table *cp_gtk_native_graphics_state_table;
+
+#define NSA_G_INIT(env, clazz) \
+ cp_gtk_native_graphics_state_table = cp_gtk_init_state_table (env, clazz)
+
+#define NSA_GET_G_PTR(env, obj) \
+ cp_gtk_get_state (env, obj, cp_gtk_native_graphics_state_table)
+
+#define NSA_SET_G_PTR(env, obj, ptr) \
+ cp_gtk_set_state (env, obj, cp_gtk_native_graphics_state_table, (void *)ptr)
+
+#define NSA_DEL_G_PTR(env, obj) \
+ cp_gtk_remove_state_slot (env, obj, cp_gtk_native_graphics_state_table)
+
#define SWAPU32(w) \
(((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24))
@@ -142,6 +156,14 @@ JNIEnv *cp_gtk_gdk_env(void);
extern double cp_gtk_dpi_conversion_factor;
extern GtkWindowGroup *cp_gtk_global_window_group;
+/* Shared global clipboard for GtkClipboard and GtkSelection. */
+extern GtkClipboard *cp_gtk_clipboard;
+
+/* Standard target (strings) for GtkClipboard and GtkSelection. */
+extern jstring cp_gtk_stringTarget;
+extern jstring cp_gtk_imageTarget;
+extern jstring cp_gtk_filesTarget;
+
/* Union used for type punning. */
union widget_union
{
@@ -149,8 +171,9 @@ union widget_union
GtkWidget **widget;
};
-/* Keycode helpers */
+/* Constant conversion helpers */
guint cp_gtk_awt_keycode_to_keysym (jint keyCode, jint keyLocation);
+jint cp_gtk_state_to_awt_mods (guint state);
/* Image helpers */
GdkPixbuf *cp_gtk_image_get_pixbuf (JNIEnv *env, jobject obj);
@@ -166,6 +189,7 @@ void cp_gtk_button_init_jni (void);
void cp_gtk_checkbox_init_jni (void);
void cp_gtk_choice_init_jni (void);
void cp_gtk_component_init_jni (void);
+void cp_gtk_filedialog_init_jni (void);
void cp_gtk_list_init_jni (void);
void cp_gtk_menuitem_init_jni (void);
void cp_gtk_scrollbar_init_jni (void);
@@ -182,6 +206,8 @@ void cp_gtk_textcomponent_connect_signals (GObject *ptr, jobject *gref);
/* Debugging */
void cp_gtk_print_current_thread (void);
+#define SYNCHRONIZE_GDK 0
+
#define DEBUG_LOCKING 0
#if DEBUG_LOCKING
diff --git a/libjava/classpath/native/jni/java-io/Makefile.in b/libjava/classpath/native/jni/java-io/Makefile.in
index a48c78f..9f0e017 100644
--- a/libjava/classpath/native/jni/java-io/Makefile.in
+++ b/libjava/classpath/native/jni/java-io/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -112,8 +112,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -175,6 +181,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -186,12 +193,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -213,10 +221,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
diff --git a/libjava/classpath/native/jni/java-lang/Makefile.in b/libjava/classpath/native/jni/java-lang/Makefile.in
index c8e8ef8..2e9ffdd 100644
--- a/libjava/classpath/native/jni/java-lang/Makefile.in
+++ b/libjava/classpath/native/jni/java-lang/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -117,8 +117,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -180,6 +186,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -191,12 +198,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -218,10 +226,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
diff --git a/libjava/classpath/native/jni/java-lang/java_lang_VMDouble.c b/libjava/classpath/native/jni/java-lang/java_lang_VMDouble.c
index 6b4aed4..846df2e 100644
--- a/libjava/classpath/native/jni/java-lang/java_lang_VMDouble.c
+++ b/libjava/classpath/native/jni/java-lang/java_lang_VMDouble.c
@@ -348,12 +348,7 @@ Java_java_lang_VMDouble_parseDouble
struct _Jv_reent reent;
memset (&reent, 0, sizeof reent);
-#ifdef KISSME_LINUX_USER
- /* FIXME: The libc strtod may not be reliable. */
- val = strtod (p, &endptr);
-#else
val = _strtod_r (&reent, p, &endptr);
-#endif
#ifdef DEBUG
fprintf (stderr, "java.lang.VMDouble.parseDouble val = %g\n", val);
diff --git a/libjava/classpath/native/jni/java-net/Makefile.in b/libjava/classpath/native/jni/java-net/Makefile.in
index aa4df4f..c4970ec 100644
--- a/libjava/classpath/native/jni/java-net/Makefile.in
+++ b/libjava/classpath/native/jni/java-net/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -114,8 +114,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -177,6 +183,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -188,12 +195,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -215,10 +223,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
diff --git a/libjava/classpath/native/jni/java-net/gnu_java_net_PlainSocketImpl.c b/libjava/classpath/native/jni/java-net/gnu_java_net_PlainSocketImpl.c
index a526151..f5f22ab7 100644
--- a/libjava/classpath/native/jni/java-net/gnu_java_net_PlainSocketImpl.c
+++ b/libjava/classpath/native/jni/java-net/gnu_java_net_PlainSocketImpl.c
@@ -50,6 +50,7 @@ exception statement from your version. */
#include "target_native.h"
#ifndef WITHOUT_NETWORK
+#include "target_native_file.h" /* Get FIONREAD on Solaris. */
#include "target_native_network.h"
#endif /* WITHOUT_NETWORK */
diff --git a/libjava/classpath/native/jni/java-nio/Makefile.in b/libjava/classpath/native/jni/java-nio/Makefile.in
index cd3568f..2fd5d85 100644
--- a/libjava/classpath/native/jni/java-nio/Makefile.in
+++ b/libjava/classpath/native/jni/java-nio/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -119,8 +119,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -182,6 +188,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -193,12 +200,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -220,10 +228,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
diff --git a/libjava/classpath/native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c b/libjava/classpath/native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c
index 743e12a..a989499 100644
--- a/libjava/classpath/native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c
+++ b/libjava/classpath/native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c
@@ -56,6 +56,10 @@ exception statement from your version. */
#include <fcntl.h>
#endif /* HAVE_FCNTL_H */
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif /* HAVE_SYS_MMAN_H */
+
/* These values must be kept in sync with FileChannelImpl.java. */
#define FILECHANNELIMPL_READ 1
#define FILECHANNELIMPL_WRITE 2
@@ -91,6 +95,10 @@ exception statement from your version. */
#define CONVERT_SSIZE_T_TO_JINT(x) ((jint)(x & 0xFFFFFFFF))
#define CONVERT_JINT_TO_SSIZE_T(x) (x)
+/* Align a value up or down to a multiple of the pagesize. */
+#define ALIGN_DOWN(p,s) ((p) - ((p) % (s)))
+#define ALIGN_UP(p,s) ((p) + ((s) - ((p) % (s))))
+
/* cached fieldID of gnu.java.nio.channels.FileChannelImpl.fd */
static jfieldID native_fd_fieldID;
@@ -105,12 +113,12 @@ get_native_fd (JNIEnv * env, jobject obj)
* static initialization.
*/
JNIEXPORT void JNICALL
-Java_gnu_java_nio_channels_FileChannelImpl_init (JNIEnv * env, jclass clazz)
+Java_gnu_java_nio_channels_FileChannelImpl_init (JNIEnv * env,
+ jclass clazz
+ __attribute__ ((__unused__)))
{
jclass clazz_fc;
jfieldID field;
- jmethodID constructor;
- jobject obj;
/* Initialize native_fd_fieldID so we only compute it once! */
clazz_fc = (*env)->FindClass (env, "gnu/java/nio/channels/FileChannelImpl");
@@ -128,28 +136,6 @@ Java_gnu_java_nio_channels_FileChannelImpl_init (JNIEnv * env, jclass clazz)
}
native_fd_fieldID = field;
-
- constructor = (*env)->GetMethodID (env, clazz, "<init>", "(II)V");
- if (!constructor)
- return;
-
-#define INIT_FIELD(FIELDNAME, FDVALUE, MODE) \
- field = (*env)->GetStaticFieldID (env, clazz, FIELDNAME, \
- "Lgnu/java/nio/channels/FileChannelImpl;"); \
- if (! field) \
- return; \
- obj = (*env)->NewObject (env, clazz, constructor, FDVALUE, MODE); \
- if (! obj) \
- return; \
- (*env)->SetStaticObjectField (env, clazz, field, obj); \
- if ((*env)->ExceptionOccurred (env)) \
- return;
-
- INIT_FIELD ("in", 0, FILECHANNELIMPL_READ);
- INIT_FIELD ("out", 1, FILECHANNELIMPL_WRITE);
- INIT_FIELD ("err", 2, FILECHANNELIMPL_WRITE);
-
-#undef INIT_FIELD
}
/*
@@ -218,17 +204,22 @@ Java_gnu_java_nio_channels_FileChannelImpl_open (JNIEnv * env,
#endif
TARGET_NATIVE_FILE_OPEN (filename, native_fd, flags, permissions, result);
- JCL_free_cstring (env, name, filename);
if (result != TARGET_NATIVE_OK)
{
- /* We can only throw FileNotFoundException. */
+ char message[256]; /* Fixed size we don't need to malloc. */
+ char *error_string = TARGET_NATIVE_LAST_ERROR_STRING ();
+
+ snprintf(message, 256, "%s: %s", error_string, filename);
+ /* We are only allowed to throw FileNotFoundException. */
JCL_ThrowException (env,
"java/io/FileNotFoundException",
- TARGET_NATIVE_LAST_ERROR_STRING ());
+ message);
+ JCL_free_cstring (env, name, filename);
return TARGET_NATIVE_MATH_INT_INT64_CONST_MINUS_1;
}
+ JCL_free_cstring (env, name, filename);
return native_fd;
}
@@ -245,12 +236,19 @@ Java_gnu_java_nio_channels_FileChannelImpl_implCloseChannel (JNIEnv * env,
native_fd = get_native_fd (env, obj);
- TARGET_NATIVE_FILE_CLOSE (native_fd, result);
- if (result != TARGET_NATIVE_OK)
+ do
{
- JCL_ThrowException (env, IO_EXCEPTION,
- TARGET_NATIVE_LAST_ERROR_STRING ());
+ TARGET_NATIVE_FILE_CLOSE (native_fd, result);
+ if (result != TARGET_NATIVE_OK
+ && (TARGET_NATIVE_LAST_ERROR ()
+ != TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL))
+ {
+ JCL_ThrowException (env, IO_EXCEPTION,
+ TARGET_NATIVE_LAST_ERROR_STRING ());
+ return;
+ }
}
+ while (result != TARGET_NATIVE_OK);
}
/*
@@ -267,13 +265,19 @@ Java_gnu_java_nio_channels_FileChannelImpl_available (JNIEnv * env,
native_fd = get_native_fd (env, obj);
- TARGET_NATIVE_FILE_AVAILABLE (native_fd, bytes_available, result);
- if (result != TARGET_NATIVE_OK)
+ do
{
- JCL_ThrowException (env, IO_EXCEPTION,
- TARGET_NATIVE_LAST_ERROR_STRING ());
- return 0;
+ TARGET_NATIVE_FILE_AVAILABLE (native_fd, bytes_available, result);
+ if (result != TARGET_NATIVE_OK
+ && (TARGET_NATIVE_LAST_ERROR ()
+ != TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL))
+ {
+ JCL_ThrowException (env, IO_EXCEPTION,
+ TARGET_NATIVE_LAST_ERROR_STRING ());
+ return 0;
+ }
}
+ while (result != TARGET_NATIVE_OK);
/* FIXME NYI ??? why only jint and not jlong? */
return TARGET_NATIVE_MATH_INT_INT64_TO_INT32 (bytes_available);
@@ -503,13 +507,91 @@ Java_gnu_java_nio_channels_FileChannelImpl_implTruncate (JNIEnv * env,
}
JNIEXPORT jobject JNICALL
-Java_gnu_java_nio_channels_FileChannelImpl_mapImpl (JNIEnv * env,
- jobject obj
- __attribute__ ((__unused__)), jchar mode __attribute__ ((__unused__)), jlong position __attribute__ ((__unused__)), jint size __attribute__ ((__unused__)))
+Java_gnu_java_nio_channels_FileChannelImpl_mapImpl (JNIEnv *env, jobject obj,
+ jchar mode, jlong position, jint size)
{
+#ifdef HAVE_MMAP
+ jclass MappedByteBufferImpl_class;
+ jmethodID MappedByteBufferImpl_init = NULL;
+ jobject Pointer_instance;
+ volatile jobject buffer;
+ long pagesize;
+ int prot, flags;
+ int fd;
+ void *p;
+ void *address;
+
+ /* FIXME: should we just assume we're on an OS modern enough to
+ have 'sysconf'? And not check for 'getpagesize'? */
+#if defined(HAVE_GETPAGESIZE)
+ pagesize = getpagesize ();
+#elif defined(HAVE_SYSCONF)
+ pagesize = sysconf (_SC_PAGESIZE);
+#else
JCL_ThrowException (env, IO_EXCEPTION,
- "java.nio.FileChannelImpl.nio_mmap_file(): not implemented");
+ "can't determine memory page size");
+ return NULL;
+#endif /* HAVE_GETPAGESIZE/HAVE_SYSCONF */
+
+ if ((*env)->ExceptionOccurred (env))
+ {
+ return NULL;
+ }
+
+ prot = PROT_READ;
+ if (mode == '+')
+ prot |= PROT_WRITE;
+ flags = (mode == 'c' ? MAP_PRIVATE : MAP_SHARED);
+ fd = get_native_fd (env, obj);
+ p = mmap (NULL, (size_t) ALIGN_UP (size, pagesize), prot, flags,
+ fd, ALIGN_DOWN (position, pagesize));
+ if (p == MAP_FAILED)
+ {
+ JCL_ThrowException (env, IO_EXCEPTION, strerror (errno));
+ return NULL;
+ }
+
+ /* Unalign the mapped value back up, since we aligned offset
+ down to a multiple of the page size. */
+ address = (void *) ((char *) p + (position % pagesize));
+
+ Pointer_instance = JCL_NewRawDataObject(env, address);
+
+ MappedByteBufferImpl_class = (*env)->FindClass (env,
+ "java/nio/MappedByteBufferImpl");
+ if (MappedByteBufferImpl_class != NULL)
+ {
+ MappedByteBufferImpl_init =
+ (*env)->GetMethodID (env, MappedByteBufferImpl_class,
+ "<init>", "(Lgnu/classpath/Pointer;IZ)V");
+ }
+
+ if ((*env)->ExceptionOccurred (env))
+ {
+ munmap (p, ALIGN_UP (size, pagesize));
+ return NULL;
+ }
+ if (MappedByteBufferImpl_init == NULL)
+ {
+ JCL_ThrowException (env, "java/lang/InternalError",
+ "could not get MappedByteBufferImpl constructor");
+ munmap (p, ALIGN_UP (size, pagesize));
+ return NULL;
+ }
+
+ buffer = (*env)->NewObject (env, MappedByteBufferImpl_class,
+ MappedByteBufferImpl_init, Pointer_instance,
+ (jint) size, mode == 'r');
+ return buffer;
+#else
+ (void) obj;
+ (void) mode;
+ (void) position;
+ (void) size;
+ JCL_ThrowException (env, IO_EXCEPTION,
+ "memory-mapped files not implemented");
return 0;
+#endif /* HAVE_MMAP */
}
/*
@@ -735,17 +817,23 @@ Java_gnu_java_nio_channels_FileChannelImpl_lock (JNIEnv *env, jobject obj,
flock.l_type = shared ? F_RDLCK : F_WRLCK;
flock.l_whence = SEEK_SET;
flock.l_start = (off_t) position;
- flock.l_len = (off_t) size;
+ /* Long.MAX_VALUE means lock everything possible starting at pos. */
+ if (size == 9223372036854775807LL)
+ flock.l_len = 0;
+ else
+ flock.l_len = (off_t) size;
ret = fcntl (fd, cmd, &flock);
+ /* fprintf(stderr, "fd %d, wait %d, shared %d, ret %d, position %lld, size %lld, l_start %ld, l_len %ld\n", fd, wait, shared,ret, position, size, (long) flock.l_start, (long) flock.l_len); */
if (ret)
{
/* Linux man pages for fcntl state that errno might be either
EACCES or EAGAIN if we try F_SETLK, and another process has
- an overlapping lock. */
+ an overlapping lock. We should not get an unexpected errno. */
if (errno != EACCES && errno != EAGAIN)
{
- JCL_ThrowException (env, IO_EXCEPTION, strerror (errno));
+ JCL_ThrowException (env, "java/lang/InternalError",
+ strerror (errno));
}
return JNI_FALSE;
}
@@ -776,12 +864,17 @@ Java_gnu_java_nio_channels_FileChannelImpl_unlock (JNIEnv *env,
flock.l_type = F_UNLCK;
flock.l_whence = SEEK_SET;
flock.l_start = (off_t) position;
- flock.l_len = (off_t) length;
+ /* Long.MAX_VALUE means unlock everything possible starting at pos. */
+ if (length == 9223372036854775807LL)
+ flock.l_len = 0;
+ else
+ flock.l_len = (off_t) length;
ret = fcntl (fd, F_SETLK, &flock);
if (ret)
{
- JCL_ThrowException (env, IO_EXCEPTION, strerror (errno));
+ JCL_ThrowException (env, "java/lang/InternalError",
+ strerror (errno));
}
#else
(void) obj;
diff --git a/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c b/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c
index 8c3f83a..2541e81 100644
--- a/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c
+++ b/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c
@@ -173,23 +173,14 @@ static void
createRawData (JNIEnv * env, jobject obj, void *ptr)
{
jclass cls;
- jmethodID method;
jobject data;
jfieldID data_fid;
cls = (*env)->GetObjectClass (env, obj);
- data_fid = (*env)->GetFieldID (env, cls, "data", "Lgnu/classpath/RawData;");
+ data_fid = (*env)->GetFieldID (env, cls, "data", "Lgnu/classpath/Pointer;");
assert (data_fid != 0);
-#ifdef POINTERS_ARE_64BIT
- cls = (*env)->FindClass (env, "gnu/classpath/RawData64");
- method = (*env)->GetMethodID (env, cls, "<init>", "(J)V");
- data = (*env)->NewObject (env, cls, method, (jlong) ptr);
-#else
- cls = (*env)->FindClass (env, "gnu/classpath/RawData32");
- method = (*env)->GetMethodID (env, cls, "<init>", "(I)V");
- data = (*env)->NewObject (env, cls, method, (jint) ptr);
-#endif
+ data = JCL_NewRawDataObject(env, ptr);
(*env)->SetObjectField (env, obj, data_fid, data);
}
@@ -198,22 +189,13 @@ static void *
getData (JNIEnv * env, jobject obj)
{
jclass cls;
- jfieldID field;
jfieldID data_fid;
jobject data;
cls = (*env)->GetObjectClass (env, obj);
- data_fid = (*env)->GetFieldID (env, cls, "data", "Lgnu/classpath/RawData;");
+ data_fid = (*env)->GetFieldID (env, cls, "data", "Lgnu/classpath/Pointer;");
assert (data_fid != 0);
data = (*env)->GetObjectField (env, obj, data_fid);
-#if SIZEOF_VOID_P == 8
- cls = (*env)->FindClass (env, "gnu/classpath/RawData64");
- field = (*env)->GetFieldID (env, cls, "data", "J");
- return (void *) (*env)->GetLongField (env, data, field);
-#else
- cls = (*env)->FindClass (env, "gnu/classpath/RawData32");
- field = (*env)->GetFieldID (env, cls, "data", "I");
- return (void *) (*env)->GetIntField (env, data, field);
-#endif
+ return JCL_GetRawData(env, data);
}
diff --git a/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c b/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c
index cd5d486..7a98e7e 100644
--- a/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c
+++ b/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c
@@ -173,23 +173,14 @@ static void
createRawData (JNIEnv * env, jobject obj, void *ptr)
{
jclass cls;
- jmethodID method;
jobject data;
jfieldID data_fid;
cls = (*env)->GetObjectClass (env, obj);
- data_fid = (*env)->GetFieldID (env, cls, "data", "Lgnu/classpath/RawData;");
+ data_fid = (*env)->GetFieldID (env, cls, "data", "Lgnu/classpath/Pointer;");
assert (data_fid != 0);
-
-#ifdef POINTERS_ARE_64BIT
- cls = (*env)->FindClass (env, "gnu/classpath/RawData64");
- method = (*env)->GetMethodID (env, cls, "<init>", "(J)V");
- data = (*env)->NewObject (env, cls, method, (jlong) ptr);
-#else
- cls = (*env)->FindClass (env, "gnu/classpath/RawData32");
- method = (*env)->GetMethodID (env, cls, "<init>", "(I)V");
- data = (*env)->NewObject (env, cls, method, (jint) ptr);
-#endif
+
+ data = JCL_NewRawDataObject (env, ptr);
(*env)->SetObjectField (env, obj, data_fid, data);
}
@@ -198,22 +189,13 @@ static void *
getData (JNIEnv * env, jobject obj)
{
jclass cls;
- jfieldID field;
jfieldID data_fid;
jobject data;
cls = (*env)->GetObjectClass (env, obj);
- data_fid = (*env)->GetFieldID (env, cls, "data", "Lgnu/classpath/RawData;");
+ data_fid = (*env)->GetFieldID (env, cls, "data", "Lgnu/classpath/Pointer;");
assert (data_fid != 0);
data = (*env)->GetObjectField (env, obj, data_fid);
-#if SIZEOF_VOID_P == 8
- cls = (*env)->FindClass (env, "gnu/classpath/RawData64");
- field = (*env)->GetFieldID (env, cls, "data", "J");
- return (void *) (*env)->GetLongField (env, data, field);
-#else
- cls = (*env)->FindClass (env, "gnu/classpath/RawData32");
- field = (*env)->GetFieldID (env, cls, "data", "I");
- return (void *) (*env)->GetIntField (env, data, field);
-#endif
+ return JCL_GetRawData(env, data);
}
diff --git a/libjava/classpath/native/jni/java-nio/java_nio_MappedByteBufferImpl.c b/libjava/classpath/native/jni/java-nio/java_nio_MappedByteBufferImpl.c
index e1ba1e4..b490919 100644
--- a/libjava/classpath/native/jni/java-nio/java_nio_MappedByteBufferImpl.c
+++ b/libjava/classpath/native/jni/java-nio/java_nio_MappedByteBufferImpl.c
@@ -1,5 +1,5 @@
/* java_nio_MappedByteBufferImpl.c - Native methods for MappedByteBufferImpl
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004,2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,41 +43,200 @@ exception statement from your version. */
#include "java_nio_MappedByteBufferImpl.h"
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif /* HAVE_SYS_MMAN_H */
+
#define IO_EXCEPTION "java/io/IOException"
+/* FIXME these are defined in gnu_java_nio_channels_FileChannelImpl
+ too; should be someplace common. */
+#define ALIGN_DOWN(p,s) ((jpointer)(p) - ((jpointer)(p) % (s)))
+#define ALIGN_UP(p,s) ((jpointer)(p) + ((s) - ((jpointer)(p) % (s))))
+
+/**
+ * Returns the memory page size of this platform.
+ *
+ * \return The page size.
+ */
+static long
+get_pagesize (void)
+{
+ /* FIXME can we just try HAVE_SYSCONF? */
+#if defined(HAVE_GETPAGESIZE)
+ return getpagesize ();
+#elif defined (HAVE_SYSCONF)
+ return sysconf (_SC_PAGESIZE);
+#endif /* HAVE_GETPAGESIZE / HAVE_SYSCONF */
+}
+
+/**
+ * Retrieve the 'address' and 'cap' (the mapped size) fields of this
+ * buffer.
+ *
+ * This function will align the address down to the nearest page
+ * boundary, and the size up to the nearest page boundary. Thus, it is
+ * safe to use these values in 'mman' functions.
+ *
+ * \param env The JNI environment pointer.
+ * \param this The MappedByteBufferImpl instance.
+ * \param address A pointer to where the actual pointer should be
+ * stored.
+ * \param size A pointer to where the mapped region's size should be
+ * stored
+ */
+static void
+get_raw_values (JNIEnv *env, jobject this, void **address, size_t *size)
+{
+ const long pagesize = get_pagesize ();
+ jfieldID MappedByteBufferImpl_address;
+ jfieldID MappedByteBufferImpl_size;
+ jobject MappedByteBufferImpl_address_value = NULL;
+
+ *address = NULL;
+ /* 'address' is declared in java.nio.Buffer */
+ MappedByteBufferImpl_address
+ = (*env)->GetFieldID (env, (*env)->GetObjectClass (env, this),
+ "address", "Lgnu/classpath/Pointer;");
+ /* 'cap' -- likewise, the capacity */
+ MappedByteBufferImpl_size
+ = (*env)->GetFieldID (env, (*env)->GetObjectClass (env, this),
+ "cap", "I");
+ if (MappedByteBufferImpl_address != NULL)
+ {
+ MappedByteBufferImpl_address_value =
+ (*env)->GetObjectField (env, this, MappedByteBufferImpl_address);
+ }
+ if ((*env)->ExceptionOccurred (env))
+ return;
+ if (MappedByteBufferImpl_address_value == NULL)
+ {
+ JCL_ThrowException (env, "java/lang/NullPointerException",
+ "mapped address is NULL");
+ return;
+ }
+
+ *address = (void *)
+ ALIGN_DOWN (JCL_GetRawData (env, MappedByteBufferImpl_address_value), pagesize);
+ *size = (size_t)
+ ALIGN_UP ((*env)->GetIntField (env, this, MappedByteBufferImpl_size),
+ pagesize);
+}
+
JNIEXPORT void JNICALL
-Java_java_nio_MappedByteBufferImpl_unmapImpl (JNIEnv * env,
- jclass class
- __attribute__ ((__unused__)))
+Java_java_nio_MappedByteBufferImpl_unmapImpl (JNIEnv *env, jobject this)
{
+#ifdef HAVE_MUNMAP
+ void *address;
+ size_t size;
+
+ get_raw_values (env, this, &address, &size);
+
+ if (address == NULL)
+ return;
+
+ if (munmap (address, size) != 0)
+ {
+ JCL_ThrowException (env, IO_EXCEPTION, strerror (errno));
+ return;
+ }
+#else
JCL_ThrowException (env, IO_EXCEPTION,
- "java.nio.MappedByteBufferImpl.unmapImpl(): not implemented");
+ "unmapping files not implemented");
+#endif /* HAVE_MUNMAP */
}
JNIEXPORT jboolean JNICALL
-Java_java_nio_MappedByteBufferImpl_isLoadedImpl (JNIEnv * env,
- jclass class
- __attribute__ ((__unused__)))
+Java_java_nio_MappedByteBufferImpl_isLoadedImpl (JNIEnv * env, jobject this)
{
- JCL_ThrowException (env, IO_EXCEPTION,
- "java.nio.MappedByteBufferImpl.isLoadedImpl(): not implemented");
- return 0;
+#ifdef HAVE_MINCORE
+ void *address;
+ size_t size;
+ char *vec;
+ size_t count, i;
+ const long pagesize = get_pagesize ();
+
+ /*
+ * FIXME on Darwin this does not work if the mapped region is
+ * exactly one page long; i.e., 'mincore' tells us it isn't loaded.
+ */
+ get_raw_values (env, this, &address, &size);
+ if (address == NULL)
+ return JNI_FALSE;
+ count = (size_t) ((size + pagesize - 1) / pagesize);
+ vec = (char *) malloc (count * sizeof (unsigned char));
+
+ /*
+ * Darwin (and BSD?) define argument 3 of 'mincore' to be 'char *',
+ * while GNU libc defines it to be 'unsigned char *'. Casting the
+ * argument to 'void *' fixes this, but not with C++. So you might
+ * be SOL if you compile this with g++ (!) on GNU with -Werror.
+ */
+#ifdef __cplusplus
+ if (mincore (address, size, vec) != 0)
+#else
+ if (mincore (address, size, (void *) vec) != 0)
+#endif /* __cplusplus */
+ {
+ free (vec);
+ JCL_ThrowException (env, IO_EXCEPTION, strerror (errno));
+ return JNI_FALSE;
+ }
+
+ for (i = 0; i < count; i++)
+ {
+ if ((vec[i] & 1) == 0)
+ return JNI_FALSE;
+ }
+ return JNI_TRUE;
+#else
+ return JNI_FALSE;
+#endif
}
JNIEXPORT void JNICALL
-Java_java_nio_MappedByteBufferImpl_loadImpl (JNIEnv * env,
- jclass clazz
- __attribute__ ((__unused__)))
+Java_java_nio_MappedByteBufferImpl_loadImpl (JNIEnv *env, jobject this)
{
+#ifdef HAVE_MADVISE
+ void *address;
+ size_t size;
+
+ get_raw_values (env, this, &address, &size);
+ if (address == NULL)
+ return;
+
+ madvise (address, size, MADV_WILLNEED);
+#else
JCL_ThrowException (env, IO_EXCEPTION,
- "java.nio.MappedByteBufferImpl.loadImpl(): not implemented");
+ "forcing mapped files into core not implemented");
+#endif /* HAVE_MADVISE */
}
JNIEXPORT void JNICALL
-Java_java_nio_MappedByteBufferImpl_forceImpl (JNIEnv * env,
- jclass class
- __attribute__ ((__unused__)))
+Java_java_nio_MappedByteBufferImpl_forceImpl (JNIEnv *env, jobject this)
{
+#ifdef HAVE_MSYNC
+ void *address;
+ size_t size;
+
+ get_raw_values (env, this, &address, &size);
+
+ if (address == NULL)
+ return;
+
+ /* FIXME: is using MS_SYNC ok? Should we use MS_INVALIDATE? */
+ if (msync (address, size, MS_SYNC) != 0)
+ {
+ JCL_ThrowException (env, IO_EXCEPTION, strerror (errno));
+ }
+#else
JCL_ThrowException (env, IO_EXCEPTION,
- "java.nio.MappedByteBufferImpl.forceImpl(): not implemented");
+ "forcing mapped files to disk not implemented");
+#endif /* HAVE_MSYNC */
}
diff --git a/libjava/classpath/native/jni/java-nio/java_nio_VMDirectByteBuffer.c b/libjava/classpath/native/jni/java-nio/java_nio_VMDirectByteBuffer.c
index 3eb5677..06e2990 100644
--- a/libjava/classpath/native/jni/java-nio/java_nio_VMDirectByteBuffer.c
+++ b/libjava/classpath/native/jni/java-nio/java_nio_VMDirectByteBuffer.c
@@ -45,106 +45,6 @@ exception statement from your version. */
#include "java_nio_VMDirectByteBuffer.h"
-static jclass classRawData;
-static jmethodID methodRawDataInit;
-static jfieldID fieldNativePointer;
-
-static void *NIOGetPointer (JNIEnv *, jobject);
-static jobject NIOGetRawData (JNIEnv *, void *pointer);
-
-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
-Java_java_nio_VMDirectByteBuffer_init
- (JNIEnv * env, jclass clazz __attribute__ ((__unused__)))
-{
-#if SIZEOF_VOID_P == 4
- classRawData = (*env)->FindClass (env, "gnu/classpath/RawData32");
- if (classRawData == NULL)
- {
- JCL_ThrowException (env, "java/lang/InternalError",
- "unable to find internal class");
- return;
- }
-
- methodRawDataInit = (*env)->GetMethodID (env, classRawData,
- "<init>", "(I)V");
- if (methodRawDataInit == NULL)
- {
- JCL_ThrowException (env, "java/lang/InternalError",
- "unable to find internal constructor");
- return;
- }
-
- fieldNativePointer = (*env)->GetFieldID (env, classRawData, "data", "I");
- if (fieldNativePointer == NULL)
- {
- JCL_ThrowException (env, "java/lang/InternalError",
- "unable to find internal field");
- return;
- }
-#elif SIZEOF_VOID_P == 8
- classRawData = (*env)->FindClass (env, "gnu/classpath/RawData64");
- if (classRawData == NULL)
- {
- JCL_ThrowException (env, "java/lang/InternalError",
- "unable to find internal class");
- return;
- }
-
- methodRawDataInit = (*env)->GetMethodID (env, classRawData,
- "<init>", "(J)V");
- if (methodRawDataInit == NULL)
- {
- JCL_ThrowException (env, "java/lang/InternalError",
- "unable to find internal constructor");
- return;
- }
-
- fieldNativePointer = (*env)->GetFieldID (env, classRawData, "data", "J");
- if (fieldNativePointer == NULL)
- {
- JCL_ThrowException (env, "java/lang/InternalError",
- "unable to find internal field");
- return;
- }
-#else
-#error unsupported pointer size
-#endif
-
- /* We need to wrap the jclass in global reference to make it persistent */
- if ((classRawData = (*env)->NewGlobalRef (env, classRawData)) == NULL)
- {
- JCL_ThrowException (env, "java/lang/InternalError",
- "failed to create global reference");
- return;
- }
-}
-
JNIEXPORT jobject JNICALL
Java_java_nio_VMDirectByteBuffer_allocate
(JNIEnv * env, jclass clazz __attribute__ ((__unused__)), jint capacity)
@@ -160,41 +60,53 @@ Java_java_nio_VMDirectByteBuffer_allocate
return 0;
}
- return NIOGetRawData (env, buffer);
+ return JCL_NewRawDataObject (env, buffer);
}
JNIEXPORT void JNICALL
Java_java_nio_VMDirectByteBuffer_free
(JNIEnv * env, jclass clazz __attribute__ ((__unused__)), jobject address)
{
- free (NIOGetPointer (env, address));
+ free (JCL_GetRawData (env, address));
}
JNIEXPORT jbyte JNICALL
-Java_java_nio_VMDirectByteBuffer_get__Lgnu_classpath_RawData_2I
+Java_java_nio_VMDirectByteBuffer_get__Lgnu_classpath_Pointer_2I
(JNIEnv * env, jclass clazz __attribute__ ((__unused__)),
jobject address, jint index)
{
- return ((jbyte *) NIOGetPointer (env, address))[index];
+ return ((jbyte *) JCL_GetRawData (env, address))[index];
}
JNIEXPORT void JNICALL
-Java_java_nio_VMDirectByteBuffer_put
+Java_java_nio_VMDirectByteBuffer_put__Lgnu_classpath_Pointer_2IB
(JNIEnv * env, jclass clazz __attribute__ ((__unused__)),
jobject address, jint index, jbyte value)
{
- jbyte *pointer = (jbyte *) NIOGetPointer (env, address) + index;
+ jbyte *pointer = (jbyte *) JCL_GetRawData (env, address) + index;
*pointer = value;
}
JNIEXPORT void JNICALL
-Java_java_nio_VMDirectByteBuffer_get__Lgnu_classpath_RawData_2I_3BII
+Java_java_nio_VMDirectByteBuffer_get__Lgnu_classpath_Pointer_2I_3BII
(JNIEnv * env, jclass clazz __attribute__ ((__unused__)),
jobject address, jint index, jbyteArray dst, jint dst_offset, jint dst_len)
{
- jbyte *src = (jbyte *) NIOGetPointer (env, address) + index;
- memcpy ((*env)->GetByteArrayElements (env, dst, NULL) + dst_offset, src,
- dst_len);
+ jbyte *src = (jbyte *) JCL_GetRawData (env, address) + index;
+ jbyte *_dst = (*env)->GetByteArrayElements (env, dst, NULL) + dst_offset;
+ memcpy (_dst, src, dst_len);
+ (*env)->ReleaseByteArrayElements (env, dst, _dst, 0);
+}
+
+JNIEXPORT void JNICALL
+Java_java_nio_VMDirectByteBuffer_put__Lgnu_classpath_Pointer_2I_3BII
+ (JNIEnv *env, jclass clazz __attribute__ ((__unused__)),
+ jobject address, jint index, jbyteArray src, jint src_offset, jint src_len)
+{
+ jbyte *_src = (*env)->GetByteArrayElements (env, src, NULL) + src_offset;
+ jbyte *dst = (jbyte *)JCL_GetRawData (env, address) + index;
+ (*env)->ReleaseByteArrayElements (env, src, _src, 0);
+ memcpy (dst, _src, src_len);
}
JNIEXPORT void JNICALL
@@ -202,8 +114,8 @@ Java_java_nio_VMDirectByteBuffer_shiftDown
(JNIEnv * env, jclass clazz __attribute__ ((__unused__)),
jobject address, jint dst_offset, jint src_offset, jint count)
{
- jbyte *dst = (jbyte *) NIOGetPointer (env, address) + dst_offset;
- jbyte *src = (jbyte *) NIOGetPointer (env, address) + src_offset;
+ jbyte *dst = (jbyte *) JCL_GetRawData (env, address) + dst_offset;
+ jbyte *src = (jbyte *) JCL_GetRawData (env, address) + src_offset;
memmove (dst, src, count);
}
@@ -212,5 +124,5 @@ Java_java_nio_VMDirectByteBuffer_adjustAddress
(JNIEnv * env, jclass clazz __attribute__ ((__unused__)),
jobject address, jint offset)
{
- return NIOGetRawData (env, (jbyte *) NIOGetPointer (env, address) + offset);
+ return JCL_NewRawDataObject (env, (jbyte *) JCL_GetRawData (env, address) + offset);
}
diff --git a/libjava/classpath/native/jni/java-util/Makefile.in b/libjava/classpath/native/jni/java-util/Makefile.in
index e283db3..53cd65e 100644
--- a/libjava/classpath/native/jni/java-util/Makefile.in
+++ b/libjava/classpath/native/jni/java-util/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -110,8 +110,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -173,6 +179,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -184,12 +191,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -211,10 +219,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
diff --git a/libjava/classpath/native/jni/xmlj/Makefile.in b/libjava/classpath/native/jni/xmlj/Makefile.in
index 5b9de90..694a842 100644
--- a/libjava/classpath/native/jni/xmlj/Makefile.in
+++ b/libjava/classpath/native/jni/xmlj/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -112,8 +112,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -175,6 +181,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -186,12 +193,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -213,10 +221,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
diff --git a/libjava/classpath/native/jni/xmlj/xmlj_util.c b/libjava/classpath/native/jni/xmlj/xmlj_util.c
index 498cb70..409eb6e 100644
--- a/libjava/classpath/native/jni/xmlj/xmlj_util.c
+++ b/libjava/classpath/native/jni/xmlj/xmlj_util.c
@@ -39,6 +39,7 @@ exception statement from your version. */
#include "xmlj_error.h"
#include <libxml/tree.h>
#include <unistd.h>
+#include <jcl.h>
/* xmlChar->jstring cache */
#ifdef XMLJ_STRING_CACHE
@@ -218,35 +219,13 @@ jmethodID xmljGetMethodID (JNIEnv *env,
void *
xmljAsPointer (JNIEnv *env, jobject ptr)
{
- jclass cls;
- jfieldID field;
-
-#if defined XMLJ_64BIT_POINTER
- cls = (*env)->FindClass (env, "gnu/classpath/RawData64");
- field = (*env)->GetFieldID (env, cls, "data", "J");
- return (void *) (*env)->GetLongField (env, ptr, field);
-#else
- cls = (*env)->FindClass (env, "gnu/classpath/RawData32");
- field = (*env)->GetFieldID (env, cls, "data", "I");
- return (void *) (*env)->GetIntField (env, ptr, field);
-#endif
+ return JCL_GetRawData(env, ptr);
}
jobject
xmljAsField (JNIEnv *env, void * ptr)
{
- jclass cls;
- jmethodID method;
-
-#if defined XMLJ_64BIT_POINTER
- cls = (*env)->FindClass (env, "gnu/classpath/RawData64");
- method = (*env)->GetMethodID (env, cls, "<init>", "(J)V");
- return (*env)->NewObject (env, cls, method, (jlong) ptr);
-#else
- cls = (*env)->FindClass (env, "gnu/classpath/RawData32");
- method = (*env)->GetMethodID (env, cls, "<init>", "(I)V");
- return (*env)->NewObject (env, cls, method, (jint) ptr);
-#endif
+ return JCL_NewRawDataObject(env, ptr);
}
JNIEnv *
diff --git a/libjava/classpath/native/target/Linux/Makefile.in b/libjava/classpath/native/target/Linux/Makefile.in
index f735271..c455ebd 100644
--- a/libjava/classpath/native/target/Linux/Makefile.in
+++ b/libjava/classpath/native/target/Linux/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -82,8 +82,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -145,6 +151,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -156,12 +163,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -183,10 +191,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
diff --git a/libjava/classpath/native/target/Makefile.in b/libjava/classpath/native/target/Makefile.in
index c94a3b9..e7dc7da 100644
--- a/libjava/classpath/native/target/Makefile.in
+++ b/libjava/classpath/native/target/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -91,8 +91,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -154,6 +160,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -165,12 +172,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -192,10 +200,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -287,13 +298,7 @@ uninstall-info-am:
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
- @failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+ @set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -305,7 +310,7 @@ $(RECURSIVE_TARGETS):
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@@ -313,13 +318,7 @@ $(RECURSIVE_TARGETS):
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
- @failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+ @set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@@ -340,7 +339,7 @@ maintainer-clean-recursive:
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
diff --git a/libjava/classpath/native/target/generic/Makefile.in b/libjava/classpath/native/target/generic/Makefile.in
index 4b92eff..c7681e1 100644
--- a/libjava/classpath/native/target/generic/Makefile.in
+++ b/libjava/classpath/native/target/generic/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -82,8 +82,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -145,6 +151,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -156,12 +163,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -183,10 +191,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
diff --git a/libjava/classpath/native/target/generic/target_generic_network.h b/libjava/classpath/native/target/generic/target_generic_network.h
index dbbd92e..4488ea8 100644
--- a/libjava/classpath/native/target/generic/target_generic_network.h
+++ b/libjava/classpath/native/target/generic/target_generic_network.h
@@ -666,6 +666,16 @@ Systems : all
#ifndef TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_SO_TIMEOUT
#include <sys/types.h>
#include <sys/socket.h>
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
#define TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_SO_TIMEOUT(socketDescriptor,flag,result) \
do { \
struct timeval __value; \
diff --git a/libjava/classpath/org/omg/CORBA/Any.java b/libjava/classpath/org/omg/CORBA/Any.java
index d8c892d..1e72709 100644
--- a/libjava/classpath/org/omg/CORBA/Any.java
+++ b/libjava/classpath/org/omg/CORBA/Any.java
@@ -51,7 +51,7 @@ import org.omg.CORBA.portable.IDLEntity;
public abstract class Any
implements Serializable, IDLEntity
{
- /**
+ /**
* Using v 1.4 serialVersionUID for interoperability.
*/
private static final long serialVersionUID = 1217179597823814463L;
@@ -312,12 +312,18 @@ public abstract class Any
public abstract void insert_TypeCode(TypeCode typecode);
/**
- * Insert the CORBA <code>Value</code> into this <code>Any</code>
+ * Insert the CORBA <code>Value</code> into this <code>Any</code>.
+ *
+ * The type of the Any should be set (by {@link #type(TypeCode)})
+ * before inserting the value.
*/
public abstract void insert_Value(Serializable x, TypeCode typecode);
/**
- * Insert the CORBA <code>Value</code> into this <code>Any</code>
+ * Insert the CORBA <code>Value</code> into this <code>Any</code>.
+ *
+ * The type of the Any should be set (by {@link #type(TypeCode)})
+ * before inserting the value.
*/
public abstract void insert_Value(Serializable x);
diff --git a/libjava/classpath/org/omg/CORBA/DynAnyPackage/Invalid.java b/libjava/classpath/org/omg/CORBA/DynAnyPackage/Invalid.java
index 68c7186..dc66bea 100644
--- a/libjava/classpath/org/omg/CORBA/DynAnyPackage/Invalid.java
+++ b/libjava/classpath/org/omg/CORBA/DynAnyPackage/Invalid.java
@@ -1,39 +1,40 @@
/* Invalid.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005 Free Software Foundation, Inc.
- This file is part of GNU Classpath.
+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 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.
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with GNU Classpath; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301 USA.
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
- Linking this library statically or dynamically with other modules is
- making a combined work based on this library. Thus, the terms and
- conditions of the GNU General Public License cover the whole
- combination.
+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. */
- 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 org.omg.CORBA.DynAnyPackage;
diff --git a/libjava/classpath/org/omg/CORBA/DynAnyPackage/InvalidSeq.java b/libjava/classpath/org/omg/CORBA/DynAnyPackage/InvalidSeq.java
index ca13329..ef0179e 100644
--- a/libjava/classpath/org/omg/CORBA/DynAnyPackage/InvalidSeq.java
+++ b/libjava/classpath/org/omg/CORBA/DynAnyPackage/InvalidSeq.java
@@ -1,39 +1,39 @@
/* InvalidSeq.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005 Free Software Foundation, Inc.
- This file is part of GNU Classpath.
+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 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.
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with GNU Classpath; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301 USA.
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
- Linking this library statically or dynamically with other modules is
- making a combined work based on this library. Thus, the terms and
- conditions of the GNU General Public License cover the whole
- combination.
+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. */
+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 org.omg.CORBA.DynAnyPackage;
diff --git a/libjava/classpath/org/omg/CORBA/DynAnyPackage/InvalidValue.java b/libjava/classpath/org/omg/CORBA/DynAnyPackage/InvalidValue.java
index bca6808..0c5ddf9 100644
--- a/libjava/classpath/org/omg/CORBA/DynAnyPackage/InvalidValue.java
+++ b/libjava/classpath/org/omg/CORBA/DynAnyPackage/InvalidValue.java
@@ -1,39 +1,39 @@
/* InvalidValue.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005 Free Software Foundation, Inc.
- This file is part of GNU Classpath.
+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 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.
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with GNU Classpath; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301 USA.
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
- Linking this library statically or dynamically with other modules is
- making a combined work based on this library. Thus, the terms and
- conditions of the GNU General Public License cover the whole
- combination.
+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. */
+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 org.omg.CORBA.DynAnyPackage;
diff --git a/libjava/classpath/org/omg/CORBA/DynAnyPackage/TypeMismatch.java b/libjava/classpath/org/omg/CORBA/DynAnyPackage/TypeMismatch.java
index 0de38ed..f4e9877 100644
--- a/libjava/classpath/org/omg/CORBA/DynAnyPackage/TypeMismatch.java
+++ b/libjava/classpath/org/omg/CORBA/DynAnyPackage/TypeMismatch.java
@@ -1,39 +1,39 @@
/* TypeMismatch.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005 Free Software Foundation, Inc.
- This file is part of GNU Classpath.
+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 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.
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with GNU Classpath; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301 USA.
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
- Linking this library statically or dynamically with other modules is
- making a combined work based on this library. Thus, the terms and
- conditions of the GNU General Public License cover the whole
- combination.
+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. */
+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 org.omg.CORBA.DynAnyPackage;
diff --git a/libjava/classpath/org/omg/CORBA/ORB.java b/libjava/classpath/org/omg/CORBA/ORB.java
index 5f10fba..9163736 100644
--- a/libjava/classpath/org/omg/CORBA/ORB.java
+++ b/libjava/classpath/org/omg/CORBA/ORB.java
@@ -39,10 +39,10 @@ exception statement from your version. */
package org.omg.CORBA;
import gnu.CORBA.Restricted_ORB;
-import gnu.CORBA.primitiveTypeCode;
import gnu.CORBA.fixedTypeCode;
import gnu.CORBA.generalTypeCode;
import gnu.CORBA.gnuContext;
+import gnu.CORBA.primitiveTypeCode;
import gnu.CORBA.recordTypeCode;
import gnu.CORBA.recursiveTypeCode;
@@ -118,13 +118,14 @@ public abstract class ORB
/**
* The class, implementing the default fully functional ORB.
*/
- private static final String DEFAULT_FUNCTIONAL_ORB = "gnu.CORBA.Functional_ORB";
+ private static final String DEFAULT_FUNCTIONAL_ORB =
+ gnu.CORBA.Poa.ORB_1_4.class.getName();
/**
* The class, implementing the default restricted ORB.
*/
- private static final String DEFAULT_RESTRICTED_ORB = "gnu.CORBA.Restricted_ORB";
-
+ private static final String DEFAULT_RESTRICTED_ORB =
+ gnu.CORBA.Restricted_ORB.class.getName();
/**
* Connect the given CORBA object to this ORB. After the object is
@@ -162,7 +163,6 @@ public abstract class ORB
throw new NO_IMPLEMENT();
}
-
/**
* Create alias typecode for the given typecode.
*/
@@ -204,10 +204,11 @@ public abstract class ORB
* @throws NO_IMPLEMENT, always.
*/
public DynAny create_basic_dyn_any(org.omg.CORBA.TypeCode t)
- throws InconsistentTypeCode
+ throws InconsistentTypeCode
{
throw new NO_IMPLEMENT();
- };
+ }
+ ;
/**
* The support for {@link DynAny} and derived interfaces
@@ -222,7 +223,8 @@ public abstract class ORB
public DynAny create_dyn_any(org.omg.CORBA.Any a)
{
throw new NO_IMPLEMENT();
- };
+ }
+ ;
/**
* The support for {@link DynArray}
@@ -235,10 +237,11 @@ public abstract class ORB
* @throws NO_IMPLEMENT, always.
*/
public DynArray create_dyn_array(org.omg.CORBA.TypeCode t)
- throws InconsistentTypeCode
- {
- throw new NO_IMPLEMENT();
- };
+ throws InconsistentTypeCode
+ {
+ throw new NO_IMPLEMENT();
+ }
+ ;
/**
* The support for {@link DynEnum}
@@ -251,10 +254,11 @@ public abstract class ORB
* @throws NO_IMPLEMENT, always.
*/
public DynEnum create_dyn_enum(org.omg.CORBA.TypeCode t)
- throws InconsistentTypeCode
+ throws InconsistentTypeCode
{
throw new NO_IMPLEMENT();
- };
+ }
+ ;
/**
* The support for {@link DynSequence}
@@ -267,10 +271,11 @@ public abstract class ORB
* @throws NO_IMPLEMENT, always.
*/
public DynSequence create_dyn_sequence(org.omg.CORBA.TypeCode t)
- throws InconsistentTypeCode
+ throws InconsistentTypeCode
{
throw new NO_IMPLEMENT();
- };
+ }
+ ;
/**
* The support for {@link DynStruct} and derived interfaces
@@ -283,10 +288,11 @@ public abstract class ORB
* @throws NO_IMPLEMENT, always.
*/
public DynStruct create_dyn_struct(org.omg.CORBA.TypeCode t)
- throws InconsistentTypeCode
+ throws InconsistentTypeCode
{
throw new NO_IMPLEMENT();
- };
+ }
+ ;
/**
* The support for {@link DynUnion} and derived interfaces
@@ -299,10 +305,11 @@ public abstract class ORB
* @throws NO_IMPLEMENT, always.
*/
public DynUnion create_dyn_union(org.omg.CORBA.TypeCode t)
- throws InconsistentTypeCode
+ throws InconsistentTypeCode
{
throw new NO_IMPLEMENT();
- };
+ }
+ ;
/**
* Create a typecode, defining the given enumeration.
@@ -442,8 +449,7 @@ public abstract class ORB
* particular transaction.
*/
public abstract Request get_next_response()
- throws WrongTransaction;
-
+ throws WrongTransaction;
/**
* Create a new CDR output stream, where the parameter values can be written
@@ -473,16 +479,26 @@ public abstract class ORB
}
/**
- * This should create the new policy with the specified type and initial
- * state. The policies and methods for getting them are not implemented till
- * v1.4 inclusive.
+ * <p>Creates the new policy of the specified type, having the given value.
+ * This method looks for the policy factory that was previously registered
+ * during ORB initialization by
+ * {@link org.omg.PortableInterceptor.ORBInitialiser}.
*
+ * If the suitable factory is found, this factory creates the requested policy,
+ * otherwise the PolicyError is thrown.
+ * </p><p>
+ * The POA policies should be created by POA, not by this method.
+ * </p>
* @param type the policy type.
- * @param value the policy value.
+ * @param value the policy value, wrapped into Any.
*
- * @return never
+ * @throws PolicyError if the ORB fails to instantiate the policy object.
*
- * @throws NO_IMPLEMENT, always.
+ * @throws NO_IMPLEMENT always (in this class). Overridden in derived classes
+ * returned by ORB.init(..).
+ *
+ * @see org.omg.PortableInterceptor.ORBInitInfoOperations#register_policy_factory
+ * @see org.omg.PortableInterceptor.PolicyFactoryOperations
*/
public Policy create_policy(int type, Any value)
throws PolicyError
@@ -490,8 +506,6 @@ public abstract class ORB
throw new NO_IMPLEMENT();
}
-
-
/**
* Create typecode, defining the sequence of the elements, having
* the given type.
@@ -554,7 +568,6 @@ public abstract class ORB
*/
public abstract TypeCode create_wstring_tc(int bound);
-
/**
* Create a typecode for an abstract interface. The abstract interface
* can be either CORBA object or CORBA value type.
@@ -675,15 +688,19 @@ public abstract class ORB
/**
* This should return the information, related to the current thread.
+ * The information is needed, for instance, to get the current object
+ * from the code that serves several objects in parallel threads.
* The {@link Current} is very general interface, with no fields and
* operations defined. This method is not implemented in Suns
- * releases at least till v1.4 inclusive.
+ * releases at least till v1.5 inclusive. To obtain the
+ * {@link org.omg.PortableServer.Current}, use
+ * {@link #resolve_initial_references}, passing "POACurrent".
*
- * @deprecated since 1.2
+ * @deprecated since 1.2, use {@link #resolve_initial_references}.
*
* @return never
*
- * @throws NO_IMPLEMENT, always.
+ * @throws NO_IMPLEMENT always.
*/
public Current get_current()
{
@@ -693,7 +710,7 @@ public abstract class ORB
/**
* This should return the information about the CORBA facilities and
* services, available from this ORB. However this method is oficially
- * documented as not implemented at least till v1.4 inclusive.
+ * documented as not implemented at least till v1.5 inclusive.
*
* @param service_type a type of the service being requested. The OMG
* specification currently defines only one value, 1, for security
@@ -705,10 +722,11 @@ public abstract class ORB
* @return should return true if the service information is available
* from the ORB, but this method never returns.
*
- * @throws NO_IMPLEMENT, always.
+ * @throws NO_IMPLEMENT always.
*/
public boolean get_service_information(short service_type,
- ServiceInformationHolder service_info)
+ ServiceInformationHolder service_info
+ )
{
throw new NO_IMPLEMENT();
}
@@ -846,7 +864,44 @@ public abstract class ORB
* Find and return the easily accessible CORBA object, addressed
* by name. The returned object is typically casted to the more
* specific reference using the <code>narrow(Object)</code> method
- * of its helper.
+ * of its helper. The method resolves the following string values,
+ * returning the working objects:
+ * <table border="1"><tr><th>String</th><th>Object class</th>
+ * <th>Object use</th></tr>
+ *
+ * <tr><td>NameService</td><td>{@link org.omg.CosNaming.NamingContextExt}</td>
+ * <td>Finds (usually remote) object by its name.</td></tr>
+ *
+ * <tr><td>RootPOA</td><td>{@link org.omg.PortableServer.POA}</td>
+ * <td>Holds the POA tree for this ORB, where since 1.4 all servants
+ * should be connected.</td></tr>
+ *
+ * <tr><td>RootPOAManager</td><td>{@link org.omg.PortableServer.POAManager}
+ * </td><td>Regulates (suspends/resumes) the root POA
+ * activity</td></tr>
+ *
+ * <tr><td>POACurrent</td><td>{@link org.omg.PortableServer.Current}
+ * </td><td>Informs the current thread about the Id and POA of the
+ * object being currently served (the methods of
+ * <code>Current</code> return different values for
+ * different threads).
+ * </td></tr>
+ *
+ * <tr><td>CodecFactory</td><td>{@link org.omg.IOP.Codec}</td>
+ * <td>Encodes/decodes IDL data types into/from byte arrays.</td>
+ * </tr>
+ *
+ * <tr><td>DynAnyFactory</td><td>{@link org.omg.DynamicAny.DynAnyFactory}</td>
+ * <td>Creates DynAny's.</td>
+ * </tr>
+ *
+ * <tr><td>PICurrent</td><td>{@link org.omg.PortableInterceptor.Current}</td>
+ * <td>Contains multiple slots where an interceptor can rememeber the
+ * request - specific values between subsequent
+ * calls of the interceptor methods.</td>
+ * </tr>
+ *
+ * </table>
*
* @param name the object name.
* @return the object
@@ -887,36 +942,80 @@ public abstract class ORB
{
}
- /**
- * Checks if the ORB needs the main thread to perform some work.
- * The method should return true if the ORB needs the main thread,
- * and false if it does not.
- *
- * This method is part of the support for the distribute use of the
- * single execution thread.
- *
- * Same as in Suns releases at least till 1.4 inclusive,
- * the distributed use of the single thread is not implemented.
- * Use multiple threads, provided by jre.
- *
- * @return false, always.
- */
+ /**
+ * Checks if the ORB needs the main thread to perform some work.
+ * The method should return true if the ORB needs the main thread,
+ * and false if it does not.
+ *
+ * This method is part of the support for the distribute use of the
+ * single execution thread.
+ *
+ * Same as in Suns releases at least till 1.4 inclusive,
+ * the distributed use of the single thread is not implemented.
+ * Use multiple threads, provided by jre.
+ *
+ * @return false, always.
+ */
public boolean work_pending()
{
return false;
}
/**
- * Find and return the CORBA object, addressed by the given
- * IOR string representation. The object can (an usually is)
+ * <p>Find and return the CORBA object, addressed by the given
+ * string representation. The object can be (an usually is)
* located on a remote computer, possibly running a different
* (not necessary java) CORBA implementation. The returned
* object is typically casted to the more specific reference
* using the <code>narrow(Object)</code> method of its helper.
+ * </p><p>
+ * This function supports the following input formats:<br>
+ * 1. IOR reference (<b>ior:</b>nnnnn ..), usually computer generated.<br>
+ * 2. <b>corbaloc:</b>[<b>iiop</b>][version.subversion<b>@</b>]<b>:</b>host[<b>:</b>port]<b>/</b><i>key</i>
+ * defines similar information as IOR reference, but is more human readable.
+ * This type of reference may also contain multiple addresses (see
+ * OMG documentation for complete format).<br>
+ * 3. <b>corbaloc:rir:/</b><i>name</i> defines internal reference on this
+ * ORB that is resolved using {@link #resolve_initial_references}, passing
+ * the given <i>name</i> as parameter.<br>
+ * 4. <b>corbaname:rir:#</b><i>name</i> states that the given <i>name</i>
+ * must be resolved using the naming service, default for this ORB.<br>
+ * 5. <b>corbaname:</b>[<b>iiop</b>][version.subversion<b>@</b>]<b>:</b>host[<b>:</b>port]<b>#</b><i>name</i>
+ * states that the <i>name</i> must be resolved using the naming service
+ * that runs on the given host at the given port. The ORB expects to find
+ * there the {@link org.omg.CosNaming.NamingContext} under the key
+ * "NameService.<br>
+ *
+ * <p>The default port is always 2809. The default iiop version is 1.0
+ * that now may not always be supported, so we would recommend to specify
+ * the version explicitly.</p>
+ * <p>
+ * The examples of the corbaloc and corbaname addresses:<br>
+ * corbaname:rir:#xobj - ask local naming service for "xobj".<br>
+ * corbaname:rir:/NameService#xobj - same (long form).<br>
+ * corbaname:iiop:1.2@localhost:900#xobj - same, assuming that the naming
+ * service runs at port 900 on the local host and supports iiop 1.2.<br>
+ * corbaname:iiop:localhost#xobj - same, assuming that the naming
+ * service runs at port 2809 on the local host and supports iiop 1.0.<br>
+ * corbaloc::gnu.xxx.yy/Prod/TradingService - the object exists on the
+ * host gnu.xxx.yy, port 2809 having the key "Prod/TradingService". Its ORB
+ * supports iiop 1.0.<br>
+ * corbaloc::gnu.xxx.yy/Prod/TradingService:801 - the object exists on the
+ * host gnu.xxx.yy, port 801 having the key "Prod/TradingService". Its ORB
+ * supports iiop 1.0 (iiop keyword ommitted).<br>
+ * corbaloc:iiop:1.1@gnu.xxx.yy/Prod/TradingService - the object exists on the
+ * host gnu.xxx.yy, port 801 having the key "Prod/TradingService". Its ORB
+ * supports iiop 1.1.<br>
+ * corbaloc:rir:/NameService - the default naming service.
*
* @param IOR the object IOR representation string.
*
* @return the found CORBA object.
+ *
+ * @throws BAD_PARAM if the string being parsed is invalid.
+ * @throws DATA_CONVERSION if the string being parsed contains unsupported
+ * prefix or protocol.
+ *
* @see object_to_string(org.omg.CORBA.Object)
*/
public abstract Object string_to_object(String IOR);
@@ -1098,4 +1197,4 @@ public abstract class ORB
why
);
}
-}
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA/ObjectHelper.java b/libjava/classpath/org/omg/CORBA/ObjectHelper.java
index 0e0efa5..1324c62 100644
--- a/libjava/classpath/org/omg/CORBA/ObjectHelper.java
+++ b/libjava/classpath/org/omg/CORBA/ObjectHelper.java
@@ -50,10 +50,7 @@ import org.omg.CORBA.portable.OutputStream;
*/
public abstract class ObjectHelper
{
- /**
- * The cached binding list type code.
- */
- private static TypeCode typeCode = new primitiveTypeCode(TCKind.tk_objref);
+ static TypeCode typeCode;
/**
* Extract the array of object from the given {@link Any}.
@@ -100,6 +97,8 @@ public abstract class ObjectHelper
*/
public static TypeCode type()
{
+ if (typeCode == null)
+ typeCode = ORB.init().get_primitive_tc(TCKind.tk_objref);
return typeCode;
}
diff --git a/libjava/classpath/org/omg/CORBA/ObjectHolder.java b/libjava/classpath/org/omg/CORBA/ObjectHolder.java
index 02526be..27ae674 100644
--- a/libjava/classpath/org/omg/CORBA/ObjectHolder.java
+++ b/libjava/classpath/org/omg/CORBA/ObjectHolder.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.CORBA;
import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.recordTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -59,10 +60,16 @@ public final class ObjectHolder
implements Streamable
{
/**
- * The default type code for this holder.
+ * The default type code for this holder if the object type code with
+ * the zero length string as id.
*/
- private static final TypeCode t_object =
- new primitiveTypeCode(TCKind.tk_objref);
+ private static final recordTypeCode t_object;
+
+ static
+ {
+ t_object = new recordTypeCode(TCKind.tk_objref);
+ t_object.setId("");
+ }
/**
* The <code>org.omg.CORBA.Object</code> (CORBA <code>Object</code>) value,
@@ -109,7 +116,7 @@ public final class ObjectHolder
*/
public TypeCode _type()
{
- return t_object;
+ return ObjectHelper.type();
}
/**
@@ -124,4 +131,4 @@ public final class ObjectHolder
{
output.write_Object(value);
}
-}
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA/ServiceDetailHelper.java b/libjava/classpath/org/omg/CORBA/ServiceDetailHelper.java
index 37b4f83..fe0135d 100644
--- a/libjava/classpath/org/omg/CORBA/ServiceDetailHelper.java
+++ b/libjava/classpath/org/omg/CORBA/ServiceDetailHelper.java
@@ -38,9 +38,10 @@ exception statement from your version. */
package org.omg.CORBA;
+import gnu.CORBA.ServiceDetailHolder;
+
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
-import gnu.CORBA.*;
/**
* The helper operations on the Service Detail.
@@ -140,8 +141,8 @@ public abstract class ServiceDetailHelper
TypeCode type =
orb.create_alias_tc(_id, "ServiceDetailType",
- orb.get_primitive_tc(TCKind.tk_ulong)
- );
+ orb.get_primitive_tc(TCKind.tk_ulong)
+ );
members [ 0 ] = new StructMember("service_detail_type", type, null);
TypeCode data =
@@ -166,7 +167,7 @@ public abstract class ServiceDetailHelper
ostream.write_ulong(value.service_detail_type);
ostream.write_long(value.service_detail.length);
ostream.write_octet_array(value.service_detail, 0,
- value.service_detail.length
- );
+ value.service_detail.length
+ );
}
-}
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA/TypeCode.java b/libjava/classpath/org/omg/CORBA/TypeCode.java
index 38fb056..a1ad3db 100644
--- a/libjava/classpath/org/omg/CORBA/TypeCode.java
+++ b/libjava/classpath/org/omg/CORBA/TypeCode.java
@@ -38,11 +38,11 @@ exception statement from your version. */
package org.omg.CORBA;
-import java.io.Serializable;
-
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.IDLEntity;
+import java.io.Serializable;
+
/**
* An information about a CORBA data type.
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
@@ -57,10 +57,12 @@ public abstract class TypeCode
private static final long serialVersionUID = -6521025782489515676L;
/**
- * Returns the concrete base type for this TypeCode.
- * @return a TypeCode, defining the concrete base type for this
- * Typecode.
- * @throws org.omg.CORBA.TypeCodePackage.BadKind
+ * For value types that support inheritance this method returns the
+ * of the ancestor type code.
+ *
+ * @return the ancestor TypeCode.
+ *
+ * @throws BadKind for all typecodes except the value type typecodes.
*/
public abstract TypeCode concrete_base_type()
throws BadKind;
@@ -69,7 +71,7 @@ public abstract class TypeCode
* For sequences, arrays, aliases and value boxes, returns the IDL type for
* the members of the object.
* @return a TypeCode of the memebers of this type.
- * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than
+ * @throws BadKind for types other than
* sequences, arrays, aliases and value boxes.
*/
public abstract TypeCode content_type()
@@ -79,7 +81,7 @@ public abstract class TypeCode
* For unions, returs the index of the default member.
* @return the index of the default member, -1 if there is
* no default member.
- * @throws org.omg.CORBA.TypeCodePackage.BadKind if this type is not
+ * @throws BadKind if this type is not
* a union.
*/
public abstract int default_index()
@@ -88,15 +90,15 @@ public abstract class TypeCode
/**
* Returs definition of member labels for untions
* @return a TypeCode, describing all non-default member labels.
- * @throws org.omg.CORBA.TypeCodePackage.BadKind if this type is not a
+ * @throws BadKind if this type is not a
* union.
*/
public abstract TypeCode discriminator_type()
throws BadKind;
/**
- * Test two types for equality. The default implementation
- * returs true of the types of the same kind.
+ * Test two types for equality.
+ *
* @param other the other type to compere with
* @return true if the types are interchangeable.
*/
@@ -112,7 +114,7 @@ public abstract class TypeCode
/**
* For the fixed type, returns the number of digits.
* @return the number of digits for the fixed type
- * @throws org.omg.CORBA.TypeCodePackage.BadKind if this is not a fixed
+ * @throws BadKind if this is not a fixed
* type.
*/
public abstract short fixed_digits()
@@ -123,7 +125,7 @@ public abstract class TypeCode
* positive (the number of digits to the right of the decimal point) or
* negative (adds zeros to the left of the decimal point).
* @return the scale.
- * @throws org.omg.CORBA.TypeCodePackage.BadKind if this is not a fixed
+ * @throws BadKind if this is not a fixed
* type.
*/
public abstract short fixed_scale()
@@ -140,7 +142,7 @@ public abstract class TypeCode
* Returns the RepositoryId globally identifying the type, defined by
* this TypeCode.
* @return tje RepositoryId. In some cases, it may be an empty string.
- * @throws org.omg.CORBA.TypeCodePackage.BadKind if the type is other than
+ * @throws BadKind if the type is other than
* reference, structure, union, enumeration, alias, exception, valuetype,
* boxed valuetype and also native and abstract interfaces.
*/
@@ -161,7 +163,7 @@ public abstract class TypeCode
*
* @return length or bound
*
- * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than
+ * @throws BadKind for types other than
* string, sequence and array.
*/
public abstract int length()
@@ -171,7 +173,7 @@ public abstract class TypeCode
* Returns the number of type memebers.
*
* @return the number of memebers
- * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than
+ * @throws BadKind for types other than
* structure, union, enumeration or exception.
*/
public abstract int member_count()
@@ -185,14 +187,14 @@ public abstract class TypeCode
*
* @return the label
*
- * @throws org.omg.CORBA.TypeCodePackage.BadKind if this is not a union
+ * @throws BadKind if this is not a union
* type.
* @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of
* valid bounds.
*/
public abstract Any member_label(int index)
- throws BadKind,
- org.omg.CORBA.TypeCodePackage.Bounds;
+ throws BadKind,
+ org.omg.CORBA.TypeCodePackage.Bounds;
/**
* Retrieves the simple name of the member identified by the given index.
@@ -201,14 +203,14 @@ public abstract class TypeCode
*
* @return the member name that in some cases can be an empty string.
*
- * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than
+ * @throws BadKind for types other than
* structure, union or enumeration.
* @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of
* valid bounds.
*/
public abstract String member_name(int index)
- throws BadKind,
- org.omg.CORBA.TypeCodePackage.Bounds;
+ throws BadKind,
+ org.omg.CORBA.TypeCodePackage.Bounds;
/**
* Retrieves the member type of the member identified by the given index.
@@ -217,14 +219,14 @@ public abstract class TypeCode
*
* @return the member type.
*
- * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than
+ * @throws BadKind for types other than
* structure, union, enumeration or exception.
* @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of
* valid bounds.
*/
public abstract TypeCode member_type(int index)
- throws BadKind,
- org.omg.CORBA.TypeCodePackage.Bounds;
+ throws BadKind,
+ org.omg.CORBA.TypeCodePackage.Bounds;
/**
* Returns the visibility scope of the member at the given index.
@@ -234,22 +236,21 @@ public abstract class TypeCode
*
* @return either PRIVATE_MEMBER.value or PUBLIC_MEMBER.value
*
- * @throws org.omg.CORBA.TypeCodePackage.BadKind if this is not a non boxed
+ * @throws BadKind if this is not a non boxed
* value type.
*
* @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of
* valid bounds.
*/
public abstract short member_visibility(int index)
- throws BadKind,
- org.omg.CORBA.TypeCodePackage.Bounds;
-
+ throws BadKind,
+ org.omg.CORBA.TypeCodePackage.Bounds;
/**
* Retrieves the simple name identifying this TypeCode object
* within its enclosing scope.
* @return the name, can be an empty string.
- * @throws org.omg.CORBA.TypeCodePackage.BadKind for typer other than
+ * @throws BadKind for typer other than
* reference, structure, union, enumeration, alias, exception,
* valuetype, boxed valuetype, native, and abstract interface
*/
@@ -263,9 +264,8 @@ public abstract class TypeCode
* VM_NONE.value, VM_ABSTRACT.value, VM_CUSTOM.value, or
* VM_TRUNCATABLE.value,
*
- * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than
- * value type.
+ * @throws BadKind for all types other than value type.
*/
public abstract short type_modifier()
throws BadKind;
-}
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA/package.html b/libjava/classpath/org/omg/CORBA/package.html
index 8fe9acf..3815b19 100644
--- a/libjava/classpath/org/omg/CORBA/package.html
+++ b/libjava/classpath/org/omg/CORBA/package.html
@@ -40,41 +40,81 @@ exception statement from your version. -->
<head><title>GNU Classpath - org.omg.CORBA</title></head>
<body>
-This package provides the support of <a href="www.omg.org">OMG</a>
-<a href="www.CORBA.org">CORBA</a>; see <a href="#overview">overview</a>
-of the implemented functionality. CORBA is an open, vendor independent
-system that applications use to work together over networks. Thie purpose
-of this package is to provide CORBA APIs to java programming language,
-including the fully functional Object Request Broker ({@link org.omg.CORBA.ORB}).
-
+This package provides the support of <a href="http://www.CORBA.org">CORBA</a>;
+see <a href="#overview">overview</a> of the implemented functionality.
+<p>
+CORBA a system that applications use to work over networks. CORBA messages
+are binary, not text oriented. They practically cary no "data wrapping"
+information like XML &lt;opening&gt; &lt;/closing&gt; tags. Hence CORBA
+objects easier exchange large amounts of binary data. CORBA can work
+in such data-intensive application areas as telecommunications or radio
+broadcasting. Java programs connect to CORBA objects without care
+about what platform they run on, where they exist in the network, or what
+language they were written in. The remote CORBA objects appear to the
+programmer as the ordinary Java objects and can be passed as
+parameters in both remote or local method invocations.
+</p><p>
+The CORBA processing unit is divided into {@link org.omg.CORBA.Object}
+that is exposed to the client and the servant
+({@link org.omg.PortableServer.Servant} where the method, invoked on
+object, is finally delegated. It can be multiple objects per servant or
+multiple servants per object. The servant for particular object or
+even particular call can be dynamically chosen at run time using
+{@link org.omg.PortableServer.ServantManager}.
+</p><p>
+All stages of both local and remote invocations on CORBA objects can be
+monitored and modified using {@link org.omg.PortableInterceptor.Interceptor}.
+The interceptors can add an extra data to the CORBA message (these data
+can be later accessed by other interceptor on remote side).
+</p>
<a name="overview">
<h4>Overview of the currently implemented CORBA functionality</h4>
-<p>The CORBA implementation in the Classpath project is now a working prototype.
- This prototype is interoperable with Sun's implementation v 1.4, transferring
- object references, primitive types, narrow and wide strings, arrays, structures
- and trees between these two platforms. The thrown exceptions are also transferred
- and handled. The support for stringified object references (IORs) is implemented.
- The redirection commands works, LOCATION_FORWARD_PERM changing the target address
- until the application is restarted and LOCATION_FORWARD redirecting for the
- current session only. Both Little and Big Endian encoded messages
- are accepted. The encoding of the sent messages is the same as used in the
- stringified IOR reference of that object or Big Endian, if no such data
- available.
- </p>
- <p>
- The current release supports the Value types that appeared since v 1.3 and are
- something between CORBA structures (no methods, data local) and CORBA objects
- (both methods and data remote). Value type has local data, can have
- local methods and is transferred by value, not by IOR reference.
- </p>
- <p>
- You can use both request-oriented (based on {@link org.omg.CORBA.Request})
- and stream-oriented (based on {@link org.omg.CORBA.portable.ObjectImpl})
- invocation models. The current release includes the working examples, demonstrating
- the client-server communication using both methods. These examples also show,
- how to use the Classpath naming service. The IDL compiler is not yet written,
- but as a side effect of the required compatibility, the implementation seems
- accepting the output of the Sun's 1.3 idlj.</p>
+The CORBA implementation in the Classpath project is now a working
+prototype.
+<ul>
+<li>This prototype is interoperable with Sun's implementation v 1.4,
+transferring object references, primitive types, narrow and wide strings,
+arrays, structures and trees between these two platforms.
+</li>
+<li>The prototype provides interoperable support for the Abstract interface
+ and Value types. Those appear in 1.3, being a feature of CORBA 2.3.
+</li>
+<li>The remote exceptions are also transferred and handled as expected.
+</li>
+<li>The support for parsing stringified object references (IORs), both
+Big and Little Endian encoded, is implemented.
+</li>
+<li>The redirection commands works, LOCATION_FORWARD_PERM changing the
+target address until the application is restarted and LOCATION_FORWARD
+redirecting for the current session only.
+</li>
+<li>Both Little and Big Endian encoded messages are accepted. The encoding
+of the sent messages is the same as used in the stringified IOR reference
+of that object or Big Endian, if no such data available.
+</li>
+<li>You can use both request-oriented (based on {@link org.omg.CORBA.Request}
+and stream-oriented (based on {@link org.omg.CORBA.portable.ObjectImpl}
+invocation models. The current release includes the working examples,
+demonstrating the client-server communication using both methods.
+</li>
+<li>These examples also show, how to use the Classpath naming service.
+</li>
+<li>The IDL compiler is not yet written (and not even started), but as a
+ side effect of the required compatibility, the implementation seems
+accepting the output of the Sun's idlj.
+</li>
+<li>The Portable Object Adapter is already released. For details on POA,
+see the {@link org.omg.PortableServer} package.</li>
+<li>We provide the implementation of the {@link org.omg.DynamicAny}
+package. ORB returns the working DynAnyFactory that produces working
+DynAny's as defined in OMG specification.</li>
+<li>The Portable Interceptor is also complete. See
+{@link org.omg.PortableInterceptor} package for details how to register
+and use CORBA interceptors.
+<li>All GNU Classpath classes in omg.org namespace are newly written using
+ the OMG .pdf document (Version 3.0.3, formal/04-03-12).
+</li>
+</ul>
@author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
</body>
diff --git a/libjava/classpath/org/omg/CORBA/portable/ObjectImpl.java b/libjava/classpath/org/omg/CORBA/portable/ObjectImpl.java
index c3f30cf..3cf1f49 100644
--- a/libjava/classpath/org/omg/CORBA/portable/ObjectImpl.java
+++ b/libjava/classpath/org/omg/CORBA/portable/ObjectImpl.java
@@ -185,7 +185,6 @@ public abstract class ObjectImpl
/**
* Invoke the operation.
*
- * @param target the invocation target.
* @param output the stream, containing the written arguments.
*
* @return the stream, from where the input parameters could be read.
@@ -286,7 +285,8 @@ public abstract class ObjectImpl
*/
public void _releaseReply(InputStream stream)
{
- delegate.releaseReply(this, stream);
+ if (delegate != null)
+ delegate.releaseReply(this, stream);
}
/**
@@ -387,7 +387,10 @@ public abstract class ObjectImpl
*/
public boolean equals(java.lang.Object other)
{
- return delegate.equals(this, other);
+ if (delegate == null)
+ return this == other;
+ else
+ return delegate.equals(this, other);
}
/**
@@ -399,4 +402,4 @@ public abstract class ObjectImpl
{
return delegate.toString(this);
}
-}
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA_2_3/portable/InputStream.java b/libjava/classpath/org/omg/CORBA_2_3/portable/InputStream.java
index 3ab264f..06ee33e 100644
--- a/libjava/classpath/org/omg/CORBA_2_3/portable/InputStream.java
+++ b/libjava/classpath/org/omg/CORBA_2_3/portable/InputStream.java
@@ -40,7 +40,9 @@ package org.omg.CORBA_2_3.portable;
import gnu.CORBA.CDR.Vio;
+import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.portable.BoxedValueHelper;
+import org.omg.CORBA.portable.ValueFactory;
import java.io.Serializable;
@@ -170,7 +172,7 @@ public abstract class InputStream
*/
public Serializable read_value(Serializable unitialised_value)
{
- return Vio.read(this, unitialised_value);
+ return (Serializable) Vio.read(this, unitialised_value, null);
}
/**
@@ -190,8 +192,11 @@ public abstract class InputStream
*/
public Serializable read_value(String repository_id)
{
- return ((org.omg.CORBA_2_3.ORB) orb()).lookup_value_factory(repository_id)
- .read_value(this);
+ ValueFactory factory =
+ ((org.omg.CORBA_2_3.ORB) orb()).lookup_value_factory(repository_id);
+ if (factory == null)
+ throw new MARSHAL("No factory");
+ return (Serializable) Vio.read(this, null, factory);
}
/**
@@ -203,6 +208,6 @@ public abstract class InputStream
*/
public Serializable read_value(BoxedValueHelper helper)
{
- return helper.read_value(this);
+ return Vio.read(this, helper);
}
} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA_2_3/portable/OutputStream.java b/libjava/classpath/org/omg/CORBA_2_3/portable/OutputStream.java
index 2f83a93..2ff8c22 100644
--- a/libjava/classpath/org/omg/CORBA_2_3/portable/OutputStream.java
+++ b/libjava/classpath/org/omg/CORBA_2_3/portable/OutputStream.java
@@ -117,7 +117,7 @@ public abstract class OutputStream
*/
public void write_value(Serializable value, BoxedValueHelper helper)
{
- helper.write_value(this, value);
+ Vio.write(this, value, helper);
}
/**
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextOperations.java b/libjava/classpath/org/omg/CosNaming/NamingContextOperations.java
index 40ac419..dc25daa 100644
--- a/libjava/classpath/org/omg/CosNaming/NamingContextOperations.java
+++ b/libjava/classpath/org/omg/CosNaming/NamingContextOperations.java
@@ -55,7 +55,7 @@ import org.omg.CosNaming.NamingContextPackage.NotFound;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public interface NamingContextOperations
- extends org.omg.CORBA.Object, IDLEntity
+ extends IDLEntity
{
/**
* Gives the object a name, valid in this context.
diff --git a/libjava/classpath/org/omg/CosNaming/_NamingContextExtImplBase.java b/libjava/classpath/org/omg/CosNaming/_NamingContextExtImplBase.java
index ae818dd..03630f8 100644
--- a/libjava/classpath/org/omg/CosNaming/_NamingContextExtImplBase.java
+++ b/libjava/classpath/org/omg/CosNaming/_NamingContextExtImplBase.java
@@ -66,7 +66,7 @@ public abstract class _NamingContextExtImplBase
extends _NamingContextImplBase
implements NamingContextExt, InvokeHandler
{
- private static Hashtable _methods = new Hashtable();
+ static Hashtable _methods = new Hashtable();
static
{
diff --git a/libjava/classpath/org/omg/CosNaming/_NamingContextImplBase.java b/libjava/classpath/org/omg/CosNaming/_NamingContextImplBase.java
index 16b17fc..7c1fb3a 100644
--- a/libjava/classpath/org/omg/CosNaming/_NamingContextImplBase.java
+++ b/libjava/classpath/org/omg/CosNaming/_NamingContextImplBase.java
@@ -78,8 +78,9 @@ public abstract class _NamingContextImplBase
/**
* As there are quite many methods, it may be sensible to use the hashtable.
+ * This field is also reused in NamingContextPOA.
*/
- private static Hashtable methods = new Hashtable();
+ static Hashtable methods = new Hashtable();
/**
* Put all methods into the table.
diff --git a/libjava/classpath/org/omg/IOP/ServiceContext.java b/libjava/classpath/org/omg/IOP/ServiceContext.java
index 0dcd778..e011a4e 100644
--- a/libjava/classpath/org/omg/IOP/ServiceContext.java
+++ b/libjava/classpath/org/omg/IOP/ServiceContext.java
@@ -55,7 +55,7 @@ import java.io.Serializable;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class ServiceContext
+public final class ServiceContext
implements IDLEntity, Serializable
{
/**
diff --git a/libjava/classpath/org/omg/IOP/TaggedComponentHelper.java b/libjava/classpath/org/omg/IOP/TaggedComponentHelper.java
index f432165..906d639 100644
--- a/libjava/classpath/org/omg/IOP/TaggedComponentHelper.java
+++ b/libjava/classpath/org/omg/IOP/TaggedComponentHelper.java
@@ -40,6 +40,7 @@ package org.omg.IOP;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.ORB;
import org.omg.CORBA.StructMember;
import org.omg.CORBA.TCKind;
@@ -47,11 +48,13 @@ import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
+import java.io.IOException;
+
/**
-* A helper operations for the {@link TaggedComponent}.
-*
-* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
-*/
+ * A helper operations for the {@link TaggedComponent}.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
public abstract class TaggedComponentHelper
{
/**
@@ -60,49 +63,46 @@ public abstract class TaggedComponentHelper
private static TypeCode typeCode;
/**
- * Create the TaggedComponent typecode (structure,
- * named "TaggedComponent").
- * The typecode states that the structure contains the
- * following fields: tag, component_data.
+ * Create the TaggedComponent typecode (structure, named "TaggedComponent").
+ * The typecode states that the structure contains the following fields: tag,
+ * component_data.
*/
public static TypeCode type()
{
if (typeCode == null)
{
ORB orb = ORB.init();
- StructMember[] members = new StructMember[ 2 ];
+ StructMember[] members = new StructMember[2];
TypeCode field;
- field =
- orb.create_alias_tc("IDL:omg.org/IOP/ComponentId:1.0", "ComponentId",
- orb.get_primitive_tc(TCKind.tk_ulong)
- );
- members [ 0 ] = new StructMember("tag", field, null);
+ field = orb.create_alias_tc("IDL:omg.org/IOP/ComponentId:1.0",
+ "ComponentId",
+ orb.get_primitive_tc(TCKind.tk_ulong));
+ members[0] = new StructMember("tag", field, null);
- field =
- orb.create_sequence_tc(0, orb.get_primitive_tc(TCKind.tk_octet));
- members [ 1 ] = new StructMember("component_data", field, null);
+ field = orb.create_sequence_tc(0, orb.get_primitive_tc(TCKind.tk_octet));
+ members[1] = new StructMember("component_data", field, null);
typeCode = orb.create_struct_tc(id(), "TaggedComponent", members);
}
return typeCode;
}
/**
- * Insert the TaggedComponent into the given Any.
- * This method uses the TaggedComponentHolder.
- *
- * @param any the Any to insert into.
- * @param that the TaggedComponent to insert.
- */
+ * Insert the TaggedComponent into the given Any. This method uses the
+ * TaggedComponentHolder.
+ *
+ * @param any the Any to insert into.
+ * @param that the TaggedComponent to insert.
+ */
public static void insert(Any any, TaggedComponent that)
{
any.insert_Streamable(new TaggedComponentHolder(that));
}
/**
- * Extract the TaggedComponent from given Any.
- * This method uses the TaggedComponentHolder.
+ * Extract the TaggedComponent from given Any. This method uses the
+ * TaggedComponentHolder.
*
* @throws BAD_OPERATION if the passed Any does not contain TaggedComponent.
*/
@@ -132,9 +132,8 @@ public abstract class TaggedComponentHelper
/**
* Read the structure from the CDR intput stream. Expects the integer
- * identifier of the tag, then the size of the tag data
- * and then the specified number of bytes, representing the data
- * of the tag.
+ * identifier of the tag, then the size of the tag data and then the specified
+ * number of bytes, representing the data of the tag.
*
* @param input a org.omg.CORBA.portable stream to read from.
*/
@@ -142,17 +141,24 @@ public abstract class TaggedComponentHelper
{
TaggedComponent value = new TaggedComponent();
value.tag = input.read_long();
- value.component_data = new byte[ input.read_long() ];
- for (int i0 = 0; i0 < value.component_data.length; i0++)
- value.component_data [ i0 ] = input.read_octet();
+ value.component_data = new byte[input.read_long()];
+ try
+ {
+ input.read(value.component_data);
+ }
+ catch (IOException e)
+ {
+ MARSHAL m = new MARSHAL();
+ m.initCause(e);
+ throw m;
+ }
return value;
}
/**
- * Write the structure to the CDR output stream.
- * Writes the integer identifier of the tag, then the size of the tag data
- * and then the specified number of bytes, representing the data
- * of the tag.
+ * Write the structure to the CDR output stream. Writes the integer identifier
+ * of the tag, then the size of the tag data and then the specified number of
+ * bytes, representing the data of the tag.
*
* @param output a org.omg.CORBA.portable stream stream to write into.
* @param value a value to write.
@@ -161,7 +167,16 @@ public abstract class TaggedComponentHelper
{
output.write_long(value.tag);
output.write_long(value.component_data.length);
- for (int i0 = 0; i0 < value.component_data.length; i0++)
- output.write_octet(value.component_data [ i0 ]);
+
+ try
+ {
+ output.write(value.component_data);
+ }
+ catch (IOException e)
+ {
+ MARSHAL m = new MARSHAL();
+ m.initCause(e);
+ throw m;
+ }
}
} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/IOP/TaggedProfileHelper.java b/libjava/classpath/org/omg/IOP/TaggedProfileHelper.java
index 0433e10..a23122e 100644
--- a/libjava/classpath/org/omg/IOP/TaggedProfileHelper.java
+++ b/libjava/classpath/org/omg/IOP/TaggedProfileHelper.java
@@ -38,8 +38,12 @@ exception statement from your version. */
package org.omg.IOP;
+import gnu.CORBA.CDR.cdrBufInput;
+import gnu.CORBA.CDR.cdrBufOutput;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.ORB;
import org.omg.CORBA.StructMember;
import org.omg.CORBA.TCKind;
@@ -47,11 +51,13 @@ import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
+import java.io.IOException;
+
/**
-* A helper operations for the structure {@link TaggedProfile}.
-*
-* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
-*/
+ * A helper operations for the structure {@link TaggedProfile}.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
public abstract class TaggedProfileHelper
{
/**
@@ -60,49 +66,46 @@ public abstract class TaggedProfileHelper
private static TypeCode typeCode;
/**
- * Create the TaggedProfile typecode (structure,
- * named "TaggedProfile").
- * The typecode states that the structure contains the
- * following fields: tag, profile_data.
+ * Create the TaggedProfile typecode (structure, named "TaggedProfile"). The
+ * typecode states that the structure contains the following fields: tag,
+ * profile_data.
*/
public static TypeCode type()
{
if (typeCode == null)
{
ORB orb = ORB.init();
- StructMember[] members = new StructMember[ 2 ];
+ StructMember[] members = new StructMember[2];
TypeCode field;
- field =
- orb.create_alias_tc("IDL:omg.org/IOP/ProfileId:1.0", "ProfileId",
- orb.get_primitive_tc(TCKind.tk_ulong)
- );
- members [ 0 ] = new StructMember("tag", field, null);
+ field = orb.create_alias_tc("IDL:omg.org/IOP/ProfileId:1.0",
+ "ProfileId",
+ orb.get_primitive_tc(TCKind.tk_ulong));
+ members[0] = new StructMember("tag", field, null);
- field =
- orb.create_sequence_tc(0, orb.get_primitive_tc(TCKind.tk_octet));
- members [ 1 ] = new StructMember("profile_data", field, null);
+ field = orb.create_sequence_tc(0, orb.get_primitive_tc(TCKind.tk_octet));
+ members[1] = new StructMember("profile_data", field, null);
typeCode = orb.create_struct_tc(id(), "TaggedProfile", members);
}
return typeCode;
}
/**
- * Insert the TaggedProfile into the given Any.
- * This method uses the TaggedProfileHolder.
- *
- * @param any the Any to insert into.
- * @param that the TaggedProfile to insert.
- */
+ * Insert the TaggedProfile into the given Any. This method uses the
+ * TaggedProfileHolder.
+ *
+ * @param any the Any to insert into.
+ * @param that the TaggedProfile to insert.
+ */
public static void insert(Any any, TaggedProfile that)
{
any.insert_Streamable(new TaggedProfileHolder(that));
}
/**
- * Extract the TaggedProfile from given Any.
- * This method uses the TaggedProfileHolder.
+ * Extract the TaggedProfile from given Any. This method uses the
+ * TaggedProfileHolder.
*
* @throws BAD_OPERATION if the passed Any does not contain TaggedProfile.
*/
@@ -139,9 +142,18 @@ public abstract class TaggedProfileHelper
{
TaggedProfile value = new TaggedProfile();
value.tag = input.read_long();
- value.profile_data = new byte[ input.read_long() ];
- for (int i0 = 0; i0 < value.profile_data.length; i0++)
- value.profile_data [ i0 ] = input.read_octet();
+
+ if (input instanceof cdrBufInput)
+ {
+ // Highly probable.
+ value.profile_data = ((cdrBufInput) input).read_sequence();
+ }
+ else
+ {
+ value.profile_data = new byte[input.read_long()];
+ for (int i0 = 0; i0 < value.profile_data.length; i0++)
+ value.profile_data[i0] = input.read_octet();
+ }
return value;
}
@@ -154,8 +166,27 @@ public abstract class TaggedProfileHelper
public static void write(OutputStream output, TaggedProfile value)
{
output.write_long(value.tag);
- output.write_long(value.profile_data.length);
- for (int i0 = 0; i0 < value.profile_data.length; i0++)
- output.write_octet(value.profile_data [ i0 ]);
+
+ if (output instanceof cdrBufOutput)
+ {
+ // Highly probable.
+ output.write_long(value.profile_data.length);
+ try
+ {
+ output.write(value.profile_data);
+ }
+ catch (IOException e)
+ {
+ MARSHAL m = new MARSHAL();
+ m.initCause(e);
+ throw m;
+ }
+ }
+ else
+ {
+ output.write_long(value.profile_data.length);
+ for (int i0 = 0; i0 < value.profile_data.length; i0++)
+ output.write_octet(value.profile_data[i0]);
+ }
}
} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/LOCATION_FORWARD.java b/libjava/classpath/org/omg/PortableInterceptor/LOCATION_FORWARD.java
index 2a84125..bbd23f0 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/LOCATION_FORWARD.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/LOCATION_FORWARD.java
@@ -38,7 +38,8 @@ exception statement from your version. */
package org.omg.PortableInterceptor;
- /**
+
+/**
* A reply status flag, indicating, that the object has
* moved (temporary or permanently) to another location.
*
@@ -50,4 +51,4 @@ public interface LOCATION_FORWARD
* Specifies the LOCATION_FORWARD value, 3.
*/
short value = 3;
-}
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateName.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateName.java
index 365aaf4..1872737 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateName.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateName.java
@@ -42,30 +42,28 @@ import org.omg.CORBA.UserException;
import org.omg.CORBA.portable.IDLEntity;
import java.io.Serializable;
-import gnu.CORBA.*;
/**
-* This exception is raised on an attempt to register a second
-* {@link org.omg.PortableInterceptor#Interceptor} with the same name.
-* For each {@link org.omg.PortableInterceptor#Interceptor} type, only
-* one {@link org.omg.PortableInterceptor#Interceptor} of a given name can
-* be registered with the {@link org.omg.CORBA.ORB}.
-*
-* @see org.omg.PortableInterceptor.ORBInitInfoOperations
-*
-* @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org)
-*/
-public class DuplicateName
- extends UserException
- implements IDLEntity, Serializable
+ * This exception is raised on an attempt to register a second
+ * {@link org.omg.PortableInterceptor#Interceptor} with the same name.
+ * For each {@link org.omg.PortableInterceptor#Interceptor} type, only
+ * one {@link org.omg.PortableInterceptor#Interceptor} of a given name can
+ * be registered with the {@link org.omg.CORBA.ORB}.
+ *
+ * @see org.omg.PortableInterceptor.ORBInitInfoOperations
+ *
+ * @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org)
+ */
+public class DuplicateName extends UserException implements IDLEntity,
+ Serializable
{
- /**
- * Use serialVersionUID (v1.4) for interoperability.
- */
- private static final long serialVersionUID = 7748239257677851130L;
+ /**
+ * Use serialVersionUID (v1.4) for interoperability.
+ */
+ private static final long serialVersionUID = 7748239257677851130L;
/**
- * The name field.
+ * The name that appears to be duplicate.
*/
public String name;
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java
index 6c93cff..a5c83fa 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableInterceptor.ORBInitInfoPackage;
+import gnu.CORBA.*;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -46,13 +48,12 @@ import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
-import gnu.CORBA.*;
/**
-* The helper operations for the exception {@link DuplicateName}.
-*
-* @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org)
-*/
+ * The helper operations for the exception {@link DuplicateName}.
+ *
+ * @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org)
+ */
public abstract class DuplicateNameHelper
{
/**
@@ -83,12 +84,12 @@ public abstract class DuplicateNameHelper
}
/**
- * Insert the DuplicateName into the given Any.
- * This method uses the DuplicateNameHolder.
- *
- * @param any the Any to insert into.
- * @param that the DuplicateName to insert.
- */
+ * Insert the DuplicateName into the given Any.
+ * This method uses the DuplicateNameHolder.
+ *
+ * @param any the Any to insert into.
+ * @param that the DuplicateName to insert.
+ */
public static void insert(Any any, DuplicateName that)
{
any.insert_Streamable(new DuplicateNameHolder(that));
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidName.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidName.java
index ecdde8b..17c6c6b 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidName.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidName.java
@@ -44,17 +44,16 @@ import org.omg.CORBA.portable.IDLEntity;
import java.io.Serializable;
/**
-* This exception is raised by methods in
-* {@link org.omg.PortableInterceptor.ORBInitInfoOperations} on the attempt to
-* register or resolve an invalid name like empty string. The already
-* registered names (including the default names, defined by OMG) are also
-* invalid for registration.
-*
-* @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org)
-*/
-public class InvalidName
- extends UserException
- implements IDLEntity, Serializable
+ * This exception is raised by methods in
+ * {@link org.omg.PortableInterceptor.ORBInitInfoOperations} on the attempt to
+ * register or resolve an invalid name like empty string. The already
+ * registered names (including the default names, defined by OMG) are also
+ * invalid for registration.
+ *
+ * @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org)
+ */
+public class InvalidName extends UserException implements IDLEntity,
+ Serializable
{
/**
* Use serialVersionUID (v1.4) for interoperability.
@@ -71,7 +70,7 @@ public class InvalidName
/**
* Create the InvalidName with explaining message.
*
- * @param why a string, explaining, why this exception has been thrown.
+ * @param why a string, explaining, why the name is invalid.
*/
public InvalidName(String why)
{
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHelper.java
index 841d6f9..7f1132f 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHelper.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHelper.java
@@ -50,10 +50,10 @@ import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
/**
-* The helper operations for the exception {@link InvalidName}.
-*
-* @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org)
-*/
+ * The helper operations for the exception {@link InvalidName}.
+ *
+ * @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org)
+ */
public abstract class InvalidNameHelper
{
/**
diff --git a/libjava/classpath/org/omg/PortableInterceptor/SUCCESSFUL.java b/libjava/classpath/org/omg/PortableInterceptor/SUCCESSFUL.java
index 15cc32f..d26e032 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/SUCCESSFUL.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/SUCCESSFUL.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package org.omg.PortableInterceptor;
+
/**
* A reply status flag, indicating, that the remote method
* has been called and returned without exception.
@@ -50,4 +51,4 @@ public interface SUCCESSFUL
* Specifies the SUCCESSFUL value, 0.
*/
short value = 0;
-}
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/SYSTEM_EXCEPTION.java b/libjava/classpath/org/omg/PortableInterceptor/SYSTEM_EXCEPTION.java
index a62ade9..9edf2ba 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/SYSTEM_EXCEPTION.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/SYSTEM_EXCEPTION.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package org.omg.PortableInterceptor;
+
/**
* A reply status flag, indicating, that the
* {@link org.omg.CORBA.SystemException}
@@ -51,4 +52,4 @@ public interface SYSTEM_EXCEPTION
* Specifies the SYSTEM_EXCEPTION value, 1.
*/
short value = 1;
-}
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/TRANSPORT_RETRY.java b/libjava/classpath/org/omg/PortableInterceptor/TRANSPORT_RETRY.java
index adc60da..115cad2 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/TRANSPORT_RETRY.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/TRANSPORT_RETRY.java
@@ -38,7 +38,8 @@ exception statement from your version. */
package org.omg.PortableInterceptor;
- /**
+
+/**
* A reply status, indicating the necessity of the transport retry.
* This may happen, for example, if the GIOP message status flag
* is equal to NEEDS_ADDRESSING_MODE.
@@ -51,4 +52,4 @@ public interface TRANSPORT_RETRY
* Specifies the TRANSPORT_RETRY value, 4.
*/
short value = 4;
-}
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/USER_EXCEPTION.java b/libjava/classpath/org/omg/PortableInterceptor/USER_EXCEPTION.java
index e557938..02c9535 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/USER_EXCEPTION.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/USER_EXCEPTION.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package org.omg.PortableInterceptor;
+
/**
* A reply status flag, indicating, that the
* {@link org.omg.CORBA.UserException}
@@ -51,4 +52,4 @@ public interface USER_EXCEPTION
* Specifies the USER_EXCEPTION value, 2.
*/
short value = 2;
-}
+} \ No newline at end of file
diff --git a/libjava/classpath/resource/Makefile.am b/libjava/classpath/resource/Makefile.am
index 91d8810..aa9ffa1 100644
--- a/libjava/classpath/resource/Makefile.am
+++ b/libjava/classpath/resource/Makefile.am
@@ -1,8 +1,4 @@
## used by automake to generate Makefile.in
-EXTRA_DIST = \
- orp-1.0.8.patch \
- orp-1.0.9.patch
-
security_DATA = java/security/classpath.security
securitydir = $(libdir)/security
diff --git a/libjava/classpath/resource/Makefile.in b/libjava/classpath/resource/Makefile.in
index 8e4b8d6..3541ceb 100644
--- a/libjava/classpath/resource/Makefile.in
+++ b/libjava/classpath/resource/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -92,8 +92,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -155,6 +161,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -166,12 +173,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -193,10 +201,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -236,10 +247,6 @@ target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
-EXTRA_DIST = \
- orp-1.0.8.patch \
- orp-1.0.9.patch
-
security_DATA = java/security/classpath.security
securitydir = $(libdir)/security
all: all-am
diff --git a/libjava/classpath/resource/japhar-0.09.patch.1 b/libjava/classpath/resource/japhar-0.09.patch.1
deleted file mode 100644
index 9b2c180..0000000
--- a/libjava/classpath/resource/japhar-0.09.patch.1
+++ /dev/null
@@ -1,305 +0,0 @@
-diff -uNr japhar-0.09.orig/include/runtime.h japhar-0.09/include/runtime.h
---- japhar-0.09.orig/include/runtime.h Sat Sep 16 00:49:58 2000
-+++ japhar-0.09/include/runtime.h Wed Dec 6 00:09:15 2000
-@@ -425,7 +425,9 @@
- HVM_ExceptionCleanup(HungryEnv *henv, japhar_object* exception);
-
- PR_EXTERN( void )
--HVM_ExceptionPrintBacktrace(HungryEnv *henv, japhar_object* throwable_ref);
-+HVM_ExceptionPrintStackTrace(HungryEnv *henv,
-+ japhar_object* throwable_ref,
-+ japhar_object* stream);
-
- PR_EXTERN( void )
- HVM_ExceptionFillInBacktraceFromStack(HungryEnv *henv,
-diff -uNr japhar-0.09.orig/lib/libnative/java.lang/throwable.c japhar-0.09/lib/libnative/java.lang/throwable.c
---- japhar-0.09.orig/lib/libnative/java.lang/throwable.c Sun Oct 31 19:43:00 1999
-+++ japhar-0.09/lib/libnative/java.lang/throwable.c Wed Dec 6 00:08:50 2000
-@@ -35,7 +35,7 @@
- jobject printwriter_stream)
- {
- HungryEnv *henv = HVM_ThreadGetEnv();
-- HVM_ExceptionPrintBacktrace(henv, throwable);
-+ HVM_ExceptionPrintStackTrace(henv, throwable, printwriter_stream);
- }
-
- JNIEXPORT jobject JNICALL
-diff -uNr japhar-0.09.orig/lib/libruntime/exceptions.c japhar-0.09/lib/libruntime/exceptions.c
---- japhar-0.09.orig/lib/libruntime/exceptions.c Thu Jan 6 20:33:47 2000
-+++ japhar-0.09/lib/libruntime/exceptions.c Wed Dec 6 09:16:37 2000
-@@ -46,7 +46,7 @@
- int i = 0;
- PR_ASSERT(NULL != henv);
- PR_ASSERT(NULL != method);
--
-+
- if (method->line_numbers)
- {
- for (i = 0; i < method->num_line_number_blocks; i++)
-@@ -61,10 +61,12 @@
- }
-
- PR_IMPLEMENT(void)
--HVM_ExceptionPrintBacktrace(HungryEnv *henv, japhar_object* throwable_ref)
-+HVM_ExceptionPrintStackTrace(HungryEnv *henv,
-+ japhar_object* throwable_ref,
-+ japhar_object* stream_ref)
- {
-- ClazzFile *throwable_class;
-- MethodStruct *getMessage;
-+ ClazzFile *throwable_class, *stream_class;
-+ MethodStruct *getMessage, *println = NULL;
- japhar_object* msg = NULL;
- ClazzFile *exception_cf = throwable_ref->clazz;
- char *exceptionname = getClassName(env, exception_cf);
-@@ -72,63 +74,83 @@
- ExceptionInfo *exc_info = HVM_ObjectGetNativeState(throwable_ref);
- BackTraceLevel *level;
- InterpValue msg_value;
-+ char *msg_to_print;
-+ japhar_object *msg_obj;
-
-- throwable_class = HVM_ClassFind(henv, java_lang_Throwable);
--
-- getMessage = HVM_MethodFind(henv, throwable_class,
-- "getMessage",
-- "()Ljava/lang/String;");
--
-- /*
-- * Cache exception and make sure the runtime don't think the call to
-- * getMessage failed
-- */
-- exception_cache = henv->_exception;
-- henv->_exception = NULL;
--
-- msg_value = HVM_MethodCallA(henv, getMessage, throwable_ref, NULL);
-- msg = msg_value.l;
--
-- /* Don't know what to do if the call fails. Die a horrible death? */
-- PR_ASSERT(NULL == henv->_exception);
-- henv->_exception = exception_cache;
--
-- if (msg)
-+ if (stream_ref != NULL)
- {
-- const char *msg_bytes = HVM_StringToCString(henv, msg);
-+ ClazzFile *stream_clazz = HVM_ClassFind(henv, "java/io/PrintWriter");
-+ PRBool pwriter = HVM_ObjectIsInstanceOf(henv, stream_ref, stream_clazz);
-+ if (pwriter)
-+ stream_class = HVM_ClassFind(henv, "java/io/PrintWriter");
-+ else
-+ stream_class = HVM_ClassFind(henv, "java/io/PrintStream");
-
-- fprintf (stderr, "%s (%s)\n", exceptionname, msg_bytes);
-+ if (stream_class == NULL)
-+ {
-+ if (pwriter)
-+ abort_with_message("ExceptionPrintStackTrace could not "
-+ "find java/io/PrintWriter");
-+ else
-+ abort_with_message("ExceptionPrintStackTrace could not "
-+ "find java/io/PrintStream");
-+ }
-+
-+ println = HVM_MethodFind(henv, stream_class, "println",
-+ "(Ljava/lang/String;)V");
-+ if (println == NULL)
-+ abort_with_message("ExceptionPrintStacktrace could not "
-+ "find method println");
- }
-- else
-- fprintf (stderr, "%s\n", exceptionname);
-
- level = exc_info->head;
- while (level)
- {
- int line_number = method_pc_to_line_number(henv, level->method,
- level->pc);
--
-+
-+ PR_ASSERT(NULL != level->method);
- if (level->method->access_flags & ACC_NATIVE)
-- fprintf (stderr, " in %s.%s(%s%snative method)\n",
-- level->classname,
-- level->method->name,
-- level->filename ? level->filename : "",
-- level->filename ? ", " : "");
-+ {
-+ msg_to_print = PR_smprintf(" in %s.%s(%s%snative method)",
-+ level->classname,
-+ level->method->name,
-+ level->filename ? level->filename : "",
-+ level->filename ? ", " : "");
-+ }
- else if (line_number == -1)
-- fprintf (stderr, " in %s.%s(%s%spc = %d)\n",
-- level->classname,
-- level->method->name,
-- level->filename ? level->filename : "",
-- level->filename ? ", " : "",
-- level->pc);
-+ {
-+ msg_to_print = PR_smprintf(" in %s.%s(%s%spc = %d)",
-+ level->classname,
-+ level->method->name,
-+ level->filename ? level->filename : "",
-+ level->filename ? ", " : "",
-+ level->pc);
-+ }
- else
-- fprintf (stderr, " at %s.%s(%s%s%d, pc = %d)\n",
-- level->classname,
-- level->method->name,
-- level->filename ? level->filename : "",
-- level->filename ? ":" : "line ",
-- line_number,
-- level->pc);
-+ {
-+ msg_to_print = PR_smprintf(" at %s.%s(%s%s%d, pc = %d)",
-+ level->classname,
-+ level->method->name,
-+ level->filename ? level->filename : "",
-+ level->filename ? ":" : "line ",
-+ line_number,
-+ level->pc);
-+ }
-+
-+ msg_obj = HVM_StringFromCString(henv, msg_to_print);
-+ if (msg_obj == NULL)
-+ abort_with_message("ExceptionPrintStackTrace unable to "
-+ "allocate message");
-+
-+ if (println != NULL)
-+ {
-+ HVM_MethodCall(henv, println, stream_ref, msg_obj);
-+ }
-+ else
-+ fprintf (stderr, "%s\n", msg_to_print);
-+
-+ PR_smprintf_free(msg_to_print);
-
- level = level->next;
- }
-@@ -141,7 +163,7 @@
- /* XXX remove the gc root */
- henv->_exception = NULL;
-
-- HVM_ExceptionPrintBacktrace(henv, throwable_ref);
-+ HVM_ExceptionPrintStackTrace(henv, throwable_ref, (japhar_object*)NULL);
- }
-
- PR_IMPLEMENT(void)
-@@ -173,14 +195,14 @@
- {
- ExceptionInfo *exc_info = HVM_ObjectGetNativeState(throwable_ref);
- BackTraceLevel *new_level = (BackTraceLevel*)PR_MALLOC(sizeof(BackTraceLevel));
--
-+
- new_level->classname = PL_strdup(getClassName(henv, throw_frame->method->clazz));
- new_level->filename = throw_frame->method->clazz->source_filename;
- new_level->method = throw_frame->method;
- new_level->pc = throw_frame->pc;
- new_level->next = NULL;
- new_level->prev = NULL;
--
-+
- /* link the new level into the list of levels */
- if (exc_info->tail)
- {
-@@ -284,7 +306,7 @@
-
- throw_frame = f;
-
-- PR_LOG(exceptionLm, PR_LOG_DEBUG,
-+ PR_LOG(exceptionLm, PR_LOG_DEBUG,
- ("Exception %s thrown from %s.%s - at pc %d\n",
- getClassName(ENV(throw_frame), throwable_cf),
- getClassName(ENV(throw_frame), throw_frame->method->clazz),
-@@ -303,7 +325,7 @@
- /* if we hit a native frame, we just return.
- the interpreter loop will return to it's caller
- if the exception hasn't been handled here. */
--
-+
- return;
- }
- else
-@@ -328,7 +350,7 @@
- catch_class = ExceptionBlock_getHandlerClazz(henv,
- throw_frame->method->clazz,
- exc_block);
--
-+
- if (!HVM_ObjectIsInstanceOf(henv, throwable_ref, catch_class))
- continue;
-
-@@ -337,7 +359,7 @@
- the exception was thrown from. */
-
- throw_frame->pc = exc_block->handler_pc;
--
-+
- henv->op_stack->stack_top = throw_frame->opstack_top;
-
- op_stack_push_object(henv->op_stack, throwable_ref);
-@@ -345,17 +367,17 @@
- /* XXX remove the gc root */
- henv->_exception = NULL;
-
-- PR_LOG(exceptionLm, PR_LOG_DEBUG,
-+ PR_LOG(exceptionLm, PR_LOG_DEBUG,
- ("Exception %s caught by %s.%s - at pc %d\n",
- getClassName(henv, catch_class),
- getClassName(henv, throw_frame->method->clazz),
- throw_frame->method->name,
- throw_frame->pc));
--
-+
- return;
- }
-
-- /* if we didn't find a match, pop the stack
-+ /* if we didn't find a match, pop the stack
- frame and do it again. */
- new_throw_frame = throw_frame->parent;
- pop_frame(henv);
-@@ -381,7 +403,7 @@
- char *msg = NULL;
-
- exception_cls = HVM_ClassFind(henv, exception_name);
--
-+
- if (!exception_cls)
- abort_with_message("Unable to raise exception.");
-
-@@ -417,16 +439,13 @@
- constructor = HVM_MethodFind(henv, cf,
- "<init>", "(Ljava/lang/String;)V");
-
-- HVM_MethodCall(henv, constructor,
-- new_exception, string);
-+ HVM_MethodCall(henv, constructor, new_exception, string);
- }
- else
- {
- constructor = HVM_MethodFind(henv, cf, "<init>", "()V");
-
-- HVM_MethodCallA(henv, constructor,
-- new_exception, NULL);
--
-+ HVM_MethodCallA(henv, constructor, new_exception, NULL);
- }
-
- return new_exception;
-diff -uNr japhar-0.09.orig/lib/libruntime/init.c japhar-0.09/lib/libruntime/init.c
---- japhar-0.09.orig/lib/libruntime/init.c Sat Sep 16 00:51:08 2000
-+++ japhar-0.09/lib/libruntime/init.c Wed Dec 6 09:25:34 2000
-@@ -454,7 +454,7 @@
-
- if (new_env->_exception)
- {
-- HVM_ExceptionPrintBacktrace(new_env, new_env->_exception);
-+ HVM_ExceptionPrintStackTrace(new_env, new_env->_exception, (japhar_object*)NULL);
- return PR_FALSE;
- }
-
diff --git a/libjava/classpath/resource/orp-1.0.8.patch b/libjava/classpath/resource/orp-1.0.8.patch
deleted file mode 100644
index 3ff9c98..0000000
--- a/libjava/classpath/resource/orp-1.0.8.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-diff -uNr orp.orig/base_natives/gnu_classpath/gnu_specific.cpp orp/base_natives/gnu_classpath/gnu_specific.cpp
---- orp.orig/base_natives/gnu_classpath/gnu_specific.cpp Fri Nov 16 04:14:38 2001
-+++ orp/base_natives/gnu_classpath/gnu_specific.cpp Tue Nov 27 23:19:42 2001
-@@ -298,7 +298,6 @@
- //libpath.length != 0; but it's ok in reality without libpath, for
- //system can lookup needed libs in default pathes.
-
-- "java/lang/Runtime.loadLibrary(Ljava/lang/String;)V",
- #endif
-
- //GNU Classpath has intern, we keep it here for efficiency
-@@ -310,6 +309,7 @@
-
- #endif //NON_ORP_NATIVE_LIBS
-
-+ "java/lang/Runtime.loadLibrary(Ljava/lang/String;)V",
- }; //methods_with_native_impl
-
- static int num_methods_with_native_impl = sizeof(methods_with_native_impl) / sizeof(methods_with_native_impl[0]);
diff --git a/libjava/classpath/resource/orp-1.0.9.patch b/libjava/classpath/resource/orp-1.0.9.patch
deleted file mode 100644
index 1b84d8a..0000000
--- a/libjava/classpath/resource/orp-1.0.9.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-diff -r -u orp-1.0.9.orig/arch/ia32/base/root_set_enum_ia32.cpp orp-1.0.9/arch/ia32/base/root_set_enum_ia32.cpp
---- orp-1.0.9.orig/arch/ia32/base/root_set_enum_ia32.cpp Thu Jan 17 06:49:40 2002
-+++ orp-1.0.9/arch/ia32/base/root_set_enum_ia32.cpp Thu Feb 7 15:13:02 2002
-@@ -35,9 +35,6 @@
- #include "../x86/x86.h"
-
- #ifdef ORP_POSIX
--#ifdef __linux__
--#include <asm/spinlock.h>
--#endif
- #include "platform2.h"
- #endif
-
-diff -r -u orp-1.0.9.orig/base_natives/common_olv2/mon_enter_exit.cpp orp-1.0.9/base_natives/common_olv2/mon_enter_exit.cpp
---- orp-1.0.9.orig/base_natives/common_olv2/mon_enter_exit.cpp Thu Jan 17 06:49:40 2002
-+++ orp-1.0.9/base_natives/common_olv2/mon_enter_exit.cpp Thu Feb 7 15:13:57 2002
-@@ -294,7 +294,7 @@
- #else
- "nop;nop;nop"
- #endif
-- ::: "memory"
-+ : : : "memory"
- );
-
- #else
diff --git a/libjava/classpath/scripts/Makefile.in b/libjava/classpath/scripts/Makefile.in
index 4a74379..c20328b 100644
--- a/libjava/classpath/scripts/Makefile.in
+++ b/libjava/classpath/scripts/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -83,8 +83,14 @@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATE = @DATE@
DEFS = @DEFS@
@@ -146,6 +152,7 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+MOC = @MOC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -157,12 +164,13 @@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
SET_MAKE = @SET_MAKE@
-SH = @SH@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
STRIP = @STRIP@
@@ -184,10 +192,13 @@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
diff --git a/libjava/classpath/scripts/check_jni_methods.sh b/libjava/classpath/scripts/check_jni_methods.sh
index 587b879..243bb7e 100755
--- a/libjava/classpath/scripts/check_jni_methods.sh
+++ b/libjava/classpath/scripts/check_jni_methods.sh
@@ -1,8 +1,13 @@
#!/bin/sh
-TMPFILE=check-jni-methods.$$.1
-TMPFILE2=check-jni-methods.$$.2
-TMPFILE3=check-jni-methods.$$.3
+# Fail if any command fails
+set -e
+# Don't override existing files
+set -C
+
+TMPFILE=/tmp/check-jni-methods.$$.1
+TMPFILE2=/tmp/check-jni-methods.$$.2
+TMPFILE3=/tmp/check-jni-methods.$$.3
# Find all methods defined in the header files generated
# from the java source files.
@@ -13,8 +18,19 @@ grep -h '^JNIEXPORT .* Java_' include/*.h | \
# Find all methods in the JNI C source files.
find native/jni -name \*.c | \
xargs grep -h '^Java_' | \
- LC_ALL=C sed -e 's,^\(Java_[a-z_A-Z0-9]*\) *(.*$,\1,' | \
- sort > $TMPFILE2
+ LC_ALL=C sed -e 's,^\(Java_[a-z_A-Z0-9]*\) *(.*$,\1,' > $TMPFILE2
+# Or in the the C++ files. (Note that cpp doesn't follow gnu conventions atm)
+# So we try to match both GNU style and some other style.
+find native/jni -name \*.cpp | \
+ xargs grep -h '^Java_' | \
+ LC_ALL=C sed -e 's,^\(Java_[a-z_A-Z0-9]*\) *(.*$,\1,' >> $TMPFILE2
+find native/jni -name \*.cpp | \
+ xargs egrep -h '^(JNIEXPORT .* JNICALL )?Java_' | \
+ cut -f4 -d\ | \
+ LC_ALL=C sed -e 's,^\JNIEXPORT .* JNICALL \(Java_[a-z_A-Z0-9]*\) *(.*$,\1,' >> $TMPFILE2
+mv $TMPFILE2 $TMPFILE3
+sort $TMPFILE3 > $TMPFILE2
+rm $TMPFILE3
# Write temporary ignore file.
cat > $TMPFILE3 << EOF
@@ -24,23 +40,24 @@ cat > $TMPFILE3 << EOF
EOF
# Compare again silently.
-diff -ub -0 $TMPFILE $TMPFILE2 | grep '^[+-]Java' | grep -q -v -f $TMPFILE3
-RESULT=$?
-
-if test "$RESULT" = "0" ; then
+# Use fgrep and direct the output to /dev/null for compatibility with older
+# grep instead of using the non portable -q.
+if diff -b -U 0 $TMPFILE $TMPFILE2 | grep '^[+-]Java' | \
+ fgrep -v -f $TMPFILE3 > /dev/null;
+then
+ PROBLEM=1
echo "Found a problem with the JNI methods declared and implemented."
echo "(-) missing in implementation, (+) missing in header files"
# Compare the found method lists.
- diff -ub -0 $TMPFILE $TMPFILE2 | grep '^[+-]Java' | grep -v -f $TMPFILE3
+ diff -b -U 0 $TMPFILE $TMPFILE2 | grep '^[+-]Java' | fgrep -v -f $TMPFILE3
fi
# Cleanup.
rm -f $TMPFILE $TMPFILE2 $TMPFILE3
-if test "$RESULT" = "0" ; then
+if test "$PROBLEM" = "1" ; then
exit 1
fi
exit 0
-
diff --git a/libjava/classpath/scripts/timezones.pl b/libjava/classpath/scripts/timezones.pl
index 47f7137..142ea4b 100755
--- a/libjava/classpath/scripts/timezones.pl
+++ b/libjava/classpath/scripts/timezones.pl
@@ -43,7 +43,7 @@ sub parseOffset($) {
}
# parse the time of form +/-hh:mm:ss[swguz] (:ss is optional) and return it
-# in milliseconds since midnight in local standard time
+# in milliseconds since midnight in local wall time
my $timezonename;
sub parseTime($$$) {
my ($rawoffset, $stdoffset, $time) = @_;
@@ -55,11 +55,11 @@ sub parseTime($$$) {
if ($1 eq "-") {
$millis = -$millis;
}
+ # Normally millis is in wall time, adjust for utc and standard time.
if ($6 =~ /[guz]/) {
- $millis += $rawoffset;
- } elsif ($6 =~ /w/) {
- print STDERR "$timezonename not in standard time\n" if $stdoffset;
- $millis -= $stdoffset;
+ $millis += $rawoffset + $stdoffset;
+ } elsif ($6 =~ /s/) {
+ $millis += $stdoffset;
}
return $millis;
}
@@ -155,7 +155,7 @@ sub parseRule($$$) {
$time += 24*3600*1000;
$dayoffset--;
}
- while ($time >= 24*3600*1000) {
+ while ($time > 24*3600*1000) {
$time -= 24*3600*1000;
$dayoffset++;
}
@@ -331,7 +331,7 @@ for (@timezones) {
$rawoffset = makePretty($rawoffset);
if ($rule eq "-") {
print <<EOF
- tz = new SimpleTimeZone($rawoffset, \"$name\");
+ tz = new SimpleTimeZone($rawoffset, \"$name\");
EOF
} else {
my ($endmonth, $endday, $endtime) = @{$rule->[0]};
@@ -341,24 +341,24 @@ EOF
my $savings = $rule->[2];
if ($savings == 3600 * 1000) {
print <<EOF
- tz = new SimpleTimeZone
- ($rawoffset, \"$name\",
- $startmonth, $startday, $starttime,
- $endmonth, $endday, $endtime);
+ tz = new SimpleTimeZone
+ ($rawoffset, \"$name\",
+ $startmonth, $startday, $starttime,
+ $endmonth, $endday, $endtime);
EOF
} else {
$savings = makePretty($savings);
print <<EOF
- tz = new SimpleTimeZone
- ($rawoffset, \"$name\",
- $startmonth, $startday, $starttime,
- $endmonth, $endday, $endtime, $savings);
+ tz = new SimpleTimeZone
+ ($rawoffset, \"$name\",
+ $startmonth, $startday, $starttime,
+ $endmonth, $endday, $endtime, $savings);
EOF
}
}
for (@aliases) {
print <<EOF
- timezones.put(\"$_\", tz);
+ timezones0.put(\"$_\", tz);
EOF
}
}
diff --git a/libjava/classpath/scripts/tzabbrevs b/libjava/classpath/scripts/tzabbrevs
index 73bb190..f033f08 100644
--- a/libjava/classpath/scripts/tzabbrevs
+++ b/libjava/classpath/scripts/tzabbrevs
@@ -21,7 +21,7 @@ Link EST5EDT EST
# XXX: Remove EST5EDT after java.lang.System is merged with libgcj?
# Remove EST5EDT
Link America/Anguilla PRT
-Link America/Buenos_Aires AGT
+Link America/Argentina/Buenos_Aires AGT
Link America/St_Johns CNT
Link CET ECT
Link Africa/Cairo ART
diff --git a/libjava/classpath/vm/reference/java/lang/VMClass.java b/libjava/classpath/vm/reference/java/lang/VMClass.java
index 0ca0329..a48e299 100644
--- a/libjava/classpath/vm/reference/java/lang/VMClass.java
+++ b/libjava/classpath/vm/reference/java/lang/VMClass.java
@@ -245,18 +245,22 @@ final class VMClass
static native ClassLoader getClassLoader(Class klass);
/**
- * VM implementors are free to make this method a noop if
- * the default implementation is acceptable.
+ * Load the requested class and record the specified loader as the
+ * initiating class loader.
*
* @param name the name of the class to find
+ * @param initialize should the class initializer be run?
+ * @param loader the class loader to use (or null for the bootstrap loader)
* @return the Class object representing the class or null for noop
* @throws ClassNotFoundException if the class was not found by the
- * classloader
+ * class loader
* @throws LinkageError if linking the class fails
* @throws ExceptionInInitializerError if the class loads, but an exception
* occurs during initialization
*/
- static native Class forName(String name) throws ClassNotFoundException;
+ static native Class forName(String name, boolean initialize,
+ ClassLoader loader)
+ throws ClassNotFoundException;
/**
* Return whether this class is an array type.
@@ -268,26 +272,6 @@ final class VMClass
static native boolean isArray(Class klass);
/**
- * This method should trigger class initialization (if the
- * class hasn't already been initialized)
- *
- * @param klass the Class object that's calling us
- * @throws ExceptionInInitializerError if an exception
- * occurs during initialization
- */
- static native void initialize(Class klass);
-
- /**
- * Load an array class.
- *
- * @return the Class object representing the class
- * @throws ClassNotFoundException if the class was not found by the
- * classloader
- */
- static native Class loadArrayClass(String name, ClassLoader classloader)
- throws ClassNotFoundException;
-
- /**
* Throw a checked exception without declaring it.
*/
static native void throwException(Throwable t);
diff --git a/libjava/classpath/vm/reference/java/lang/VMClassLoader.java b/libjava/classpath/vm/reference/java/lang/VMClassLoader.java
index c62f0a4..4fe1240 100644
--- a/libjava/classpath/vm/reference/java/lang/VMClassLoader.java
+++ b/libjava/classpath/vm/reference/java/lang/VMClassLoader.java
@@ -282,4 +282,11 @@ final class VMClassLoader
{
return ClassLoader.defaultGetSystemClassLoader();
}
+
+ /**
+ * Find the class if this class loader previously defined this class
+ * or if this class loader has been recorded as the initiating class loader
+ * for this class.
+ */
+ static native Class findLoadedClass(ClassLoader cl, String name);
}
diff --git a/libjava/classpath/vm/reference/java/net/VMNetworkInterface.java b/libjava/classpath/vm/reference/java/net/VMNetworkInterface.java
index af71ce2..d63de84 100644
--- a/libjava/classpath/vm/reference/java/net/VMNetworkInterface.java
+++ b/libjava/classpath/vm/reference/java/net/VMNetworkInterface.java
@@ -61,6 +61,16 @@ final class VMNetworkInterface
System.loadLibrary("javanet");
}
+ /**
+ * Returns a Vector of InetAddresses. The returned value will be
+ * 'condensed', meaning that all elements with the same interface
+ * name will be collapesed into one InetAddress for that name
+ * containing all addresses before the returning the result to the
+ * user. This means the native method can be implemented in a naive
+ * way mapping each address/interface to a name even if that means
+ * that the Vector contains multiple InetAddresses with the same
+ * interface name.
+ */
public static native Vector getInterfaces()
throws SocketException;
}
diff --git a/libjava/classpath/vm/reference/java/nio/VMDirectByteBuffer.java b/libjava/classpath/vm/reference/java/nio/VMDirectByteBuffer.java
index e42f5038..93a8388 100644
--- a/libjava/classpath/vm/reference/java/nio/VMDirectByteBuffer.java
+++ b/libjava/classpath/vm/reference/java/nio/VMDirectByteBuffer.java
@@ -1,4 +1,4 @@
-/* VMDirectByteBuffer.java --
+/* VMDirectByteBuffer.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,7 +39,7 @@ exception statement from your version. */
package java.nio;
import gnu.classpath.Configuration;
-import gnu.classpath.RawData;
+import gnu.classpath.Pointer;
final class VMDirectByteBuffer
{
@@ -50,17 +50,14 @@ final class VMDirectByteBuffer
{
System.loadLibrary("javanio");
}
-
- init();
}
- private static native void init();
-
- static native RawData allocate (int capacity);
- static native void free(RawData address);
- static native byte get(RawData address, int index);
- static native void get(RawData address, int index, byte[] dst, int offset, int length);
- static native void put(RawData address, int index, byte value);
- static native RawData adjustAddress(RawData address, int offset);
- static native void shiftDown(RawData address, int dst_offset, int src_offset, int count);
+ static native Pointer allocate (int capacity);
+ static native void free(Pointer address);
+ static native byte get(Pointer address, int index);
+ static native void get(Pointer address, int index, byte[] dst, int offset, int length);
+ static native void put(Pointer address, int index, byte value);
+ static native void put(Pointer address, int index, byte[] src, int offset, int length);
+ static native Pointer adjustAddress(Pointer address, int offset);
+ static native void shiftDown(Pointer address, int dst_offset, int src_offset, int count);
}